You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/02/16 23:39:31 UTC

[01/82] [partial] [math] Update for next development iteration: commons-math4

Repository: commons-math
Updated Branches:
  refs/heads/master 68e6de351 -> e4e1ac23c


http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/NonSelfAdjointOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/NonSelfAdjointOperatorException.java b/src/main/java/org/apache/commons/math3/linear/NonSelfAdjointOperatorException.java
deleted file mode 100644
index ad436e2..0000000
--- a/src/main/java/org/apache/commons/math3/linear/NonSelfAdjointOperatorException.java
+++ /dev/null
@@ -1,46 +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.linear;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when a self-adjoint {@link RealLinearOperator}
- * is expected.
- * Since the coefficients of the matrix are not accessible, the most
- * general definition is used to check that A is not self-adjoint, i.e.
- * there exist x and y such as {@code | x' A y - y' A x | >= eps},
- * where {@code eps} is a user-specified tolerance, and {@code x'}
- * denotes the transpose of {@code x}.
- * In the terminology of this exception, {@code A} is the "offending"
- * linear operator, {@code x} and {@code y} are the first and second
- * "offending" vectors, respectively.
- *
- * @since 3.0
- */
-public class NonSelfAdjointOperatorException
-    extends MathIllegalArgumentException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 1784999305030258247L;
-
-    /** Creates a new instance of this class. */
-    public NonSelfAdjointOperatorException() {
-        super(LocalizedFormats.NON_SELF_ADJOINT_OPERATOR);
-    }
-}


[74/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTreeVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTreeVisitor.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTreeVisitor.java
index 3d09939..836f287 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTreeVisitor.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTreeVisitor.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** This interface is used to visit {@link BSPTree BSP tree} nodes.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryAttribute.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryAttribute.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryAttribute.java
index dad884c..fc369fb 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryAttribute.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryAttribute.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** Class holding boundary attributes.
  * <p>This class is used for the attributes associated with the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java
index cea4de3..8e82e4f 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryBuilder.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** Visitor building boundary shell tree.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjection.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjection.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjection.java
index 03526e4..97d4ca4 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjection.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjection.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** Class holding the result of point projection on region boundary.
  * <p>This class is a simple placeholder, it does not provide any

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java
index 9f660bf..cfc4561 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundaryProjector.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.util.FastMath;
 
 /** Local tree visitor to compute projection on boundary.
  * @param <S> Type of the space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundarySizeVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundarySizeVisitor.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundarySizeVisitor.java
index e29083a..b97f653 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundarySizeVisitor.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BoundarySizeVisitor.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** Visitor computing the boundary size.
  * @param <S> Type of the space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java
index 58efe0f..e1caf17 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/Characterization.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.geometry.Space;
 
 /** Cut sub-hyperplanes characterization with respect to inside/outside cells.
  * @see BoundaryBuilder

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/Embedding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/Embedding.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/Embedding.java
index 74e2c00..d5f58ba 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/Embedding.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/Embedding.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** This interface defines mappers between a space and one of its sub-spaces.
 
@@ -25,10 +25,10 @@ import org.apache.commons.math3.geometry.Space;
  * space. The (n-1)-dimension sub-spaces are specific sub-spaces known
  * as {@link Hyperplane hyperplanes}. This interface can be used regardless
  * of the dimensions differences. As an example, {@link
- * org.apache.commons.math3.geometry.euclidean.threed.Line Line} in 3D
+ * org.apache.commons.math4.geometry.euclidean.threed.Line Line} in 3D
  * implements Embedding<{@link
- * org.apache.commons.math3.geometry.euclidean.threed.Vector3D Vector3D}, {link
- * org.apache.commons.math3.geometry.euclidean.oned.Vector1D Vector1D>, i.e. it
+ * org.apache.commons.math4.geometry.euclidean.threed.Vector3D Vector3D}, {link
+ * org.apache.commons.math4.geometry.euclidean.oned.Vector1D Vector1D}, i.e. it
  * maps directly dimensions 3 and 1.</p>
 
  * <p>In the 3D euclidean space, hyperplanes are 2D planes, and the 1D

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/Hyperplane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/Hyperplane.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/Hyperplane.java
index f90c3bc..b9948f5 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/Hyperplane.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/Hyperplane.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** This interface represents an hyperplane of a space.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/InsideFinder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/InsideFinder.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/InsideFinder.java
index 2b0b405..14bd142 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/InsideFinder.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/InsideFinder.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** Utility class checking if inside nodes can be found
  * on the plus and minus sides of an hyperplane.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java
index 688279a..d3099c2 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/NodesSet.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** Set of {@link BSPTree BSP tree} nodes.
  * @see BoundaryAttribute

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/Region.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/Region.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/Region.java
index 3f4d5f5..80c80b8 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/Region.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/Region.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Point;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** This interface represents a region of a space as a partition.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java
index 16d4472..d8679ec 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/RegionFactory.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.partitioning.BSPTree.VanishingCutHandler;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.partitioning.BSPTree.VanishingCutHandler;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
 
 /** This class is a factory for {@link Region}.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/Side.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/Side.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/Side.java
index c9a1357..4851230 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/Side.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/Side.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 /** Enumerate representing the location of an element with respect to an
  * {@link Hyperplane hyperplane} of a space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/SubHyperplane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/SubHyperplane.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/SubHyperplane.java
index 70c6043..33afd20 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/SubHyperplane.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/SubHyperplane.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** This interface represents the remaining parts of an hyperplane after
  * other parts have been chopped off.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/Transform.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/Transform.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/Transform.java
index ba0c1dd..3fd3c08 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/Transform.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/Transform.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 
 /** This interface represents an inversible affine transform in a space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/package-info.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/package-info.java
index 6e63c73..e427483 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/package-info.java
@@ -19,7 +19,7 @@
  * This package provides classes to implement Binary Space Partition trees.
  *
  * <p>
- * {@link org.apache.commons.math3.geometry.partitioning.BSPTree BSP trees}
+ * {@link org.apache.commons.math4.geometry.partitioning.BSPTree BSP trees}
  * are an efficient way to represent parts of space and in particular
  * polytopes (line segments in 1D, polygons in 2D and polyhedrons in 3D)
  * and to operate on them. The main principle is to recursively subdivide
@@ -52,9 +52,9 @@
  * single part, but by several convex ones. This is the property that
  * allows BSP-trees to represent non-convex polytopes despites all parts
  * are convex. The {@link
- * org.apache.commons.math3.geometry.partitioning.Region Region} class is
+ * org.apache.commons.math4.geometry.partitioning.Region Region} class is
  * devoted to this representation, it is build on top of the {@link
- * org.apache.commons.math3.geometry.partitioning.BSPTree BSPTree} class using
+ * org.apache.commons.math4.geometry.partitioning.BSPTree BSPTree} class using
  * boolean objects as the leaf nodes attributes to represent the
  * inside/outside property of each leaf part, and also adds various
  * methods dealing with boundaries (i.e. the separation between the
@@ -111,4 +111,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTree.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTree.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTree.java
index 9412421..f995cd3 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTree.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTree.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning.utilities;
+package org.apache.commons.math4.geometry.partitioning.utilities;
 
 /** This class implements AVL trees.
  *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/OrderedTuple.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/OrderedTuple.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/OrderedTuple.java
index 2dad2d7..490c80c 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/OrderedTuple.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/OrderedTuple.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning.utilities;
+package org.apache.commons.math4.geometry.partitioning.utilities;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class implements an ordering operation for T-uples.
  *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/package-info.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/package-info.java
index 31f57f1..9cf8725 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/utilities/package-info.java
@@ -21,4 +21,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.partitioning.utilities;
+package org.apache.commons.math4.geometry.partitioning.utilities;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
index af0388e..b175250 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Arc.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 
 /** This class represents an arc on a circle.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
index 5c03150..7479a22 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -22,26 +22,26 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BoundaryProjection;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.partitioning.AbstractRegion;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BoundaryProjection;
+import org.apache.commons.math4.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /** This class represents a region of a circle: a set of arcs.
  * <p>
  * Note that due to the wrapping around \(2 \pi\), barycenter is
  * ill-defined here. It was defined only in order to fulfill
  * the requirements of the {@link
- * org.apache.commons.math3.geometry.partitioning.Region Region}
+ * org.apache.commons.math4.geometry.partitioning.Region Region}
  * interface, but its use is discouraged.
  * </p>
  * @since 3.3
@@ -104,7 +104,7 @@ public class ArcsSet extends AbstractRegion<Sphere1D, Sphere1D> implements Itera
      * boundary does not really separate an inside open from an outside
      * open (open having here its topological meaning), then subsequent
      * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
+     * org.apache.commons.math4.geometry.partitioning.Region#checkPoint(org.apache.commons.math4.geometry.Point)
      * checkPoint} method will not be meaningful anymore.</p>
      * <p>If the boundary is empty, the region will represent the whole
      * space.</p>
@@ -942,7 +942,7 @@ public class ArcsSet extends AbstractRegion<Sphere1D, Sphere1D> implements Itera
     /** Specialized exception for inconsistent BSP tree state inconsistency.
      * <p>
      * This exception is thrown at {@link ArcsSet} construction time when the
-     * {@link org.apache.commons.math3.geometry.partitioning.Region.Location inside/outside}
+     * {@link org.apache.commons.math4.geometry.partitioning.Region.Location inside/outside}
      * state is not consistent at the 0, \(2 \pi \) crossing.
      * </p>
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngle.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngle.java
index 748a142..bfd7894 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngle.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngle.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
 
 /** This class represents a 1D oriented hyperplane on the circle.
  * <p>An hyperplane on the 1-sphere is an angle with an orientation.</p>
@@ -83,9 +83,9 @@ public class LimitAngle implements Hyperplane<Sphere1D> {
      * <p>Since this class represent zero dimension spaces which does
      * not have lower dimension sub-spaces, this method returns a dummy
      * implementation of a {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane SubHyperplane}.
+     * org.apache.commons.math4.geometry.partitioning.SubHyperplane SubHyperplane}.
      * This implementation is only used to allow the {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
+     * org.apache.commons.math4.geometry.partitioning.SubHyperplane
      * SubHyperplane} class implementation to work properly, it should
      * <em>not</em> be used otherwise.</p>
      * @return a dummy sub hyperplane

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/oned/S1Point.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/S1Point.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/S1Point.java
index 263a559..66d21cc 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/S1Point.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/S1Point.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /** This class represents a point on the 1-sphere.
  * <p>Instances of this class are guaranteed to be immutable.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1D.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1D.java
index ce5c7cd..cdd397f 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1D.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Space;
 
 /**
  * This class implements a one-dimensional sphere (i.e. a circle).

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java
index 880a7e8..e90ad8b 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/SubLimitAngle.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.Side;
 
 /** This class represents sub-hyperplane for {@link LimitAngle}.
  * <p>Instances of this class are guaranteed to be immutable.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/oned/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/package-info.java b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/package-info.java
index d54bc0b..0659050 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/oned/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/oned/package-info.java
@@ -27,4 +27,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Circle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Circle.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Circle.java
index d6d47de..f4a554d 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Circle.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Circle.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.S1Point;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.geometry.spherical.twod;
+
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.Embedding;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Transform;
+import org.apache.commons.math4.geometry.spherical.oned.Arc;
+import org.apache.commons.math4.geometry.spherical.oned.ArcsSet;
+import org.apache.commons.math4.geometry.spherical.oned.S1Point;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class represents an oriented great circle on the 2-sphere.
 
@@ -274,12 +274,12 @@ public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1
         return Vector3D.dotProduct(pole, otherC.pole) >= 0.0;
     }
 
-    /** Get a {@link org.apache.commons.math3.geometry.partitioning.Transform
+    /** Get a {@link org.apache.commons.math4.geometry.partitioning.Transform
      * Transform} embedding a 3D rotation.
      * @param rotation rotation to use
      * @return a new transform that can be applied to either {@link
      * Point Point}, {@link Circle Line} or {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
+     * org.apache.commons.math4.geometry.partitioning.SubHyperplane
      * SubHyperplane} instances
      */
     public static Transform<Sphere2D, Sphere1D> getTransform(final Rotation rotation) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Edge.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Edge.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Edge.java
index a9ccb08..8c13baa 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Edge.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Edge.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.spherical.oned.Arc;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /** Spherical polygons boundary edge.
  * @see SphericalPolygonsSet#getBoundaryLoops()

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java
index 4aa712c..64e7d37 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/EdgesBuilder.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
 import java.util.ArrayList;
 import java.util.IdentityHashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.S1Point;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
+import org.apache.commons.math4.geometry.partitioning.BoundaryAttribute;
+import org.apache.commons.math4.geometry.spherical.oned.Arc;
+import org.apache.commons.math4.geometry.spherical.oned.ArcsSet;
+import org.apache.commons.math4.geometry.spherical.oned.S1Point;
 
 /** Visitor building edges.
  * @since 3.3

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java
index 9d15b11..7987f31 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/PropertiesComputer.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /** Visitor computing geometrical properties.
  * @since 3.3

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/S2Point.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/S2Point.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/S2Point.java
index 677e830..fb02807 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/S2Point.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/S2Point.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.geometry.spherical.twod;
+
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /** This class represents a point on the 2-sphere.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Sphere2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Sphere2D.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Sphere2D.java
index 93ff04e..0f87462 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Sphere2D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Sphere2D.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
 
 /**
  * This class implements a two-dimensional sphere (i.e. the regular sphere).

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
index 5fdb1c3..8cb5d5c 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -22,21 +22,21 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.enclosing.WelzlEncloser;
-import org.apache.commons.math3.geometry.euclidean.threed.Euclidean3D;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.SphereGenerator;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BoundaryProjection;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.enclosing.WelzlEncloser;
+import org.apache.commons.math4.geometry.euclidean.threed.Euclidean3D;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.SphereGenerator;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.AbstractRegion;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BoundaryProjection;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /** This class represents a region on the 2-sphere: a set of spherical polygons.
  * @since 3.3
@@ -105,7 +105,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
      * boundary does not really separate an inside open from an outside
      * open (open having here its topological meaning), then subsequent
      * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
+     * org.apache.commons.math4.geometry.partitioning.Region#checkPoint(org.apache.commons.math4.geometry.Point)
      * checkPoint} method will not be meaningful anymore.</p>
      * <p>If the boundary is empty, the region will represent the whole
      * space.</p>
@@ -419,7 +419,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
      * <p>
      * This method is intended as a first test to quickly identify points
      * that are guaranteed to be outside of the region, hence performing a full
-     * {@link #checkPoint(org.apache.commons.math3.geometry.Vector) checkPoint}
+     * {@link #checkPoint(org.apache.commons.math4.geometry.Vector) checkPoint}
      * only if the point status remains undecided after the quick check. It is
      * is therefore mostly useful to speed up computation for small polygons with
      * complex shapes (say a country boundary on Earth), as the spherical cap will
@@ -454,7 +454,7 @@ public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
      * In the special cases of empty or whole sphere polygons, special
      * spherical caps are returned, with angular radius set to negative
      * or positive infinity so the {@link
-     * EnclosingBall#contains(org.apache.commons.math3.geometry.Point) ball.contains(point)}
+     * EnclosingBall#contains(org.apache.commons.math4.geometry.Point) ball.contains(point)}
      * method return always false or true.
      * </p>
      * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
index fa7fd9c..afa5005 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/SubCircle.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.spherical.oned.Arc;
+import org.apache.commons.math4.geometry.spherical.oned.ArcsSet;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class represents a sub-hyperplane for {@link Circle}.
  * @since 3.3

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
index 3003da8..d3102c1 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/Vertex.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
 import java.util.ArrayList;
 import java.util.List;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/spherical/twod/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/package-info.java b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/package-info.java
index 3f3c5b0..4614d85 100644
--- a/src/main/java/org/apache/commons/math4/geometry/spherical/twod/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/spherical/twod/package-info.java
@@ -27,4 +27,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
index 686ffbb..39832fa 100644
--- a/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AbstractFieldMatrix.java
@@ -15,21 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Basic implementation of {@link FieldMatrix} methods regardless of the underlying storage.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
index e0fc945..e72d4c4 100644
--- a/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AbstractRealMatrix.java
@@ -15,21 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.ArrayList;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Basic implementation of RealMatrix methods regardless of the underlying storage.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java b/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java
index 736819a..85a5fe7 100644
--- a/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/AnyMatrix.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
index b02e69f..70d7894 100644
--- a/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/Array2DRowFieldMatrix.java
@@ -15,22 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implementation of FieldMatrix<T> using a {@link FieldElement}[][] array to store entries.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/Array2DRowRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/Array2DRowRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/Array2DRowRealMatrix.java
index 6302cf3..3778db5 100644
--- a/src/main/java/org/apache/commons/math4/linear/Array2DRowRealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/Array2DRowRealMatrix.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implementation of {@link RealMatrix} using a {@code double[][]} array to

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
index 0e93a0f..b994bc5 100644
--- a/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/ArrayFieldVector.java
@@ -14,24 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * This class implements the {@link FieldVector} interface with a {@link FieldElement} array.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/ArrayRealVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/ArrayRealVector.java b/src/main/java/org/apache/commons/math4/linear/ArrayRealVector.java
index 00b81d0..1dfc220 100644
--- a/src/main/java/org/apache/commons/math4/linear/ArrayRealVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/ArrayRealVector.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Iterator;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * This class implements the {@link RealVector} interface with a double array.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/BiDiagonalTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/BiDiagonalTransformer.java b/src/main/java/org/apache/commons/math4/linear/BiDiagonalTransformer.java
index cfbcb68..7ed29b7 100644
--- a/src/main/java/org/apache/commons/math4/linear/BiDiagonalTransformer.java
+++ b/src/main/java/org/apache/commons/math4/linear/BiDiagonalTransformer.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
index 4a41f7f..e5294f2 100644
--- a/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/BlockFieldMatrix.java
@@ -15,22 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Cache-friendly implementation of FieldMatrix using a flat arrays to store

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/BlockRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/BlockRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/BlockRealMatrix.java
index 1ea22b6..7554007 100644
--- a/src/main/java/org/apache/commons/math4/linear/BlockRealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/BlockRealMatrix.java
@@ -15,20 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Cache-friendly implementation of RealMatrix using a flat arrays to store

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java b/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java
index 63b9a83..66d5260 100644
--- a/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/CholeskyDecomposition.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/ConjugateGradient.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/ConjugateGradient.java b/src/main/java/org/apache/commons/math4/linear/ConjugateGradient.java
index d64b442..de831ff 100644
--- a/src/main/java/org/apache/commons/math4/linear/ConjugateGradient.java
+++ b/src/main/java/org/apache/commons/math4/linear/ConjugateGradient.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.util.IterationManager;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.util.IterationManager;
 
 /**
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/DecompositionSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DecompositionSolver.java b/src/main/java/org/apache/commons/math4/linear/DecompositionSolver.java
index 50090a9..a0dfadb 100644
--- a/src/main/java/org/apache/commons/math4/linear/DecompositionSolver.java
+++ b/src/main/java/org/apache/commons/math4/linear/DecompositionSolver.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * Interface handling decomposition algorithms that can solve A &times; X = B.
@@ -42,7 +42,7 @@ public interface DecompositionSolver {
      *
      * @param b right-hand side of the equation A &times; X = B
      * @return a vector X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the matrices dimensions do not match.
      * @throws SingularMatrixException if the decomposed matrix is singular.
      */
@@ -56,7 +56,7 @@ public interface DecompositionSolver {
      *
      * @param b right-hand side of the equation A &times; X = B
      * @return a matrix X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the matrices dimensions do not match.
      * @throws SingularMatrixException if the decomposed matrix is singular.
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java
index 11a61fa..7c93429 100644
--- a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixChangingVisitor.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Default implementation of the {@link FieldMatrixChangingVisitor} interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java
index 97fb59b..1e8e14f 100644
--- a/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/DefaultFieldMatrixPreservingVisitor.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Default implementation of the {@link FieldMatrixPreservingVisitor} interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/DefaultIterativeLinearSolverEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultIterativeLinearSolverEvent.java b/src/main/java/org/apache/commons/math4/linear/DefaultIterativeLinearSolverEvent.java
index dbced15..4c4b7f7 100644
--- a/src/main/java/org/apache/commons/math4/linear/DefaultIterativeLinearSolverEvent.java
+++ b/src/main/java/org/apache/commons/math4/linear/DefaultIterativeLinearSolverEvent.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
 
 /**
  * A default concrete implementation of the abstract class

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java
index 64949f7..04db987 100644
--- a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixChangingVisitor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * Default implementation of the {@link RealMatrixChangingVisitor} interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java
index 103e85b..ac6dcfe 100644
--- a/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/DefaultRealMatrixPreservingVisitor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * Default implementation of the {@link RealMatrixPreservingVisitor} interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java b/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
index 22ab9f1..56ab4b2 100644
--- a/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/DiagonalMatrix.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Implementation of a diagonal matrix.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java b/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
index bd3819e..1ae63bf 100644
--- a/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/EigenDecomposition.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
-
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Calculates the eigen decomposition of a real matrix.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldDecompositionSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldDecompositionSolver.java b/src/main/java/org/apache/commons/math4/linear/FieldDecompositionSolver.java
index 322eb3b..92f95d5 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldDecompositionSolver.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldDecompositionSolver.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.FieldElement;
 
 
 /**
@@ -41,7 +41,7 @@ public interface FieldDecompositionSolver<T extends FieldElement<T>> {
      * decomposition algorithm.</p>
      * @param b right-hand side of the equation A &times; X = B
      * @return a vector X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the matrices dimensions do not match.
      * @throws SingularMatrixException
      * if the decomposed matrix is singular.
@@ -53,7 +53,7 @@ public interface FieldDecompositionSolver<T extends FieldElement<T>> {
      * decomposition algorithm.</p>
      * @param b right-hand side of the equation A &times; X = B
      * @return a matrix X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the matrices dimensions do not match.
      * @throws SingularMatrixException
      * if the decomposed matrix is singular.


[60/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
index 63a6eed..3ae15dd 100644
--- a/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/UniformIntegerDistributionTest.java
@@ -15,11 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.UniformIntegerDistribution;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
 
 /**
  * Test cases for UniformIntegerDistribution. See class javadoc for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java
index 29f6a85..839ae08 100644
--- a/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/UniformRealDistributionTest.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/WeibullDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/WeibullDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/WeibullDistributionTest.java
index af4fd6d..78a6113 100644
--- a/src/test/java/org/apache/commons/math4/distribution/WeibullDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/WeibullDistributionTest.java
@@ -15,11 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.WeibullDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 06ec3c4..661eb33 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ZipfDistributionTest.java
@@ -15,11 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.ZipfDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java b/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
index 75328fc..18291eb 100644
--- a/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximizationTest.java
@@ -14,21 +14,22 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.commons.math3.distribution.fitting;
+package org.apache.commons.math4.distribution.fitting;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.distribution.MixtureMultivariateNormalDistribution;
-import org.apache.commons.math3.distribution.MultivariateNormalDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.distribution.MixtureMultivariateNormalDistribution;
+import org.apache.commons.math4.distribution.MultivariateNormalDistribution;
+import org.apache.commons.math4.distribution.fitting.MultivariateNormalMixtureExpectationMaximization;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.util.Pair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java
index 3ac51e9..263e28d 100644
--- a/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/DimensionMismatchExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.DimensionMismatchException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java
index ba0de1e..f0da371 100644
--- a/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/MaxCountExceededExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.MaxCountExceededException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java
index 42c5460..6c3b475 100644
--- a/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/NonMonotonicSequenceExceptionTest.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
-
-import org.apache.commons.math3.util.MathArrays;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.util.MathArrays;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java
index 6e4106c..37276cf 100644
--- a/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/NotPositiveExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.NotPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java
index e313b15..95748fc 100644
--- a/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/NotStrictlyPositiveExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java
index 5ebe49d..fea0233 100644
--- a/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/NumberIsTooLargeExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java
index b70032f..95935c0 100644
--- a/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/NumberIsTooSmallExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java
index deda254..a640443 100644
--- a/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/OutOfRangeExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
+import org.apache.commons.math4.exception.OutOfRangeException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java b/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java
index c21775e..0315f26 100644
--- a/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/TooManyEvaluationsExceptionTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
 import java.text.MessageFormat;
 
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java b/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java
index d07708f..bb55ac2 100644
--- a/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/util/ArgUtilsTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 import java.util.List;
 import java.util.ArrayList;
 
+import org.apache.commons.math4.exception.util.ArgUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java b/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java
index 91fe804..a9489f8 100644
--- a/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/util/ExceptionContextTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 import java.util.Locale;
 import java.util.Arrays;
@@ -24,6 +24,8 @@ import java.io.ObjectInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayInputStream;
 
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/exception/util/LocalizedFormatsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/exception/util/LocalizedFormatsTest.java b/src/test/java/org/apache/commons/math4/exception/util/LocalizedFormatsTest.java
index 1a51f64..4b169a9 100644
--- a/src/test/java/org/apache/commons/math4/exception/util/LocalizedFormatsTest.java
+++ b/src/test/java/org/apache/commons/math4/exception/util/LocalizedFormatsTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 
 import java.text.MessageFormat;
@@ -22,6 +22,7 @@ import java.util.Enumeration;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java b/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
index f7a08c8..eeb2aa0 100644
--- a/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
+++ b/src/test/java/org/apache/commons/math4/filter/KalmanFilterTest.java
@@ -12,20 +12,25 @@
  * governing permissions and limitations under the License.
  */
 
-package org.apache.commons.math3.filter;
-
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.MatrixDimensionMismatchException;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.filter;
+
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.filter.DefaultMeasurementModel;
+import org.apache.commons.math4.filter.DefaultProcessModel;
+import org.apache.commons.math4.filter.KalmanFilter;
+import org.apache.commons.math4.filter.MeasurementModel;
+import org.apache.commons.math4.filter.ProcessModel;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.MatrixDimensionMismatchException;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java
index d08e942..18915e0 100644
--- a/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.fitting.CurveFitter;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java
index 153274b..b14aceb 100644
--- a/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/GaussianCurveFitterTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.TooManyIterationsException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.TooManyIterationsException;
+import org.apache.commons.math4.fitting.GaussianCurveFitter;
+import org.apache.commons.math4.fitting.WeightedObservedPoints;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java
index ddec57d..a7ca9b2 100644
--- a/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.fitting.GaussianFitter;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java
index 9f6a15c..d85588e 100644
--- a/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/HarmonicCurveFitterTest.java
@@ -14,17 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.fitting.HarmonicCurveFitter;
+import org.apache.commons.math4.fitting.WeightedObservedPoint;
+import org.apache.commons.math4.fitting.WeightedObservedPoints;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java
index 8a6dcea..328d060 100644
--- a/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java
@@ -14,16 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Random;
 
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.fitting.HarmonicFitter;
+import org.apache.commons.math4.fitting.WeightedObservedPoint;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java
index 6b8dfa2..02c5810 100644
--- a/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/PolynomialCurveFitterTest.java
@@ -14,16 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Random;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.fitting.PolynomialCurveFitter;
+import org.apache.commons.math4.fitting.WeightedObservedPoints;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java
index a053157..ff543ab 100644
--- a/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java
@@ -14,22 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction.Parametric;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction.Parametric;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.fitting.CurveFitter;
+import org.apache.commons.math4.fitting.PolynomialFitter;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.optim.nonlinear.vector.MultivariateVectorOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java
index d411d4a..bd2b594 100644
--- a/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/SimpleCurveFitterTest.java
@@ -14,17 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Random;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.fitting.SimpleCurveFitter;
+import org.apache.commons.math4.fitting.WeightedObservedPoints;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java b/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
index 6b9e311..773e883 100644
--- a/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/WeightedObservedPointsTest.java
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.List;
+
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.fitting.WeightedObservedPoint;
+import org.apache.commons.math4.fitting.WeightedObservedPoints;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Tests {@link WeightedObservedPoints}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java
index bb9c9ac..6880bbe 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -14,25 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
-
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Pair;
+package org.apache.commons.math4.fitting.leastsquares;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.MultivariateJacobianFunction;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java
index ed637d4..63c817e 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleProblem.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.util.ArrayList;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Class that models a circle.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java
index 968bea5..3ba837b 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/CircleVectorial.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.util.ArrayList;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
 
 /**
  * Class used in the tests.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsCheckerTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsCheckerTest.java
index 6f5e3df..d98dcaa 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsCheckerTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.ConvergenceChecker;
+import org.apache.commons.math4.fitting.leastsquares.EvaluationRmsChecker;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.ConvergenceChecker;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
index a53b3f7..b34dcaf 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTest.java
@@ -11,22 +11,27 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.fitting.leastsquares;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresFactory;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.MultivariateJacobianFunction;
+import org.apache.commons.math4.fitting.leastsquares.ValueAndJacobianFunction;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java
index eaa7b8d..6642854 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/EvaluationTestValidation.java
@@ -11,14 +11,16 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
-
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.fitting.leastsquares;
+
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -30,7 +32,7 @@ import java.util.List;
  * This class demonstrates the main functionality of the
  * {@link LeastSquaresProblem.Evaluation}, common to the
  * optimizer implementations in package
- * {@link org.apache.commons.math3.fitting.leastsquares}.
+ * {@link org.apache.commons.math4.fitting.leastsquares}.
  * <br/>
  * Not enabled by default, as the class name does not end with "Test".
  * <br/>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithCholeskyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithCholeskyTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithCholeskyTest.java
index beb59b2..c6d26d4 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithCholeskyTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithCholeskyTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
 import org.junit.Test;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithLUTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithLUTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithLUTest.java
index b3b57cb..f7a5ef9 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithLUTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithLUTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
 import org.junit.Test;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithQRTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithQRTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithQRTest.java
index 31aa8c3..9b9f86c 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithQRTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithQRTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
 import org.junit.Test;
 
 import java.io.IOException;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java
index 4ea760e..3ad564e 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizerWithSVDTest.java
@@ -15,16 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
-import org.apache.commons.math3.geometry.euclidean.threed.Plane;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.fitting.leastsquares;
+
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.GaussNewtonOptimizer.Decomposition;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
+import org.apache.commons.math4.geometry.euclidean.threed.Plane;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
index 7dff7a9..73b443d 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizerTest.java
@@ -15,22 +15,27 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
-
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.fitting.leastsquares;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.ParameterValidator;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java
index b91140b..9fc4504 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/MinpackTest.java
@@ -15,15 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.util.Arrays;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.util.FastMath;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomCirclePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomCirclePointGenerator.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomCirclePointGenerator.java
index 3f9a20d..dc7d3fb 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomCirclePointGenerator.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomCirclePointGenerator.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well44497b;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Factory for generating a cloud of points that approximate a circle.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomStraightLinePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomStraightLinePointGenerator.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomStraightLinePointGenerator.java
index 1c60cd2..6db49bb 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomStraightLinePointGenerator.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/RandomStraightLinePointGenerator.java
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.awt.geom.Point2D;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well44497b;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
+
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
 
 /**
  * Factory for generating a cloud of points that approximate a straight line.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java
index 5f3dbba..f78b318 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDataset.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.ArrayList;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.util.MathArrays;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class gives access to the statistical reference datasets provided by the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDatasetFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDatasetFactory.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDatasetFactory.java
index cca7c98..4a4178f 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDatasetFactory.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StatisticalReferenceDatasetFactory.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
-import org.apache.commons.math3.util.FastMath;
+
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * A factory to create instances of {@link StatisticalReferenceDataset} from

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java
index f17c461..b59e703 100644
--- a/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java
+++ b/src/test/java/org/apache/commons/math4/fitting/leastsquares/StraightLineProblem.java
@@ -15,13 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.util.ArrayList;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.stat.regression.SimpleRegression;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.stat.regression.SimpleRegression;
 
 /**
  * Class that models a straight line defined as {@code y = a x + b}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fraction/BigFractionFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fraction/BigFractionFieldTest.java b/src/test/java/org/apache/commons/math4/fraction/BigFractionFieldTest.java
index 7e7b534..ccbd6eb 100644
--- a/src/test/java/org/apache/commons/math4/fraction/BigFractionFieldTest.java
+++ b/src/test/java/org/apache/commons/math4/fraction/BigFractionFieldTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.fraction.BigFractionField;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fraction/BigFractionFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fraction/BigFractionFormatTest.java b/src/test/java/org/apache/commons/math4/fraction/BigFractionFormatTest.java
index cabff63..a398a80 100644
--- a/src/test/java/org/apache/commons/math4/fraction/BigFractionFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/fraction/BigFractionFormatTest.java
@@ -15,15 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.text.NumberFormat;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.fraction.BigFractionFormat;
+import org.apache.commons.math4.fraction.ProperBigFractionFormat;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fraction/BigFractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fraction/BigFractionTest.java b/src/test/java/org/apache/commons/math4/fraction/BigFractionTest.java
index 229da69..d921026 100644
--- a/src/test/java/org/apache/commons/math4/fraction/BigFractionTest.java
+++ b/src/test/java/org/apache/commons/math4/fraction/BigFractionTest.java
@@ -14,17 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fraction/FractionFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fraction/FractionFieldTest.java b/src/test/java/org/apache/commons/math4/fraction/FractionFieldTest.java
index 200bf68..4a85f08 100644
--- a/src/test/java/org/apache/commons/math4/fraction/FractionFieldTest.java
+++ b/src/test/java/org/apache/commons/math4/fraction/FractionFieldTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionField;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fraction/FractionFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fraction/FractionFormatTest.java b/src/test/java/org/apache/commons/math4/fraction/FractionFormatTest.java
index 4f95147..fc91b6c 100644
--- a/src/test/java/org/apache/commons/math4/fraction/FractionFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/fraction/FractionFormatTest.java
@@ -15,13 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.text.NumberFormat;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionFormat;
+import org.apache.commons.math4.fraction.ProperFractionFormat;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fraction/FractionTest.java b/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
index 132fd0c..174fa09 100644
--- a/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
+++ b/src/test/java/org/apache/commons/math4/fraction/FractionTest.java
@@ -14,13 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.fraction;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/BinaryChromosomeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/BinaryChromosomeTest.java b/src/test/java/org/apache/commons/math4/genetics/BinaryChromosomeTest.java
index 63c04c3..b846fde 100644
--- a/src/test/java/org/apache/commons/math4/genetics/BinaryChromosomeTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/BinaryChromosomeTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java b/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
index 95327fe..5ada12a 100644
--- a/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/BinaryMutationTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.BinaryMutation;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java b/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java
index 0d08812..126d5c3 100644
--- a/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/ChromosomeTest.java
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ListPopulation;
+import org.apache.commons.math4.genetics.Population;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java
index 7b6e6b8..740091d 100644
--- a/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/CycleCrossoverTest.java
@@ -14,10 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+package org.apache.commons.math4.genetics;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ChromosomePair;
+import org.apache.commons.math4.genetics.CrossoverPolicy;
+import org.apache.commons.math4.genetics.CycleCrossover;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/DummyBinaryChromosome.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/DummyBinaryChromosome.java b/src/test/java/org/apache/commons/math4/genetics/DummyBinaryChromosome.java
index e1a4a91..789da5a 100644
--- a/src/test/java/org/apache/commons/math4/genetics/DummyBinaryChromosome.java
+++ b/src/test/java/org/apache/commons/math4/genetics/DummyBinaryChromosome.java
@@ -14,10 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.List;
 
+import org.apache.commons.math4.genetics.AbstractListChromosome;
+import org.apache.commons.math4.genetics.BinaryChromosome;
+
 /**
  * Implementation of BinaryChromosome for testing purposes
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java b/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java
index 4831e67..0fd1186 100644
--- a/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java
+++ b/src/test/java/org/apache/commons/math4/genetics/DummyListChromosome.java
@@ -14,11 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.commons.math4.genetics.AbstractListChromosome;
+import org.apache.commons.math4.genetics.InvalidRepresentationException;
+
 /**
  * Implementation of ListChromosome for testing purposes
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/DummyRandomKey.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/DummyRandomKey.java b/src/test/java/org/apache/commons/math4/genetics/DummyRandomKey.java
index 4d671b4..594ebb3 100644
--- a/src/test/java/org/apache/commons/math4/genetics/DummyRandomKey.java
+++ b/src/test/java/org/apache/commons/math4/genetics/DummyRandomKey.java
@@ -14,10 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.List;
 
+import org.apache.commons.math4.genetics.AbstractListChromosome;
+import org.apache.commons.math4.genetics.RandomKey;
+
 /**
  * Implementation of RandomKey for testing purposes
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java b/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java
index dbfc9f1..08dbeb3 100644
--- a/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/ElitisticListPopulationTest.java
@@ -14,13 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.genetics.Population;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java b/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java
index 1b878f5..71ae818 100644
--- a/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/FitnessCachingTest.java
@@ -14,12 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.BinaryMutation;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.genetics.FixedGenerationCount;
+import org.apache.commons.math4.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.genetics.OnePointCrossover;
+import org.apache.commons.math4.genetics.Population;
+import org.apache.commons.math4.genetics.StoppingCondition;
+import org.apache.commons.math4.genetics.TournamentSelection;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/FixedElapsedTimeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/FixedElapsedTimeTest.java b/src/test/java/org/apache/commons/math4/genetics/FixedElapsedTimeTest.java
index 775bebe..75e21bb 100644
--- a/src/test/java/org/apache/commons/math4/genetics/FixedElapsedTimeTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/FixedElapsedTimeTest.java
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.Iterator;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.FixedElapsedTime;
+import org.apache.commons.math4.genetics.Population;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/FixedGenerationCountTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/FixedGenerationCountTest.java b/src/test/java/org/apache/commons/math4/genetics/FixedGenerationCountTest.java
index 37e03fa..e174879 100644
--- a/src/test/java/org/apache/commons/math4/genetics/FixedGenerationCountTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/FixedGenerationCountTest.java
@@ -14,11 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.Iterator;
 
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.FixedGenerationCount;
+import org.apache.commons.math4.genetics.Population;
 import org.junit.Assert;
 import org.junit.Test;
 


[06/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/BiDiagonalTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/BiDiagonalTransformer.java b/src/main/java/org/apache/commons/math3/linear/BiDiagonalTransformer.java
deleted file mode 100644
index cfbcb68..0000000
--- a/src/main/java/org/apache/commons/math3/linear/BiDiagonalTransformer.java
+++ /dev/null
@@ -1,380 +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.linear;
-
-import org.apache.commons.math3.util.FastMath;
-
-
-/**
- * Class transforming any matrix to bi-diagonal shape.
- * <p>Any m &times; n matrix A can be written as the product of three matrices:
- * A = U &times; B &times; V<sup>T</sup> with U an m &times; m orthogonal matrix,
- * B an m &times; n bi-diagonal matrix (lower diagonal if m &lt; n, upper diagonal
- * otherwise), and V an n &times; n orthogonal matrix.</p>
- * <p>Transformation to bi-diagonal shape is often not a goal by itself, but it is
- * an intermediate step in more general decomposition algorithms like {@link
- * SingularValueDecomposition Singular Value Decomposition}. This class is therefore
- * intended for internal use by the library and is not public. As a consequence of
- * this explicitly limited scope, many methods directly returns references to
- * internal arrays, not copies.</p>
- * @since 2.0
- */
-class BiDiagonalTransformer {
-
-    /** Householder vectors. */
-    private final double householderVectors[][];
-
-    /** Main diagonal. */
-    private final double[] main;
-
-    /** Secondary diagonal. */
-    private final double[] secondary;
-
-    /** Cached value of U. */
-    private RealMatrix cachedU;
-
-    /** Cached value of B. */
-    private RealMatrix cachedB;
-
-    /** Cached value of V. */
-    private RealMatrix cachedV;
-
-    /**
-     * Build the transformation to bi-diagonal shape of a matrix.
-     * @param matrix the matrix to transform.
-     */
-    public BiDiagonalTransformer(RealMatrix matrix) {
-
-        final int m = matrix.getRowDimension();
-        final int n = matrix.getColumnDimension();
-        final int p = FastMath.min(m, n);
-        householderVectors = matrix.getData();
-        main      = new double[p];
-        secondary = new double[p - 1];
-        cachedU   = null;
-        cachedB   = null;
-        cachedV   = null;
-
-        // transform matrix
-        if (m >= n) {
-            transformToUpperBiDiagonal();
-        } else {
-            transformToLowerBiDiagonal();
-        }
-
-    }
-
-    /**
-     * Returns the matrix U of the transform.
-     * <p>U is an orthogonal matrix, i.e. its transpose is also its inverse.</p>
-     * @return the U matrix
-     */
-    public RealMatrix getU() {
-
-        if (cachedU == null) {
-
-            final int m = householderVectors.length;
-            final int n = householderVectors[0].length;
-            final int p = main.length;
-            final int diagOffset    = (m >= n) ? 0 : 1;
-            final double[] diagonal = (m >= n) ? main : secondary;
-            double[][] ua = new double[m][m];
-
-            // fill up the part of the matrix not affected by Householder transforms
-            for (int k = m - 1; k >= p; --k) {
-                ua[k][k] = 1;
-            }
-
-            // build up first part of the matrix by applying Householder transforms
-            for (int k = p - 1; k >= diagOffset; --k) {
-                final double[] hK = householderVectors[k];
-                ua[k][k] = 1;
-                if (hK[k - diagOffset] != 0.0) {
-                    for (int j = k; j < m; ++j) {
-                        double alpha = 0;
-                        for (int i = k; i < m; ++i) {
-                            alpha -= ua[i][j] * householderVectors[i][k - diagOffset];
-                        }
-                        alpha /= diagonal[k - diagOffset] * hK[k - diagOffset];
-
-                        for (int i = k; i < m; ++i) {
-                            ua[i][j] += -alpha * householderVectors[i][k - diagOffset];
-                        }
-                    }
-                }
-            }
-            if (diagOffset > 0) {
-                ua[0][0] = 1;
-            }
-            cachedU = MatrixUtils.createRealMatrix(ua);
-        }
-
-        // return the cached matrix
-        return cachedU;
-
-    }
-
-    /**
-     * Returns the bi-diagonal matrix B of the transform.
-     * @return the B matrix
-     */
-    public RealMatrix getB() {
-
-        if (cachedB == null) {
-
-            final int m = householderVectors.length;
-            final int n = householderVectors[0].length;
-            double[][] ba = new double[m][n];
-            for (int i = 0; i < main.length; ++i) {
-                ba[i][i] = main[i];
-                if (m < n) {
-                    if (i > 0) {
-                        ba[i][i-1] = secondary[i - 1];
-                    }
-                } else {
-                    if (i < main.length - 1) {
-                        ba[i][i+1] = secondary[i];
-                    }
-                }
-            }
-            cachedB = MatrixUtils.createRealMatrix(ba);
-        }
-
-        // return the cached matrix
-        return cachedB;
-
-    }
-
-    /**
-     * Returns the matrix V of the transform.
-     * <p>V is an orthogonal matrix, i.e. its transpose is also its inverse.</p>
-     * @return the V matrix
-     */
-    public RealMatrix getV() {
-
-        if (cachedV == null) {
-
-            final int m = householderVectors.length;
-            final int n = householderVectors[0].length;
-            final int p = main.length;
-            final int diagOffset    = (m >= n) ? 1 : 0;
-            final double[] diagonal = (m >= n) ? secondary : main;
-            double[][] va = new double[n][n];
-
-            // fill up the part of the matrix not affected by Householder transforms
-            for (int k = n - 1; k >= p; --k) {
-                va[k][k] = 1;
-            }
-
-            // build up first part of the matrix by applying Householder transforms
-            for (int k = p - 1; k >= diagOffset; --k) {
-                final double[] hK = householderVectors[k - diagOffset];
-                va[k][k] = 1;
-                if (hK[k] != 0.0) {
-                    for (int j = k; j < n; ++j) {
-                        double beta = 0;
-                        for (int i = k; i < n; ++i) {
-                            beta -= va[i][j] * hK[i];
-                        }
-                        beta /= diagonal[k - diagOffset] * hK[k];
-
-                        for (int i = k; i < n; ++i) {
-                            va[i][j] += -beta * hK[i];
-                        }
-                    }
-                }
-            }
-            if (diagOffset > 0) {
-                va[0][0] = 1;
-            }
-            cachedV = MatrixUtils.createRealMatrix(va);
-        }
-
-        // return the cached matrix
-        return cachedV;
-
-    }
-
-    /**
-     * Get the Householder vectors of the transform.
-     * <p>Note that since this class is only intended for internal use,
-     * it returns directly a reference to its internal arrays, not a copy.</p>
-     * @return the main diagonal elements of the B matrix
-     */
-    double[][] getHouseholderVectorsRef() {
-        return householderVectors;
-    }
-
-    /**
-     * Get the main diagonal elements of the matrix B of the transform.
-     * <p>Note that since this class is only intended for internal use,
-     * it returns directly a reference to its internal arrays, not a copy.</p>
-     * @return the main diagonal elements of the B matrix
-     */
-    double[] getMainDiagonalRef() {
-        return main;
-    }
-
-    /**
-     * Get the secondary diagonal elements of the matrix B of the transform.
-     * <p>Note that since this class is only intended for internal use,
-     * it returns directly a reference to its internal arrays, not a copy.</p>
-     * @return the secondary diagonal elements of the B matrix
-     */
-    double[] getSecondaryDiagonalRef() {
-        return secondary;
-    }
-
-    /**
-     * Check if the matrix is transformed to upper bi-diagonal.
-     * @return true if the matrix is transformed to upper bi-diagonal
-     */
-    boolean isUpperBiDiagonal() {
-        return householderVectors.length >=  householderVectors[0].length;
-    }
-
-    /**
-     * Transform original matrix to upper bi-diagonal form.
-     * <p>Transformation is done using alternate Householder transforms
-     * on columns and rows.</p>
-     */
-    private void transformToUpperBiDiagonal() {
-
-        final int m = householderVectors.length;
-        final int n = householderVectors[0].length;
-        for (int k = 0; k < n; k++) {
-
-            //zero-out a column
-            double xNormSqr = 0;
-            for (int i = k; i < m; ++i) {
-                final double c = householderVectors[i][k];
-                xNormSqr += c * c;
-            }
-            final double[] hK = householderVectors[k];
-            final double a = (hK[k] > 0) ? -FastMath.sqrt(xNormSqr) : FastMath.sqrt(xNormSqr);
-            main[k] = a;
-            if (a != 0.0) {
-                hK[k] -= a;
-                for (int j = k + 1; j < n; ++j) {
-                    double alpha = 0;
-                    for (int i = k; i < m; ++i) {
-                        final double[] hI = householderVectors[i];
-                        alpha -= hI[j] * hI[k];
-                    }
-                    alpha /= a * householderVectors[k][k];
-                    for (int i = k; i < m; ++i) {
-                        final double[] hI = householderVectors[i];
-                        hI[j] -= alpha * hI[k];
-                    }
-                }
-            }
-
-            if (k < n - 1) {
-                //zero-out a row
-                xNormSqr = 0;
-                for (int j = k + 1; j < n; ++j) {
-                    final double c = hK[j];
-                    xNormSqr += c * c;
-                }
-                final double b = (hK[k + 1] > 0) ? -FastMath.sqrt(xNormSqr) : FastMath.sqrt(xNormSqr);
-                secondary[k] = b;
-                if (b != 0.0) {
-                    hK[k + 1] -= b;
-                    for (int i = k + 1; i < m; ++i) {
-                        final double[] hI = householderVectors[i];
-                        double beta = 0;
-                        for (int j = k + 1; j < n; ++j) {
-                            beta -= hI[j] * hK[j];
-                        }
-                        beta /= b * hK[k + 1];
-                        for (int j = k + 1; j < n; ++j) {
-                            hI[j] -= beta * hK[j];
-                        }
-                    }
-                }
-            }
-
-        }
-    }
-
-    /**
-     * Transform original matrix to lower bi-diagonal form.
-     * <p>Transformation is done using alternate Householder transforms
-     * on rows and columns.</p>
-     */
-    private void transformToLowerBiDiagonal() {
-
-        final int m = householderVectors.length;
-        final int n = householderVectors[0].length;
-        for (int k = 0; k < m; k++) {
-
-            //zero-out a row
-            final double[] hK = householderVectors[k];
-            double xNormSqr = 0;
-            for (int j = k; j < n; ++j) {
-                final double c = hK[j];
-                xNormSqr += c * c;
-            }
-            final double a = (hK[k] > 0) ? -FastMath.sqrt(xNormSqr) : FastMath.sqrt(xNormSqr);
-            main[k] = a;
-            if (a != 0.0) {
-                hK[k] -= a;
-                for (int i = k + 1; i < m; ++i) {
-                    final double[] hI = householderVectors[i];
-                    double alpha = 0;
-                    for (int j = k; j < n; ++j) {
-                        alpha -= hI[j] * hK[j];
-                    }
-                    alpha /= a * householderVectors[k][k];
-                    for (int j = k; j < n; ++j) {
-                        hI[j] -= alpha * hK[j];
-                    }
-                }
-            }
-
-            if (k < m - 1) {
-                //zero-out a column
-                final double[] hKp1 = householderVectors[k + 1];
-                xNormSqr = 0;
-                for (int i = k + 1; i < m; ++i) {
-                    final double c = householderVectors[i][k];
-                    xNormSqr += c * c;
-                }
-                final double b = (hKp1[k] > 0) ? -FastMath.sqrt(xNormSqr) : FastMath.sqrt(xNormSqr);
-                secondary[k] = b;
-                if (b != 0.0) {
-                    hKp1[k] -= b;
-                    for (int j = k + 1; j < n; ++j) {
-                        double beta = 0;
-                        for (int i = k + 1; i < m; ++i) {
-                            final double[] hI = householderVectors[i];
-                            beta -= hI[j] * hI[k];
-                        }
-                        beta /= b * hKp1[k];
-                        for (int i = k + 1; i < m; ++i) {
-                            final double[] hI = householderVectors[i];
-                            hI[j] -= beta * hI[k];
-                        }
-                    }
-                }
-            }
-
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/BlockFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/BlockFieldMatrix.java b/src/main/java/org/apache/commons/math3/linear/BlockFieldMatrix.java
deleted file mode 100644
index 4a41f7f..0000000
--- a/src/main/java/org/apache/commons/math3/linear/BlockFieldMatrix.java
+++ /dev/null
@@ -1,1592 +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.linear;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Cache-friendly implementation of FieldMatrix using a flat arrays to store
- * square blocks of the matrix.
- * <p>
- * This implementation is specially designed to be cache-friendly. Square blocks are
- * stored as small arrays and allow efficient traversal of data both in row major direction
- * and columns major direction, one block at a time. This greatly increases performances
- * for algorithms that use crossed directions loops like multiplication or transposition.
- * </p>
- * <p>
- * The size of square blocks is a static parameter. It may be tuned according to the cache
- * size of the target computer processor. As a rule of thumbs, it should be the largest
- * value that allows three blocks to be simultaneously cached (this is necessary for example
- * for matrix multiplication). The default value is to use 36x36 blocks.
- * </p>
- * <p>
- * The regular blocks represent {@link #BLOCK_SIZE} x {@link #BLOCK_SIZE} squares. Blocks
- * at right hand side and bottom side which may be smaller to fit matrix dimensions. The square
- * blocks are flattened in row major order in single dimension arrays which are therefore
- * {@link #BLOCK_SIZE}<sup>2</sup> elements long for regular blocks. The blocks are themselves
- * organized in row major order.
- * </p>
- * <p>
- * As an example, for a block size of 36x36, a 100x60 matrix would be stored in 6 blocks.
- * Block 0 would be a Field[1296] array holding the upper left 36x36 square, block 1 would be
- * a Field[1296] array holding the upper center 36x36 square, block 2 would be a Field[1008]
- * array holding the upper right 36x28 rectangle, block 3 would be a Field[864] array holding
- * the lower left 24x36 rectangle, block 4 would be a Field[864] array holding the lower center
- * 24x36 rectangle and block 5 would be a Field[672] array holding the lower right 24x28
- * rectangle.
- * </p>
- * <p>
- * The layout complexity overhead versus simple mapping of matrices to java
- * arrays is negligible for small matrices (about 1%). The gain from cache efficiency leads
- * to up to 3-fold improvements for matrices of moderate to large size.
- * </p>
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public class BlockFieldMatrix<T extends FieldElement<T>> extends AbstractFieldMatrix<T> implements Serializable {
-    /** Block size. */
-    public static final int BLOCK_SIZE = 36;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -4602336630143123183L;
-    /** Blocks of matrix entries. */
-    private final T blocks[][];
-    /** Number of rows of the matrix. */
-    private final int rows;
-    /** Number of columns of the matrix. */
-    private final int columns;
-    /** Number of block rows of the matrix. */
-    private final int blockRows;
-    /** Number of block columns of the matrix. */
-    private final int blockColumns;
-
-    /**
-     * Create a new matrix with the supplied row and column dimensions.
-     *
-     * @param field Field to which the elements belong.
-     * @param rows Number of rows in the new matrix.
-     * @param columns Number of columns in the new matrix.
-     * @throws NotStrictlyPositiveException if row or column dimension is not
-     * positive.
-     */
-    public BlockFieldMatrix(final Field<T> field, final int rows,
-                            final int columns)
-        throws NotStrictlyPositiveException {
-        super(field, rows, columns);
-        this.rows    = rows;
-        this.columns = columns;
-
-        // number of blocks
-        blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        // allocate storage blocks, taking care of smaller ones at right and bottom
-        blocks = createBlocksLayout(field, rows, columns);
-    }
-
-    /**
-     * Create a new dense matrix copying entries from raw layout data.
-     * <p>The input array <em>must</em> already be in raw layout.</p>
-     * <p>Calling this constructor is equivalent to call:
-     * <pre>matrix = new BlockFieldMatrix<T>(getField(), rawData.length, rawData[0].length,
-     *                                   toBlocksLayout(rawData), false);</pre>
-     * </p>
-     *
-     * @param rawData Data for the new matrix, in raw layout.
-     * @throws DimensionMismatchException if the {@code blockData} shape is
-     * inconsistent with block layout.
-     * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
-     */
-    public BlockFieldMatrix(final T[][] rawData)
-        throws DimensionMismatchException {
-        this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);
-    }
-
-    /**
-     * Create a new dense matrix copying entries from block layout data.
-     * <p>The input array <em>must</em> already be in blocks layout.</p>
-     * @param rows  the number of rows in the new matrix
-     * @param columns  the number of columns in the new matrix
-     * @param blockData data for new matrix
-     * @param copyArray if true, the input array will be copied, otherwise
-     * it will be referenced
-     *
-     * @throws DimensionMismatchException if the {@code blockData} shape is
-     * inconsistent with block layout.
-     * @throws NotStrictlyPositiveException if row or column dimension is not
-     * positive.
-     * @see #createBlocksLayout(Field, int, int)
-     * @see #toBlocksLayout(FieldElement[][])
-     * @see #BlockFieldMatrix(FieldElement[][])
-     */
-    public BlockFieldMatrix(final int rows, final int columns,
-                            final T[][] blockData, final boolean copyArray)
-        throws DimensionMismatchException, NotStrictlyPositiveException {
-        super(extractField(blockData), rows, columns);
-        this.rows    = rows;
-        this.columns = columns;
-
-        // number of blocks
-        blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        if (copyArray) {
-            // allocate storage blocks, taking care of smaller ones at right and bottom
-            blocks = MathArrays.buildArray(getField(), blockRows * blockColumns, -1);
-        } else {
-            // reference existing array
-            blocks = blockData;
-        }
-
-        int index = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock, ++index) {
-                if (blockData[index].length != iHeight * blockWidth(jBlock)) {
-                    throw new DimensionMismatchException(blockData[index].length,
-                                                         iHeight * blockWidth(jBlock));
-                }
-                if (copyArray) {
-                    blocks[index] = blockData[index].clone();
-                }
-            }
-        }
-    }
-
-    /**
-     * Convert a data array from raw layout to blocks layout.
-     * <p>
-     * Raw layout is the straightforward layout where element at row i and
-     * column j is in array element <code>rawData[i][j]</code>. Blocks layout
-     * is the layout used in {@link BlockFieldMatrix} instances, where the matrix
-     * is split in square blocks (except at right and bottom side where blocks may
-     * be rectangular to fit matrix size) and each block is stored in a flattened
-     * one-dimensional array.
-     * </p>
-     * <p>
-     * This method creates an array in blocks layout from an input array in raw layout.
-     * It can be used to provide the array argument of the {@link
-     * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}
-     * constructor.
-     * </p>
-     * @param <T> Type of the field elements.
-     * @param rawData Data array in raw layout.
-     * @return a new data array containing the same entries but in blocks layout
-     * @throws DimensionMismatchException if {@code rawData} is not rectangular
-     *  (not all rows have the same length).
-     * @see #createBlocksLayout(Field, int, int)
-     * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
-     */
-    public static <T extends FieldElement<T>> T[][] toBlocksLayout(final T[][] rawData)
-        throws DimensionMismatchException {
-
-        final int rows         = rawData.length;
-        final int columns      = rawData[0].length;
-        final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        // safety checks
-        for (int i = 0; i < rawData.length; ++i) {
-            final int length = rawData[i].length;
-            if (length != columns) {
-                throw new DimensionMismatchException(columns, length);
-            }
-        }
-
-        // convert array
-        final Field<T> field = extractField(rawData);
-        final T[][] blocks = MathArrays.buildArray(field, blockRows * blockColumns, -1);
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart  = iBlock * BLOCK_SIZE;
-            final int pEnd    = FastMath.min(pStart + BLOCK_SIZE, rows);
-            final int iHeight = pEnd - pStart;
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final int jWidth = qEnd - qStart;
-
-                // allocate new block
-                final T[] block = MathArrays.buildArray(field, iHeight * jWidth);
-                blocks[blockIndex] = block;
-
-                // copy data
-                int index = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    System.arraycopy(rawData[p], qStart, block, index, jWidth);
-                    index += jWidth;
-                }
-
-                ++blockIndex;
-            }
-        }
-
-        return blocks;
-    }
-
-    /**
-     * Create a data array in blocks layout.
-     * <p>
-     * This method can be used to create the array argument of the {@link
-     * #BlockFieldMatrix(int, int, FieldElement[][], boolean)}
-     * constructor.
-     * </p>
-     * @param <T> Type of the field elements.
-     * @param field Field to which the elements belong.
-     * @param rows Number of rows in the new matrix.
-     * @param columns Number of columns in the new matrix.
-     * @return a new data array in blocks layout.
-     * @see #toBlocksLayout(FieldElement[][])
-     * @see #BlockFieldMatrix(int, int, FieldElement[][], boolean)
-     */
-    public static <T extends FieldElement<T>> T[][] createBlocksLayout(final Field<T> field,
-                                                                       final int rows, final int columns) {
-        final int blockRows    = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        final T[][] blocks = MathArrays.buildArray(field, blockRows * blockColumns, -1);
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart  = iBlock * BLOCK_SIZE;
-            final int pEnd    = FastMath.min(pStart + BLOCK_SIZE, rows);
-            final int iHeight = pEnd - pStart;
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final int jWidth = qEnd - qStart;
-                blocks[blockIndex] = MathArrays.buildArray(field, iHeight * jWidth);
-                ++blockIndex;
-            }
-        }
-
-        return blocks;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> createMatrix(final int rowDimension,
-                                       final int columnDimension)
-        throws NotStrictlyPositiveException {
-        return new BlockFieldMatrix<T>(getField(), rowDimension,
-                                       columnDimension);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> copy() {
-
-        // create an empty matrix
-        BlockFieldMatrix<T> copied = new BlockFieldMatrix<T>(getField(), rows, columns);
-
-        // copy the blocks
-        for (int i = 0; i < blocks.length; ++i) {
-            System.arraycopy(blocks[i], 0, copied.blocks[i], 0, blocks[i].length);
-        }
-
-        return copied;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> add(final FieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        try {
-            return add((BlockFieldMatrix<T>) m);
-        } catch (ClassCastException cce) {
-
-            // safety check
-            checkAdditionCompatible(m);
-
-            final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
-
-            // perform addition block-wise, to ensure good cache behavior
-            int blockIndex = 0;
-            for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-                for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-
-                    // perform addition on the current block
-                    final T[] outBlock = out.blocks[blockIndex];
-                    final T[] tBlock   = blocks[blockIndex];
-                    final int      pStart   = iBlock * BLOCK_SIZE;
-                    final int      pEnd     = FastMath.min(pStart + BLOCK_SIZE, rows);
-                    final int      qStart   = jBlock * BLOCK_SIZE;
-                    final int      qEnd     = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    int k = 0;
-                    for (int p = pStart; p < pEnd; ++p) {
-                        for (int q = qStart; q < qEnd; ++q) {
-                            outBlock[k] = tBlock[k].add(m.getEntry(p, q));
-                            ++k;
-                        }
-                    }
-
-                    // go to next block
-                    ++blockIndex;
-
-                }
-            }
-
-            return out;
-        }
-    }
-
-    /**
-     * Compute the sum of {@code this} and {@code m}.
-     *
-     * @param m matrix to be added
-     * @return {@code this + m}
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this}
-     */
-    public BlockFieldMatrix<T> add(final BlockFieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-
-        // safety check
-        checkAdditionCompatible(m);
-
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
-
-        // perform addition block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final T[] outBlock = out.blocks[blockIndex];
-            final T[] tBlock   = blocks[blockIndex];
-            final T[] mBlock   = m.blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k].add(mBlock[k]);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> subtract(final FieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        try {
-            return subtract((BlockFieldMatrix<T>) m);
-        } catch (ClassCastException cce) {
-
-            // safety check
-            checkSubtractionCompatible(m);
-
-            final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
-
-            // perform subtraction block-wise, to ensure good cache behavior
-            int blockIndex = 0;
-            for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-                for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-
-                    // perform subtraction on the current block
-                    final T[] outBlock = out.blocks[blockIndex];
-                    final T[] tBlock   = blocks[blockIndex];
-                    final int      pStart   = iBlock * BLOCK_SIZE;
-                    final int      pEnd     = FastMath.min(pStart + BLOCK_SIZE, rows);
-                    final int      qStart   = jBlock * BLOCK_SIZE;
-                    final int      qEnd     = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    int k = 0;
-                    for (int p = pStart; p < pEnd; ++p) {
-                        for (int q = qStart; q < qEnd; ++q) {
-                            outBlock[k] = tBlock[k].subtract(m.getEntry(p, q));
-                            ++k;
-                        }
-                    }
-
-                    // go to next block
-                    ++blockIndex;
-
-                }
-            }
-
-            return out;
-        }
-    }
-
-    /**
-     * Compute {@code this - m}.
-     *
-     * @param m matrix to be subtracted
-     * @return {@code this - m}
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this}
-     */
-    public BlockFieldMatrix<T> subtract(final BlockFieldMatrix<T> m) throws MatrixDimensionMismatchException {
-        // safety check
-        checkSubtractionCompatible(m);
-
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
-
-        // perform subtraction block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final T[] outBlock = out.blocks[blockIndex];
-            final T[] tBlock   = blocks[blockIndex];
-            final T[] mBlock   = m.blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k].subtract(mBlock[k]);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> scalarAdd(final T d) {
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
-
-        // perform subtraction block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final T[] outBlock = out.blocks[blockIndex];
-            final T[] tBlock   = blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k].add(d);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> scalarMultiply(final T d) {
-
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, columns);
-
-        // perform subtraction block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final T[] outBlock = out.blocks[blockIndex];
-            final T[] tBlock   = blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k].multiply(d);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> multiply(final FieldMatrix<T> m)
-        throws DimensionMismatchException {
-        try {
-            return multiply((BlockFieldMatrix<T>) m);
-        } catch (ClassCastException cce) {
-
-            // safety check
-            checkMultiplicationCompatible(m);
-
-            final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, m.getColumnDimension());
-            final T zero = getField().getZero();
-
-            // perform multiplication block-wise, to ensure good cache behavior
-            int blockIndex = 0;
-            for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-
-                final int pStart = iBlock * BLOCK_SIZE;
-                final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-
-                for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, m.getColumnDimension());
-
-                    // select current block
-                    final T[] outBlock = out.blocks[blockIndex];
-
-                    // perform multiplication on current block
-                    for (int kBlock = 0; kBlock < blockColumns; ++kBlock) {
-                        final int kWidth      = blockWidth(kBlock);
-                        final T[] tBlock = blocks[iBlock * blockColumns + kBlock];
-                        final int rStart      = kBlock * BLOCK_SIZE;
-                        int k = 0;
-                        for (int p = pStart; p < pEnd; ++p) {
-                            final int lStart = (p - pStart) * kWidth;
-                            final int lEnd   = lStart + kWidth;
-                            for (int q = qStart; q < qEnd; ++q) {
-                                T sum = zero;
-                                int r = rStart;
-                                for (int l = lStart; l < lEnd; ++l) {
-                                    sum = sum.add(tBlock[l].multiply(m.getEntry(r, q)));
-                                    ++r;
-                                }
-                                outBlock[k] = outBlock[k].add(sum);
-                                ++k;
-                            }
-                        }
-                    }
-
-                    // go to next block
-                    ++blockIndex;
-
-                }
-            }
-
-            return out;
-        }
-    }
-
-    /**
-     * Returns the result of postmultiplying {@code this} by {@code m}.
-     *
-     * @param m matrix to postmultiply by
-     * @return {@code this * m}
-     * @throws DimensionMismatchException if the matrices are not compatible.
-     */
-    public BlockFieldMatrix<T> multiply(BlockFieldMatrix<T> m)
-        throws DimensionMismatchException {
-
-        // safety check
-        checkMultiplicationCompatible(m);
-
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, m.columns);
-        final T zero = getField().getZero();
-
-        // perform multiplication block-wise, to ensure good cache behavior
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-
-            for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-                final int jWidth = out.blockWidth(jBlock);
-                final int jWidth2 = jWidth  + jWidth;
-                final int jWidth3 = jWidth2 + jWidth;
-                final int jWidth4 = jWidth3 + jWidth;
-
-                // select current block
-                final T[] outBlock = out.blocks[blockIndex];
-
-                // perform multiplication on current block
-                for (int kBlock = 0; kBlock < blockColumns; ++kBlock) {
-                    final int kWidth = blockWidth(kBlock);
-                    final T[] tBlock = blocks[iBlock * blockColumns + kBlock];
-                    final T[] mBlock = m.blocks[kBlock * m.blockColumns + jBlock];
-                    int k = 0;
-                    for (int p = pStart; p < pEnd; ++p) {
-                        final int lStart = (p - pStart) * kWidth;
-                        final int lEnd   = lStart + kWidth;
-                        for (int nStart = 0; nStart < jWidth; ++nStart) {
-                            T sum = zero;
-                            int l = lStart;
-                            int n = nStart;
-                            while (l < lEnd - 3) {
-                                sum = sum.
-                                      add(tBlock[l].multiply(mBlock[n])).
-                                      add(tBlock[l + 1].multiply(mBlock[n + jWidth])).
-                                      add(tBlock[l + 2].multiply(mBlock[n + jWidth2])).
-                                      add(tBlock[l + 3].multiply(mBlock[n + jWidth3]));
-                                l += 4;
-                                n += jWidth4;
-                            }
-                            while (l < lEnd) {
-                                sum = sum.add(tBlock[l++].multiply(mBlock[n]));
-                                n += jWidth;
-                            }
-                            outBlock[k] = outBlock[k].add(sum);
-                            ++k;
-                        }
-                    }
-                }
-
-                // go to next block
-                ++blockIndex;
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[][] getData() {
-
-        final T[][] data = MathArrays.buildArray(getField(), getRowDimension(), getColumnDimension());
-        final int lastColumns = columns - (blockColumns - 1) * BLOCK_SIZE;
-
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-            int regularPos   = 0;
-            int lastPos      = 0;
-            for (int p = pStart; p < pEnd; ++p) {
-                final T[] dataP = data[p];
-                int blockIndex = iBlock * blockColumns;
-                int dataPos    = 0;
-                for (int jBlock = 0; jBlock < blockColumns - 1; ++jBlock) {
-                    System.arraycopy(blocks[blockIndex++], regularPos, dataP, dataPos, BLOCK_SIZE);
-                    dataPos += BLOCK_SIZE;
-                }
-                System.arraycopy(blocks[blockIndex], lastPos, dataP, dataPos, lastColumns);
-                regularPos += BLOCK_SIZE;
-                lastPos    += lastColumns;
-            }
-        }
-
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> getSubMatrix(final int startRow, final int endRow,
-                                       final int startColumn,
-                                       final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        // safety checks
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-
-        // create the output matrix
-        final BlockFieldMatrix<T> out =
-            new BlockFieldMatrix<T>(getField(), endRow - startRow + 1, endColumn - startColumn + 1);
-
-        // compute blocks shifts
-        final int blockStartRow    = startRow    / BLOCK_SIZE;
-        final int rowsShift        = startRow    % BLOCK_SIZE;
-        final int blockStartColumn = startColumn / BLOCK_SIZE;
-        final int columnsShift     = startColumn % BLOCK_SIZE;
-
-        // perform extraction block-wise, to ensure good cache behavior
-        int pBlock = blockStartRow;
-        for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-            final int iHeight = out.blockHeight(iBlock);
-            int qBlock = blockStartColumn;
-            for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-                final int jWidth = out.blockWidth(jBlock);
-
-                // handle one block of the output matrix
-                final int      outIndex = iBlock * out.blockColumns + jBlock;
-                final T[] outBlock = out.blocks[outIndex];
-                final int      index    = pBlock * blockColumns + qBlock;
-                final int      width    = blockWidth(qBlock);
-
-                final int heightExcess = iHeight + rowsShift - BLOCK_SIZE;
-                final int widthExcess  = jWidth + columnsShift - BLOCK_SIZE;
-                if (heightExcess > 0) {
-                    // the submatrix block spans on two blocks rows from the original matrix
-                    if (widthExcess > 0) {
-                        // the submatrix block spans on two blocks columns from the original matrix
-                        final int width2 = blockWidth(qBlock + 1);
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, BLOCK_SIZE,
-                                      columnsShift, BLOCK_SIZE,
-                                      outBlock, jWidth, 0, 0);
-                        copyBlockPart(blocks[index + 1], width2,
-                                      rowsShift, BLOCK_SIZE,
-                                      0, widthExcess,
-                                      outBlock, jWidth, 0, jWidth - widthExcess);
-                        copyBlockPart(blocks[index + blockColumns], width,
-                                      0, heightExcess,
-                                      columnsShift, BLOCK_SIZE,
-                                      outBlock, jWidth, iHeight - heightExcess, 0);
-                        copyBlockPart(blocks[index + blockColumns + 1], width2,
-                                      0, heightExcess,
-                                      0, widthExcess,
-                                      outBlock, jWidth, iHeight - heightExcess, jWidth - widthExcess);
-                    } else {
-                        // the submatrix block spans on one block column from the original matrix
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, BLOCK_SIZE,
-                                      columnsShift, jWidth + columnsShift,
-                                      outBlock, jWidth, 0, 0);
-                        copyBlockPart(blocks[index + blockColumns], width,
-                                      0, heightExcess,
-                                      columnsShift, jWidth + columnsShift,
-                                      outBlock, jWidth, iHeight - heightExcess, 0);
-                    }
-                } else {
-                    // the submatrix block spans on one block row from the original matrix
-                    if (widthExcess > 0) {
-                        // the submatrix block spans on two blocks columns from the original matrix
-                        final int width2 = blockWidth(qBlock + 1);
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, iHeight + rowsShift,
-                                      columnsShift, BLOCK_SIZE,
-                                      outBlock, jWidth, 0, 0);
-                        copyBlockPart(blocks[index + 1], width2,
-                                      rowsShift, iHeight + rowsShift,
-                                      0, widthExcess,
-                                      outBlock, jWidth, 0, jWidth - widthExcess);
-                    } else {
-                        // the submatrix block spans on one block column from the original matrix
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, iHeight + rowsShift,
-                                      columnsShift, jWidth + columnsShift,
-                                      outBlock, jWidth, 0, 0);
-                    }
-               }
-                ++qBlock;
-            }
-            ++pBlock;
-        }
-
-        return out;
-    }
-
-    /**
-     * Copy a part of a block into another one
-     * <p>This method can be called only when the specified part fits in both
-     * blocks, no verification is done here.</p>
-     * @param srcBlock source block
-     * @param srcWidth source block width ({@link #BLOCK_SIZE} or smaller)
-     * @param srcStartRow start row in the source block
-     * @param srcEndRow end row (exclusive) in the source block
-     * @param srcStartColumn start column in the source block
-     * @param srcEndColumn end column (exclusive) in the source block
-     * @param dstBlock destination block
-     * @param dstWidth destination block width ({@link #BLOCK_SIZE} or smaller)
-     * @param dstStartRow start row in the destination block
-     * @param dstStartColumn start column in the destination block
-     */
-    private void copyBlockPart(final T[] srcBlock, final int srcWidth,
-                               final int srcStartRow, final int srcEndRow,
-                               final int srcStartColumn, final int srcEndColumn,
-                               final T[] dstBlock, final int dstWidth,
-                               final int dstStartRow, final int dstStartColumn) {
-        final int length = srcEndColumn - srcStartColumn;
-        int srcPos = srcStartRow * srcWidth + srcStartColumn;
-        int dstPos = dstStartRow * dstWidth + dstStartColumn;
-        for (int srcRow = srcStartRow; srcRow < srcEndRow; ++srcRow) {
-            System.arraycopy(srcBlock, srcPos, dstBlock, dstPos, length);
-            srcPos += srcWidth;
-            dstPos += dstWidth;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSubMatrix(final T[][] subMatrix, final int row,
-                             final int column)
-        throws DimensionMismatchException, OutOfRangeException,
-        NoDataException, NullArgumentException {
-        // safety checks
-        MathUtils.checkNotNull(subMatrix);
-        final int refLength = subMatrix[0].length;
-        if (refLength == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-        }
-        final int endRow    = row + subMatrix.length - 1;
-        final int endColumn = column + refLength - 1;
-        checkSubMatrixIndex(row, endRow, column, endColumn);
-        for (final T[] subRow : subMatrix) {
-            if (subRow.length != refLength) {
-                throw new DimensionMismatchException(refLength, subRow.length);
-            }
-        }
-
-        // compute blocks bounds
-        final int blockStartRow    = row / BLOCK_SIZE;
-        final int blockEndRow      = (endRow + BLOCK_SIZE) / BLOCK_SIZE;
-        final int blockStartColumn = column / BLOCK_SIZE;
-        final int blockEndColumn   = (endColumn + BLOCK_SIZE) / BLOCK_SIZE;
-
-        // perform copy block-wise, to ensure good cache behavior
-        for (int iBlock = blockStartRow; iBlock < blockEndRow; ++iBlock) {
-            final int iHeight  = blockHeight(iBlock);
-            final int firstRow = iBlock * BLOCK_SIZE;
-            final int iStart   = FastMath.max(row,    firstRow);
-            final int iEnd     = FastMath.min(endRow + 1, firstRow + iHeight);
-
-            for (int jBlock = blockStartColumn; jBlock < blockEndColumn; ++jBlock) {
-                final int jWidth      = blockWidth(jBlock);
-                final int firstColumn = jBlock * BLOCK_SIZE;
-                final int jStart      = FastMath.max(column,    firstColumn);
-                final int jEnd        = FastMath.min(endColumn + 1, firstColumn + jWidth);
-                final int jLength     = jEnd - jStart;
-
-                // handle one block, row by row
-                final T[] block = blocks[iBlock * blockColumns + jBlock];
-                for (int i = iStart; i < iEnd; ++i) {
-                    System.arraycopy(subMatrix[i - row], jStart - column,
-                                     block, (i - firstRow) * jWidth + (jStart - firstColumn),
-                                     jLength);
-                }
-
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> getRowMatrix(final int row)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), 1, columns);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock  = row / BLOCK_SIZE;
-        final int iRow    = row - iBlock * BLOCK_SIZE;
-        int outBlockIndex = 0;
-        int outIndex      = 0;
-        T[] outBlock = out.blocks[outBlockIndex];
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth     = blockWidth(jBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            final int available  = outBlock.length - outIndex;
-            if (jWidth > available) {
-                System.arraycopy(block, iRow * jWidth, outBlock, outIndex, available);
-                outBlock = out.blocks[++outBlockIndex];
-                System.arraycopy(block, iRow * jWidth, outBlock, 0, jWidth - available);
-                outIndex = jWidth - available;
-            } else {
-                System.arraycopy(block, iRow * jWidth, outBlock, outIndex, jWidth);
-                outIndex += jWidth;
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setRowMatrix(final int row, final FieldMatrix<T> matrix)
-        throws MatrixDimensionMismatchException, OutOfRangeException {
-        try {
-            setRowMatrix(row, (BlockFieldMatrix<T>) matrix);
-        } catch (ClassCastException cce) {
-            super.setRowMatrix(row, matrix);
-        }
-    }
-
-    /**
-     * Sets the entries in row number <code>row</code>
-     * as a row matrix.  Row indices start at 0.
-     *
-     * @param row the row to be set
-     * @param matrix row matrix (must have one row and the same number of columns
-     * as the instance)
-     * @throws MatrixDimensionMismatchException if the matrix dimensions do
-     * not match one instance row.
-     * @throws OutOfRangeException if the specified row index is invalid.
-     */
-    public void setRowMatrix(final int row, final BlockFieldMatrix<T> matrix)
-        throws MatrixDimensionMismatchException, OutOfRangeException {
-        checkRowIndex(row);
-        final int nCols = getColumnDimension();
-        if ((matrix.getRowDimension() != 1) ||
-            (matrix.getColumnDimension() != nCols)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       1, nCols);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock = row / BLOCK_SIZE;
-        final int iRow   = row - iBlock * BLOCK_SIZE;
-        int mBlockIndex  = 0;
-        int mIndex       = 0;
-        T[] mBlock  = matrix.blocks[mBlockIndex];
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth     = blockWidth(jBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            final int available  = mBlock.length - mIndex;
-            if (jWidth > available) {
-                System.arraycopy(mBlock, mIndex, block, iRow * jWidth, available);
-                mBlock = matrix.blocks[++mBlockIndex];
-                System.arraycopy(mBlock, 0, block, iRow * jWidth, jWidth - available);
-                mIndex = jWidth - available;
-            } else {
-                System.arraycopy(mBlock, mIndex, block, iRow * jWidth, jWidth);
-                mIndex += jWidth;
-           }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> getColumnMatrix(final int column)
-        throws OutOfRangeException {
-        checkColumnIndex(column);
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), rows, 1);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock  = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth  = blockWidth(jBlock);
-        int outBlockIndex = 0;
-        int outIndex      = 0;
-        T[] outBlock = out.blocks[outBlockIndex];
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                if (outIndex >= outBlock.length) {
-                    outBlock = out.blocks[++outBlockIndex];
-                    outIndex = 0;
-                }
-                outBlock[outIndex++] = block[i * jWidth + jColumn];
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setColumnMatrix(final int column, final FieldMatrix<T> matrix)
-        throws MatrixDimensionMismatchException, OutOfRangeException {
-        try {
-            setColumnMatrix(column, (BlockFieldMatrix<T>) matrix);
-        } catch (ClassCastException cce) {
-            super.setColumnMatrix(column, matrix);
-        }
-    }
-
-    /**
-     * Sets the entries in column number {@code column}
-     * as a column matrix.  Column indices start at 0.
-     *
-     * @param column Column to be set.
-     * @param matrix Column matrix (must have one column and the same number of rows
-     * as the instance).
-     * @throws MatrixDimensionMismatchException if the matrix dimensions do
-     * not match one instance column.
-     * @throws OutOfRangeException if the specified column index is invalid.
-     */
-    void setColumnMatrix(final int column, final BlockFieldMatrix<T> matrix)
-        throws MatrixDimensionMismatchException, OutOfRangeException {
-        checkColumnIndex(column);
-        final int nRows = getRowDimension();
-        if ((matrix.getRowDimension() != nRows) ||
-            (matrix.getColumnDimension() != 1)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       nRows, 1);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock  = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth  = blockWidth(jBlock);
-        int mBlockIndex = 0;
-        int mIndex      = 0;
-        T[] mBlock = matrix.blocks[mBlockIndex];
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                if (mIndex >= mBlock.length) {
-                    mBlock = matrix.blocks[++mBlockIndex];
-                    mIndex = 0;
-                }
-                block[i * jWidth + jColumn] = mBlock[mIndex++];
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldVector<T> getRowVector(final int row)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        final T[] outData = MathArrays.buildArray(getField(), columns);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock  = row / BLOCK_SIZE;
-        final int iRow    = row - iBlock * BLOCK_SIZE;
-        int outIndex      = 0;
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth     = blockWidth(jBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            System.arraycopy(block, iRow * jWidth, outData, outIndex, jWidth);
-            outIndex += jWidth;
-        }
-
-        return new ArrayFieldVector<T>(getField(), outData, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setRowVector(final int row, final FieldVector<T> vector)
-        throws MatrixDimensionMismatchException, OutOfRangeException {
-        try {
-            setRow(row, ((ArrayFieldVector<T>) vector).getDataRef());
-        } catch (ClassCastException cce) {
-            super.setRowVector(row, vector);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldVector<T> getColumnVector(final int column)
-        throws OutOfRangeException {
-        checkColumnIndex(column);
-        final T[] outData = MathArrays.buildArray(getField(), rows);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock  = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth  = blockWidth(jBlock);
-        int outIndex      = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                outData[outIndex++] = block[i * jWidth + jColumn];
-            }
-        }
-
-        return new ArrayFieldVector<T>(getField(), outData, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setColumnVector(final int column, final FieldVector<T> vector)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        try {
-            setColumn(column, ((ArrayFieldVector<T>) vector).getDataRef());
-        } catch (ClassCastException cce) {
-            super.setColumnVector(column, vector);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[] getRow(final int row) throws OutOfRangeException {
-        checkRowIndex(row);
-        final T[] out = MathArrays.buildArray(getField(), columns);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock  = row / BLOCK_SIZE;
-        final int iRow    = row - iBlock * BLOCK_SIZE;
-        int outIndex      = 0;
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth     = blockWidth(jBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            System.arraycopy(block, iRow * jWidth, out, outIndex, jWidth);
-            outIndex += jWidth;
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setRow(final int row, final T[] array)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        checkRowIndex(row);
-        final int nCols = getColumnDimension();
-        if (array.length != nCols) {
-            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock  = row / BLOCK_SIZE;
-        final int iRow    = row - iBlock * BLOCK_SIZE;
-        int outIndex      = 0;
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth     = blockWidth(jBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            System.arraycopy(array, outIndex, block, iRow * jWidth, jWidth);
-            outIndex += jWidth;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[] getColumn(final int column) throws OutOfRangeException {
-        checkColumnIndex(column);
-        final T[] out = MathArrays.buildArray(getField(), rows);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock  = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth  = blockWidth(jBlock);
-        int outIndex      = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                out[outIndex++] = block[i * jWidth + jColumn];
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setColumn(final int column, final T[] array)
-        throws MatrixDimensionMismatchException, OutOfRangeException {
-        checkColumnIndex(column);
-        final int nRows = getRowDimension();
-        if (array.length != nRows) {
-            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock  = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth  = blockWidth(jBlock);
-        int outIndex      = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final T[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                block[i * jWidth + jColumn] = array[outIndex++];
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T getEntry(final int row, final int column)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        final int iBlock = row    / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-
-        return blocks[iBlock * blockColumns + jBlock][k];
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setEntry(final int row, final int column, final T value)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        final int iBlock = row    / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-
-        blocks[iBlock * blockColumns + jBlock][k] = value;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void addToEntry(final int row, final int column, final T increment)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        final int iBlock = row    / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-        final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
-
-        blockIJ[k] = blockIJ[k].add(increment);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void multiplyEntry(final int row, final int column, final T factor)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        final int iBlock = row    / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k      = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-        final T[] blockIJ = blocks[iBlock * blockColumns + jBlock];
-
-        blockIJ[k] = blockIJ[k].multiply(factor);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> transpose() {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        final BlockFieldMatrix<T> out = new BlockFieldMatrix<T>(getField(), nCols, nRows);
-
-        // perform transpose block-wise, to ensure good cache behavior
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockColumns; ++iBlock) {
-            for (int jBlock = 0; jBlock < blockRows; ++jBlock) {
-
-                // transpose current block
-                final T[] outBlock = out.blocks[blockIndex];
-                final T[] tBlock   = blocks[jBlock * blockColumns + iBlock];
-                final int      pStart   = iBlock * BLOCK_SIZE;
-                final int      pEnd     = FastMath.min(pStart + BLOCK_SIZE, columns);
-                final int      qStart   = jBlock * BLOCK_SIZE;
-                final int      qEnd     = FastMath.min(qStart + BLOCK_SIZE, rows);
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    final int lInc = pEnd - pStart;
-                    int l = p - pStart;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        outBlock[k] = tBlock[l];
-                        ++k;
-                        l+= lInc;
-                    }
-                }
-
-                // go to next block
-                ++blockIndex;
-
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getRowDimension() {
-        return rows;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getColumnDimension() {
-        return columns;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[] operate(final T[] v) throws DimensionMismatchException {
-        if (v.length != columns) {
-            throw new DimensionMismatchException(v.length, columns);
-        }
-        final T[] out = MathArrays.buildArray(getField(), rows);
-        final T zero = getField().getZero();
-
-        // perform multiplication block-wise, to ensure good cache behavior
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final T[] block  = blocks[iBlock * blockColumns + jBlock];
-                final int      qStart = jBlock * BLOCK_SIZE;
-                final int      qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    T sum = zero;
-                    int q = qStart;
-                    while (q < qEnd - 3) {
-                        sum = sum.
-                              add(block[k].multiply(v[q])).
-                              add(block[k + 1].multiply(v[q + 1])).
-                              add(block[k + 2].multiply(v[q + 2])).
-                              add(block[k + 3].multiply(v[q + 3]));
-                        k += 4;
-                        q += 4;
-                    }
-                    while (q < qEnd) {
-                        sum = sum.add(block[k++].multiply(v[q++]));
-                    }
-                    out[p] = out[p].add(sum);
-                }
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[] preMultiply(final T[] v) throws DimensionMismatchException {
-
-        if (v.length != rows) {
-            throw new DimensionMismatchException(v.length, rows);
-        }
-        final T[] out = MathArrays.buildArray(getField(), columns);
-        final T zero = getField().getZero();
-
-        // perform multiplication block-wise, to ensure good cache behavior
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth  = blockWidth(jBlock);
-            final int jWidth2 = jWidth  + jWidth;
-            final int jWidth3 = jWidth2 + jWidth;
-            final int jWidth4 = jWidth3 + jWidth;
-            final int qStart = jBlock * BLOCK_SIZE;
-            final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-            for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-                final T[] block  = blocks[iBlock * blockColumns + jBlock];
-                final int      pStart = iBlock * BLOCK_SIZE;
-                final int      pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-                for (int q = qStart; q < qEnd; ++q) {
-                    int k = q - qStart;
-                    T sum = zero;
-                    int p = pStart;
-                    while (p < pEnd - 3) {
-                        sum = sum.
-                              add(block[k].multiply(v[p])).
-                              add(block[k + jWidth].multiply(v[p + 1])).
-                              add(block[k + jWidth2].multiply(v[p + 2])).
-                              add(block[k + jWidth3].multiply(v[p + 3]));
-                        k += jWidth4;
-                        p += 4;
-                    }
-                    while (p < pEnd) {
-                        sum = sum.add(block[k].multiply(v[p++]));
-                        k += jWidth;
-                    }
-                    out[q] = out[q].add(sum);
-                }
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    final T[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - pStart) * jWidth;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    final T[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - pStart) * jWidth;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor,
-                            final int startRow, final int endRow,
-                            final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0     = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd   = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int q0     = jBlock * BLOCK_SIZE;
-                    final int qStart = FastMath.max(startColumn, q0);
-                    final int qEnd   = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                    final T[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor,
-                            final int startRow, final int endRow,
-                            final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0     = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd   = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int q0     = jBlock * BLOCK_SIZE;
-                    final int qStart = FastMath.max(startColumn, q0);
-                    final int qEnd   = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                    final T[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInOptimizedOrder(final FieldMatrixChangingVisitor<T> visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final T[] block = blocks[blockIndex];
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-                ++blockIndex;
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor<T> visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd   = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd   = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final T[] block = blocks[blockIndex];
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-                ++blockIndex;
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInOptimizedOrder(final FieldMatrixChangingVisitor<T> visitor,
-                                  final int startRow, final int endRow,
-                                  final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0     = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd   = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                final int jWidth = blockWidth(jBlock);
-                final int q0     = jBlock * BLOCK_SIZE;
-                final int qStart = FastMath.max(startColumn, q0);
-                final int qEnd   = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                final T[] block = blocks[iBlock * blockColumns + jBlock];
-                for (int p = pStart; p < pEnd; ++p) {
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor<T> visitor,
-                                  final int startRow, final int endRow,
-                                  final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0     = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd   = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                final int jWidth = blockWidth(jBlock);
-                final int q0     = jBlock * BLOCK_SIZE;
-                final int qStart = FastMath.max(startColumn, q0);
-                final int qEnd   = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                final T[] block = blocks[iBlock * blockColumns + jBlock];
-                for (int p = pStart; p < pEnd; ++p) {
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-            }
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Get the height of a block.
-     * @param blockRow row index (in block sense) of the block
-     * @return height (number of rows) of the block
-     */
-    private int blockHeight(final int blockRow) {
-        return (blockRow == blockRows - 1) ? rows - blockRow * BLOCK_SIZE : BLOCK_SIZE;
-    }
-
-    /**
-     * Get the width of a block.
-     * @param blockColumn column index (in block sense) of the block
-     * @return width (number of columns) of the block
-     */
-    private int blockWidth(final int blockColumn) {
-        return (blockColumn == blockColumns - 1) ? columns - blockColumn * BLOCK_SIZE : BLOCK_SIZE;
-    }
-}


[27/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java
deleted file mode 100644
index e5e7be4..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/HarmonicCurveFitter.java
+++ /dev/null
@@ -1,445 +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.fitting;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Fits points to a {@link
- * org.apache.commons.math3.analysis.function.HarmonicOscillator.Parametric harmonic oscillator}
- * function.
- * <br/>
- * The {@link #withStartPoint(double[]) initial guess values} must be passed
- * in the following order:
- * <ul>
- *  <li>Amplitude</li>
- *  <li>Angular frequency</li>
- *  <li>phase</li>
- * </ul>
- * The optimal values will be returned in the same order.
- *
- * @since 3.3
- */
-public class HarmonicCurveFitter extends AbstractCurveFitter {
-    /** Parametric function to be fitted. */
-    private static final HarmonicOscillator.Parametric FUNCTION = new HarmonicOscillator.Parametric();
-    /** Initial guess. */
-    private final double[] initialGuess;
-    /** Maximum number of iterations of the optimization algorithm. */
-    private final int maxIter;
-
-    /**
-     * Contructor used by the factory methods.
-     *
-     * @param initialGuess Initial guess. If set to {@code null}, the initial guess
-     * will be estimated using the {@link ParameterGuesser}.
-     * @param maxIter Maximum number of iterations of the optimization algorithm.
-     */
-    private HarmonicCurveFitter(double[] initialGuess,
-                                int maxIter) {
-        this.initialGuess = initialGuess;
-        this.maxIter = maxIter;
-    }
-
-    /**
-     * Creates a default curve fitter.
-     * The initial guess for the parameters will be {@link ParameterGuesser}
-     * computed automatically, and the maximum number of iterations of the
-     * optimization algorithm is set to {@link Integer#MAX_VALUE}.
-     *
-     * @return a curve fitter.
-     *
-     * @see #withStartPoint(double[])
-     * @see #withMaxIterations(int)
-     */
-    public static HarmonicCurveFitter create() {
-        return new HarmonicCurveFitter(null, Integer.MAX_VALUE);
-    }
-
-    /**
-     * Configure the start point (initial guess).
-     * @param newStart new start point (initial guess)
-     * @return a new instance.
-     */
-    public HarmonicCurveFitter withStartPoint(double[] newStart) {
-        return new HarmonicCurveFitter(newStart.clone(),
-                                       maxIter);
-    }
-
-    /**
-     * Configure the maximum number of iterations.
-     * @param newMaxIter maximum number of iterations
-     * @return a new instance.
-     */
-    public HarmonicCurveFitter withMaxIterations(int newMaxIter) {
-        return new HarmonicCurveFitter(initialGuess,
-                                       newMaxIter);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations) {
-        // Prepare least-squares problem.
-        final int len = observations.size();
-        final double[] target  = new double[len];
-        final double[] weights = new double[len];
-
-        int i = 0;
-        for (WeightedObservedPoint obs : observations) {
-            target[i]  = obs.getY();
-            weights[i] = obs.getWeight();
-            ++i;
-        }
-
-        final AbstractCurveFitter.TheoreticalValuesFunction model
-            = new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION,
-                                                                observations);
-
-        final double[] startPoint = initialGuess != null ?
-            initialGuess :
-            // Compute estimation.
-            new ParameterGuesser(observations).guess();
-
-        // Return a new optimizer set up to fit a Gaussian curve to the
-        // observed points.
-        return new LeastSquaresBuilder().
-                maxEvaluations(Integer.MAX_VALUE).
-                maxIterations(maxIter).
-                start(startPoint).
-                target(target).
-                weight(new DiagonalMatrix(weights)).
-                model(model.getModelFunction(), model.getModelFunctionJacobian()).
-                build();
-
-    }
-
-    /**
-     * This class guesses harmonic coefficients from a sample.
-     * <p>The algorithm used to guess the coefficients is as follows:</p>
-     *
-     * <p>We know \( f(t) \) at some sampling points \( t_i \) and want
-     * to find \( a \), \( \omega \) and \( \phi \) such that
-     * \( f(t) = a \cos (\omega t + \phi) \).
-     * </p>
-     *
-     * <p>From the analytical expression, we can compute two primitives :
-     * \[
-     *     If2(t) = \int f^2 dt  = a^2 (t + S(t)) / 2
-     * \]
-     * \[
-     *     If'2(t) = \int f'^2 dt = a^2 \omega^2 (t - S(t)) / 2
-     * \]
-     * where \(S(t) = \frac{\sin(2 (\omega t + \phi))}{2\omega}\)
-     * </p>
-     *
-     * <p>We can remove \(S\) between these expressions :
-     * \[
-     *     If'2(t) = a^2 \omega^2 t - \omega^2 If2(t)
-     * \]
-     * </p>
-     *
-     * <p>The preceding expression shows that \(If'2 (t)\) is a linear
-     * combination of both \(t\) and \(If2(t)\):
-     * \[
-     *   If'2(t) = A t + B If2(t)
-     * \]
-     * </p>
-     *
-     * <p>From the primitive, we can deduce the same form for definite
-     * integrals between \(t_1\) and \(t_i\) for each \(t_i\) :
-     * \[
-     *   If2(t_i) - If2(t_1) = A (t_i - t_1) + B (If2 (t_i) - If2(t_1))
-     * \]
-     * </p>
-     *
-     * <p>We can find the coefficients \(A\) and \(B\) that best fit the sample
-     * to this linear expression by computing the definite integrals for
-     * each sample points.
-     * </p>
-     *
-     * <p>For a bilinear expression \(z(x_i, y_i) = A x_i + B y_i\), the
-     * coefficients \(A\) and \(B\) that minimize a least-squares criterion
-     * \(\sum (z_i - z(x_i, y_i))^2\) are given by these expressions:</p>
-     * \[
-     *   A = \frac{\sum y_i y_i \sum x_i z_i - \sum x_i y_i \sum y_i z_i}
-     *            {\sum x_i x_i \sum y_i y_i - \sum x_i y_i \sum x_i y_i}
-     * \]
-     * \[
-     *   B = \frac{\sum x_i x_i \sum y_i z_i - \sum x_i y_i \sum x_i z_i}
-     *            {\sum x_i x_i \sum y_i y_i - \sum x_i y_i \sum x_i y_i}
-     *
-     * \]
-     *
-     * <p>In fact, we can assume that both \(a\) and \(\omega\) are positive and
-     * compute them directly, knowing that \(A = a^2 \omega^2\) and that
-     * \(B = -\omega^2\). The complete algorithm is therefore:</p>
-     *
-     * For each \(t_i\) from \(t_1\) to \(t_{n-1}\), compute:
-     * \[ f(t_i) \]
-     * \[ f'(t_i) = \frac{f (t_{i+1}) - f(t_{i-1})}{t_{i+1} - t_{i-1}} \]
-     * \[ x_i = t_i  - t_1 \]
-     * \[ y_i = \int_{t_1}^{t_i} f^2(t) dt \]
-     * \[ z_i = \int_{t_1}^{t_i} f'^2(t) dt \]
-     * and update the sums:
-     * \[ \sum x_i x_i, \sum y_i y_i, \sum x_i y_i, \sum x_i z_i, \sum y_i z_i \]
-     *
-     * Then:
-     * \[
-     *  a = \sqrt{\frac{\sum y_i y_i  \sum x_i z_i - \sum x_i y_i \sum y_i z_i }
-     *                 {\sum x_i y_i  \sum x_i z_i - \sum x_i x_i \sum y_i z_i }}
-     * \]
-     * \[
-     *  \omega = \sqrt{\frac{\sum x_i y_i \sum x_i z_i - \sum x_i x_i \sum y_i z_i}
-     *                      {\sum x_i x_i \sum y_i y_i - \sum x_i y_i \sum x_i y_i}}
-     * \]
-     *
-     * <p>Once we know \(\omega\) we can compute:
-     * \[
-     *    fc = \omega f(t) \cos(\omega t) - f'(t) \sin(\omega t)
-     * \]
-     * \[
-     *    fs = \omega f(t) \sin(\omega t) + f'(t) \cos(\omega t)
-     * \]
-     * </p>
-     *
-     * <p>It appears that \(fc = a \omega \cos(\phi)\) and
-     * \(fs = -a \omega \sin(\phi)\), so we can use these
-     * expressions to compute \(\phi\). The best estimate over the sample is
-     * given by averaging these expressions.
-     * </p>
-     *
-     * <p>Since integrals and means are involved in the preceding
-     * estimations, these operations run in \(O(n)\) time, where \(n\) is the
-     * number of measurements.</p>
-     */
-    public static class ParameterGuesser {
-        /** Amplitude. */
-        private final double a;
-        /** Angular frequency. */
-        private final double omega;
-        /** Phase. */
-        private final double phi;
-
-        /**
-         * Simple constructor.
-         *
-         * @param observations Sampled observations.
-         * @throws NumberIsTooSmallException if the sample is too short.
-         * @throws ZeroException if the abscissa range is zero.
-         * @throws MathIllegalStateException when the guessing procedure cannot
-         * produce sensible results.
-         */
-        public ParameterGuesser(Collection<WeightedObservedPoint> observations) {
-            if (observations.size() < 4) {
-                throw new NumberIsTooSmallException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE,
-                                                    observations.size(), 4, true);
-            }
-
-            final WeightedObservedPoint[] sorted
-                = sortObservations(observations).toArray(new WeightedObservedPoint[0]);
-
-            final double aOmega[] = guessAOmega(sorted);
-            a = aOmega[0];
-            omega = aOmega[1];
-
-            phi = guessPhi(sorted);
-        }
-
-        /**
-         * Gets an estimation of the parameters.
-         *
-         * @return the guessed parameters, in the following order:
-         * <ul>
-         *  <li>Amplitude</li>
-         *  <li>Angular frequency</li>
-         *  <li>Phase</li>
-         * </ul>
-         */
-        public double[] guess() {
-            return new double[] { a, omega, phi };
-        }
-
-        /**
-         * Sort the observations with respect to the abscissa.
-         *
-         * @param unsorted Input observations.
-         * @return the input observations, sorted.
-         */
-        private List<WeightedObservedPoint> sortObservations(Collection<WeightedObservedPoint> unsorted) {
-            final List<WeightedObservedPoint> observations = new ArrayList<WeightedObservedPoint>(unsorted);
-
-            // Since the samples are almost always already sorted, this
-            // method is implemented as an insertion sort that reorders the
-            // elements in place. Insertion sort is very efficient in this case.
-            WeightedObservedPoint curr = observations.get(0);
-            final int len = observations.size();
-            for (int j = 1; j < len; j++) {
-                WeightedObservedPoint prec = curr;
-                curr = observations.get(j);
-                if (curr.getX() < prec.getX()) {
-                    // the current element should be inserted closer to the beginning
-                    int i = j - 1;
-                    WeightedObservedPoint mI = observations.get(i);
-                    while ((i >= 0) && (curr.getX() < mI.getX())) {
-                        observations.set(i + 1, mI);
-                        if (i-- != 0) {
-                            mI = observations.get(i);
-                        }
-                    }
-                    observations.set(i + 1, curr);
-                    curr = observations.get(j);
-                }
-            }
-
-            return observations;
-        }
-
-        /**
-         * Estimate a first guess of the amplitude and angular frequency.
-         *
-         * @param observations Observations, sorted w.r.t. abscissa.
-         * @throws ZeroException if the abscissa range is zero.
-         * @throws MathIllegalStateException when the guessing procedure cannot
-         * produce sensible results.
-         * @return the guessed amplitude (at index 0) and circular frequency
-         * (at index 1).
-         */
-        private double[] guessAOmega(WeightedObservedPoint[] observations) {
-            final double[] aOmega = new double[2];
-
-            // initialize the sums for the linear model between the two integrals
-            double sx2 = 0;
-            double sy2 = 0;
-            double sxy = 0;
-            double sxz = 0;
-            double syz = 0;
-
-            double currentX = observations[0].getX();
-            double currentY = observations[0].getY();
-            double f2Integral = 0;
-            double fPrime2Integral = 0;
-            final double startX = currentX;
-            for (int i = 1; i < observations.length; ++i) {
-                // one step forward
-                final double previousX = currentX;
-                final double previousY = currentY;
-                currentX = observations[i].getX();
-                currentY = observations[i].getY();
-
-                // update the integrals of f<sup>2</sup> and f'<sup>2</sup>
-                // considering a linear model for f (and therefore constant f')
-                final double dx = currentX - previousX;
-                final double dy = currentY - previousY;
-                final double f2StepIntegral =
-                    dx * (previousY * previousY + previousY * currentY + currentY * currentY) / 3;
-                final double fPrime2StepIntegral = dy * dy / dx;
-
-                final double x = currentX - startX;
-                f2Integral += f2StepIntegral;
-                fPrime2Integral += fPrime2StepIntegral;
-
-                sx2 += x * x;
-                sy2 += f2Integral * f2Integral;
-                sxy += x * f2Integral;
-                sxz += x * fPrime2Integral;
-                syz += f2Integral * fPrime2Integral;
-            }
-
-            // compute the amplitude and pulsation coefficients
-            double c1 = sy2 * sxz - sxy * syz;
-            double c2 = sxy * sxz - sx2 * syz;
-            double c3 = sx2 * sy2 - sxy * sxy;
-            if ((c1 / c2 < 0) || (c2 / c3 < 0)) {
-                final int last = observations.length - 1;
-                // Range of the observations, assuming that the
-                // observations are sorted.
-                final double xRange = observations[last].getX() - observations[0].getX();
-                if (xRange == 0) {
-                    throw new ZeroException();
-                }
-                aOmega[1] = 2 * Math.PI / xRange;
-
-                double yMin = Double.POSITIVE_INFINITY;
-                double yMax = Double.NEGATIVE_INFINITY;
-                for (int i = 1; i < observations.length; ++i) {
-                    final double y = observations[i].getY();
-                    if (y < yMin) {
-                        yMin = y;
-                    }
-                    if (y > yMax) {
-                        yMax = y;
-                    }
-                }
-                aOmega[0] = 0.5 * (yMax - yMin);
-            } else {
-                if (c2 == 0) {
-                    // In some ill-conditioned cases (cf. MATH-844), the guesser
-                    // procedure cannot produce sensible results.
-                    throw new MathIllegalStateException(LocalizedFormats.ZERO_DENOMINATOR);
-                }
-
-                aOmega[0] = FastMath.sqrt(c1 / c2);
-                aOmega[1] = FastMath.sqrt(c2 / c3);
-            }
-
-            return aOmega;
-        }
-
-        /**
-         * Estimate a first guess of the phase.
-         *
-         * @param observations Observations, sorted w.r.t. abscissa.
-         * @return the guessed phase.
-         */
-        private double guessPhi(WeightedObservedPoint[] observations) {
-            // initialize the means
-            double fcMean = 0;
-            double fsMean = 0;
-
-            double currentX = observations[0].getX();
-            double currentY = observations[0].getY();
-            for (int i = 1; i < observations.length; ++i) {
-                // one step forward
-                final double previousX = currentX;
-                final double previousY = currentY;
-                currentX = observations[i].getX();
-                currentY = observations[i].getY();
-                final double currentYPrime = (currentY - previousY) / (currentX - previousX);
-
-                double omegaX = omega * currentX;
-                double cosine = FastMath.cos(omegaX);
-                double sine = FastMath.sin(omegaX);
-                fcMean += omega * currentY * cosine - currentYPrime * sine;
-                fsMean += omega * currentY * sine + currentYPrime * cosine;
-            }
-
-            return FastMath.atan2(-fsMean, fcMean);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/HarmonicFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/HarmonicFitter.java b/src/main/java/org/apache/commons/math3/fitting/HarmonicFitter.java
deleted file mode 100644
index 24952a6..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/HarmonicFitter.java
+++ /dev/null
@@ -1,384 +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.fitting;
-
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Class that implements a curve fitting specialized for sinusoids.
- *
- * Harmonic fitting is a very simple case of curve fitting. The
- * estimated coefficients are the amplitude a, the pulsation &omega; and
- * the phase &phi;: <code>f (t) = a cos (&omega; t + &phi;)</code>. They are
- * searched by a least square estimator initialized with a rough guess
- * based on integrals.
- *
- * @since 2.0
- * @deprecated As of 3.3. Please use {@link HarmonicCurveFitter} and
- * {@link WeightedObservedPoints} instead.
- */
-@Deprecated
-public class HarmonicFitter extends CurveFitter<HarmonicOscillator.Parametric> {
-    /**
-     * Simple constructor.
-     * @param optimizer Optimizer to use for the fitting.
-     */
-    public HarmonicFitter(final MultivariateVectorOptimizer optimizer) {
-        super(optimizer);
-    }
-
-    /**
-     * Fit an harmonic function to the observed points.
-     *
-     * @param initialGuess First guess values in the following order:
-     * <ul>
-     *  <li>Amplitude</li>
-     *  <li>Angular frequency</li>
-     *  <li>Phase</li>
-     * </ul>
-     * @return the parameters of the harmonic function that best fits the
-     * observed points (in the same order as above).
-     */
-    public double[] fit(double[] initialGuess) {
-        return fit(new HarmonicOscillator.Parametric(), initialGuess);
-    }
-
-    /**
-     * Fit an harmonic function to the observed points.
-     * An initial guess will be automatically computed.
-     *
-     * @return the parameters of the harmonic function that best fits the
-     * observed points (see the other {@link #fit(double[]) fit} method.
-     * @throws NumberIsTooSmallException if the sample is too short for the
-     * the first guess to be computed.
-     * @throws ZeroException if the first guess cannot be computed because
-     * the abscissa range is zero.
-     */
-    public double[] fit() {
-        return fit((new ParameterGuesser(getObservations())).guess());
-    }
-
-    /**
-     * This class guesses harmonic coefficients from a sample.
-     * <p>The algorithm used to guess the coefficients is as follows:</p>
-     *
-     * <p>We know f (t) at some sampling points t<sub>i</sub> and want to find a,
-     * &omega; and &phi; such that f (t) = a cos (&omega; t + &phi;).
-     * </p>
-     *
-     * <p>From the analytical expression, we can compute two primitives :
-     * <pre>
-     *     If2  (t) = &int; f<sup>2</sup>  = a<sup>2</sup> &times; [t + S (t)] / 2
-     *     If'2 (t) = &int; f'<sup>2</sup> = a<sup>2</sup> &omega;<sup>2</sup> &times; [t - S (t)] / 2
-     *     where S (t) = sin (2 (&omega; t + &phi;)) / (2 &omega;)
-     * </pre>
-     * </p>
-     *
-     * <p>We can remove S between these expressions :
-     * <pre>
-     *     If'2 (t) = a<sup>2</sup> &omega;<sup>2</sup> t - &omega;<sup>2</sup> If2 (t)
-     * </pre>
-     * </p>
-     *
-     * <p>The preceding expression shows that If'2 (t) is a linear
-     * combination of both t and If2 (t): If'2 (t) = A &times; t + B &times; If2 (t)
-     * </p>
-     *
-     * <p>From the primitive, we can deduce the same form for definite
-     * integrals between t<sub>1</sub> and t<sub>i</sub> for each t<sub>i</sub> :
-     * <pre>
-     *   If2 (t<sub>i</sub>) - If2 (t<sub>1</sub>) = A &times; (t<sub>i</sub> - t<sub>1</sub>) + B &times; (If2 (t<sub>i</sub>) - If2 (t<sub>1</sub>))
-     * </pre>
-     * </p>
-     *
-     * <p>We can find the coefficients A and B that best fit the sample
-     * to this linear expression by computing the definite integrals for
-     * each sample points.
-     * </p>
-     *
-     * <p>For a bilinear expression z (x<sub>i</sub>, y<sub>i</sub>) = A &times; x<sub>i</sub> + B &times; y<sub>i</sub>, the
-     * coefficients A and B that minimize a least square criterion
-     * &sum; (z<sub>i</sub> - z (x<sub>i</sub>, y<sub>i</sub>))<sup>2</sup> are given by these expressions:</p>
-     * <pre>
-     *
-     *         &sum;y<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>z<sub>i</sub> - &sum;x<sub>i</sub>y<sub>i</sub> &sum;y<sub>i</sub>z<sub>i</sub>
-     *     A = ------------------------
-     *         &sum;x<sub>i</sub>x<sub>i</sub> &sum;y<sub>i</sub>y<sub>i</sub> - &sum;x<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>y<sub>i</sub>
-     *
-     *         &sum;x<sub>i</sub>x<sub>i</sub> &sum;y<sub>i</sub>z<sub>i</sub> - &sum;x<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>z<sub>i</sub>
-     *     B = ------------------------
-     *         &sum;x<sub>i</sub>x<sub>i</sub> &sum;y<sub>i</sub>y<sub>i</sub> - &sum;x<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>y<sub>i</sub>
-     * </pre>
-     * </p>
-     *
-     *
-     * <p>In fact, we can assume both a and &omega; are positive and
-     * compute them directly, knowing that A = a<sup>2</sup> &omega;<sup>2</sup> and that
-     * B = - &omega;<sup>2</sup>. The complete algorithm is therefore:</p>
-     * <pre>
-     *
-     * for each t<sub>i</sub> from t<sub>1</sub> to t<sub>n-1</sub>, compute:
-     *   f  (t<sub>i</sub>)
-     *   f' (t<sub>i</sub>) = (f (t<sub>i+1</sub>) - f(t<sub>i-1</sub>)) / (t<sub>i+1</sub> - t<sub>i-1</sub>)
-     *   x<sub>i</sub> = t<sub>i</sub> - t<sub>1</sub>
-     *   y<sub>i</sub> = &int; f<sup>2</sup> from t<sub>1</sub> to t<sub>i</sub>
-     *   z<sub>i</sub> = &int; f'<sup>2</sup> from t<sub>1</sub> to t<sub>i</sub>
-     *   update the sums &sum;x<sub>i</sub>x<sub>i</sub>, &sum;y<sub>i</sub>y<sub>i</sub>, &sum;x<sub>i</sub>y<sub>i</sub>, &sum;x<sub>i</sub>z<sub>i</sub> and &sum;y<sub>i</sub>z<sub>i</sub>
-     * end for
-     *
-     *            |--------------------------
-     *         \  | &sum;y<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>z<sub>i</sub> - &sum;x<sub>i</sub>y<sub>i</sub> &sum;y<sub>i</sub>z<sub>i</sub>
-     * a     =  \ | ------------------------
-     *           \| &sum;x<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>z<sub>i</sub> - &sum;x<sub>i</sub>x<sub>i</sub> &sum;y<sub>i</sub>z<sub>i</sub>
-     *
-     *
-     *            |--------------------------
-     *         \  | &sum;x<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>z<sub>i</sub> - &sum;x<sub>i</sub>x<sub>i</sub> &sum;y<sub>i</sub>z<sub>i</sub>
-     * &omega;     =  \ | ------------------------
-     *           \| &sum;x<sub>i</sub>x<sub>i</sub> &sum;y<sub>i</sub>y<sub>i</sub> - &sum;x<sub>i</sub>y<sub>i</sub> &sum;x<sub>i</sub>y<sub>i</sub>
-     *
-     * </pre>
-     * </p>
-     *
-     * <p>Once we know &omega;, we can compute:
-     * <pre>
-     *    fc = &omega; f (t) cos (&omega; t) - f' (t) sin (&omega; t)
-     *    fs = &omega; f (t) sin (&omega; t) + f' (t) cos (&omega; t)
-     * </pre>
-     * </p>
-     *
-     * <p>It appears that <code>fc = a &omega; cos (&phi;)</code> and
-     * <code>fs = -a &omega; sin (&phi;)</code>, so we can use these
-     * expressions to compute &phi;. The best estimate over the sample is
-     * given by averaging these expressions.
-     * </p>
-     *
-     * <p>Since integrals and means are involved in the preceding
-     * estimations, these operations run in O(n) time, where n is the
-     * number of measurements.</p>
-     */
-    public static class ParameterGuesser {
-        /** Amplitude. */
-        private final double a;
-        /** Angular frequency. */
-        private final double omega;
-        /** Phase. */
-        private final double phi;
-
-        /**
-         * Simple constructor.
-         *
-         * @param observations Sampled observations.
-         * @throws NumberIsTooSmallException if the sample is too short.
-         * @throws ZeroException if the abscissa range is zero.
-         * @throws MathIllegalStateException when the guessing procedure cannot
-         * produce sensible results.
-         */
-        public ParameterGuesser(WeightedObservedPoint[] observations) {
-            if (observations.length < 4) {
-                throw new NumberIsTooSmallException(LocalizedFormats.INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE,
-                                                    observations.length, 4, true);
-            }
-
-            final WeightedObservedPoint[] sorted = sortObservations(observations);
-
-            final double aOmega[] = guessAOmega(sorted);
-            a = aOmega[0];
-            omega = aOmega[1];
-
-            phi = guessPhi(sorted);
-        }
-
-        /**
-         * Gets an estimation of the parameters.
-         *
-         * @return the guessed parameters, in the following order:
-         * <ul>
-         *  <li>Amplitude</li>
-         *  <li>Angular frequency</li>
-         *  <li>Phase</li>
-         * </ul>
-         */
-        public double[] guess() {
-            return new double[] { a, omega, phi };
-        }
-
-        /**
-         * Sort the observations with respect to the abscissa.
-         *
-         * @param unsorted Input observations.
-         * @return the input observations, sorted.
-         */
-        private WeightedObservedPoint[] sortObservations(WeightedObservedPoint[] unsorted) {
-            final WeightedObservedPoint[] observations = unsorted.clone();
-
-            // Since the samples are almost always already sorted, this
-            // method is implemented as an insertion sort that reorders the
-            // elements in place. Insertion sort is very efficient in this case.
-            WeightedObservedPoint curr = observations[0];
-            for (int j = 1; j < observations.length; ++j) {
-                WeightedObservedPoint prec = curr;
-                curr = observations[j];
-                if (curr.getX() < prec.getX()) {
-                    // the current element should be inserted closer to the beginning
-                    int i = j - 1;
-                    WeightedObservedPoint mI = observations[i];
-                    while ((i >= 0) && (curr.getX() < mI.getX())) {
-                        observations[i + 1] = mI;
-                        if (i-- != 0) {
-                            mI = observations[i];
-                        }
-                    }
-                    observations[i + 1] = curr;
-                    curr = observations[j];
-                }
-            }
-
-            return observations;
-        }
-
-        /**
-         * Estimate a first guess of the amplitude and angular frequency.
-         * This method assumes that the {@link #sortObservations(WeightedObservedPoint[])} method
-         * has been called previously.
-         *
-         * @param observations Observations, sorted w.r.t. abscissa.
-         * @throws ZeroException if the abscissa range is zero.
-         * @throws MathIllegalStateException when the guessing procedure cannot
-         * produce sensible results.
-         * @return the guessed amplitude (at index 0) and circular frequency
-         * (at index 1).
-         */
-        private double[] guessAOmega(WeightedObservedPoint[] observations) {
-            final double[] aOmega = new double[2];
-
-            // initialize the sums for the linear model between the two integrals
-            double sx2 = 0;
-            double sy2 = 0;
-            double sxy = 0;
-            double sxz = 0;
-            double syz = 0;
-
-            double currentX = observations[0].getX();
-            double currentY = observations[0].getY();
-            double f2Integral = 0;
-            double fPrime2Integral = 0;
-            final double startX = currentX;
-            for (int i = 1; i < observations.length; ++i) {
-                // one step forward
-                final double previousX = currentX;
-                final double previousY = currentY;
-                currentX = observations[i].getX();
-                currentY = observations[i].getY();
-
-                // update the integrals of f<sup>2</sup> and f'<sup>2</sup>
-                // considering a linear model for f (and therefore constant f')
-                final double dx = currentX - previousX;
-                final double dy = currentY - previousY;
-                final double f2StepIntegral =
-                    dx * (previousY * previousY + previousY * currentY + currentY * currentY) / 3;
-                final double fPrime2StepIntegral = dy * dy / dx;
-
-                final double x = currentX - startX;
-                f2Integral += f2StepIntegral;
-                fPrime2Integral += fPrime2StepIntegral;
-
-                sx2 += x * x;
-                sy2 += f2Integral * f2Integral;
-                sxy += x * f2Integral;
-                sxz += x * fPrime2Integral;
-                syz += f2Integral * fPrime2Integral;
-            }
-
-            // compute the amplitude and pulsation coefficients
-            double c1 = sy2 * sxz - sxy * syz;
-            double c2 = sxy * sxz - sx2 * syz;
-            double c3 = sx2 * sy2 - sxy * sxy;
-            if ((c1 / c2 < 0) || (c2 / c3 < 0)) {
-                final int last = observations.length - 1;
-                // Range of the observations, assuming that the
-                // observations are sorted.
-                final double xRange = observations[last].getX() - observations[0].getX();
-                if (xRange == 0) {
-                    throw new ZeroException();
-                }
-                aOmega[1] = 2 * Math.PI / xRange;
-
-                double yMin = Double.POSITIVE_INFINITY;
-                double yMax = Double.NEGATIVE_INFINITY;
-                for (int i = 1; i < observations.length; ++i) {
-                    final double y = observations[i].getY();
-                    if (y < yMin) {
-                        yMin = y;
-                    }
-                    if (y > yMax) {
-                        yMax = y;
-                    }
-                }
-                aOmega[0] = 0.5 * (yMax - yMin);
-            } else {
-                if (c2 == 0) {
-                    // In some ill-conditioned cases (cf. MATH-844), the guesser
-                    // procedure cannot produce sensible results.
-                    throw new MathIllegalStateException(LocalizedFormats.ZERO_DENOMINATOR);
-                }
-
-                aOmega[0] = FastMath.sqrt(c1 / c2);
-                aOmega[1] = FastMath.sqrt(c2 / c3);
-            }
-
-            return aOmega;
-        }
-
-        /**
-         * Estimate a first guess of the phase.
-         *
-         * @param observations Observations, sorted w.r.t. abscissa.
-         * @return the guessed phase.
-         */
-        private double guessPhi(WeightedObservedPoint[] observations) {
-            // initialize the means
-            double fcMean = 0;
-            double fsMean = 0;
-
-            double currentX = observations[0].getX();
-            double currentY = observations[0].getY();
-            for (int i = 1; i < observations.length; ++i) {
-                // one step forward
-                final double previousX = currentX;
-                final double previousY = currentY;
-                currentX = observations[i].getX();
-                currentY = observations[i].getY();
-                final double currentYPrime = (currentY - previousY) / (currentX - previousX);
-
-                double omegaX = omega * currentX;
-                double cosine = FastMath.cos(omegaX);
-                double sine = FastMath.sin(omegaX);
-                fcMean += omega * currentY * cosine - currentYPrime * sine;
-                fsMean += omega * currentY * sine + currentYPrime * cosine;
-            }
-
-            return FastMath.atan2(-fsMean, fcMean);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java
deleted file mode 100644
index 9a6f3a9..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/PolynomialCurveFitter.java
+++ /dev/null
@@ -1,131 +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.fitting;
-
-import java.util.Collection;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-
-/**
- * Fits points to a {@link
- * org.apache.commons.math3.analysis.polynomials.PolynomialFunction.Parametric polynomial}
- * function.
- * <br/>
- * The size of the {@link #withStartPoint(double[]) initial guess} array defines the
- * degree of the polynomial to be fitted.
- * They must be sorted in increasing order of the polynomial's degree.
- * The optimal values of the coefficients will be returned in the same order.
- *
- * @since 3.3
- */
-public class PolynomialCurveFitter extends AbstractCurveFitter {
-    /** Parametric function to be fitted. */
-    private static final PolynomialFunction.Parametric FUNCTION = new PolynomialFunction.Parametric();
-    /** Initial guess. */
-    private final double[] initialGuess;
-    /** Maximum number of iterations of the optimization algorithm. */
-    private final int maxIter;
-
-    /**
-     * Contructor used by the factory methods.
-     *
-     * @param initialGuess Initial guess.
-     * @param maxIter Maximum number of iterations of the optimization algorithm.
-     * @throws MathInternalError if {@code initialGuess} is {@code null}.
-     */
-    private PolynomialCurveFitter(double[] initialGuess,
-                                  int maxIter) {
-        this.initialGuess = initialGuess;
-        this.maxIter = maxIter;
-    }
-
-    /**
-     * Creates a default curve fitter.
-     * Zero will be used as initial guess for the coefficients, and the maximum
-     * number of iterations of the optimization algorithm is set to
-     * {@link Integer#MAX_VALUE}.
-     *
-     * @param degree Degree of the polynomial to be fitted.
-     * @return a curve fitter.
-     *
-     * @see #withStartPoint(double[])
-     * @see #withMaxIterations(int)
-     */
-    public static PolynomialCurveFitter create(int degree) {
-        return new PolynomialCurveFitter(new double[degree + 1], Integer.MAX_VALUE);
-    }
-
-    /**
-     * Configure the start point (initial guess).
-     * @param newStart new start point (initial guess)
-     * @return a new instance.
-     */
-    public PolynomialCurveFitter withStartPoint(double[] newStart) {
-        return new PolynomialCurveFitter(newStart.clone(),
-                                         maxIter);
-    }
-
-    /**
-     * Configure the maximum number of iterations.
-     * @param newMaxIter maximum number of iterations
-     * @return a new instance.
-     */
-    public PolynomialCurveFitter withMaxIterations(int newMaxIter) {
-        return new PolynomialCurveFitter(initialGuess,
-                                         newMaxIter);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations) {
-        // Prepare least-squares problem.
-        final int len = observations.size();
-        final double[] target  = new double[len];
-        final double[] weights = new double[len];
-
-        int i = 0;
-        for (WeightedObservedPoint obs : observations) {
-            target[i]  = obs.getY();
-            weights[i] = obs.getWeight();
-            ++i;
-        }
-
-        final AbstractCurveFitter.TheoreticalValuesFunction model =
-                new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION, observations);
-
-        if (initialGuess == null) {
-            throw new MathInternalError();
-        }
-
-        // Return a new least squares problem set up to fit a polynomial curve to the
-        // observed points.
-        return new LeastSquaresBuilder().
-                maxEvaluations(Integer.MAX_VALUE).
-                maxIterations(maxIter).
-                start(initialGuess).
-                target(target).
-                weight(new DiagonalMatrix(weights)).
-                model(model.getModelFunction(), model.getModelFunctionJacobian()).
-                build();
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/PolynomialFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/PolynomialFitter.java b/src/main/java/org/apache/commons/math3/fitting/PolynomialFitter.java
deleted file mode 100644
index ec242c1..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/PolynomialFitter.java
+++ /dev/null
@@ -1,72 +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.fitting;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-
-/**
- * Polynomial fitting is a very simple case of {@link CurveFitter curve fitting}.
- * The estimated coefficients are the polynomial coefficients (see the
- * {@link #fit(double[]) fit} method).
- *
- * @since 2.0
- * @deprecated As of 3.3. Please use {@link PolynomialCurveFitter} and
- * {@link WeightedObservedPoints} instead.
- */
-@Deprecated
-public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric> {
-    /**
-     * Simple constructor.
-     *
-     * @param optimizer Optimizer to use for the fitting.
-     */
-    public PolynomialFitter(MultivariateVectorOptimizer optimizer) {
-        super(optimizer);
-    }
-
-    /**
-     * Get the coefficients of the polynomial fitting the weighted data points.
-     * The degree of the fitting polynomial is {@code guess.length - 1}.
-     *
-     * @param guess First guess for the coefficients. They must be sorted in
-     * increasing order of the polynomial's degree.
-     * @param maxEval Maximum number of evaluations of the polynomial.
-     * @return the coefficients of the polynomial that best fits the observed points.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
-     * the number of evaluations exceeds {@code maxEval}.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
-     * if the algorithm failed to converge.
-     */
-    public double[] fit(int maxEval, double[] guess) {
-        return fit(maxEval, new PolynomialFunction.Parametric(), guess);
-    }
-
-    /**
-     * Get the coefficients of the polynomial fitting the weighted data points.
-     * The degree of the fitting polynomial is {@code guess.length - 1}.
-     *
-     * @param guess First guess for the coefficients. They must be sorted in
-     * increasing order of the polynomial's degree.
-     * @return the coefficients of the polynomial that best fits the observed points.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
-     * if the algorithm failed to converge.
-     */
-    public double[] fit(double[] guess) {
-        return fit(new PolynomialFunction.Parametric(), guess);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/SimpleCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/SimpleCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/SimpleCurveFitter.java
deleted file mode 100644
index 3f6b7d6..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/SimpleCurveFitter.java
+++ /dev/null
@@ -1,125 +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.fitting;
-
-import java.util.Collection;
-
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-
-/**
- * Fits points to a user-defined {@link ParametricUnivariateFunction function}.
- *
- * @since 3.4
- */
-public class SimpleCurveFitter extends AbstractCurveFitter {
-    /** Function to fit. */
-    private final ParametricUnivariateFunction function;
-    /** Initial guess for the parameters. */
-    private final double[] initialGuess;
-    /** Maximum number of iterations of the optimization algorithm. */
-    private final int maxIter;
-
-    /**
-     * Contructor used by the factory methods.
-     *
-     * @param function Function to fit.
-     * @param initialGuess Initial guess. Cannot be {@code null}. Its length must
-     * be consistent with the number of parameters of the {@code function} to fit.
-     * @param maxIter Maximum number of iterations of the optimization algorithm.
-     */
-    private SimpleCurveFitter(ParametricUnivariateFunction function,
-                              double[] initialGuess,
-                              int maxIter) {
-        this.function = function;
-        this.initialGuess = initialGuess;
-        this.maxIter = maxIter;
-    }
-
-    /**
-     * Creates a curve fitter.
-     * The maximum number of iterations of the optimization algorithm is set
-     * to {@link Integer#MAX_VALUE}.
-     *
-     * @param f Function to fit.
-     * @param start Initial guess for the parameters.  Cannot be {@code null}.
-     * Its length must be consistent with the number of parameters of the
-     * function to fit.
-     * @return a curve fitter.
-     *
-     * @see #withStartPoint(double[])
-     * @see #withMaxIterations(int)
-     */
-    public static SimpleCurveFitter create(ParametricUnivariateFunction f,
-                                           double[] start) {
-        return new SimpleCurveFitter(f, start, Integer.MAX_VALUE);
-    }
-
-    /**
-     * Configure the start point (initial guess).
-     * @param newStart new start point (initial guess)
-     * @return a new instance.
-     */
-    public SimpleCurveFitter withStartPoint(double[] newStart) {
-        return new SimpleCurveFitter(function,
-                                     newStart.clone(),
-                                     maxIter);
-    }
-
-    /**
-     * Configure the maximum number of iterations.
-     * @param newMaxIter maximum number of iterations
-     * @return a new instance.
-     */
-    public SimpleCurveFitter withMaxIterations(int newMaxIter) {
-        return new SimpleCurveFitter(function,
-                                     initialGuess,
-                                     newMaxIter);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations) {
-        // Prepare least-squares problem.
-        final int len = observations.size();
-        final double[] target  = new double[len];
-        final double[] weights = new double[len];
-
-        int count = 0;
-        for (WeightedObservedPoint obs : observations) {
-            target[count]  = obs.getY();
-            weights[count] = obs.getWeight();
-            ++count;
-        }
-
-        final AbstractCurveFitter.TheoreticalValuesFunction model
-            = new AbstractCurveFitter.TheoreticalValuesFunction(function,
-                                                                observations);
-
-        // Create an optimizer for fitting the curve to the observed points.
-        return new LeastSquaresBuilder().
-                maxEvaluations(Integer.MAX_VALUE).
-                maxIterations(maxIter).
-                start(initialGuess).
-                target(target).
-                weight(new DiagonalMatrix(weights)).
-                model(model.getModelFunction(), model.getModelFunctionJacobian()).
-                build();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoint.java b/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoint.java
deleted file mode 100644
index 00292c9..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoint.java
+++ /dev/null
@@ -1,78 +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.fitting;
-
-import java.io.Serializable;
-
-/**
- * This class is a simple container for weighted observed point in
- * {@link CurveFitter curve fitting}.
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 2.0
- */
-public class WeightedObservedPoint implements Serializable {
-    /** Serializable version id. */
-    private static final long serialVersionUID = 5306874947404636157L;
-    /** Weight of the measurement in the fitting process. */
-    private final double weight;
-    /** Abscissa of the point. */
-    private final double x;
-    /** Observed value of the function at x. */
-    private final double y;
-
-    /**
-     * Simple constructor.
-     *
-     * @param weight Weight of the measurement in the fitting process.
-     * @param x Abscissa of the measurement.
-     * @param y Ordinate of the measurement.
-     */
-    public WeightedObservedPoint(final double weight, final double x, final double y) {
-        this.weight = weight;
-        this.x      = x;
-        this.y      = y;
-    }
-
-    /**
-     * Gets the weight of the measurement in the fitting process.
-     *
-     * @return the weight of the measurement in the fitting process.
-     */
-    public double getWeight() {
-        return weight;
-    }
-
-    /**
-     * Gets the abscissa of the point.
-     *
-     * @return the abscissa of the point.
-     */
-    public double getX() {
-        return x;
-    }
-
-    /**
-     * Gets the observed value of the function at x.
-     *
-     * @return the observed value of the function at x.
-     */
-    public double getY() {
-        return y;
-    }
-
-}
-

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoints.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoints.java b/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoints.java
deleted file mode 100644
index 9eba337..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/WeightedObservedPoints.java
+++ /dev/null
@@ -1,112 +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.fitting;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.io.Serializable;
-
-/**
- * Simple container for weighted observed points used
- * in {@link AbstractCurveFitter curve fitting} algorithms.
- *
- * @since 3.3
- */
-public class WeightedObservedPoints implements Serializable {
-    /** Serializable version id. */
-    private static final long serialVersionUID = 20130813L;
-
-    /** Observed points. */
-    private final List<WeightedObservedPoint> observations
-        = new ArrayList<WeightedObservedPoint>();
-
-    /**
-     * Adds a point to the sample.
-     * Calling this method is equivalent to calling
-     * {@code add(1.0, x, y)}.
-     *
-     * @param x Abscissa of the point.
-     * @param y Observed value  at {@code x}. After fitting we should
-     * have {@code f(x)} as close as possible to this value.
-     *
-     * @see #add(double, double, double)
-     * @see #add(WeightedObservedPoint)
-     * @see #toList()
-     */
-    public void add(double x, double y) {
-        add(1d, x, y);
-    }
-
-    /**
-     * Adds a point to the sample.
-     *
-     * @param weight Weight of the observed point.
-     * @param x Abscissa of the point.
-     * @param y Observed value  at {@code x}. After fitting we should
-     * have {@code f(x)} as close as possible to this value.
-     *
-     * @see #add(double, double)
-     * @see #add(WeightedObservedPoint)
-     * @see #toList()
-     */
-    public void add(double weight, double x, double y) {
-        observations.add(new WeightedObservedPoint(weight, x, y));
-    }
-
-    /**
-     * Adds a point to the sample.
-     *
-     * @param observed Observed point to add.
-     *
-     * @see #add(double, double)
-     * @see #add(double, double, double)
-     * @see #toList()
-     */
-    public void add(WeightedObservedPoint observed) {
-        observations.add(observed);
-    }
-
-    /**
-     * Gets a <em>snapshot</em> of the observed points.
-     * The list of stored points is copied in order to ensure that
-     * modification of the returned instance does not affect this
-     * container.
-     * Conversely, further modification of this container (through
-     * the {@code add} or {@code clear} methods) will not affect the
-     * returned list.
-     *
-     * @return the observed points, in the order they were added to this
-     * container.
-     *
-     * @see #add(double, double)
-     * @see #add(double, double, double)
-     * @see #add(WeightedObservedPoint)
-     */
-    public List<WeightedObservedPoint> toList() {
-        // The copy is necessary to ensure thread-safety because of the
-        // "clear" method (which otherwise would be able to empty the
-        // list of points while it is being used by another thread).
-        return new ArrayList<WeightedObservedPoint>(observations);
-    }
-
-    /**
-     * Removes all observations from this container.
-     */
-    public void clear() {
-        observations.clear();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/AbstractEvaluation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/AbstractEvaluation.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/AbstractEvaluation.java
deleted file mode 100644
index b164380..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/AbstractEvaluation.java
+++ /dev/null
@@ -1,87 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.DecompositionSolver;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * An implementation of {@link Evaluation} that is designed for extension. All of the
- * methods implemented here use the methods that are left unimplemented.
- * <p/>
- * TODO cache results?
- *
- * @since 3.3
- */
-public abstract class AbstractEvaluation implements Evaluation {
-
-    /** number of observations */
-    private final int observationSize;
-
-    /**
-     * Constructor.
-     *
-     * @param observationSize the number of observation. Needed for {@link
-     *                        #getRMS()}.
-     */
-    AbstractEvaluation(final int observationSize) {
-        this.observationSize = observationSize;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getCovariances(double threshold) {
-        // Set up the Jacobian.
-        final RealMatrix j = this.getJacobian();
-
-        // Compute transpose(J)J.
-        final RealMatrix jTj = j.transpose().multiply(j);
-
-        // Compute the covariances matrix.
-        final DecompositionSolver solver
-                = new QRDecomposition(jTj, threshold).getSolver();
-        return solver.getInverse();
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getSigma(double covarianceSingularityThreshold) {
-        final RealMatrix cov = this.getCovariances(covarianceSingularityThreshold);
-        final int nC = cov.getColumnDimension();
-        final RealVector sig = new ArrayRealVector(nC);
-        for (int i = 0; i < nC; ++i) {
-            sig.setEntry(i, FastMath.sqrt(cov.getEntry(i,i)));
-        }
-        return sig;
-    }
-
-    /** {@inheritDoc} */
-    public double getRMS() {
-        final double cost = this.getCost();
-        return FastMath.sqrt(cost * cost / this.observationSize);
-    }
-
-    /** {@inheritDoc} */
-    public double getCost() {
-        final ArrayRealVector r = new ArrayRealVector(this.getResiduals());
-        return FastMath.sqrt(r.dotProduct(r));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java
deleted file mode 100644
index 89f5f1f..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/DenseWeightedEvaluation.java
+++ /dev/null
@@ -1,68 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-
-/**
- * Applies a dense weight matrix to an evaluation.
- *
- * @since 3.3
- */
-class DenseWeightedEvaluation extends AbstractEvaluation {
-
-    /** the unweighted evaluation */
-    private final Evaluation unweighted;
-    /** reference to the weight square root matrix */
-    private final RealMatrix weightSqrt;
-
-    /**
-     * Create a weighted evaluation from an unweighted one.
-     *
-     * @param unweighted the evalutation before weights are applied
-     * @param weightSqrt the matrix square root of the weight matrix
-     */
-    DenseWeightedEvaluation(final Evaluation unweighted,
-                            final RealMatrix weightSqrt) {
-        // weight square root is square, nR=nC=number of observations
-        super(weightSqrt.getColumnDimension());
-        this.unweighted = unweighted;
-        this.weightSqrt = weightSqrt;
-    }
-
-    /* apply weights */
-
-    /** {@inheritDoc} */
-    public RealMatrix getJacobian() {
-        return weightSqrt.multiply(this.unweighted.getJacobian());
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getResiduals() {
-        return this.weightSqrt.operate(this.unweighted.getResiduals());
-    }
-
-    /* delegate */
-
-    /** {@inheritDoc} */
-    public RealVector getPoint() {
-        return unweighted.getPoint();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/EvaluationRmsChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/EvaluationRmsChecker.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/EvaluationRmsChecker.java
deleted file mode 100644
index ceb5988..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/EvaluationRmsChecker.java
+++ /dev/null
@@ -1,75 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * Check if an optimization has converged based on the change in computed RMS.
- *
- * @since 3.4
- */
-public class EvaluationRmsChecker implements ConvergenceChecker<Evaluation> {
-
-    /** relative tolerance for comparisons. */
-    private final double relTol;
-    /** absolute tolerance for comparisons. */
-    private final double absTol;
-
-    /**
-     * Create a convergence checker for the RMS with the same relative and absolute
-     * tolerance.
-     *
-     * <p>Convenience constructor for when the relative and absolute tolerances are the
-     * same. Same as {@code new EvaluationRmsChecker(tol, tol)}.
-     *
-     * @param tol the relative and absolute tolerance.
-     * @see #EvaluationRmsChecker(double, double)
-     */
-    public EvaluationRmsChecker(final double tol) {
-        this(tol, tol);
-    }
-
-    /**
-     * Create a convergence checker for the RMS with a relative and absolute tolerance.
-     *
-     * <p>The optimization has converged when the RMS of consecutive evaluations are equal
-     * to within the given relative tolerance or absolute tolerance.
-     *
-     * @param relTol the relative tolerance.
-     * @param absTol the absolute tolerance.
-     * @see Precision#equals(double, double, double)
-     * @see Precision#equalsWithRelativeTolerance(double, double, double)
-     */
-    public EvaluationRmsChecker(final double relTol, final double absTol) {
-        this.relTol = relTol;
-        this.absTol = absTol;
-    }
-
-    /** {@inheritDoc} */
-    public boolean converged(final int iteration,
-                             final Evaluation previous,
-                             final Evaluation current) {
-        final double prevRms = previous.getRMS();
-        final double currRms = current.getRMS();
-        return Precision.equals(prevRms, currRms, this.absTol) ||
-                Precision.equalsWithRelativeTolerance(prevRms, currRms, this.relTol);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/GaussNewtonOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/GaussNewtonOptimizer.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/GaussNewtonOptimizer.java
deleted file mode 100644
index bc4503c..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/GaussNewtonOptimizer.java
+++ /dev/null
@@ -1,300 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.CholeskyDecomposition;
-import org.apache.commons.math3.linear.LUDecomposition;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.linear.SingularValueDecomposition;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Gauss-Newton least-squares solver.
- * <p> This class solve a least-square problem by
- * solving the normal equations of the linearized problem at each iteration. Either LU
- * decomposition or Cholesky decomposition can be used to solve the normal equations,
- * or QR decomposition or SVD decomposition can be used to solve the linear system. LU
- * decomposition is faster but QR decomposition is more robust for difficult problems,
- * and SVD can compute a solution for rank-deficient problems.
- * </p>
- *
- * @since 3.3
- */
-public class GaussNewtonOptimizer implements LeastSquaresOptimizer {
-
-    /** The decomposition algorithm to use to solve the normal equations. */
-    //TODO move to linear package and expand options?
-    public static enum Decomposition {
-        /**
-         * Solve by forming the normal equations (J<sup>T</sup>Jx=J<sup>T</sup>r) and
-         * using the {@link LUDecomposition}.
-         *
-         * <p> Theoretically this method takes mn<sup>2</sup>/2 operations to compute the
-         * normal matrix and n<sup>3</sup>/3 operations (m > n) to solve the system using
-         * the LU decomposition. </p>
-         */
-        LU {
-            @Override
-            protected RealVector solve(final RealMatrix jacobian,
-                                       final RealVector residuals) {
-                try {
-                    final Pair<RealMatrix, RealVector> normalEquation =
-                            computeNormalMatrix(jacobian, residuals);
-                    final RealMatrix normal = normalEquation.getFirst();
-                    final RealVector jTr = normalEquation.getSecond();
-                    return new LUDecomposition(normal, SINGULARITY_THRESHOLD)
-                            .getSolver()
-                            .solve(jTr);
-                } catch (SingularMatrixException e) {
-                    throw new ConvergenceException(LocalizedFormats.UNABLE_TO_SOLVE_SINGULAR_PROBLEM, e);
-                }
-            }
-        },
-        /**
-         * Solve the linear least squares problem (Jx=r) using the {@link
-         * QRDecomposition}.
-         *
-         * <p> Theoretically this method takes mn<sup>2</sup> - n<sup>3</sup>/3 operations
-         * (m > n) and has better numerical accuracy than any method that forms the normal
-         * equations. </p>
-         */
-        QR {
-            @Override
-            protected RealVector solve(final RealMatrix jacobian,
-                                       final RealVector residuals) {
-                try {
-                    return new QRDecomposition(jacobian, SINGULARITY_THRESHOLD)
-                            .getSolver()
-                            .solve(residuals);
-                } catch (SingularMatrixException e) {
-                    throw new ConvergenceException(LocalizedFormats.UNABLE_TO_SOLVE_SINGULAR_PROBLEM, e);
-                }
-            }
-        },
-        /**
-         * Solve by forming the normal equations (J<sup>T</sup>Jx=J<sup>T</sup>r) and
-         * using the {@link CholeskyDecomposition}.
-         *
-         * <p> Theoretically this method takes mn<sup>2</sup>/2 operations to compute the
-         * normal matrix and n<sup>3</sup>/6 operations (m > n) to solve the system using
-         * the Cholesky decomposition. </p>
-         */
-        CHOLESKY {
-            @Override
-            protected RealVector solve(final RealMatrix jacobian,
-                                       final RealVector residuals) {
-                try {
-                    final Pair<RealMatrix, RealVector> normalEquation =
-                            computeNormalMatrix(jacobian, residuals);
-                    final RealMatrix normal = normalEquation.getFirst();
-                    final RealVector jTr = normalEquation.getSecond();
-                    return new CholeskyDecomposition(
-                            normal, SINGULARITY_THRESHOLD, SINGULARITY_THRESHOLD)
-                            .getSolver()
-                            .solve(jTr);
-                } catch (NonPositiveDefiniteMatrixException e) {
-                    throw new ConvergenceException(LocalizedFormats.UNABLE_TO_SOLVE_SINGULAR_PROBLEM, e);
-                }
-            }
-        },
-        /**
-         * Solve the linear least squares problem using the {@link
-         * SingularValueDecomposition}.
-         *
-         * <p> This method is slower, but can provide a solution for rank deficient and
-         * nearly singular systems.
-         */
-        SVD {
-            @Override
-            protected RealVector solve(final RealMatrix jacobian,
-                                       final RealVector residuals) {
-                return new SingularValueDecomposition(jacobian)
-                        .getSolver()
-                        .solve(residuals);
-            }
-        };
-
-        /**
-         * Solve the linear least squares problem Jx=r.
-         *
-         * @param jacobian  the Jacobian matrix, J. the number of rows >= the number or
-         *                  columns.
-         * @param residuals the computed residuals, r.
-         * @return the solution x, to the linear least squares problem Jx=r.
-         * @throws ConvergenceException if the matrix properties (e.g. singular) do not
-         *                              permit a solution.
-         */
-        protected abstract RealVector solve(RealMatrix jacobian,
-                                            RealVector residuals);
-    }
-
-    /**
-     * The singularity threshold for matrix decompositions. Determines when a {@link
-     * ConvergenceException} is thrown. The current value was the default value for {@link
-     * LUDecomposition}.
-     */
-    private static final double SINGULARITY_THRESHOLD = 1e-11;
-
-    /** Indicator for using LU decomposition. */
-    private final Decomposition decomposition;
-
-    /**
-     * Creates a Gauss Newton optimizer.
-     * <p/>
-     * The default for the algorithm is to solve the normal equations using QR
-     * decomposition.
-     */
-    public GaussNewtonOptimizer() {
-        this(Decomposition.QR);
-    }
-
-    /**
-     * Create a Gauss Newton optimizer that uses the given decomposition algorithm to
-     * solve the normal equations.
-     *
-     * @param decomposition the {@link Decomposition} algorithm.
-     */
-    public GaussNewtonOptimizer(final Decomposition decomposition) {
-        this.decomposition = decomposition;
-    }
-
-    /**
-     * Get the matrix decomposition algorithm used to solve the normal equations.
-     *
-     * @return the matrix {@link Decomposition} algoritm.
-     */
-    public Decomposition getDecomposition() {
-        return this.decomposition;
-    }
-
-    /**
-     * Configure the decomposition algorithm.
-     *
-     * @param newDecomposition the {@link Decomposition} algorithm to use.
-     * @return a new instance.
-     */
-    public GaussNewtonOptimizer withDecomposition(final Decomposition newDecomposition) {
-        return new GaussNewtonOptimizer(newDecomposition);
-    }
-
-    /** {@inheritDoc} */
-    public Optimum optimize(final LeastSquaresProblem lsp) {
-        //create local evaluation and iteration counts
-        final Incrementor evaluationCounter = lsp.getEvaluationCounter();
-        final Incrementor iterationCounter = lsp.getIterationCounter();
-        final ConvergenceChecker<Evaluation> checker
-                = lsp.getConvergenceChecker();
-
-        // Computation will be useless without a checker (see "for-loop").
-        if (checker == null) {
-            throw new NullArgumentException();
-        }
-
-        RealVector currentPoint = lsp.getStart();
-
-        // iterate until convergence is reached
-        Evaluation current = null;
-        while (true) {
-            iterationCounter.incrementCount();
-
-            // evaluate the objective function and its jacobian
-            Evaluation previous = current;
-            // Value of the objective function at "currentPoint".
-            evaluationCounter.incrementCount();
-            current = lsp.evaluate(currentPoint);
-            final RealVector currentResiduals = current.getResiduals();
-            final RealMatrix weightedJacobian = current.getJacobian();
-            currentPoint = current.getPoint();
-
-            // Check convergence.
-            if (previous != null) {
-                if (checker.converged(iterationCounter.getCount(), previous, current)) {
-                    return new OptimumImpl(
-                            current,
-                            evaluationCounter.getCount(),
-                            iterationCounter.getCount());
-                }
-            }
-
-            // solve the linearized least squares problem
-            final RealVector dX = this.decomposition.solve(weightedJacobian, currentResiduals);
-            // update the estimated parameters
-            currentPoint = currentPoint.add(dX);
-        }
-    }
-
-    @Override
-    public String toString() {
-        return "GaussNewtonOptimizer{" +
-                "decomposition=" + decomposition +
-                '}';
-    }
-
-    /**
-     * Compute the normal matrix, J<sup>T</sup>J.
-     *
-     * @param jacobian  the m by n jacobian matrix, J. Input.
-     * @param residuals the m by 1 residual vector, r. Input.
-     * @return  the n by n normal matrix and  the n by 1 J<sup>Tr vector.
-     */
-    private static Pair<RealMatrix, RealVector> computeNormalMatrix(final RealMatrix jacobian,
-                                                                    final RealVector residuals) {
-        //since the normal matrix is symmetric, we only need to compute half of it.
-        final int nR = jacobian.getRowDimension();
-        final int nC = jacobian.getColumnDimension();
-        //allocate space for return values
-        final RealMatrix normal = MatrixUtils.createRealMatrix(nC, nC);
-        final RealVector jTr = new ArrayRealVector(nC);
-        //for each measurement
-        for (int i = 0; i < nR; ++i) {
-            //compute JTr for measurement i
-            for (int j = 0; j < nC; j++) {
-                jTr.setEntry(j, jTr.getEntry(j) +
-                        residuals.getEntry(i) * jacobian.getEntry(i, j));
-            }
-
-            // add the the contribution to the normal matrix for measurement i
-            for (int k = 0; k < nC; ++k) {
-                //only compute the upper triangular part
-                for (int l = k; l < nC; ++l) {
-                    normal.setEntry(k, l, normal.getEntry(k, l) +
-                            jacobian.getEntry(i, k) * jacobian.getEntry(i, l));
-                }
-            }
-        }
-        //copy the upper triangular part to the lower triangular part.
-        for (int i = 0; i < nC; i++) {
-            for (int j = 0; j < i; j++) {
-                normal.setEntry(i, j, normal.getEntry(j, i));
-            }
-        }
-        return new Pair<RealMatrix, RealVector>(normal, jTr);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresAdapter.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresAdapter.java
deleted file mode 100644
index 1c09874..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresAdapter.java
+++ /dev/null
@@ -1,77 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Incrementor;
-
-/**
- * An adapter that delegates to another implementation of {@link LeastSquaresProblem}.
- *
- * @since 3.3
- */
-public class LeastSquaresAdapter implements LeastSquaresProblem {
-
-    /** the delegate problem */
-    private final LeastSquaresProblem problem;
-
-    /**
-     * Delegate the {@link LeastSquaresProblem} interface to the given implementation.
-     *
-     * @param problem the delegate
-     */
-    public LeastSquaresAdapter(final LeastSquaresProblem problem) {
-        this.problem = problem;
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getStart() {
-        return problem.getStart();
-    }
-
-    /** {@inheritDoc} */
-    public int getObservationSize() {
-        return problem.getObservationSize();
-    }
-
-    /** {@inheritDoc} */
-    public int getParameterSize() {
-        return problem.getParameterSize();
-    }
-
-    /** {@inheritDoc}
-     * @param point*/
-    public Evaluation evaluate(final RealVector point) {
-        return problem.evaluate(point);
-    }
-
-    /** {@inheritDoc} */
-    public Incrementor getEvaluationCounter() {
-        return problem.getEvaluationCounter();
-    }
-
-    /** {@inheritDoc} */
-    public Incrementor getIterationCounter() {
-        return problem.getIterationCounter();
-    }
-
-    /** {@inheritDoc} */
-    public ConvergenceChecker<Evaluation> getConvergenceChecker() {
-        return problem.getConvergenceChecker();
-    }
-}


[41/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java
deleted file mode 100644
index 4260606..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.java
+++ /dev/null
@@ -1,482 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.TrivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Function that implements the
- * <a href="http://en.wikipedia.org/wiki/Tricubic_interpolation">
- * tricubic spline interpolation</a>, as proposed in
- * <quote>
- *  Tricubic interpolation in three dimensions<br/>
- *  F. Lekien and J. Marsden<br/>
- *  <em>Int. J. Numer. Meth. Engng</em> 2005; <b>63</b>:455-471
- * </quote>
- *
- * @since 2.2
- * @deprecated To be removed in 4.0 (see MATH-1166).
- */
-@Deprecated
-public class TricubicSplineInterpolatingFunction
-    implements TrivariateFunction {
-    /**
-     * Matrix to compute the spline coefficients from the function values
-     * and function derivatives values
-     */
-    private static final double[][] AINV = {
-        { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -3,3,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 2,-2,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 9,-9,-9,9,0,0,0,0,6,3,-6,-3,0,0,0,0,6,-6,3,-3,0,0,0,0,0,0,0,0,0,0,0,0,4,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,6,-6,0,0,0,0,-3,-3,3,3,0,0,0,0,-4,4,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,-2,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,6,-6,0,0,0,0,-4,-2,4,2,0,0,0,0,-3,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 4,-4,-4,4,0,0,0,0,2,2,-2,-2,0,0,0,0,2,-2,2,-2,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,0,0,0,0,1,1,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,-9,-9,9,0,0,0,0,0,0,0,0,0,0,0,0,6,3,-6,-3,0,0,0,0,6,-6,3,-3,0,0,0,0,4,2,2,1,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,6,-6,0,0,0,0,0,0,0,0,0,0,0,0,-3,-3,3,3,0,0,0,0,-4,4,-2,2,0,0,0,0,-2,-2,-1,-1,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,6,-6,0,0,0,0,0,0,0,0,0,0,0,0,-4,-2,4,2,0,0,0,0,-3,3,-3,3,0,0,0,0,-2,-1,-2,-1,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,-4,-4,4,0,0,0,0,0,0,0,0,0,0,0,0,2,2,-2,-2,0,0,0,0,2,-2,2,-2,0,0,0,0,1,1,1,1,0,0,0,0 },
-        {-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 9,-9,0,0,-9,9,0,0,6,3,0,0,-6,-3,0,0,0,0,0,0,0,0,0,0,6,-6,0,0,3,-3,0,0,0,0,0,0,0,0,0,0,4,2,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,0,0,6,-6,0,0,-3,-3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,-4,4,0,0,-2,2,0,0,0,0,0,0,0,0,0,0,-2,-2,0,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,-9,0,0,-9,9,0,0,0,0,0,0,0,0,0,0,6,3,0,0,-6,-3,0,0,0,0,0,0,0,0,0,0,6,-6,0,0,3,-3,0,0,4,2,0,0,2,1,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,0,0,6,-6,0,0,0,0,0,0,0,0,0,0,-3,-3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,-4,4,0,0,-2,2,0,0,-2,-2,0,0,-1,-1,0,0 },
-        { 9,0,-9,0,-9,0,9,0,0,0,0,0,0,0,0,0,6,0,3,0,-6,0,-3,0,6,0,-6,0,3,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,2,0,2,0,1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,9,0,-9,0,-9,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,3,0,-6,0,-3,0,6,0,-6,0,3,0,-3,0,0,0,0,0,0,0,0,0,4,0,2,0,2,0,1,0 },
-        { -27,27,27,-27,27,-27,-27,27,-18,-9,18,9,18,9,-18,-9,-18,18,-9,9,18,-18,9,-9,-18,18,18,-18,-9,9,9,-9,-12,-6,-6,-3,12,6,6,3,-12,-6,12,6,-6,-3,6,3,-12,12,-6,6,-6,6,-3,3,-8,-4,-4,-2,-4,-2,-2,-1 },
-        { 18,-18,-18,18,-18,18,18,-18,9,9,-9,-9,-9,-9,9,9,12,-12,6,-6,-12,12,-6,6,12,-12,-12,12,6,-6,-6,6,6,6,3,3,-6,-6,-3,-3,6,6,-6,-6,3,3,-3,-3,8,-8,4,-4,4,-4,2,-2,4,4,2,2,2,2,1,1 },
-        { -6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,-3,0,-3,0,3,0,3,0,-4,0,4,0,-2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-2,0,-1,0,-1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,-3,0,3,0,3,0,-4,0,4,0,-2,0,2,0,0,0,0,0,0,0,0,0,-2,0,-2,0,-1,0,-1,0 },
-        { 18,-18,-18,18,-18,18,18,-18,12,6,-12,-6,-12,-6,12,6,9,-9,9,-9,-9,9,-9,9,12,-12,-12,12,6,-6,-6,6,6,3,6,3,-6,-3,-6,-3,8,4,-8,-4,4,2,-4,-2,6,-6,6,-6,3,-3,3,-3,4,2,4,2,2,1,2,1 },
-        { -12,12,12,-12,12,-12,-12,12,-6,-6,6,6,6,6,-6,-6,-6,6,-6,6,6,-6,6,-6,-8,8,8,-8,-4,4,4,-4,-3,-3,-3,-3,3,3,3,3,-4,-4,4,4,-2,-2,2,2,-4,4,-4,4,-2,2,-2,2,-2,-2,-2,-2,-1,-1,-1,-1 },
-        { 2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,0,0,6,-6,0,0,-4,-2,0,0,4,2,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,-3,3,0,0,0,0,0,0,0,0,0,0,-2,-1,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 4,-4,0,0,-4,4,0,0,2,2,0,0,-2,-2,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,2,-2,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,0,0,6,-6,0,0,0,0,0,0,0,0,0,0,-4,-2,0,0,4,2,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,-3,3,0,0,-2,-1,0,0,-2,-1,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,-4,0,0,-4,4,0,0,0,0,0,0,0,0,0,0,2,2,0,0,-2,-2,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,2,-2,0,0,1,1,0,0,1,1,0,0 },
-        { -6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,-4,0,-2,0,4,0,2,0,-3,0,3,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,-2,0,-1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-4,0,-2,0,4,0,2,0,-3,0,3,0,-3,0,3,0,0,0,0,0,0,0,0,0,-2,0,-1,0,-2,0,-1,0 },
-        { 18,-18,-18,18,-18,18,18,-18,12,6,-12,-6,-12,-6,12,6,12,-12,6,-6,-12,12,-6,6,9,-9,-9,9,9,-9,-9,9,8,4,4,2,-8,-4,-4,-2,6,3,-6,-3,6,3,-6,-3,6,-6,3,-3,6,-6,3,-3,4,2,2,1,4,2,2,1 },
-        { -12,12,12,-12,12,-12,-12,12,-6,-6,6,6,6,6,-6,-6,-8,8,-4,4,8,-8,4,-4,-6,6,6,-6,-6,6,6,-6,-4,-4,-2,-2,4,4,2,2,-3,-3,3,3,-3,-3,3,3,-4,4,-2,2,-4,4,-2,2,-2,-2,-1,-1,-2,-2,-1,-1 },
-        { 4,0,-4,0,-4,0,4,0,0,0,0,0,0,0,0,0,2,0,2,0,-2,0,-2,0,2,0,-2,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,4,0,-4,0,-4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,-2,0,-2,0,2,0,-2,0,2,0,-2,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0 },
-        { -12,12,12,-12,12,-12,-12,12,-8,-4,8,4,8,4,-8,-4,-6,6,-6,6,6,-6,6,-6,-6,6,6,-6,-6,6,6,-6,-4,-2,-4,-2,4,2,4,2,-4,-2,4,2,-4,-2,4,2,-3,3,-3,3,-3,3,-3,3,-2,-1,-2,-1,-2,-1,-2,-1 },
-        { 8,-8,-8,8,-8,8,8,-8,4,4,-4,-4,-4,-4,4,4,4,-4,4,-4,-4,4,-4,4,4,-4,-4,4,4,-4,-4,4,2,2,2,2,-2,-2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,-2,2,-2,2,-2,2,-2,1,1,1,1,1,1,1,1 }
-    };
-
-    /** Samples x-coordinates */
-    private final double[] xval;
-    /** Samples y-coordinates */
-    private final double[] yval;
-    /** Samples z-coordinates */
-    private final double[] zval;
-    /** Set of cubic splines pacthing the whole data grid */
-    private final TricubicSplineFunction[][][] splines;
-
-    /**
-     * @param x Sample values of the x-coordinate, in increasing order.
-     * @param y Sample values of the y-coordinate, in increasing order.
-     * @param z Sample values of the y-coordinate, in increasing order.
-     * @param f Values of the function on every grid point.
-     * @param dFdX Values of the partial derivative of function with respect to x on every grid point.
-     * @param dFdY Values of the partial derivative of function with respect to y on every grid point.
-     * @param dFdZ Values of the partial derivative of function with respect to z on every grid point.
-     * @param d2FdXdY Values of the cross partial derivative of function on every grid point.
-     * @param d2FdXdZ Values of the cross partial derivative of function on every grid point.
-     * @param d2FdYdZ Values of the cross partial derivative of function on every grid point.
-     * @param d3FdXdYdZ Values of the cross partial derivative of function on every grid point.
-     * @throws NoDataException if any of the arrays has zero length.
-     * @throws DimensionMismatchException if the various arrays do not contain the expected number of elements.
-     * @throws NonMonotonicSequenceException if {@code x}, {@code y} or {@code z} are not strictly increasing.
-     */
-    public TricubicSplineInterpolatingFunction(double[] x,
-                                               double[] y,
-                                               double[] z,
-                                               double[][][] f,
-                                               double[][][] dFdX,
-                                               double[][][] dFdY,
-                                               double[][][] dFdZ,
-                                               double[][][] d2FdXdY,
-                                               double[][][] d2FdXdZ,
-                                               double[][][] d2FdYdZ,
-                                               double[][][] d3FdXdYdZ)
-        throws NoDataException,
-               DimensionMismatchException,
-               NonMonotonicSequenceException {
-        final int xLen = x.length;
-        final int yLen = y.length;
-        final int zLen = z.length;
-
-        if (xLen == 0 || yLen == 0 || z.length == 0 || f.length == 0 || f[0].length == 0) {
-            throw new NoDataException();
-        }
-        if (xLen != f.length) {
-            throw new DimensionMismatchException(xLen, f.length);
-        }
-        if (xLen != dFdX.length) {
-            throw new DimensionMismatchException(xLen, dFdX.length);
-        }
-        if (xLen != dFdY.length) {
-            throw new DimensionMismatchException(xLen, dFdY.length);
-        }
-        if (xLen != dFdZ.length) {
-            throw new DimensionMismatchException(xLen, dFdZ.length);
-        }
-        if (xLen != d2FdXdY.length) {
-            throw new DimensionMismatchException(xLen, d2FdXdY.length);
-        }
-        if (xLen != d2FdXdZ.length) {
-            throw new DimensionMismatchException(xLen, d2FdXdZ.length);
-        }
-        if (xLen != d2FdYdZ.length) {
-            throw new DimensionMismatchException(xLen, d2FdYdZ.length);
-        }
-        if (xLen != d3FdXdYdZ.length) {
-            throw new DimensionMismatchException(xLen, d3FdXdYdZ.length);
-        }
-
-        MathArrays.checkOrder(x);
-        MathArrays.checkOrder(y);
-        MathArrays.checkOrder(z);
-
-        xval = x.clone();
-        yval = y.clone();
-        zval = z.clone();
-
-        final int lastI = xLen - 1;
-        final int lastJ = yLen - 1;
-        final int lastK = zLen - 1;
-        splines = new TricubicSplineFunction[lastI][lastJ][lastK];
-
-        for (int i = 0; i < lastI; i++) {
-            if (f[i].length != yLen) {
-                throw new DimensionMismatchException(f[i].length, yLen);
-            }
-            if (dFdX[i].length != yLen) {
-                throw new DimensionMismatchException(dFdX[i].length, yLen);
-            }
-            if (dFdY[i].length != yLen) {
-                throw new DimensionMismatchException(dFdY[i].length, yLen);
-            }
-            if (dFdZ[i].length != yLen) {
-                throw new DimensionMismatchException(dFdZ[i].length, yLen);
-            }
-            if (d2FdXdY[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdXdY[i].length, yLen);
-            }
-            if (d2FdXdZ[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdXdZ[i].length, yLen);
-            }
-            if (d2FdYdZ[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdYdZ[i].length, yLen);
-            }
-            if (d3FdXdYdZ[i].length != yLen) {
-                throw new DimensionMismatchException(d3FdXdYdZ[i].length, yLen);
-            }
-
-            final int ip1 = i + 1;
-            for (int j = 0; j < lastJ; j++) {
-                if (f[i][j].length != zLen) {
-                    throw new DimensionMismatchException(f[i][j].length, zLen);
-                }
-                if (dFdX[i][j].length != zLen) {
-                    throw new DimensionMismatchException(dFdX[i][j].length, zLen);
-                }
-                if (dFdY[i][j].length != zLen) {
-                    throw new DimensionMismatchException(dFdY[i][j].length, zLen);
-                }
-                if (dFdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(dFdZ[i][j].length, zLen);
-                }
-                if (d2FdXdY[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d2FdXdY[i][j].length, zLen);
-                }
-                if (d2FdXdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d2FdXdZ[i][j].length, zLen);
-                }
-                if (d2FdYdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d2FdYdZ[i][j].length, zLen);
-                }
-                if (d3FdXdYdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d3FdXdYdZ[i][j].length, zLen);
-                }
-
-                final int jp1 = j + 1;
-                for (int k = 0; k < lastK; k++) {
-                    final int kp1 = k + 1;
-
-                    final double[] beta = new double[] {
-                        f[i][j][k], f[ip1][j][k],
-                        f[i][jp1][k], f[ip1][jp1][k],
-                        f[i][j][kp1], f[ip1][j][kp1],
-                        f[i][jp1][kp1], f[ip1][jp1][kp1],
-
-                        dFdX[i][j][k], dFdX[ip1][j][k],
-                        dFdX[i][jp1][k], dFdX[ip1][jp1][k],
-                        dFdX[i][j][kp1], dFdX[ip1][j][kp1],
-                        dFdX[i][jp1][kp1], dFdX[ip1][jp1][kp1],
-
-                        dFdY[i][j][k], dFdY[ip1][j][k],
-                        dFdY[i][jp1][k], dFdY[ip1][jp1][k],
-                        dFdY[i][j][kp1], dFdY[ip1][j][kp1],
-                        dFdY[i][jp1][kp1], dFdY[ip1][jp1][kp1],
-
-                        dFdZ[i][j][k], dFdZ[ip1][j][k],
-                        dFdZ[i][jp1][k], dFdZ[ip1][jp1][k],
-                        dFdZ[i][j][kp1], dFdZ[ip1][j][kp1],
-                        dFdZ[i][jp1][kp1], dFdZ[ip1][jp1][kp1],
-
-                        d2FdXdY[i][j][k], d2FdXdY[ip1][j][k],
-                        d2FdXdY[i][jp1][k], d2FdXdY[ip1][jp1][k],
-                        d2FdXdY[i][j][kp1], d2FdXdY[ip1][j][kp1],
-                        d2FdXdY[i][jp1][kp1], d2FdXdY[ip1][jp1][kp1],
-
-                        d2FdXdZ[i][j][k], d2FdXdZ[ip1][j][k],
-                        d2FdXdZ[i][jp1][k], d2FdXdZ[ip1][jp1][k],
-                        d2FdXdZ[i][j][kp1], d2FdXdZ[ip1][j][kp1],
-                        d2FdXdZ[i][jp1][kp1], d2FdXdZ[ip1][jp1][kp1],
-
-                        d2FdYdZ[i][j][k], d2FdYdZ[ip1][j][k],
-                        d2FdYdZ[i][jp1][k], d2FdYdZ[ip1][jp1][k],
-                        d2FdYdZ[i][j][kp1], d2FdYdZ[ip1][j][kp1],
-                        d2FdYdZ[i][jp1][kp1], d2FdYdZ[ip1][jp1][kp1],
-
-                        d3FdXdYdZ[i][j][k], d3FdXdYdZ[ip1][j][k],
-                        d3FdXdYdZ[i][jp1][k], d3FdXdYdZ[ip1][jp1][k],
-                        d3FdXdYdZ[i][j][kp1], d3FdXdYdZ[ip1][j][kp1],
-                        d3FdXdYdZ[i][jp1][kp1], d3FdXdYdZ[ip1][jp1][kp1],
-                    };
-
-                    splines[i][j][k] = new TricubicSplineFunction(computeSplineCoefficients(beta));
-                }
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws OutOfRangeException if any of the variables is outside its interpolation range.
-     */
-    public double value(double x, double y, double z)
-        throws OutOfRangeException {
-        final int i = searchIndex(x, xval);
-        if (i == -1) {
-            throw new OutOfRangeException(x, xval[0], xval[xval.length - 1]);
-        }
-        final int j = searchIndex(y, yval);
-        if (j == -1) {
-            throw new OutOfRangeException(y, yval[0], yval[yval.length - 1]);
-        }
-        final int k = searchIndex(z, zval);
-        if (k == -1) {
-            throw new OutOfRangeException(z, zval[0], zval[zval.length - 1]);
-        }
-
-        final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]);
-        final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]);
-        final double zN = (z - zval[k]) / (zval[k + 1] - zval[k]);
-
-        return splines[i][j][k].value(xN, yN, zN);
-    }
-
-    /**
-     * @param c Coordinate.
-     * @param val Coordinate samples.
-     * @return the index in {@code val} corresponding to the interval containing {@code c}, or {@code -1}
-     *   if {@code c} is out of the range defined by the end values of {@code val}.
-     */
-    private int searchIndex(double c, double[] val) {
-        if (c < val[0]) {
-            return -1;
-        }
-
-        final int max = val.length;
-        for (int i = 1; i < max; i++) {
-            if (c <= val[i]) {
-                return i - 1;
-            }
-        }
-
-        return -1;
-    }
-
-    /**
-     * Compute the spline coefficients from the list of function values and
-     * function partial derivatives values at the four corners of a grid
-     * element. They must be specified in the following order:
-     * <ul>
-     *  <li>f(0,0,0)</li>
-     *  <li>f(1,0,0)</li>
-     *  <li>f(0,1,0)</li>
-     *  <li>f(1,1,0)</li>
-     *  <li>f(0,0,1)</li>
-     *  <li>f(1,0,1)</li>
-     *  <li>f(0,1,1)</li>
-     *  <li>f(1,1,1)</li>
-     *
-     *  <li>f<sub>x</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>x</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>y</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>y</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>z</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>z</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>xy</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>xy</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>xz</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>xz</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>yz</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>yz</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>xyz</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>xyz</sub>(1,1,1)</li>
-     * </ul>
-     * where the subscripts indicate the partial derivative with respect to
-     * the corresponding variable(s).
-     *
-     * @param beta List of function values and function partial derivatives values.
-     * @return the spline coefficients.
-     */
-    private double[] computeSplineCoefficients(double[] beta) {
-        final int sz = 64;
-        final double[] a = new double[sz];
-
-        for (int i = 0; i < sz; i++) {
-            double result = 0;
-            final double[] row = AINV[i];
-            for (int j = 0; j < sz; j++) {
-                result += row[j] * beta[j];
-            }
-            a[i] = result;
-        }
-
-        return a;
-    }
-}
-
-/**
- * 3D-spline function.
- *
- */
-class TricubicSplineFunction
-    implements TrivariateFunction {
-    /** Number of points. */
-    private static final short N = 4;
-    /** Coefficients */
-    private final double[][][] a = new double[N][N][N];
-
-    /**
-     * @param aV List of spline coefficients.
-     */
-    public TricubicSplineFunction(double[] aV) {
-        for (int i = 0; i < N; i++) {
-            for (int j = 0; j < N; j++) {
-                for (int k = 0; k < N; k++) {
-                    a[i][j][k] = aV[i + N * (j + N * k)];
-                }
-            }
-        }
-    }
-
-    /**
-     * @param x x-coordinate of the interpolation point.
-     * @param y y-coordinate of the interpolation point.
-     * @param z z-coordinate of the interpolation point.
-     * @return the interpolated value.
-     * @throws OutOfRangeException if {@code x}, {@code y} or
-     * {@code z} are not in the interval {@code [0, 1]}.
-     */
-    public double value(double x, double y, double z)
-        throws OutOfRangeException {
-        if (x < 0 || x > 1) {
-            throw new OutOfRangeException(x, 0, 1);
-        }
-        if (y < 0 || y > 1) {
-            throw new OutOfRangeException(y, 0, 1);
-        }
-        if (z < 0 || z > 1) {
-            throw new OutOfRangeException(z, 0, 1);
-        }
-
-        final double x2 = x * x;
-        final double x3 = x2 * x;
-        final double[] pX = { 1, x, x2, x3 };
-
-        final double y2 = y * y;
-        final double y3 = y2 * y;
-        final double[] pY = { 1, y, y2, y3 };
-
-        final double z2 = z * z;
-        final double z3 = z2 * z;
-        final double[] pZ = { 1, z, z2, z3 };
-
-        double result = 0;
-        for (int i = 0; i < N; i++) {
-            for (int j = 0; j < N; j++) {
-                for (int k = 0; k < N; k++) {
-                    result += a[i][j][k] * pX[i] * pY[j] * pZ[k];
-                }
-            }
-        }
-
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java
deleted file mode 100644
index da19986..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.java
+++ /dev/null
@@ -1,201 +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.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Generates a tricubic interpolating function.
- *
- * @since 2.2
- * @deprecated To be removed in 4.0 (see MATH-1166).
- */
-@Deprecated
-public class TricubicSplineInterpolator
-    implements TrivariateGridInterpolator {
-    /**
-     * {@inheritDoc}
-     */
-    public TricubicSplineInterpolatingFunction interpolate(final double[] xval,
-                                                           final double[] yval,
-                                                           final double[] zval,
-                                                           final double[][][] fval)
-        throws NoDataException, NumberIsTooSmallException,
-               DimensionMismatchException, NonMonotonicSequenceException {
-        if (xval.length == 0 || yval.length == 0 || zval.length == 0 || fval.length == 0) {
-            throw new NoDataException();
-        }
-        if (xval.length != fval.length) {
-            throw new DimensionMismatchException(xval.length, fval.length);
-        }
-
-        MathArrays.checkOrder(xval);
-        MathArrays.checkOrder(yval);
-        MathArrays.checkOrder(zval);
-
-        final int xLen = xval.length;
-        final int yLen = yval.length;
-        final int zLen = zval.length;
-
-        // Samples, re-ordered as (z, x, y) and (y, z, x) tuplets
-        // fvalXY[k][i][j] = f(xval[i], yval[j], zval[k])
-        // fvalZX[j][k][i] = f(xval[i], yval[j], zval[k])
-        final double[][][] fvalXY = new double[zLen][xLen][yLen];
-        final double[][][] fvalZX = new double[yLen][zLen][xLen];
-        for (int i = 0; i < xLen; i++) {
-            if (fval[i].length != yLen) {
-                throw new DimensionMismatchException(fval[i].length, yLen);
-            }
-
-            for (int j = 0; j < yLen; j++) {
-                if (fval[i][j].length != zLen) {
-                    throw new DimensionMismatchException(fval[i][j].length, zLen);
-                }
-
-                for (int k = 0; k < zLen; k++) {
-                    final double v = fval[i][j][k];
-                    fvalXY[k][i][j] = v;
-                    fvalZX[j][k][i] = v;
-                }
-            }
-        }
-
-        final BicubicSplineInterpolator bsi = new BicubicSplineInterpolator(true);
-
-        // For each line x[i] (0 <= i < xLen), construct a 2D spline in y and z
-        final BicubicSplineInterpolatingFunction[] xSplineYZ
-            = new BicubicSplineInterpolatingFunction[xLen];
-        for (int i = 0; i < xLen; i++) {
-            xSplineYZ[i] = bsi.interpolate(yval, zval, fval[i]);
-        }
-
-        // For each line y[j] (0 <= j < yLen), construct a 2D spline in z and x
-        final BicubicSplineInterpolatingFunction[] ySplineZX
-            = new BicubicSplineInterpolatingFunction[yLen];
-        for (int j = 0; j < yLen; j++) {
-            ySplineZX[j] = bsi.interpolate(zval, xval, fvalZX[j]);
-        }
-
-        // For each line z[k] (0 <= k < zLen), construct a 2D spline in x and y
-        final BicubicSplineInterpolatingFunction[] zSplineXY
-            = new BicubicSplineInterpolatingFunction[zLen];
-        for (int k = 0; k < zLen; k++) {
-            zSplineXY[k] = bsi.interpolate(xval, yval, fvalXY[k]);
-        }
-
-        // Partial derivatives wrt x and wrt y
-        final double[][][] dFdX = new double[xLen][yLen][zLen];
-        final double[][][] dFdY = new double[xLen][yLen][zLen];
-        final double[][][] d2FdXdY = new double[xLen][yLen][zLen];
-        for (int k = 0; k < zLen; k++) {
-            final BicubicSplineInterpolatingFunction f = zSplineXY[k];
-            for (int i = 0; i < xLen; i++) {
-                final double x = xval[i];
-                for (int j = 0; j < yLen; j++) {
-                    final double y = yval[j];
-                    dFdX[i][j][k] = f.partialDerivativeX(x, y);
-                    dFdY[i][j][k] = f.partialDerivativeY(x, y);
-                    d2FdXdY[i][j][k] = f.partialDerivativeXY(x, y);
-                }
-            }
-        }
-
-        // Partial derivatives wrt y and wrt z
-        final double[][][] dFdZ = new double[xLen][yLen][zLen];
-        final double[][][] d2FdYdZ = new double[xLen][yLen][zLen];
-        for (int i = 0; i < xLen; i++) {
-            final BicubicSplineInterpolatingFunction f = xSplineYZ[i];
-            for (int j = 0; j < yLen; j++) {
-                final double y = yval[j];
-                for (int k = 0; k < zLen; k++) {
-                    final double z = zval[k];
-                    dFdZ[i][j][k] = f.partialDerivativeY(y, z);
-                    d2FdYdZ[i][j][k] = f.partialDerivativeXY(y, z);
-                }
-            }
-        }
-
-        // Partial derivatives wrt x and wrt z
-        final double[][][] d2FdZdX = new double[xLen][yLen][zLen];
-        for (int j = 0; j < yLen; j++) {
-            final BicubicSplineInterpolatingFunction f = ySplineZX[j];
-            for (int k = 0; k < zLen; k++) {
-                final double z = zval[k];
-                for (int i = 0; i < xLen; i++) {
-                    final double x = xval[i];
-                    d2FdZdX[i][j][k] = f.partialDerivativeXY(z, x);
-                }
-            }
-        }
-
-        // Third partial cross-derivatives
-        final double[][][] d3FdXdYdZ = new double[xLen][yLen][zLen];
-        for (int i = 0; i < xLen ; i++) {
-            final int nI = nextIndex(i, xLen);
-            final int pI = previousIndex(i);
-            for (int j = 0; j < yLen; j++) {
-                final int nJ = nextIndex(j, yLen);
-                final int pJ = previousIndex(j);
-                for (int k = 0; k < zLen; k++) {
-                    final int nK = nextIndex(k, zLen);
-                    final int pK = previousIndex(k);
-
-                    // XXX Not sure about this formula
-                    d3FdXdYdZ[i][j][k] = (fval[nI][nJ][nK] - fval[nI][pJ][nK] -
-                                          fval[pI][nJ][nK] + fval[pI][pJ][nK] -
-                                          fval[nI][nJ][pK] + fval[nI][pJ][pK] +
-                                          fval[pI][nJ][pK] - fval[pI][pJ][pK]) /
-                        ((xval[nI] - xval[pI]) * (yval[nJ] - yval[pJ]) * (zval[nK] - zval[pK])) ;
-                }
-            }
-        }
-
-        // Create the interpolating splines
-        return new TricubicSplineInterpolatingFunction(xval, yval, zval, fval,
-                                                       dFdX, dFdY, dFdZ,
-                                                       d2FdXdY, d2FdZdX, d2FdYdZ,
-                                                       d3FdXdYdZ);
-    }
-
-    /**
-     * Compute the next index of an array, clipping if necessary.
-     * It is assumed (but not checked) that {@code i} is larger than or equal to 0}.
-     *
-     * @param i Index
-     * @param max Upper limit of the array
-     * @return the next index
-     */
-    private int nextIndex(int i, int max) {
-        final int index = i + 1;
-        return index < max ? index : index - 1;
-    }
-    /**
-     * Compute the previous index of an array, clipping if necessary.
-     * It is assumed (but not checked) that {@code i} is smaller than the size of the array.
-     *
-     * @param i Index
-     * @return the previous index
-     */
-    private int previousIndex(int i) {
-        final int index = i - 1;
-        return index >= 0 ? index : 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java
deleted file mode 100644
index ec69715..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.java
+++ /dev/null
@@ -1,54 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.TrivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-
-/**
- * Interface representing a trivariate real interpolating function where the
- * sample points must be specified on a regular grid.
- *
- * @since 2.2
- */
-public interface TrivariateGridInterpolator {
-    /**
-     * Compute an interpolating function for the dataset.
-     *
-     * @param xval All the x-coordinates of the interpolation points, sorted
-     * in increasing order.
-     * @param yval All the y-coordinates of the interpolation points, sorted
-     * in increasing order.
-     * @param zval All the z-coordinates of the interpolation points, sorted
-     * in increasing order.
-     * @param fval the values of the interpolation points on all the grid knots:
-     * {@code fval[i][j][k] = f(xval[i], yval[j], zval[k])}.
-     * @return a function that interpolates the data set.
-     * @throws NoDataException if any of the arrays has zero length.
-     * @throws DimensionMismatchException if the array lengths are inconsistent.
-     * @throws NonMonotonicSequenceException if arrays are not sorted
-     * @throws NumberIsTooSmallException if the number of points is too small for
-     * the order of the interpolation
-     */
-    TrivariateFunction interpolate(double[] xval, double[] yval, double[] zval,
-                                   double[][][] fval)
-        throws NoDataException, NumberIsTooSmallException,
-               DimensionMismatchException, NonMonotonicSequenceException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariateInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariateInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariateInterpolator.java
deleted file mode 100644
index f7a1bd1..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariateInterpolator.java
+++ /dev/null
@@ -1,41 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-/**
- * Interface representing a univariate real interpolating function.
- *
- */
-public interface UnivariateInterpolator {
-    /**
-     * Compute an interpolating function for the dataset.
-     *
-     * @param xval Arguments for the interpolation points.
-     * @param yval Values for the interpolation points.
-     * @return a function which interpolates the dataset.
-     * @throws MathIllegalArgumentException
-     * if the arguments violate assumptions made by the interpolation
-     * algorithm.
-     * @throws DimensionMismatchException if arrays lengthes do not match
-     */
-    UnivariateFunction interpolate(double xval[], double yval[])
-        throws MathIllegalArgumentException, DimensionMismatchException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java
deleted file mode 100644
index 6b788b1..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/UnivariatePeriodicInterpolator.java
+++ /dev/null
@@ -1,123 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-
-/**
- * Adapter for classes implementing the {@link UnivariateInterpolator}
- * interface.
- * The data to be interpolated is assumed to be periodic. Thus values that are
- * outside of the range can be passed to the interpolation function: They will
- * be wrapped into the initial range before being passed to the class that
- * actually computes the interpolation.
- *
- */
-public class UnivariatePeriodicInterpolator
-    implements UnivariateInterpolator {
-    /** Default number of extension points of the samples array. */
-    public static final int DEFAULT_EXTEND = 5;
-    /** Interpolator. */
-    private final UnivariateInterpolator interpolator;
-    /** Period. */
-    private final double period;
-    /** Number of extension points. */
-    private final int extend;
-
-    /**
-     * Builds an interpolator.
-     *
-     * @param interpolator Interpolator.
-     * @param period Period.
-     * @param extend Number of points to be appended at the beginning and
-     * end of the sample arrays in order to avoid interpolation failure at
-     * the (periodic) boundaries of the orginal interval. The value is the
-     * number of sample points which the original {@code interpolator} needs
-     * on each side of the interpolated point.
-     */
-    public UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator,
-                                          double period,
-                                          int extend) {
-        this.interpolator = interpolator;
-        this.period = period;
-        this.extend = extend;
-    }
-
-    /**
-     * Builds an interpolator.
-     * Uses {@link #DEFAULT_EXTEND} as the number of extension points on each side
-     * of the original abscissae range.
-     *
-     * @param interpolator Interpolator.
-     * @param period Period.
-     */
-    public UnivariatePeriodicInterpolator(UnivariateInterpolator interpolator,
-                                          double period) {
-        this(interpolator, period, DEFAULT_EXTEND);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws NumberIsTooSmallException if the number of extension points
-     * is larger than the size of {@code xval}.
-     */
-    public UnivariateFunction interpolate(double[] xval,
-                                          double[] yval)
-        throws NumberIsTooSmallException, NonMonotonicSequenceException {
-        if (xval.length < extend) {
-            throw new NumberIsTooSmallException(xval.length, extend, true);
-        }
-
-        MathArrays.checkOrder(xval);
-        final double offset = xval[0];
-
-        final int len = xval.length + extend * 2;
-        final double[] x = new double[len];
-        final double[] y = new double[len];
-        for (int i = 0; i < xval.length; i++) {
-            final int index = i + extend;
-            x[index] = MathUtils.reduce(xval[i], period, offset);
-            y[index] = yval[i];
-        }
-
-        // Wrap to enable interpolation at the boundaries.
-        for (int i = 0; i < extend; i++) {
-            int index = xval.length - extend + i;
-            x[i] = MathUtils.reduce(xval[index], period, offset) - period;
-            y[i] = yval[index];
-
-            index = len - extend + i;
-            x[index] = MathUtils.reduce(xval[i], period, offset) + period;
-            y[index] = yval[i];
-        }
-
-        MathArrays.sortInPlace(x, y);
-
-        final UnivariateFunction f = interpolator.interpolate(x, y);
-        return new UnivariateFunction() {
-            public double value(final double x) throws MathIllegalArgumentException {
-                return f.value(MathUtils.reduce(x, period, offset));
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/package-info.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/package-info.java
deleted file mode 100644
index b4b25dd..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-/**
- *
- *     Univariate real functions interpolation algorithms.
- *
- */
-package org.apache.commons.math3.analysis.interpolation;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/package-info.java b/src/main/java/org/apache/commons/math3/analysis/package-info.java
deleted file mode 100644
index 46e0477..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/package-info.java
+++ /dev/null
@@ -1,32 +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.
- */
-/**
- *
- *    <p>
- *      Parent package for common numerical analysis procedures, including root finding,
- *      function interpolation and integration. Note that optimization (i.e. minimization
- *      and maximization) is a separate top-level package.
- *    </p>
- *    <p>
- *      Function interfaces are intended to be implemented by user code to represent
- *      domain problems. The algorithms provided by the library operate on these
- *      functions to find their roots, or integrate them, or ... Functions can be multivariate
- *      or univariate, real vectorial or matrix-valued, and they can be differentiable or not.
- *    </p>
- *
- */
-package org.apache.commons.math3.analysis;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.java
deleted file mode 100644
index d424a88..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.java
+++ /dev/null
@@ -1,412 +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.analysis.polynomials;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Immutable representation of a real polynomial function with real coefficients.
- * <p>
- * <a href="http://mathworld.wolfram.com/HornersMethod.html">Horner's Method</a>
- * is used to evaluate the function.</p>
- *
- */
-public class PolynomialFunction implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction, Serializable {
-    /**
-     * Serialization identifier
-     */
-    private static final long serialVersionUID = -7726511984200295583L;
-    /**
-     * The coefficients of the polynomial, ordered by degree -- i.e.,
-     * coefficients[0] is the constant term and coefficients[n] is the
-     * coefficient of x^n where n is the degree of the polynomial.
-     */
-    private final double coefficients[];
-
-    /**
-     * Construct a polynomial with the given coefficients.  The first element
-     * of the coefficients array is the constant term.  Higher degree
-     * coefficients follow in sequence.  The degree of the resulting polynomial
-     * is the index of the last non-null element of the array, or 0 if all elements
-     * are null.
-     * <p>
-     * The constructor makes a copy of the input array and assigns the copy to
-     * the coefficients property.</p>
-     *
-     * @param c Polynomial coefficients.
-     * @throws NullArgumentException if {@code c} is {@code null}.
-     * @throws NoDataException if {@code c} is empty.
-     */
-    public PolynomialFunction(double c[])
-        throws NullArgumentException, NoDataException {
-        super();
-        MathUtils.checkNotNull(c);
-        int n = c.length;
-        if (n == 0) {
-            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
-        }
-        while ((n > 1) && (c[n - 1] == 0)) {
-            --n;
-        }
-        this.coefficients = new double[n];
-        System.arraycopy(c, 0, this.coefficients, 0, n);
-    }
-
-    /**
-     * Compute the value of the function for the given argument.
-     * <p>
-     *  The value returned is <br/>
-     *  <code>coefficients[n] * x^n + ... + coefficients[1] * x  + coefficients[0]</code>
-     * </p>
-     *
-     * @param x Argument for which the function value should be computed.
-     * @return the value of the polynomial at the given point.
-     * @see UnivariateFunction#value(double)
-     */
-    public double value(double x) {
-       return evaluate(coefficients, x);
-    }
-
-    /**
-     * Returns the degree of the polynomial.
-     *
-     * @return the degree of the polynomial.
-     */
-    public int degree() {
-        return coefficients.length - 1;
-    }
-
-    /**
-     * Returns a copy of the coefficients array.
-     * <p>
-     * Changes made to the returned copy will not affect the coefficients of
-     * the polynomial.</p>
-     *
-     * @return a fresh copy of the coefficients array.
-     */
-    public double[] getCoefficients() {
-        return coefficients.clone();
-    }
-
-    /**
-     * Uses Horner's Method to evaluate the polynomial with the given coefficients at
-     * the argument.
-     *
-     * @param coefficients Coefficients of the polynomial to evaluate.
-     * @param argument Input value.
-     * @return the value of the polynomial.
-     * @throws NoDataException if {@code coefficients} is empty.
-     * @throws NullArgumentException if {@code coefficients} is {@code null}.
-     */
-    protected static double evaluate(double[] coefficients, double argument)
-        throws NullArgumentException, NoDataException {
-        MathUtils.checkNotNull(coefficients);
-        int n = coefficients.length;
-        if (n == 0) {
-            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
-        }
-        double result = coefficients[n - 1];
-        for (int j = n - 2; j >= 0; j--) {
-            result = argument * result + coefficients[j];
-        }
-        return result;
-    }
-
-
-    /** {@inheritDoc}
-     * @since 3.1
-     * @throws NoDataException if {@code coefficients} is empty.
-     * @throws NullArgumentException if {@code coefficients} is {@code null}.
-     */
-    public DerivativeStructure value(final DerivativeStructure t)
-        throws NullArgumentException, NoDataException {
-        MathUtils.checkNotNull(coefficients);
-        int n = coefficients.length;
-        if (n == 0) {
-            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
-        }
-        DerivativeStructure result =
-                new DerivativeStructure(t.getFreeParameters(), t.getOrder(), coefficients[n - 1]);
-        for (int j = n - 2; j >= 0; j--) {
-            result = result.multiply(t).add(coefficients[j]);
-        }
-        return result;
-    }
-
-    /**
-     * Add a polynomial to the instance.
-     *
-     * @param p Polynomial to add.
-     * @return a new polynomial which is the sum of the instance and {@code p}.
-     */
-    public PolynomialFunction add(final PolynomialFunction p) {
-        // identify the lowest degree polynomial
-        final int lowLength  = FastMath.min(coefficients.length, p.coefficients.length);
-        final int highLength = FastMath.max(coefficients.length, p.coefficients.length);
-
-        // build the coefficients array
-        double[] newCoefficients = new double[highLength];
-        for (int i = 0; i < lowLength; ++i) {
-            newCoefficients[i] = coefficients[i] + p.coefficients[i];
-        }
-        System.arraycopy((coefficients.length < p.coefficients.length) ?
-                         p.coefficients : coefficients,
-                         lowLength,
-                         newCoefficients, lowLength,
-                         highLength - lowLength);
-
-        return new PolynomialFunction(newCoefficients);
-    }
-
-    /**
-     * Subtract a polynomial from the instance.
-     *
-     * @param p Polynomial to subtract.
-     * @return a new polynomial which is the difference the instance minus {@code p}.
-     */
-    public PolynomialFunction subtract(final PolynomialFunction p) {
-        // identify the lowest degree polynomial
-        int lowLength  = FastMath.min(coefficients.length, p.coefficients.length);
-        int highLength = FastMath.max(coefficients.length, p.coefficients.length);
-
-        // build the coefficients array
-        double[] newCoefficients = new double[highLength];
-        for (int i = 0; i < lowLength; ++i) {
-            newCoefficients[i] = coefficients[i] - p.coefficients[i];
-        }
-        if (coefficients.length < p.coefficients.length) {
-            for (int i = lowLength; i < highLength; ++i) {
-                newCoefficients[i] = -p.coefficients[i];
-            }
-        } else {
-            System.arraycopy(coefficients, lowLength, newCoefficients, lowLength,
-                             highLength - lowLength);
-        }
-
-        return new PolynomialFunction(newCoefficients);
-    }
-
-    /**
-     * Negate the instance.
-     *
-     * @return a new polynomial.
-     */
-    public PolynomialFunction negate() {
-        double[] newCoefficients = new double[coefficients.length];
-        for (int i = 0; i < coefficients.length; ++i) {
-            newCoefficients[i] = -coefficients[i];
-        }
-        return new PolynomialFunction(newCoefficients);
-    }
-
-    /**
-     * Multiply the instance by a polynomial.
-     *
-     * @param p Polynomial to multiply by.
-     * @return a new polynomial.
-     */
-    public PolynomialFunction multiply(final PolynomialFunction p) {
-        double[] newCoefficients = new double[coefficients.length + p.coefficients.length - 1];
-
-        for (int i = 0; i < newCoefficients.length; ++i) {
-            newCoefficients[i] = 0.0;
-            for (int j = FastMath.max(0, i + 1 - p.coefficients.length);
-                 j < FastMath.min(coefficients.length, i + 1);
-                 ++j) {
-                newCoefficients[i] += coefficients[j] * p.coefficients[i-j];
-            }
-        }
-
-        return new PolynomialFunction(newCoefficients);
-    }
-
-    /**
-     * Returns the coefficients of the derivative of the polynomial with the given coefficients.
-     *
-     * @param coefficients Coefficients of the polynomial to differentiate.
-     * @return the coefficients of the derivative or {@code null} if coefficients has length 1.
-     * @throws NoDataException if {@code coefficients} is empty.
-     * @throws NullArgumentException if {@code coefficients} is {@code null}.
-     */
-    protected static double[] differentiate(double[] coefficients)
-        throws NullArgumentException, NoDataException {
-        MathUtils.checkNotNull(coefficients);
-        int n = coefficients.length;
-        if (n == 0) {
-            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
-        }
-        if (n == 1) {
-            return new double[]{0};
-        }
-        double[] result = new double[n - 1];
-        for (int i = n - 1; i > 0; i--) {
-            result[i - 1] = i * coefficients[i];
-        }
-        return result;
-    }
-
-    /**
-     * Returns the derivative as a {@link PolynomialFunction}.
-     *
-     * @return the derivative polynomial.
-     */
-    public PolynomialFunction polynomialDerivative() {
-        return new PolynomialFunction(differentiate(coefficients));
-    }
-
-    /**
-     * Returns the derivative as a {@link UnivariateFunction}.
-     *
-     * @return the derivative function.
-     */
-    public UnivariateFunction derivative() {
-        return polynomialDerivative();
-    }
-
-    /**
-     * Returns a string representation of the polynomial.
-     *
-     * <p>The representation is user oriented. Terms are displayed lowest
-     * degrees first. The multiplications signs, coefficients equals to
-     * one and null terms are not displayed (except if the polynomial is 0,
-     * in which case the 0 constant term is displayed). Addition of terms
-     * with negative coefficients are replaced by subtraction of terms
-     * with positive coefficients except for the first displayed term
-     * (i.e. we display <code>-3</code> for a constant negative polynomial,
-     * but <code>1 - 3 x + x^2</code> if the negative coefficient is not
-     * the first one displayed).</p>
-     *
-     * @return a string representation of the polynomial.
-     */
-    @Override
-    public String toString() {
-        StringBuilder s = new StringBuilder();
-        if (coefficients[0] == 0.0) {
-            if (coefficients.length == 1) {
-                return "0";
-            }
-        } else {
-            s.append(toString(coefficients[0]));
-        }
-
-        for (int i = 1; i < coefficients.length; ++i) {
-            if (coefficients[i] != 0) {
-                if (s.length() > 0) {
-                    if (coefficients[i] < 0) {
-                        s.append(" - ");
-                    } else {
-                        s.append(" + ");
-                    }
-                } else {
-                    if (coefficients[i] < 0) {
-                        s.append("-");
-                    }
-                }
-
-                double absAi = FastMath.abs(coefficients[i]);
-                if ((absAi - 1) != 0) {
-                    s.append(toString(absAi));
-                    s.append(' ');
-                }
-
-                s.append("x");
-                if (i > 1) {
-                    s.append('^');
-                    s.append(Integer.toString(i));
-                }
-            }
-        }
-
-        return s.toString();
-    }
-
-    /**
-     * Creates a string representing a coefficient, removing ".0" endings.
-     *
-     * @param coeff Coefficient.
-     * @return a string representation of {@code coeff}.
-     */
-    private static String toString(double coeff) {
-        final String c = Double.toString(coeff);
-        if (c.endsWith(".0")) {
-            return c.substring(0, c.length() - 2);
-        } else {
-            return c;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int hashCode() {
-        final int prime = 31;
-        int result = 1;
-        result = prime * result + Arrays.hashCode(coefficients);
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof PolynomialFunction)) {
-            return false;
-        }
-        PolynomialFunction other = (PolynomialFunction) obj;
-        if (!Arrays.equals(coefficients, other.coefficients)) {
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Dedicated parametric polynomial class.
-     *
-     * @since 3.0
-     */
-    public static class Parametric implements ParametricUnivariateFunction {
-        /** {@inheritDoc} */
-        public double[] gradient(double x, double ... parameters) {
-            final double[] gradient = new double[parameters.length];
-            double xn = 1.0;
-            for (int i = 0; i < parameters.length; ++i) {
-                gradient[i] = xn;
-                xn *= x;
-            }
-            return gradient;
-        }
-
-        /** {@inheritDoc} */
-        public double value(final double x, final double ... parameters)
-            throws NoDataException {
-            return PolynomialFunction.evaluate(parameters, x);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionLagrangeForm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionLagrangeForm.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionLagrangeForm.java
deleted file mode 100644
index 9d812df..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionLagrangeForm.java
+++ /dev/null
@@ -1,326 +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.analysis.polynomials;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Implements the representation of a real polynomial function in
- * <a href="http://mathworld.wolfram.com/LagrangeInterpolatingPolynomial.html">
- * Lagrange Form</a>. For reference, see <b>Introduction to Numerical
- * Analysis</b>, ISBN 038795452X, chapter 2.
- * <p>
- * The approximated function should be smooth enough for Lagrange polynomial
- * to work well. Otherwise, consider using splines instead.</p>
- *
- * @since 1.2
- */
-public class PolynomialFunctionLagrangeForm implements UnivariateFunction {
-    /**
-     * The coefficients of the polynomial, ordered by degree -- i.e.
-     * coefficients[0] is the constant term and coefficients[n] is the
-     * coefficient of x^n where n is the degree of the polynomial.
-     */
-    private double coefficients[];
-    /**
-     * Interpolating points (abscissas).
-     */
-    private final double x[];
-    /**
-     * Function values at interpolating points.
-     */
-    private final double y[];
-    /**
-     * Whether the polynomial coefficients are available.
-     */
-    private boolean coefficientsComputed;
-
-    /**
-     * Construct a Lagrange polynomial with the given abscissas and function
-     * values. The order of interpolating points are not important.
-     * <p>
-     * The constructor makes copy of the input arrays and assigns them.</p>
-     *
-     * @param x interpolating points
-     * @param y function values at interpolating points
-     * @throws DimensionMismatchException if the array lengths are different.
-     * @throws NumberIsTooSmallException if the number of points is less than 2.
-     * @throws NonMonotonicSequenceException
-     * if two abscissae have the same value.
-     */
-    public PolynomialFunctionLagrangeForm(double x[], double y[])
-        throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
-        this.x = new double[x.length];
-        this.y = new double[y.length];
-        System.arraycopy(x, 0, this.x, 0, x.length);
-        System.arraycopy(y, 0, this.y, 0, y.length);
-        coefficientsComputed = false;
-
-        if (!verifyInterpolationArray(x, y, false)) {
-            MathArrays.sortInPlace(this.x, this.y);
-            // Second check in case some abscissa is duplicated.
-            verifyInterpolationArray(this.x, this.y, true);
-        }
-    }
-
-    /**
-     * Calculate the function value at the given point.
-     *
-     * @param z Point at which the function value is to be computed.
-     * @return the function value.
-     * @throws DimensionMismatchException if {@code x} and {@code y} have
-     * different lengths.
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
-     * if {@code x} is not sorted in strictly increasing order.
-     * @throws NumberIsTooSmallException if the size of {@code x} is less
-     * than 2.
-     */
-    public double value(double z) {
-        return evaluateInternal(x, y, z);
-    }
-
-    /**
-     * Returns the degree of the polynomial.
-     *
-     * @return the degree of the polynomial
-     */
-    public int degree() {
-        return x.length - 1;
-    }
-
-    /**
-     * Returns a copy of the interpolating points array.
-     * <p>
-     * Changes made to the returned copy will not affect the polynomial.</p>
-     *
-     * @return a fresh copy of the interpolating points array
-     */
-    public double[] getInterpolatingPoints() {
-        double[] out = new double[x.length];
-        System.arraycopy(x, 0, out, 0, x.length);
-        return out;
-    }
-
-    /**
-     * Returns a copy of the interpolating values array.
-     * <p>
-     * Changes made to the returned copy will not affect the polynomial.</p>
-     *
-     * @return a fresh copy of the interpolating values array
-     */
-    public double[] getInterpolatingValues() {
-        double[] out = new double[y.length];
-        System.arraycopy(y, 0, out, 0, y.length);
-        return out;
-    }
-
-    /**
-     * Returns a copy of the coefficients array.
-     * <p>
-     * Changes made to the returned copy will not affect the polynomial.</p>
-     * <p>
-     * Note that coefficients computation can be ill-conditioned. Use with caution
-     * and only when it is necessary.</p>
-     *
-     * @return a fresh copy of the coefficients array
-     */
-    public double[] getCoefficients() {
-        if (!coefficientsComputed) {
-            computeCoefficients();
-        }
-        double[] out = new double[coefficients.length];
-        System.arraycopy(coefficients, 0, out, 0, coefficients.length);
-        return out;
-    }
-
-    /**
-     * Evaluate the Lagrange polynomial using
-     * <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html">
-     * Neville's Algorithm</a>. It takes O(n^2) time.
-     *
-     * @param x Interpolating points array.
-     * @param y Interpolating values array.
-     * @param z Point at which the function value is to be computed.
-     * @return the function value.
-     * @throws DimensionMismatchException if {@code x} and {@code y} have
-     * different lengths.
-     * @throws NonMonotonicSequenceException
-     * if {@code x} is not sorted in strictly increasing order.
-     * @throws NumberIsTooSmallException if the size of {@code x} is less
-     * than 2.
-     */
-    public static double evaluate(double x[], double y[], double z)
-        throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
-        if (verifyInterpolationArray(x, y, false)) {
-            return evaluateInternal(x, y, z);
-        }
-
-        // Array is not sorted.
-        final double[] xNew = new double[x.length];
-        final double[] yNew = new double[y.length];
-        System.arraycopy(x, 0, xNew, 0, x.length);
-        System.arraycopy(y, 0, yNew, 0, y.length);
-
-        MathArrays.sortInPlace(xNew, yNew);
-        // Second check in case some abscissa is duplicated.
-        verifyInterpolationArray(xNew, yNew, true);
-        return evaluateInternal(xNew, yNew, z);
-    }
-
-    /**
-     * Evaluate the Lagrange polynomial using
-     * <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html">
-     * Neville's Algorithm</a>. It takes O(n^2) time.
-     *
-     * @param x Interpolating points array.
-     * @param y Interpolating values array.
-     * @param z Point at which the function value is to be computed.
-     * @return the function value.
-     * @throws DimensionMismatchException if {@code x} and {@code y} have
-     * different lengths.
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
-     * if {@code x} is not sorted in strictly increasing order.
-     * @throws NumberIsTooSmallException if the size of {@code x} is less
-     * than 2.
-     */
-    private static double evaluateInternal(double x[], double y[], double z) {
-        int nearest = 0;
-        final int n = x.length;
-        final double[] c = new double[n];
-        final double[] d = new double[n];
-        double min_dist = Double.POSITIVE_INFINITY;
-        for (int i = 0; i < n; i++) {
-            // initialize the difference arrays
-            c[i] = y[i];
-            d[i] = y[i];
-            // find out the abscissa closest to z
-            final double dist = FastMath.abs(z - x[i]);
-            if (dist < min_dist) {
-                nearest = i;
-                min_dist = dist;
-            }
-        }
-
-        // initial approximation to the function value at z
-        double value = y[nearest];
-
-        for (int i = 1; i < n; i++) {
-            for (int j = 0; j < n-i; j++) {
-                final double tc = x[j] - z;
-                final double td = x[i+j] - z;
-                final double divider = x[j] - x[i+j];
-                // update the difference arrays
-                final double w = (c[j+1] - d[j]) / divider;
-                c[j] = tc * w;
-                d[j] = td * w;
-            }
-            // sum up the difference terms to get the final value
-            if (nearest < 0.5*(n-i+1)) {
-                value += c[nearest];    // fork down
-            } else {
-                nearest--;
-                value += d[nearest];    // fork up
-            }
-        }
-
-        return value;
-    }
-
-    /**
-     * Calculate the coefficients of Lagrange polynomial from the
-     * interpolation data. It takes O(n^2) time.
-     * Note that this computation can be ill-conditioned: Use with caution
-     * and only when it is necessary.
-     */
-    protected void computeCoefficients() {
-        final int n = degree() + 1;
-        coefficients = new double[n];
-        for (int i = 0; i < n; i++) {
-            coefficients[i] = 0.0;
-        }
-
-        // c[] are the coefficients of P(x) = (x-x[0])(x-x[1])...(x-x[n-1])
-        final double[] c = new double[n+1];
-        c[0] = 1.0;
-        for (int i = 0; i < n; i++) {
-            for (int j = i; j > 0; j--) {
-                c[j] = c[j-1] - c[j] * x[i];
-            }
-            c[0] *= -x[i];
-            c[i+1] = 1;
-        }
-
-        final double[] tc = new double[n];
-        for (int i = 0; i < n; i++) {
-            // d = (x[i]-x[0])...(x[i]-x[i-1])(x[i]-x[i+1])...(x[i]-x[n-1])
-            double d = 1;
-            for (int j = 0; j < n; j++) {
-                if (i != j) {
-                    d *= x[i] - x[j];
-                }
-            }
-            final double t = y[i] / d;
-            // Lagrange polynomial is the sum of n terms, each of which is a
-            // polynomial of degree n-1. tc[] are the coefficients of the i-th
-            // numerator Pi(x) = (x-x[0])...(x-x[i-1])(x-x[i+1])...(x-x[n-1]).
-            tc[n-1] = c[n];     // actually c[n] = 1
-            coefficients[n-1] += t * tc[n-1];
-            for (int j = n-2; j >= 0; j--) {
-                tc[j] = c[j+1] + tc[j+1] * x[i];
-                coefficients[j] += t * tc[j];
-            }
-        }
-
-        coefficientsComputed = true;
-    }
-
-    /**
-     * Check that the interpolation arrays are valid.
-     * The arrays features checked by this method are that both arrays have the
-     * same length and this length is at least 2.
-     *
-     * @param x Interpolating points array.
-     * @param y Interpolating values array.
-     * @param abort Whether to throw an exception if {@code x} is not sorted.
-     * @throws DimensionMismatchException if the array lengths are different.
-     * @throws NumberIsTooSmallException if the number of points is less than 2.
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
-     * if {@code x} is not sorted in strictly increasing order and {@code abort}
-     * is {@code true}.
-     * @return {@code false} if the {@code x} is not sorted in increasing order,
-     * {@code true} otherwise.
-     * @see #evaluate(double[], double[], double)
-     * @see #computeCoefficients()
-     */
-    public static boolean verifyInterpolationArray(double x[], double y[], boolean abort)
-        throws DimensionMismatchException, NumberIsTooSmallException, NonMonotonicSequenceException {
-        if (x.length != y.length) {
-            throw new DimensionMismatchException(x.length, y.length);
-        }
-        if (x.length < 2) {
-            throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
-        }
-
-        return MathArrays.checkOrder(x, MathArrays.OrderDirection.INCREASING, true, abort);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionNewtonForm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionNewtonForm.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionNewtonForm.java
deleted file mode 100644
index fc2f1fd..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialFunctionNewtonForm.java
+++ /dev/null
@@ -1,245 +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.analysis.polynomials;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Implements the representation of a real polynomial function in
- * Newton Form. For reference, see <b>Elementary Numerical Analysis</b>,
- * ISBN 0070124477, chapter 2.
- * <p>
- * The formula of polynomial in Newton form is
- *     p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... +
- *            a[n](x-c[0])(x-c[1])...(x-c[n-1])
- * Note that the length of a[] is one more than the length of c[]</p>
- *
- * @since 1.2
- */
-public class PolynomialFunctionNewtonForm implements UnivariateDifferentiableFunction {
-
-    /**
-     * The coefficients of the polynomial, ordered by degree -- i.e.
-     * coefficients[0] is the constant term and coefficients[n] is the
-     * coefficient of x^n where n is the degree of the polynomial.
-     */
-    private double coefficients[];
-
-    /**
-     * Centers of the Newton polynomial.
-     */
-    private final double c[];
-
-    /**
-     * When all c[i] = 0, a[] becomes normal polynomial coefficients,
-     * i.e. a[i] = coefficients[i].
-     */
-    private final double a[];
-
-    /**
-     * Whether the polynomial coefficients are available.
-     */
-    private boolean coefficientsComputed;
-
-    /**
-     * Construct a Newton polynomial with the given a[] and c[]. The order of
-     * centers are important in that if c[] shuffle, then values of a[] would
-     * completely change, not just a permutation of old a[].
-     * <p>
-     * The constructor makes copy of the input arrays and assigns them.</p>
-     *
-     * @param a Coefficients in Newton form formula.
-     * @param c Centers.
-     * @throws NullArgumentException if any argument is {@code null}.
-     * @throws NoDataException if any array has zero length.
-     * @throws DimensionMismatchException if the size difference between
-     * {@code a} and {@code c} is not equal to 1.
-     */
-    public PolynomialFunctionNewtonForm(double a[], double c[])
-        throws NullArgumentException, NoDataException, DimensionMismatchException {
-
-        verifyInputArray(a, c);
-        this.a = new double[a.length];
-        this.c = new double[c.length];
-        System.arraycopy(a, 0, this.a, 0, a.length);
-        System.arraycopy(c, 0, this.c, 0, c.length);
-        coefficientsComputed = false;
-    }
-
-    /**
-     * Calculate the function value at the given point.
-     *
-     * @param z Point at which the function value is to be computed.
-     * @return the function value.
-     */
-    public double value(double z) {
-       return evaluate(a, c, z);
-    }
-
-    /**
-     * {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        verifyInputArray(a, c);
-
-        final int n = c.length;
-        DerivativeStructure value = new DerivativeStructure(t.getFreeParameters(), t.getOrder(), a[n]);
-        for (int i = n - 1; i >= 0; i--) {
-            value = t.subtract(c[i]).multiply(value).add(a[i]);
-        }
-
-        return value;
-
-    }
-
-    /**
-     * Returns the degree of the polynomial.
-     *
-     * @return the degree of the polynomial
-     */
-    public int degree() {
-        return c.length;
-    }
-
-    /**
-     * Returns a copy of coefficients in Newton form formula.
-     * <p>
-     * Changes made to the returned copy will not affect the polynomial.</p>
-     *
-     * @return a fresh copy of coefficients in Newton form formula
-     */
-    public double[] getNewtonCoefficients() {
-        double[] out = new double[a.length];
-        System.arraycopy(a, 0, out, 0, a.length);
-        return out;
-    }
-
-    /**
-     * Returns a copy of the centers array.
-     * <p>
-     * Changes made to the returned copy will not affect the polynomial.</p>
-     *
-     * @return a fresh copy of the centers array.
-     */
-    public double[] getCenters() {
-        double[] out = new double[c.length];
-        System.arraycopy(c, 0, out, 0, c.length);
-        return out;
-    }
-
-    /**
-     * Returns a copy of the coefficients array.
-     * <p>
-     * Changes made to the returned copy will not affect the polynomial.</p>
-     *
-     * @return a fresh copy of the coefficients array.
-     */
-    public double[] getCoefficients() {
-        if (!coefficientsComputed) {
-            computeCoefficients();
-        }
-        double[] out = new double[coefficients.length];
-        System.arraycopy(coefficients, 0, out, 0, coefficients.length);
-        return out;
-    }
-
-    /**
-     * Evaluate the Newton polynomial using nested multiplication. It is
-     * also called <a href="http://mathworld.wolfram.com/HornersRule.html">
-     * Horner's Rule</a> and takes O(N) time.
-     *
-     * @param a Coefficients in Newton form formula.
-     * @param c Centers.
-     * @param z Point at which the function value is to be computed.
-     * @return the function value.
-     * @throws NullArgumentException if any argument is {@code null}.
-     * @throws NoDataException if any array has zero length.
-     * @throws DimensionMismatchException if the size difference between
-     * {@code a} and {@code c} is not equal to 1.
-     */
-    public static double evaluate(double a[], double c[], double z)
-        throws NullArgumentException, DimensionMismatchException, NoDataException {
-        verifyInputArray(a, c);
-
-        final int n = c.length;
-        double value = a[n];
-        for (int i = n - 1; i >= 0; i--) {
-            value = a[i] + (z - c[i]) * value;
-        }
-
-        return value;
-    }
-
-    /**
-     * Calculate the normal polynomial coefficients given the Newton form.
-     * It also uses nested multiplication but takes O(N^2) time.
-     */
-    protected void computeCoefficients() {
-        final int n = degree();
-
-        coefficients = new double[n+1];
-        for (int i = 0; i <= n; i++) {
-            coefficients[i] = 0.0;
-        }
-
-        coefficients[0] = a[n];
-        for (int i = n-1; i >= 0; i--) {
-            for (int j = n-i; j > 0; j--) {
-                coefficients[j] = coefficients[j-1] - c[i] * coefficients[j];
-            }
-            coefficients[0] = a[i] - c[i] * coefficients[0];
-        }
-
-        coefficientsComputed = true;
-    }
-
-    /**
-     * Verifies that the input arrays are valid.
-     * <p>
-     * The centers must be distinct for interpolation purposes, but not
-     * for general use. Thus it is not verified here.</p>
-     *
-     * @param a the coefficients in Newton form formula
-     * @param c the centers
-     * @throws NullArgumentException if any argument is {@code null}.
-     * @throws NoDataException if any array has zero length.
-     * @throws DimensionMismatchException if the size difference between
-     * {@code a} and {@code c} is not equal to 1.
-     * @see org.apache.commons.math3.analysis.interpolation.DividedDifferenceInterpolator#computeDividedDifference(double[],
-     * double[])
-     */
-    protected static void verifyInputArray(double a[], double c[])
-        throws NullArgumentException, NoDataException, DimensionMismatchException {
-        MathUtils.checkNotNull(a);
-        MathUtils.checkNotNull(c);
-        if (a.length == 0 || c.length == 0) {
-            throw new NoDataException(LocalizedFormats.EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY);
-        }
-        if (a.length != c.length + 1) {
-            throw new DimensionMismatchException(LocalizedFormats.ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1,
-                                                 a.length, c.length);
-        }
-    }
-
-}


[15/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java
deleted file mode 100644
index 46268f5..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java
+++ /dev/null
@@ -1,1160 +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.geometry.euclidean.twod;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-
-/** This class represents a 2D region: a set of polygons.
- * @since 3.0
- */
-public class PolygonsSet extends AbstractRegion<Euclidean2D, Euclidean1D> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Vertices organized as boundary loops. */
-    private Vector2D[][] vertices;
-
-    /** Build a polygons set representing the whole plane.
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolygonsSet(final double tolerance) {
-        super(tolerance);
-    }
-
-    /** Build a polygons set from a BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * <p>
-     * This constructor is aimed at expert use, as building the tree may
-     * be a difficult task. It is not intended for general use and for
-     * performances reasons does not check thoroughly its input, as this would
-     * require walking the full tree each time. Failing to provide a tree with
-     * the proper attributes, <em>will</em> therefore generate problems like
-     * {@link NullPointerException} or {@link ClassCastException} only later on.
-     * This limitation is known and explains why this constructor is for expert
-     * use only. The caller does have the responsibility to provided correct arguments.
-     * </p>
-     * @param tree inside/outside BSP tree representing the region
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolygonsSet(final BSPTree<Euclidean2D> tree, final double tolerance) {
-        super(tree, tolerance);
-    }
-
-    /** Build a polygons set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polygons with holes
-     * or a set of disjoint polygons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
-     * checkPoint} method will not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements, as a
-     * collection of {@link SubHyperplane SubHyperplane} objects
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolygonsSet(final Collection<SubHyperplane<Euclidean2D>> boundary, final double tolerance) {
-        super(boundary, tolerance);
-    }
-
-    /** Build a parallellepipedic box.
-     * @param xMin low bound along the x direction
-     * @param xMax high bound along the x direction
-     * @param yMin low bound along the y direction
-     * @param yMax high bound along the y direction
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolygonsSet(final double xMin, final double xMax,
-                       final double yMin, final double yMax,
-                       final double tolerance) {
-        super(boxBoundary(xMin, xMax, yMin, yMax, tolerance), tolerance);
-    }
-
-    /** Build a polygon from a simple list of vertices.
-     * <p>The boundary is provided as a list of points considering to
-     * represent the vertices of a simple loop. The interior part of the
-     * region is on the left side of this path and the exterior is on its
-     * right side.</p>
-     * <p>This constructor does not handle polygons with a boundary
-     * forming several disconnected paths (such as polygons with holes).</p>
-     * <p>For cases where this simple constructor applies, it is expected to
-     * be numerically more robust than the {@link #PolygonsSet(Collection) general
-     * constructor} using {@link SubHyperplane subhyperplanes}.</p>
-     * <p>If the list is empty, the region will represent the whole
-     * space.</p>
-     * <p>
-     * Polygons with thin pikes or dents are inherently difficult to handle because
-     * they involve lines with almost opposite directions at some vertices. Polygons
-     * whose vertices come from some physical measurement with noise are also
-     * difficult because an edge that should be straight may be broken in lots of
-     * different pieces with almost equal directions. In both cases, computing the
-     * lines intersections is not numerically robust due to the almost 0 or almost
-     * &pi; angle. Such cases need to carefully adjust the {@code hyperplaneThickness}
-     * parameter. A too small value would often lead to completely wrong polygons
-     * with large area wrongly identified as inside or outside. Large values are
-     * often much safer. As a rule of thumb, a value slightly below the size of the
-     * most accurate detail needed is a good value for the {@code hyperplaneThickness}
-     * parameter.
-     * </p>
-     * @param hyperplaneThickness tolerance below which points are considered to
-     * belong to the hyperplane (which is therefore more a slab)
-     * @param vertices vertices of the simple loop boundary
-     */
-    public PolygonsSet(final double hyperplaneThickness, final Vector2D ... vertices) {
-        super(verticesToTree(hyperplaneThickness, vertices), hyperplaneThickness);
-    }
-
-    /** Build a polygons set representing the whole real line.
-     * @deprecated as of 3.3, replaced with {@link #PolygonsSet(double)}
-     */
-    @Deprecated
-    public PolygonsSet() {
-        this(DEFAULT_TOLERANCE);
-    }
-
-    /** Build a polygons set from a BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * @param tree inside/outside BSP tree representing the region
-     * @deprecated as of 3.3, replaced with {@link #PolygonsSet(BSPTree, double)}
-     */
-    @Deprecated
-    public PolygonsSet(final BSPTree<Euclidean2D> tree) {
-        this(tree, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a polygons set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polygons with holes
-     * or a set of disjoint polygons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
-     * checkPoint} method will not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements, as a
-     * collection of {@link SubHyperplane SubHyperplane} objects
-     * @deprecated as of 3.3, replaced with {@link #PolygonsSet(Collection, double)}
-     */
-    @Deprecated
-    public PolygonsSet(final Collection<SubHyperplane<Euclidean2D>> boundary) {
-        this(boundary, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a parallellepipedic box.
-     * @param xMin low bound along the x direction
-     * @param xMax high bound along the x direction
-     * @param yMin low bound along the y direction
-     * @param yMax high bound along the y direction
-     * @deprecated as of 3.3, replaced with {@link #PolygonsSet(double, double, double, double, double)}
-     */
-    @Deprecated
-    public PolygonsSet(final double xMin, final double xMax,
-                       final double yMin, final double yMax) {
-        this(xMin, xMax, yMin, yMax, DEFAULT_TOLERANCE);
-    }
-
-    /** Create a list of hyperplanes representing the boundary of a box.
-     * @param xMin low bound along the x direction
-     * @param xMax high bound along the x direction
-     * @param yMin low bound along the y direction
-     * @param yMax high bound along the y direction
-     * @param tolerance tolerance below which points are considered identical
-     * @return boundary of the box
-     */
-    private static Line[] boxBoundary(final double xMin, final double xMax,
-                                      final double yMin, final double yMax,
-                                      final double tolerance) {
-        if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance)) {
-            // too thin box, build an empty polygons set
-            return null;
-        }
-        final Vector2D minMin = new Vector2D(xMin, yMin);
-        final Vector2D minMax = new Vector2D(xMin, yMax);
-        final Vector2D maxMin = new Vector2D(xMax, yMin);
-        final Vector2D maxMax = new Vector2D(xMax, yMax);
-        return new Line[] {
-            new Line(minMin, maxMin, tolerance),
-            new Line(maxMin, maxMax, tolerance),
-            new Line(maxMax, minMax, tolerance),
-            new Line(minMax, minMin, tolerance)
-        };
-    }
-
-    /** Build the BSP tree of a polygons set from a simple list of vertices.
-     * <p>The boundary is provided as a list of points considering to
-     * represent the vertices of a simple loop. The interior part of the
-     * region is on the left side of this path and the exterior is on its
-     * right side.</p>
-     * <p>This constructor does not handle polygons with a boundary
-     * forming several disconnected paths (such as polygons with holes).</p>
-     * <p>For cases where this simple constructor applies, it is expected to
-     * be numerically more robust than the {@link #PolygonsSet(Collection) general
-     * constructor} using {@link SubHyperplane subhyperplanes}.</p>
-     * @param hyperplaneThickness tolerance below which points are consider to
-     * belong to the hyperplane (which is therefore more a slab)
-     * @param vertices vertices of the simple loop boundary
-     * @return the BSP tree of the input vertices
-     */
-    private static BSPTree<Euclidean2D> verticesToTree(final double hyperplaneThickness,
-                                                       final Vector2D ... vertices) {
-
-        final int n = vertices.length;
-        if (n == 0) {
-            // the tree represents the whole space
-            return new BSPTree<Euclidean2D>(Boolean.TRUE);
-        }
-
-        // build the vertices
-        final Vertex[] vArray = new Vertex[n];
-        for (int i = 0; i < n; ++i) {
-            vArray[i] = new Vertex(vertices[i]);
-        }
-
-        // build the edges
-        List<Edge> edges = new ArrayList<Edge>(n);
-        for (int i = 0; i < n; ++i) {
-
-            // get the endpoints of the edge
-            final Vertex start = vArray[i];
-            final Vertex end   = vArray[(i + 1) % n];
-
-            // get the line supporting the edge, taking care not to recreate it
-            // if it was already created earlier due to another edge being aligned
-            // with the current one
-            Line line = start.sharedLineWith(end);
-            if (line == null) {
-                line = new Line(start.getLocation(), end.getLocation(), hyperplaneThickness);
-            }
-
-            // create the edge and store it
-            edges.add(new Edge(start, end, line));
-
-            // check if another vertex also happens to be on this line
-            for (final Vertex vertex : vArray) {
-                if (vertex != start && vertex != end &&
-                    FastMath.abs(line.getOffset((Point<Euclidean2D>) vertex.getLocation())) <= hyperplaneThickness) {
-                    vertex.bindWith(line);
-                }
-            }
-
-        }
-
-        // build the tree top-down
-        final BSPTree<Euclidean2D> tree = new BSPTree<Euclidean2D>();
-        insertEdges(hyperplaneThickness, tree, edges);
-
-        return tree;
-
-    }
-
-    /** Recursively build a tree by inserting cut sub-hyperplanes.
-     * @param hyperplaneThickness tolerance below which points are consider to
-     * belong to the hyperplane (which is therefore more a slab)
-     * @param node current tree node (it is a leaf node at the beginning
-     * of the call)
-     * @param edges list of edges to insert in the cell defined by this node
-     * (excluding edges not belonging to the cell defined by this node)
-     */
-    private static void insertEdges(final double hyperplaneThickness,
-                                    final BSPTree<Euclidean2D> node,
-                                    final List<Edge> edges) {
-
-        // find an edge with an hyperplane that can be inserted in the node
-        int index = 0;
-        Edge inserted =null;
-        while (inserted == null && index < edges.size()) {
-            inserted = edges.get(index++);
-            if (inserted.getNode() == null) {
-                if (node.insertCut(inserted.getLine())) {
-                    inserted.setNode(node);
-                } else {
-                    inserted = null;
-                }
-            } else {
-                inserted = null;
-            }
-        }
-
-        if (inserted == null) {
-            // no suitable edge was found, the node remains a leaf node
-            // we need to set its inside/outside boolean indicator
-            final BSPTree<Euclidean2D> parent = node.getParent();
-            if (parent == null || node == parent.getMinus()) {
-                node.setAttribute(Boolean.TRUE);
-            } else {
-                node.setAttribute(Boolean.FALSE);
-            }
-            return;
-        }
-
-        // we have split the node by inserting an edge as a cut sub-hyperplane
-        // distribute the remaining edges in the two sub-trees
-        final List<Edge> plusList  = new ArrayList<Edge>();
-        final List<Edge> minusList = new ArrayList<Edge>();
-        for (final Edge edge : edges) {
-            if (edge != inserted) {
-                final double startOffset = inserted.getLine().getOffset((Point<Euclidean2D>) edge.getStart().getLocation());
-                final double endOffset   = inserted.getLine().getOffset((Point<Euclidean2D>) edge.getEnd().getLocation());
-                Side startSide = (FastMath.abs(startOffset) <= hyperplaneThickness) ?
-                                 Side.HYPER : ((startOffset < 0) ? Side.MINUS : Side.PLUS);
-                Side endSide   = (FastMath.abs(endOffset) <= hyperplaneThickness) ?
-                                 Side.HYPER : ((endOffset < 0) ? Side.MINUS : Side.PLUS);
-                switch (startSide) {
-                    case PLUS:
-                        if (endSide == Side.MINUS) {
-                            // we need to insert a split point on the hyperplane
-                            final Vertex splitPoint = edge.split(inserted.getLine());
-                            minusList.add(splitPoint.getOutgoing());
-                            plusList.add(splitPoint.getIncoming());
-                        } else {
-                            plusList.add(edge);
-                        }
-                        break;
-                    case MINUS:
-                        if (endSide == Side.PLUS) {
-                            // we need to insert a split point on the hyperplane
-                            final Vertex splitPoint = edge.split(inserted.getLine());
-                            minusList.add(splitPoint.getIncoming());
-                            plusList.add(splitPoint.getOutgoing());
-                        } else {
-                            minusList.add(edge);
-                        }
-                        break;
-                    default:
-                        if (endSide == Side.PLUS) {
-                            plusList.add(edge);
-                        } else if (endSide == Side.MINUS) {
-                            minusList.add(edge);
-                        }
-                        break;
-                }
-            }
-        }
-
-        // recurse through lower levels
-        if (!plusList.isEmpty()) {
-            insertEdges(hyperplaneThickness, node.getPlus(),  plusList);
-        } else {
-            node.getPlus().setAttribute(Boolean.FALSE);
-        }
-        if (!minusList.isEmpty()) {
-            insertEdges(hyperplaneThickness, node.getMinus(), minusList);
-        } else {
-            node.getMinus().setAttribute(Boolean.TRUE);
-        }
-
-    }
-
-    /** Internal class for holding vertices while they are processed to build a BSP tree. */
-    private static class Vertex {
-
-        /** Vertex location. */
-        private final Vector2D location;
-
-        /** Incoming edge. */
-        private Edge incoming;
-
-        /** Outgoing edge. */
-        private Edge outgoing;
-
-        /** Lines bound with this vertex. */
-        private final List<Line> lines;
-
-        /** Build a non-processed vertex not owned by any node yet.
-         * @param location vertex location
-         */
-        public Vertex(final Vector2D location) {
-            this.location = location;
-            this.incoming = null;
-            this.outgoing = null;
-            this.lines    = new ArrayList<Line>();
-        }
-
-        /** Get Vertex location.
-         * @return vertex location
-         */
-        public Vector2D getLocation() {
-            return location;
-        }
-
-        /** Bind a line considered to contain this vertex.
-         * @param line line to bind with this vertex
-         */
-        public void bindWith(final Line line) {
-            lines.add(line);
-        }
-
-        /** Get the common line bound with both the instance and another vertex, if any.
-         * <p>
-         * When two vertices are both bound to the same line, this means they are
-         * already handled by node associated with this line, so there is no need
-         * to create a cut hyperplane for them.
-         * </p>
-         * @param vertex other vertex to check instance against
-         * @return line bound with both the instance and another vertex, or null if the
-         * two vertices do not share a line yet
-         */
-        public Line sharedLineWith(final Vertex vertex) {
-            for (final Line line1 : lines) {
-                for (final Line line2 : vertex.lines) {
-                    if (line1 == line2) {
-                        return line1;
-                    }
-                }
-            }
-            return null;
-        }
-
-        /** Set incoming edge.
-         * <p>
-         * The line supporting the incoming edge is automatically bound
-         * with the instance.
-         * </p>
-         * @param incoming incoming edge
-         */
-        public void setIncoming(final Edge incoming) {
-            this.incoming = incoming;
-            bindWith(incoming.getLine());
-        }
-
-        /** Get incoming edge.
-         * @return incoming edge
-         */
-        public Edge getIncoming() {
-            return incoming;
-        }
-
-        /** Set outgoing edge.
-         * <p>
-         * The line supporting the outgoing edge is automatically bound
-         * with the instance.
-         * </p>
-         * @param outgoing outgoing edge
-         */
-        public void setOutgoing(final Edge outgoing) {
-            this.outgoing = outgoing;
-            bindWith(outgoing.getLine());
-        }
-
-        /** Get outgoing edge.
-         * @return outgoing edge
-         */
-        public Edge getOutgoing() {
-            return outgoing;
-        }
-
-    }
-
-    /** Internal class for holding edges while they are processed to build a BSP tree. */
-    private static class Edge {
-
-        /** Start vertex. */
-        private final Vertex start;
-
-        /** End vertex. */
-        private final Vertex end;
-
-        /** Line supporting the edge. */
-        private final Line line;
-
-        /** Node whose cut hyperplane contains this edge. */
-        private BSPTree<Euclidean2D> node;
-
-        /** Build an edge not contained in any node yet.
-         * @param start start vertex
-         * @param end end vertex
-         * @param line line supporting the edge
-         */
-        public Edge(final Vertex start, final Vertex end, final Line line) {
-
-            this.start = start;
-            this.end   = end;
-            this.line  = line;
-            this.node  = null;
-
-            // connect the vertices back to the edge
-            start.setOutgoing(this);
-            end.setIncoming(this);
-
-        }
-
-        /** Get start vertex.
-         * @return start vertex
-         */
-        public Vertex getStart() {
-            return start;
-        }
-
-        /** Get end vertex.
-         * @return end vertex
-         */
-        public Vertex getEnd() {
-            return end;
-        }
-
-        /** Get the line supporting this edge.
-         * @return line supporting this edge
-         */
-        public Line getLine() {
-            return line;
-        }
-
-        /** Set the node whose cut hyperplane contains this edge.
-         * @param node node whose cut hyperplane contains this edge
-         */
-        public void setNode(final BSPTree<Euclidean2D> node) {
-            this.node = node;
-        }
-
-        /** Get the node whose cut hyperplane contains this edge.
-         * @return node whose cut hyperplane contains this edge
-         * (null if edge has not yet been inserted into the BSP tree)
-         */
-        public BSPTree<Euclidean2D> getNode() {
-            return node;
-        }
-
-        /** Split the edge.
-         * <p>
-         * Once split, this edge is not referenced anymore by the vertices,
-         * it is replaced by the two half-edges and an intermediate splitting
-         * vertex is introduced to connect these two halves.
-         * </p>
-         * @param splitLine line splitting the edge in two halves
-         * @return split vertex (its incoming and outgoing edges are the two halves)
-         */
-        public Vertex split(final Line splitLine) {
-            final Vertex splitVertex = new Vertex(line.intersection(splitLine));
-            splitVertex.bindWith(splitLine);
-            final Edge startHalf = new Edge(start, splitVertex, line);
-            final Edge endHalf   = new Edge(splitVertex, end, line);
-            startHalf.node = node;
-            endHalf.node   = node;
-            return splitVertex;
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public PolygonsSet buildNew(final BSPTree<Euclidean2D> tree) {
-        return new PolygonsSet(tree, getTolerance());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void computeGeometricalProperties() {
-
-        final Vector2D[][] v = getVertices();
-
-        if (v.length == 0) {
-            final BSPTree<Euclidean2D> tree = getTree(false);
-            if (tree.getCut() == null && (Boolean) tree.getAttribute()) {
-                // the instance covers the whole space
-                setSize(Double.POSITIVE_INFINITY);
-                setBarycenter((Point<Euclidean2D>) Vector2D.NaN);
-            } else {
-                setSize(0);
-                setBarycenter((Point<Euclidean2D>) new Vector2D(0, 0));
-            }
-        } else if (v[0][0] == null) {
-            // there is at least one open-loop: the polygon is infinite
-            setSize(Double.POSITIVE_INFINITY);
-            setBarycenter((Point<Euclidean2D>) Vector2D.NaN);
-        } else {
-            // all loops are closed, we compute some integrals around the shape
-
-            double sum  = 0;
-            double sumX = 0;
-            double sumY = 0;
-
-            for (Vector2D[] loop : v) {
-                double x1 = loop[loop.length - 1].getX();
-                double y1 = loop[loop.length - 1].getY();
-                for (final Vector2D point : loop) {
-                    final double x0 = x1;
-                    final double y0 = y1;
-                    x1 = point.getX();
-                    y1 = point.getY();
-                    final double factor = x0 * y1 - y0 * x1;
-                    sum  += factor;
-                    sumX += factor * (x0 + x1);
-                    sumY += factor * (y0 + y1);
-                }
-            }
-
-            if (sum < 0) {
-                // the polygon as a finite outside surrounded by an infinite inside
-                setSize(Double.POSITIVE_INFINITY);
-                setBarycenter((Point<Euclidean2D>) Vector2D.NaN);
-            } else {
-                setSize(sum / 2);
-                setBarycenter((Point<Euclidean2D>) new Vector2D(sumX / (3 * sum), sumY / (3 * sum)));
-            }
-
-        }
-
-    }
-
-    /** Get the vertices of the polygon.
-     * <p>The polygon boundary can be represented as an array of loops,
-     * each loop being itself an array of vertices.</p>
-     * <p>In order to identify open loops which start and end by
-     * infinite edges, the open loops arrays start with a null point. In
-     * this case, the first non null point and the last point of the
-     * array do not represent real vertices, they are dummy points
-     * intended only to get the direction of the first and last edge. An
-     * open loop consisting of a single infinite line will therefore be
-     * represented by a three elements array with one null point
-     * followed by two dummy points. The open loops are always the first
-     * ones in the loops array.</p>
-     * <p>If the polygon has no boundary at all, a zero length loop
-     * array will be returned.</p>
-     * <p>All line segments in the various loops have the inside of the
-     * region on their left side and the outside on their right side
-     * when moving in the underlying line direction. This means that
-     * closed loops surrounding finite areas obey the direct
-     * trigonometric orientation.</p>
-     * @return vertices of the polygon, organized as oriented boundary
-     * loops with the open loops first (the returned value is guaranteed
-     * to be non-null)
-     */
-    public Vector2D[][] getVertices() {
-        if (vertices == null) {
-            if (getTree(false).getCut() == null) {
-                vertices = new Vector2D[0][];
-            } else {
-
-                // build the unconnected segments
-                final SegmentsBuilder visitor = new SegmentsBuilder(getTolerance());
-                getTree(true).visit(visitor);
-                final List<ConnectableSegment> segments = visitor.getSegments();
-
-                // connect all segments, using topological criteria first
-                // and using Euclidean distance only as a last resort
-                int pending = segments.size();
-                pending -= naturalFollowerConnections(segments);
-                if (pending > 0) {
-                    pending -= splitEdgeConnections(segments);
-                }
-                if (pending > 0) {
-                    pending -= closeVerticesConnections(segments);
-                }
-
-                // create the segment loops
-                final ArrayList<List<Segment>> loops = new ArrayList<List<Segment>>();
-                for (ConnectableSegment s = getUnprocessed(segments); s != null; s = getUnprocessed(segments)) {
-                    final List<Segment> loop = followLoop(s);
-                    if (loop != null) {
-                        if (loop.get(0).getStart() == null) {
-                            // this is an open loop, we put it on the front
-                            loops.add(0, loop);
-                        } else {
-                            // this is a closed loop, we put it on the back
-                            loops.add(loop);
-                        }
-                    }
-                }
-
-                // transform the loops in an array of arrays of points
-                vertices = new Vector2D[loops.size()][];
-                int i = 0;
-
-                for (final List<Segment> loop : loops) {
-                    if (loop.size() < 2 ||
-                        (loop.size() == 2 && loop.get(0).getStart() == null && loop.get(1).getEnd() == null)) {
-                        // single infinite line
-                        final Line line = loop.get(0).getLine();
-                        vertices[i++] = new Vector2D[] {
-                            null,
-                            line.toSpace((Point<Euclidean1D>) new Vector1D(-Float.MAX_VALUE)),
-                            line.toSpace((Point<Euclidean1D>) new Vector1D(+Float.MAX_VALUE))
-                        };
-                    } else if (loop.get(0).getStart() == null) {
-                        // open loop with at least one real point
-                        final Vector2D[] array = new Vector2D[loop.size() + 2];
-                        int j = 0;
-                        for (Segment segment : loop) {
-
-                            if (j == 0) {
-                                // null point and first dummy point
-                                double x = segment.getLine().toSubSpace((Point<Euclidean2D>) segment.getEnd()).getX();
-                                x -= FastMath.max(1.0, FastMath.abs(x / 2));
-                                array[j++] = null;
-                                array[j++] = segment.getLine().toSpace((Point<Euclidean1D>) new Vector1D(x));
-                            }
-
-                            if (j < (array.length - 1)) {
-                                // current point
-                                array[j++] = segment.getEnd();
-                            }
-
-                            if (j == (array.length - 1)) {
-                                // last dummy point
-                                double x = segment.getLine().toSubSpace((Point<Euclidean2D>) segment.getStart()).getX();
-                                x += FastMath.max(1.0, FastMath.abs(x / 2));
-                                array[j++] = segment.getLine().toSpace((Point<Euclidean1D>) new Vector1D(x));
-                            }
-
-                        }
-                        vertices[i++] = array;
-                    } else {
-                        final Vector2D[] array = new Vector2D[loop.size()];
-                        int j = 0;
-                        for (Segment segment : loop) {
-                            array[j++] = segment.getStart();
-                        }
-                        vertices[i++] = array;
-                    }
-                }
-
-            }
-        }
-
-        return vertices.clone();
-
-    }
-
-    /** Connect the segments using only natural follower information.
-     * @param segments segments complete segments list
-     * @return number of connections performed
-     */
-    private int naturalFollowerConnections(final List<ConnectableSegment> segments) {
-        int connected = 0;
-        for (final ConnectableSegment segment : segments) {
-            if (segment.getNext() == null) {
-                final BSPTree<Euclidean2D> node = segment.getNode();
-                final BSPTree<Euclidean2D> end  = segment.getEndNode();
-                for (final ConnectableSegment candidateNext : segments) {
-                    if (candidateNext.getPrevious()  == null &&
-                        candidateNext.getNode()      == end &&
-                        candidateNext.getStartNode() == node) {
-                        // connect the two segments
-                        segment.setNext(candidateNext);
-                        candidateNext.setPrevious(segment);
-                        ++connected;
-                        break;
-                    }
-                }
-            }
-        }
-        return connected;
-    }
-
-    /** Connect the segments resulting from a line splitting a straight edge.
-     * @param segments segments complete segments list
-     * @return number of connections performed
-     */
-    private int splitEdgeConnections(final List<ConnectableSegment> segments) {
-        int connected = 0;
-        for (final ConnectableSegment segment : segments) {
-            if (segment.getNext() == null) {
-                final Hyperplane<Euclidean2D> hyperplane = segment.getNode().getCut().getHyperplane();
-                final BSPTree<Euclidean2D> end  = segment.getEndNode();
-                for (final ConnectableSegment candidateNext : segments) {
-                    if (candidateNext.getPrevious()                      == null &&
-                        candidateNext.getNode().getCut().getHyperplane() == hyperplane &&
-                        candidateNext.getStartNode()                     == end) {
-                        // connect the two segments
-                        segment.setNext(candidateNext);
-                        candidateNext.setPrevious(segment);
-                        ++connected;
-                        break;
-                    }
-                }
-            }
-        }
-        return connected;
-    }
-
-    /** Connect the segments using Euclidean distance.
-     * <p>
-     * This connection heuristic should be used last, as it relies
-     * only on a fuzzy distance criterion.
-     * </p>
-     * @param segments segments complete segments list
-     * @return number of connections performed
-     */
-    private int closeVerticesConnections(final List<ConnectableSegment> segments) {
-        int connected = 0;
-        for (final ConnectableSegment segment : segments) {
-            if (segment.getNext() == null && segment.getEnd() != null) {
-                final Vector2D end = segment.getEnd();
-                ConnectableSegment selectedNext = null;
-                double min = Double.POSITIVE_INFINITY;
-                for (final ConnectableSegment candidateNext : segments) {
-                    if (candidateNext.getPrevious() == null && candidateNext.getStart() != null) {
-                        final double distance = Vector2D.distance(end, candidateNext.getStart());
-                        if (distance < min) {
-                            selectedNext = candidateNext;
-                            min          = distance;
-                        }
-                    }
-                }
-                if (min <= getTolerance()) {
-                    // connect the two segments
-                    segment.setNext(selectedNext);
-                    selectedNext.setPrevious(segment);
-                    ++connected;
-                }
-            }
-        }
-        return connected;
-    }
-
-    /** Get first unprocessed segment from a list.
-     * @param segments segments list
-     * @return first segment that has not been processed yet
-     * or null if all segments have been processed
-     */
-    private ConnectableSegment getUnprocessed(final List<ConnectableSegment> segments) {
-        for (final ConnectableSegment segment : segments) {
-            if (!segment.isProcessed()) {
-                return segment;
-            }
-        }
-        return null;
-    }
-
-    /** Build the loop containing a segment.
-     * <p>
-     * The segment put in the loop will be marked as processed.
-     * </p>
-     * @param defining segment used to define the loop
-     * @return loop containing the segment (may be null if the loop is a
-     * degenerated infinitely thin 2 points loop
-     */
-    private List<Segment> followLoop(final ConnectableSegment defining) {
-
-        final List<Segment> loop = new ArrayList<Segment>();
-        loop.add(defining);
-        defining.setProcessed(true);
-
-        // add segments in connection order
-        ConnectableSegment next = defining.getNext();
-        while (next != defining && next != null) {
-            loop.add(next);
-            next.setProcessed(true);
-            next = next.getNext();
-        }
-
-        if (next == null) {
-            // the loop is open and we have found its end,
-            // we need to find its start too
-            ConnectableSegment previous = defining.getPrevious();
-            while (previous != null) {
-                loop.add(0, previous);
-                previous.setProcessed(true);
-                previous = previous.getPrevious();
-            }
-        }
-
-        // filter out spurious vertices
-        filterSpuriousVertices(loop);
-
-        if (loop.size() == 2 && loop.get(0).getStart() != null) {
-            // this is a degenerated infinitely thin closed loop, we simply ignore it
-            return null;
-        } else {
-            return loop;
-        }
-
-    }
-
-    /** Filter out spurious vertices on straight lines (at machine precision).
-     * @param loop segments loop to filter (will be modified in-place)
-     */
-    private void filterSpuriousVertices(final List<Segment> loop) {
-        for (int i = 0; i < loop.size(); ++i) {
-            final Segment previous = loop.get(i);
-            int j = (i + 1) % loop.size();
-            final Segment next = loop.get(j);
-            if (next != null &&
-                Precision.equals(previous.getLine().getAngle(), next.getLine().getAngle(), Precision.EPSILON)) {
-                // the vertex between the two edges is a spurious one
-                // replace the two segments by a single one
-                loop.set(j, new Segment(previous.getStart(), next.getEnd(), previous.getLine()));
-                loop.remove(i--);
-            }
-        }
-    }
-
-    /** Private extension of Segment allowing connection. */
-    private static class ConnectableSegment extends Segment {
-
-        /** Node containing segment. */
-        private final BSPTree<Euclidean2D> node;
-
-        /** Node whose intersection with current node defines start point. */
-        private final BSPTree<Euclidean2D> startNode;
-
-        /** Node whose intersection with current node defines end point. */
-        private final BSPTree<Euclidean2D> endNode;
-
-        /** Previous segment. */
-        private ConnectableSegment previous;
-
-        /** Next segment. */
-        private ConnectableSegment next;
-
-        /** Indicator for completely processed segments. */
-        private boolean processed;
-
-        /** Build a segment.
-         * @param start start point of the segment
-         * @param end end point of the segment
-         * @param line line containing the segment
-         * @param node node containing the segment
-         * @param startNode node whose intersection with current node defines start point
-         * @param endNode node whose intersection with current node defines end point
-         */
-        public ConnectableSegment(final Vector2D start, final Vector2D end, final Line line,
-                                  final BSPTree<Euclidean2D> node,
-                                  final BSPTree<Euclidean2D> startNode,
-                                  final BSPTree<Euclidean2D> endNode) {
-            super(start, end, line);
-            this.node      = node;
-            this.startNode = startNode;
-            this.endNode   = endNode;
-            this.previous  = null;
-            this.next      = null;
-            this.processed = false;
-        }
-
-        /** Get the node containing segment.
-         * @return node containing segment
-         */
-        public BSPTree<Euclidean2D> getNode() {
-            return node;
-        }
-
-        /** Get the node whose intersection with current node defines start point.
-         * @return node whose intersection with current node defines start point
-         */
-        public BSPTree<Euclidean2D> getStartNode() {
-            return startNode;
-        }
-
-        /** Get the node whose intersection with current node defines end point.
-         * @return node whose intersection with current node defines end point
-         */
-        public BSPTree<Euclidean2D> getEndNode() {
-            return endNode;
-        }
-
-        /** Get the previous segment.
-         * @return previous segment
-         */
-        public ConnectableSegment getPrevious() {
-            return previous;
-        }
-
-        /** Set the previous segment.
-         * @param previous previous segment
-         */
-        public void setPrevious(final ConnectableSegment previous) {
-            this.previous = previous;
-        }
-
-        /** Get the next segment.
-         * @return next segment
-         */
-        public ConnectableSegment getNext() {
-            return next;
-        }
-
-        /** Set the next segment.
-         * @param next previous segment
-         */
-        public void setNext(final ConnectableSegment next) {
-            this.next = next;
-        }
-
-        /** Set the processed flag.
-         * @param processed processed flag to set
-         */
-        public void setProcessed(final boolean processed) {
-            this.processed = processed;
-        }
-
-        /** Check if the segment has been processed.
-         * @return true if the segment has been processed
-         */
-        public boolean isProcessed() {
-            return processed;
-        }
-
-    }
-
-    /** Visitor building segments. */
-    private static class SegmentsBuilder implements BSPTreeVisitor<Euclidean2D> {
-
-        /** Tolerance for close nodes connection. */
-        private final double tolerance;
-
-        /** Built segments. */
-        private final List<ConnectableSegment> segments;
-
-        /** Simple constructor.
-         * @param tolerance tolerance for close nodes connection
-         */
-        public SegmentsBuilder(final double tolerance) {
-            this.tolerance = tolerance;
-            this.segments  = new ArrayList<ConnectableSegment>();
-        }
-
-        /** {@inheritDoc} */
-        public Order visitOrder(final BSPTree<Euclidean2D> node) {
-            return Order.MINUS_SUB_PLUS;
-        }
-
-        /** {@inheritDoc} */
-        public void visitInternalNode(final BSPTree<Euclidean2D> node) {
-            @SuppressWarnings("unchecked")
-            final BoundaryAttribute<Euclidean2D> attribute = (BoundaryAttribute<Euclidean2D>) node.getAttribute();
-            final Iterable<BSPTree<Euclidean2D>> splitters = attribute.getSplitters();
-            if (attribute.getPlusOutside() != null) {
-                addContribution(attribute.getPlusOutside(), node, splitters, false);
-            }
-            if (attribute.getPlusInside() != null) {
-                addContribution(attribute.getPlusInside(), node, splitters, true);
-            }
-        }
-
-        /** {@inheritDoc} */
-        public void visitLeafNode(final BSPTree<Euclidean2D> node) {
-        }
-
-        /** Add the contribution of a boundary facet.
-         * @param sub boundary facet
-         * @param node node containing segment
-         * @param splitters splitters for the boundary facet
-         * @param reversed if true, the facet has the inside on its plus side
-         */
-        private void addContribution(final SubHyperplane<Euclidean2D> sub,
-                                     final BSPTree<Euclidean2D> node,
-                                     final Iterable<BSPTree<Euclidean2D>> splitters,
-                                     final boolean reversed) {
-            @SuppressWarnings("unchecked")
-            final AbstractSubHyperplane<Euclidean2D, Euclidean1D> absSub =
-                (AbstractSubHyperplane<Euclidean2D, Euclidean1D>) sub;
-            final Line line      = (Line) sub.getHyperplane();
-            final List<Interval> intervals = ((IntervalsSet) absSub.getRemainingRegion()).asList();
-            for (final Interval i : intervals) {
-
-                // find the 2D points
-                final Vector2D startV = Double.isInfinite(i.getInf()) ?
-                                        null : (Vector2D) line.toSpace((Point<Euclidean1D>) new Vector1D(i.getInf()));
-                final Vector2D endV   = Double.isInfinite(i.getSup()) ?
-                                        null : (Vector2D) line.toSpace((Point<Euclidean1D>) new Vector1D(i.getSup()));
-
-                // recover the connectivity information
-                final BSPTree<Euclidean2D> startN = selectClosest(startV, splitters);
-                final BSPTree<Euclidean2D> endN   = selectClosest(endV, splitters);
-
-                if (reversed) {
-                    segments.add(new ConnectableSegment(endV, startV, line.getReverse(),
-                                                        node, endN, startN));
-                } else {
-                    segments.add(new ConnectableSegment(startV, endV, line,
-                                                        node, startN, endN));
-                }
-
-            }
-        }
-
-        /** Select the node whose cut sub-hyperplane is closest to specified point.
-         * @param point reference point
-         * @param candidates candidate nodes
-         * @return node closest to point, or null if no node is closer than tolerance
-         */
-        private BSPTree<Euclidean2D> selectClosest(final Vector2D point, final Iterable<BSPTree<Euclidean2D>> candidates) {
-
-            BSPTree<Euclidean2D> selected = null;
-            double min = Double.POSITIVE_INFINITY;
-
-            for (final BSPTree<Euclidean2D> node : candidates) {
-                final double distance = FastMath.abs(node.getCut().getHyperplane().getOffset(point));
-                if (distance < min) {
-                    selected = node;
-                    min      = distance;
-                }
-            }
-
-            return min <= tolerance ? selected : null;
-
-        }
-
-        /** Get the segments.
-         * @return built segments
-         */
-        public List<ConnectableSegment> getSegments() {
-            return segments;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Segment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Segment.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Segment.java
deleted file mode 100644
index 2ef7f4e..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Segment.java
+++ /dev/null
@@ -1,112 +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.geometry.euclidean.twod;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.util.FastMath;
-
-/** Simple container for a two-points segment.
- * @since 3.0
- */
-public class Segment {
-
-    /** Start point of the segment. */
-    private final Vector2D start;
-
-    /** End point of the segment. */
-    private final Vector2D end;
-
-    /** Line containing the segment. */
-    private final Line     line;
-
-    /** Build a segment.
-     * @param start start point of the segment
-     * @param end end point of the segment
-     * @param line line containing the segment
-     */
-    public Segment(final Vector2D start, final Vector2D end, final Line line) {
-        this.start  = start;
-        this.end    = end;
-        this.line   = line;
-    }
-
-    /** Get the start point of the segment.
-     * @return start point of the segment
-     */
-    public Vector2D getStart() {
-        return start;
-    }
-
-    /** Get the end point of the segment.
-     * @return end point of the segment
-     */
-    public Vector2D getEnd() {
-        return end;
-    }
-
-    /** Get the line containing the segment.
-     * @return line containing the segment
-     */
-    public Line getLine() {
-        return line;
-    }
-
-    /** Calculates the shortest distance from a point to this line segment.
-     * <p>
-     * If the perpendicular extension from the point to the line does not
-     * cross in the bounds of the line segment, the shortest distance to
-     * the two end points will be returned.
-     * </p>
-     *
-     * Algorithm adapted from:
-     * <a href="http://www.codeguru.com/forum/printthread.php?s=cc8cf0596231f9a7dba4da6e77c29db3&t=194400&pp=15&page=1">
-     * Thread @ Codeguru</a>
-     *
-     * @param p to check
-     * @return distance between the instance and the point
-     * @since 3.1
-     */
-    public double distance(final Vector2D p) {
-        final double deltaX = end.getX() - start.getX();
-        final double deltaY = end.getY() - start.getY();
-
-        final double r = ((p.getX() - start.getX()) * deltaX + (p.getY() - start.getY()) * deltaY) /
-                         (deltaX * deltaX + deltaY * deltaY);
-
-        // r == 0 => P = startPt
-        // r == 1 => P = endPt
-        // r < 0 => P is on the backward extension of the segment
-        // r > 1 => P is on the forward extension of the segment
-        // 0 < r < 1 => P is on the segment
-
-        // if point isn't on the line segment, just return the shortest distance to the end points
-        if (r < 0 || r > 1) {
-            final double dist1 = getStart().distance((Point<Euclidean2D>) p);
-            final double dist2 = getEnd().distance((Point<Euclidean2D>) p);
-
-            return FastMath.min(dist1, dist2);
-        }
-        else {
-            // find point on line and see if it is in the line segment
-            final double px = start.getX() + r * deltaX;
-            final double py = start.getY() + r * deltaY;
-
-            final Vector2D interPt = new Vector2D(px, py);
-            return interPt.distance((Point<Euclidean2D>) p);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java
deleted file mode 100644
index d27b116..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java
+++ /dev/null
@@ -1,233 +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.geometry.euclidean.twod;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.OrientedPoint;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
-
-/** This class represents a sub-hyperplane for {@link Line}.
- * @since 3.0
- */
-public class SubLine extends AbstractSubHyperplane<Euclidean2D, Euclidean1D> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Simple constructor.
-     * @param hyperplane underlying hyperplane
-     * @param remainingRegion remaining region of the hyperplane
-     */
-    public SubLine(final Hyperplane<Euclidean2D> hyperplane,
-                   final Region<Euclidean1D> remainingRegion) {
-        super(hyperplane, remainingRegion);
-    }
-
-    /** Create a sub-line from two endpoints.
-     * @param start start point
-     * @param end end point
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public SubLine(final Vector2D start, final Vector2D end, final double tolerance) {
-        super(new Line(start, end, tolerance), buildIntervalSet(start, end, tolerance));
-    }
-
-    /** Create a sub-line from two endpoints.
-     * @param start start point
-     * @param end end point
-     * @deprecated as of 3.3, replaced with {@link #SubLine(Vector2D, Vector2D, double)}
-     */
-    @Deprecated
-    public SubLine(final Vector2D start, final Vector2D end) {
-        this(start, end, DEFAULT_TOLERANCE);
-    }
-
-    /** Create a sub-line from a segment.
-     * @param segment single segment forming the sub-line
-     */
-    public SubLine(final Segment segment) {
-        super(segment.getLine(),
-              buildIntervalSet(segment.getStart(), segment.getEnd(), segment.getLine().getTolerance()));
-    }
-
-    /** Get the endpoints of the sub-line.
-     * <p>
-     * A subline may be any arbitrary number of disjoints segments, so the endpoints
-     * are provided as a list of endpoint pairs. Each element of the list represents
-     * one segment, and each segment contains a start point at index 0 and an end point
-     * at index 1. If the sub-line is unbounded in the negative infinity direction,
-     * the start point of the first segment will have infinite coordinates. If the
-     * sub-line is unbounded in the positive infinity direction, the end point of the
-     * last segment will have infinite coordinates. So a sub-line covering the whole
-     * line will contain just one row and both elements of this row will have infinite
-     * coordinates. If the sub-line is empty, the returned list will contain 0 segments.
-     * </p>
-     * @return list of segments endpoints
-     */
-    public List<Segment> getSegments() {
-
-        final Line line = (Line) getHyperplane();
-        final List<Interval> list = ((IntervalsSet) getRemainingRegion()).asList();
-        final List<Segment> segments = new ArrayList<Segment>(list.size());
-
-        for (final Interval interval : list) {
-            final Vector2D start = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getInf()));
-            final Vector2D end   = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getSup()));
-            segments.add(new Segment(start, end, line));
-        }
-
-        return segments;
-
-    }
-
-    /** Get the intersection of the instance and another sub-line.
-     * <p>
-     * This method is related to the {@link Line#intersection(Line)
-     * intersection} method in the {@link Line Line} class, but in addition
-     * to compute the point along infinite lines, it also checks the point
-     * lies on both sub-line ranges.
-     * </p>
-     * @param subLine other sub-line which may intersect instance
-     * @param includeEndPoints if true, endpoints are considered to belong to
-     * instance (i.e. they are closed sets) and may be returned, otherwise endpoints
-     * are considered to not belong to instance (i.e. they are open sets) and intersection
-     * occurring on endpoints lead to null being returned
-     * @return the intersection point if there is one, null if the sub-lines don't intersect
-     */
-    public Vector2D intersection(final SubLine subLine, final boolean includeEndPoints) {
-
-        // retrieve the underlying lines
-        Line line1 = (Line) getHyperplane();
-        Line line2 = (Line) subLine.getHyperplane();
-
-        // compute the intersection on infinite line
-        Vector2D v2D = line1.intersection(line2);
-        if (v2D == null) {
-            return null;
-        }
-
-        // check location of point with respect to first sub-line
-        Location loc1 = getRemainingRegion().checkPoint(line1.toSubSpace((Point<Euclidean2D>) v2D));
-
-        // check location of point with respect to second sub-line
-        Location loc2 = subLine.getRemainingRegion().checkPoint(line2.toSubSpace((Point<Euclidean2D>) v2D));
-
-        if (includeEndPoints) {
-            return ((loc1 != Location.OUTSIDE) && (loc2 != Location.OUTSIDE)) ? v2D : null;
-        } else {
-            return ((loc1 == Location.INSIDE) && (loc2 == Location.INSIDE)) ? v2D : null;
-        }
-
-    }
-
-    /** Build an interval set from two points.
-     * @param start start point
-     * @param end end point
-     * @param tolerance tolerance below which points are considered identical
-     * @return an interval set
-     */
-    private static IntervalsSet buildIntervalSet(final Vector2D start, final Vector2D end, final double tolerance) {
-        final Line line = new Line(start, end, tolerance);
-        return new IntervalsSet(line.toSubSpace((Point<Euclidean2D>) start).getX(),
-                                line.toSubSpace((Point<Euclidean2D>) end).getX(),
-                                tolerance);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected AbstractSubHyperplane<Euclidean2D, Euclidean1D> buildNew(final Hyperplane<Euclidean2D> hyperplane,
-                                                                       final Region<Euclidean1D> remainingRegion) {
-        return new SubLine(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Side side(final Hyperplane<Euclidean2D> hyperplane) {
-
-        final Line    thisLine  = (Line) getHyperplane();
-        final Line    otherLine = (Line) hyperplane;
-        final Vector2D crossing  = thisLine.intersection(otherLine);
-
-        if (crossing == null) {
-            // the lines are parallel,
-            final double global = otherLine.getOffset(thisLine);
-            return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
-        }
-
-        // the lines do intersect
-        final boolean direct = FastMath.sin(thisLine.getAngle() - otherLine.getAngle()) < 0;
-        final Vector1D x = thisLine.toSubSpace((Point<Euclidean2D>) crossing);
-        return getRemainingRegion().side(new OrientedPoint(x, direct, thisLine.getTolerance()));
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public SplitSubHyperplane<Euclidean2D> split(final Hyperplane<Euclidean2D> hyperplane) {
-
-        final Line    thisLine  = (Line) getHyperplane();
-        final Line    otherLine = (Line) hyperplane;
-        final Vector2D crossing = thisLine.intersection(otherLine);
-        final double tolerance  = thisLine.getTolerance();
-
-        if (crossing == null) {
-            // the lines are parallel
-            final double global = otherLine.getOffset(thisLine);
-            return (global < -1.0e-10) ?
-                   new SplitSubHyperplane<Euclidean2D>(null, this) :
-                   new SplitSubHyperplane<Euclidean2D>(this, null);
-        }
-
-        // the lines do intersect
-        final boolean direct = FastMath.sin(thisLine.getAngle() - otherLine.getAngle()) < 0;
-        final Vector1D x      = thisLine.toSubSpace((Point<Euclidean2D>) crossing);
-        final SubHyperplane<Euclidean1D> subPlus  =
-                new OrientedPoint(x, !direct, tolerance).wholeHyperplane();
-        final SubHyperplane<Euclidean1D> subMinus =
-                new OrientedPoint(x,  direct, tolerance).wholeHyperplane();
-
-        final BSPTree<Euclidean1D> splitTree = getRemainingRegion().getTree(false).split(subMinus);
-        final BSPTree<Euclidean1D> plusTree  = getRemainingRegion().isEmpty(splitTree.getPlus()) ?
-                                               new BSPTree<Euclidean1D>(Boolean.FALSE) :
-                                               new BSPTree<Euclidean1D>(subPlus, new BSPTree<Euclidean1D>(Boolean.FALSE),
-                                                                        splitTree.getPlus(), null);
-        final BSPTree<Euclidean1D> minusTree = getRemainingRegion().isEmpty(splitTree.getMinus()) ?
-                                               new BSPTree<Euclidean1D>(Boolean.FALSE) :
-                                               new BSPTree<Euclidean1D>(subMinus, new BSPTree<Euclidean1D>(Boolean.FALSE),
-                                                                        splitTree.getMinus(), null);
-
-        return new SplitSubHyperplane<Euclidean2D>(new SubLine(thisLine.copySelf(), new IntervalsSet(plusTree, tolerance)),
-                                                   new SubLine(thisLine.copySelf(), new IntervalsSet(minusTree, tolerance)));
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java
deleted file mode 100644
index 191d225..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.java
+++ /dev/null
@@ -1,460 +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.geometry.euclidean.twod;
-
-import java.text.NumberFormat;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/** This class represents a 2D vector.
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.0
- */
-public class Vector2D implements Vector<Euclidean2D> {
-
-    /** Origin (coordinates: 0, 0). */
-    public static final Vector2D ZERO   = new Vector2D(0, 0);
-
-    // CHECKSTYLE: stop ConstantName
-    /** A vector with all coordinates set to NaN. */
-    public static final Vector2D NaN = new Vector2D(Double.NaN, Double.NaN);
-    // CHECKSTYLE: resume ConstantName
-
-    /** A vector with all coordinates set to positive infinity. */
-    public static final Vector2D POSITIVE_INFINITY =
-        new Vector2D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
-
-    /** A vector with all coordinates set to negative infinity. */
-    public static final Vector2D NEGATIVE_INFINITY =
-        new Vector2D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 266938651998679754L;
-
-    /** Abscissa. */
-    private final double x;
-
-    /** Ordinate. */
-    private final double y;
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param x abscissa
-     * @param y ordinate
-     * @see #getX()
-     * @see #getY()
-     */
-    public Vector2D(double x, double y) {
-        this.x = x;
-        this.y = y;
-    }
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param v coordinates array
-     * @exception DimensionMismatchException if array does not have 2 elements
-     * @see #toArray()
-     */
-    public Vector2D(double[] v) throws DimensionMismatchException {
-        if (v.length != 2) {
-            throw new DimensionMismatchException(v.length, 2);
-        }
-        this.x = v[0];
-        this.y = v[1];
-    }
-
-    /** Multiplicative constructor
-     * Build a vector from another one and a scale factor.
-     * The vector built will be a * u
-     * @param a scale factor
-     * @param u base (unscaled) vector
-     */
-    public Vector2D(double a, Vector2D u) {
-        this.x = a * u.x;
-        this.y = a * u.y;
-    }
-
-    /** Linear constructor
-     * Build a vector from two other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     */
-    public Vector2D(double a1, Vector2D u1, double a2, Vector2D u2) {
-        this.x = a1 * u1.x + a2 * u2.x;
-        this.y = a1 * u1.y + a2 * u2.y;
-    }
-
-    /** Linear constructor
-     * Build a vector from three other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     */
-    public Vector2D(double a1, Vector2D u1, double a2, Vector2D u2,
-                   double a3, Vector2D u3) {
-        this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x;
-        this.y = a1 * u1.y + a2 * u2.y + a3 * u3.y;
-    }
-
-    /** Linear constructor
-     * Build a vector from four other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     * @param a4 fourth scale factor
-     * @param u4 fourth base (unscaled) vector
-     */
-    public Vector2D(double a1, Vector2D u1, double a2, Vector2D u2,
-                   double a3, Vector2D u3, double a4, Vector2D u4) {
-        this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x + a4 * u4.x;
-        this.y = a1 * u1.y + a2 * u2.y + a3 * u3.y + a4 * u4.y;
-    }
-
-    /** Get the abscissa of the vector.
-     * @return abscissa of the vector
-     * @see #Vector2D(double, double)
-     */
-    public double getX() {
-        return x;
-    }
-
-    /** Get the ordinate of the vector.
-     * @return ordinate of the vector
-     * @see #Vector2D(double, double)
-     */
-    public double getY() {
-        return y;
-    }
-
-    /** Get the vector coordinates as a dimension 2 array.
-     * @return vector coordinates
-     * @see #Vector2D(double[])
-     */
-    public double[] toArray() {
-        return new double[] { x, y };
-    }
-
-    /** {@inheritDoc} */
-    public Space getSpace() {
-        return Euclidean2D.getInstance();
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D getZero() {
-        return ZERO;
-    }
-
-    /** {@inheritDoc} */
-    public double getNorm1() {
-        return FastMath.abs(x) + FastMath.abs(y);
-    }
-
-    /** {@inheritDoc} */
-    public double getNorm() {
-        return FastMath.sqrt (x * x + y * y);
-    }
-
-    /** {@inheritDoc} */
-    public double getNormSq() {
-        return x * x + y * y;
-    }
-
-    /** {@inheritDoc} */
-    public double getNormInf() {
-        return FastMath.max(FastMath.abs(x), FastMath.abs(y));
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D add(Vector<Euclidean2D> v) {
-        Vector2D v2 = (Vector2D) v;
-        return new Vector2D(x + v2.getX(), y + v2.getY());
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D add(double factor, Vector<Euclidean2D> v) {
-        Vector2D v2 = (Vector2D) v;
-        return new Vector2D(x + factor * v2.getX(), y + factor * v2.getY());
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D subtract(Vector<Euclidean2D> p) {
-        Vector2D p3 = (Vector2D) p;
-        return new Vector2D(x - p3.x, y - p3.y);
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D subtract(double factor, Vector<Euclidean2D> v) {
-        Vector2D v2 = (Vector2D) v;
-        return new Vector2D(x - factor * v2.getX(), y - factor * v2.getY());
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D normalize() throws MathArithmeticException {
-        double s = getNorm();
-        if (s == 0) {
-            throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
-        }
-        return scalarMultiply(1 / s);
-    }
-
-    /** Compute the angular separation between two vectors.
-     * <p>This method computes the angular separation between two
-     * vectors using the dot product for well separated vectors and the
-     * cross product for almost aligned vectors. This allows to have a
-     * good accuracy in all cases, even for vectors very close to each
-     * other.</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return angular separation between v1 and v2
-     * @exception MathArithmeticException if either vector has a null norm
-     */
-    public static double angle(Vector2D v1, Vector2D v2) throws MathArithmeticException {
-
-        double normProduct = v1.getNorm() * v2.getNorm();
-        if (normProduct == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-
-        double dot = v1.dotProduct(v2);
-        double threshold = normProduct * 0.9999;
-        if ((dot < -threshold) || (dot > threshold)) {
-            // the vectors are almost aligned, compute using the sine
-            final double n = FastMath.abs(MathArrays.linearCombination(v1.x, v2.y, -v1.y, v2.x));
-            if (dot >= 0) {
-                return FastMath.asin(n / normProduct);
-            }
-            return FastMath.PI - FastMath.asin(n / normProduct);
-        }
-
-        // the vectors are sufficiently separated to use the cosine
-        return FastMath.acos(dot / normProduct);
-
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D negate() {
-        return new Vector2D(-x, -y);
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D scalarMultiply(double a) {
-        return new Vector2D(a * x, a * y);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isNaN() {
-        return Double.isNaN(x) || Double.isNaN(y);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isInfinite() {
-        return !isNaN() && (Double.isInfinite(x) || Double.isInfinite(y));
-    }
-
-    /** {@inheritDoc} */
-    public double distance1(Vector<Euclidean2D> p) {
-        Vector2D p3 = (Vector2D) p;
-        final double dx = FastMath.abs(p3.x - x);
-        final double dy = FastMath.abs(p3.y - y);
-        return dx + dy;
-    }
-
-    /** {@inheritDoc}
-     */
-    public double distance(Vector<Euclidean2D> p) {
-        return distance((Point<Euclidean2D>) p);
-    }
-
-    /** {@inheritDoc} */
-    public double distance(Point<Euclidean2D> p) {
-        Vector2D p3 = (Vector2D) p;
-        final double dx = p3.x - x;
-        final double dy = p3.y - y;
-        return FastMath.sqrt(dx * dx + dy * dy);
-    }
-
-    /** {@inheritDoc} */
-    public double distanceInf(Vector<Euclidean2D> p) {
-        Vector2D p3 = (Vector2D) p;
-        final double dx = FastMath.abs(p3.x - x);
-        final double dy = FastMath.abs(p3.y - y);
-        return FastMath.max(dx, dy);
-    }
-
-    /** {@inheritDoc} */
-    public double distanceSq(Vector<Euclidean2D> p) {
-        Vector2D p3 = (Vector2D) p;
-        final double dx = p3.x - x;
-        final double dy = p3.y - y;
-        return dx * dx + dy * dy;
-    }
-
-    /** {@inheritDoc} */
-    public double dotProduct(final Vector<Euclidean2D> v) {
-        final Vector2D v2 = (Vector2D) v;
-        return MathArrays.linearCombination(x, v2.x, y, v2.y);
-    }
-
-    /**
-     * Compute the cross-product of the instance and the given points.
-     * <p>
-     * The cross product can be used to determine the location of a point
-     * with regard to the line formed by (p1, p2) and is calculated as:
-     * \[
-     *    P = (x_2 - x_1)(y_3 - y_1) - (y_2 - y_1)(x_3 - x_1)
-     * \]
-     * with \(p3 = (x_3, y_3)\) being this instance.
-     * <p>
-     * If the result is 0, the points are collinear, i.e. lie on a single straight line L;
-     * if it is positive, this point lies to the left, otherwise to the right of the line
-     * formed by (p1, p2).
-     *
-     * @param p1 first point of the line
-     * @param p2 second point of the line
-     * @return the cross-product
-     *
-     * @see <a href="http://en.wikipedia.org/wiki/Cross_product">Cross product (Wikipedia)</a>
-     */
-    public double crossProduct(final Vector2D p1, final Vector2D p2) {
-        final double x1 = p2.getX() - p1.getX();
-        final double y1 = getY() - p1.getY();
-        final double x2 = getX() - p1.getX();
-        final double y2 = p2.getY() - p1.getY();
-        return MathArrays.linearCombination(x1, y1, -x2, y2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>p1.subtract(p2).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the distance between p1 and p2 according to the L<sub>2</sub> norm
-     */
-    public static double distance(Vector2D p1, Vector2D p2) {
-        return p1.distance(p2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>p1.subtract(p2).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the distance between p1 and p2 according to the L<sub>&infin;</sub> norm
-     */
-    public static double distanceInf(Vector2D p1, Vector2D p2) {
-        return p1.distanceInf(p2);
-    }
-
-    /** Compute the square of the distance between two vectors.
-     * <p>Calling this method is equivalent to calling:
-     * <code>p1.subtract(p2).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the square of the distance between p1 and p2
-     */
-    public static double distanceSq(Vector2D p1, Vector2D p2) {
-        return p1.distanceSq(p2);
-    }
-
-    /**
-     * Test for the equality of two 2D vectors.
-     * <p>
-     * If all coordinates of two 2D vectors are exactly the same, and none are
-     * <code>Double.NaN</code>, the two 2D vectors are considered to be equal.
-     * </p>
-     * <p>
-     * <code>NaN</code> coordinates are considered to affect globally the vector
-     * and be equals to each other - i.e, if either (or all) coordinates of the
-     * 2D vector are equal to <code>Double.NaN</code>, the 2D vector is equal to
-     * {@link #NaN}.
-     * </p>
-     *
-     * @param other Object to test for equality to this
-     * @return true if two 2D vector objects are equal, false if
-     *         object is null, not an instance of Vector2D, or
-     *         not equal to this Vector2D instance
-     *
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof Vector2D) {
-            final Vector2D rhs = (Vector2D)other;
-            if (rhs.isNaN()) {
-                return this.isNaN();
-            }
-
-            return (x == rhs.x) && (y == rhs.y);
-        }
-        return false;
-    }
-
-    /**
-     * Get a hashCode for the 2D vector.
-     * <p>
-     * All NaN values have the same hash code.</p>
-     *
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN()) {
-            return 542;
-        }
-        return 122 * (76 * MathUtils.hash(x) +  MathUtils.hash(y));
-    }
-
-    /** Get a string representation of this vector.
-     * @return a string representation of this vector
-     */
-    @Override
-    public String toString() {
-        return Vector2DFormat.getInstance().format(this);
-    }
-
-    /** {@inheritDoc} */
-    public String toString(final NumberFormat format) {
-        return new Vector2DFormat(format).format(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java
deleted file mode 100644
index 21261c5..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.java
+++ /dev/null
@@ -1,138 +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.geometry.euclidean.twod;
-
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.VectorFormat;
-import org.apache.commons.math3.util.CompositeFormat;
-
-/**
- * Formats a 2D vector in components list format "{x; y}".
- * <p>The prefix and suffix "{" and "}" and the separator "; " can be replaced by
- * any user-defined strings. The number format for components can be configured.</p>
- * <p>White space is ignored at parse time, even if it is in the prefix, suffix
- * or separator specifications. So even if the default separator does include a space
- * character that is used at format time, both input string "{1;1}" and
- * " { 1 ; 1 } " will be parsed without error and the same vector will be
- * returned. In the second case, however, the parse position after parsing will be
- * just after the closing curly brace, i.e. just before the trailing space.</p>
- * <p><b>Note:</b> using "," as a separator may interfere with the grouping separator
- * of the default {@link NumberFormat} for the current locale. Thus it is advised
- * to use a {@link NumberFormat} instance with disabled grouping in such a case.</p>
- *
- * @since 3.0
- */
-public class Vector2DFormat extends VectorFormat<Euclidean2D> {
-
-    /**
-     * Create an instance with default settings.
-     * <p>The instance uses the default prefix, suffix and separator:
-     * "{", "}", and "; " and the default number format for components.</p>
-     */
-    public Vector2DFormat() {
-        super(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR,
-              CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with a custom number format for components.
-     * @param format the custom format for components.
-     */
-    public Vector2DFormat(final NumberFormat format) {
-        super(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, format);
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix and separator.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     * @param separator separator to use instead of the default "; "
-     */
-    public Vector2DFormat(final String prefix, final String suffix,
-                         final String separator) {
-        super(prefix, suffix, separator, CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix, separator and format
-     * for components.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     * @param separator separator to use instead of the default "; "
-     * @param format the custom format for components.
-     */
-    public Vector2DFormat(final String prefix, final String suffix,
-                         final String separator, final NumberFormat format) {
-        super(prefix, suffix, separator, format);
-    }
-
-    /**
-     * Returns the default 2D vector format for the current locale.
-     * @return the default 2D vector format.
-     */
-    public static Vector2DFormat getInstance() {
-        return getInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default 2D vector format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the 2D vector format specific to the given locale.
-     */
-    public static Vector2DFormat getInstance(final Locale locale) {
-        return new Vector2DFormat(CompositeFormat.getDefaultNumberFormat(locale));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public StringBuffer format(final Vector<Euclidean2D> vector, final StringBuffer toAppendTo,
-                               final FieldPosition pos) {
-        final Vector2D p2 = (Vector2D) vector;
-        return format(toAppendTo, pos, p2.getX(), p2.getY());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Vector2D parse(final String source) throws MathParseException {
-        ParsePosition parsePosition = new ParsePosition(0);
-        Vector2D result = parse(source, parsePosition);
-        if (parsePosition.getIndex() == 0) {
-            throw new MathParseException(source,
-                                         parsePosition.getErrorIndex(),
-                                         Vector2D.class);
-        }
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Vector2D parse(final String source, final ParsePosition pos) {
-        final double[] coordinates = parseCoordinates(2, source, pos);
-        if (coordinates == null) {
-            return null;
-        }
-        return new Vector2D(coordinates[0], coordinates[1]);
-    }
-
-}


[57/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/distance/ChebyshevDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/distance/ChebyshevDistanceTest.java b/src/test/java/org/apache/commons/math4/ml/distance/ChebyshevDistanceTest.java
index 41a3887..2132a92 100644
--- a/src/test/java/org/apache/commons/math4/ml/distance/ChebyshevDistanceTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/distance/ChebyshevDistanceTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
+import org.apache.commons.math4.ml.distance.ChebyshevDistance;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/distance/EarthMoversDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/distance/EarthMoversDistanceTest.java b/src/test/java/org/apache/commons/math4/ml/distance/EarthMoversDistanceTest.java
index 43d3b6f..8755e72 100644
--- a/src/test/java/org/apache/commons/math4/ml/distance/EarthMoversDistanceTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/distance/EarthMoversDistanceTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
 import org.junit.Assert;
-
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EarthMoversDistance;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/distance/EuclideanDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/distance/EuclideanDistanceTest.java b/src/test/java/org/apache/commons/math4/ml/distance/EuclideanDistanceTest.java
index 13ec4c5..b55d367 100644
--- a/src/test/java/org/apache/commons/math4/ml/distance/EuclideanDistanceTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/distance/EuclideanDistanceTest.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Tests for {@link EuclideanDistance} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/distance/ManhattanDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/distance/ManhattanDistanceTest.java b/src/test/java/org/apache/commons/math4/ml/distance/ManhattanDistanceTest.java
index 2a74c77..cf610f3 100644
--- a/src/test/java/org/apache/commons/math4/ml/distance/ManhattanDistanceTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/distance/ManhattanDistanceTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.ManhattanDistance;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java
index 72bf09c..d395ba7 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/MapUtilsTest.java
@@ -15,13 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 import java.util.Set;
 import java.util.HashSet;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.ml.neuralnet.oned.NeuronString;
+
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializerFactory;
+import org.apache.commons.math4.ml.neuralnet.MapUtils;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.oned.NeuronString;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/NetworkTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/NetworkTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/NetworkTest.java
index 7f2bec9..4f81eb6 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/NetworkTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/NetworkTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -25,7 +25,12 @@ import java.io.ObjectOutputStream;
 import java.util.Collection;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math3.ml.neuralnet.twod.NeuronSquareMesh2D;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializerFactory;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.SquareNeighbourhood;
+import org.apache.commons.math4.ml.neuralnet.twod.NeuronSquareMesh2D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/NeuronTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/NeuronTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/NeuronTest.java
index b03f07d..92ec4bf 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/NeuronTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/NeuronTest.java
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 import java.io.ByteArrayOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ObjectOutputStream;
 import java.io.ObjectInputStream;
 import java.io.IOException;
+
+import org.apache.commons.math4.ml.neuralnet.Neuron;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/OffsetFeatureInitializer.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/OffsetFeatureInitializer.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/OffsetFeatureInitializer.java
index 9c800cc..cc19143 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/OffsetFeatureInitializer.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/OffsetFeatureInitializer.java
@@ -15,7 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
+
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java
index 782cbda..e7654fd 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronStringTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.oned;
+package org.apache.commons.math4.ml.neuralnet.oned;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -25,10 +25,11 @@ import java.io.ObjectOutputStream;
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializer;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializerFactory;
-import org.apache.commons.math3.ml.neuralnet.Network;
-import org.apache.commons.math3.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializerFactory;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.oned.NeuronString;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
index d3f5628..f729f48 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTaskTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
 import java.io.PrintWriter;
 import java.util.ArrayList;
@@ -28,9 +28,10 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
-import org.apache.commons.math3.Retry;
-import org.apache.commons.math3.RetryRunner;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.Retry;
+import org.apache.commons.math4.RetryRunner;
+import org.apache.commons.math4.ml.neuralnet.sofm.KohonenTrainingTask;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateActionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateActionTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateActionTest.java
index 334a5a8..9051dd6 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateActionTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateActionTest.java
@@ -15,18 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
-import org.apache.commons.math3.ml.neuralnet.Neuron;
-import org.apache.commons.math3.ml.neuralnet.Network;
-import org.apache.commons.math3.ml.neuralnet.MapUtils;
-import org.apache.commons.math3.ml.neuralnet.UpdateAction;
-import org.apache.commons.math3.ml.neuralnet.OffsetFeatureInitializer;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializer;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializerFactory;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.ml.neuralnet.oned.NeuronString;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializerFactory;
+import org.apache.commons.math4.ml.neuralnet.MapUtils;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.OffsetFeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.UpdateAction;
+import org.apache.commons.math4.ml.neuralnet.oned.NeuronString;
+import org.apache.commons.math4.ml.neuralnet.sofm.KohonenUpdateAction;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunctionFactory;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunctionFactory;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactoryTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactoryTest.java
index 93df5ad..59eb78d 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactoryTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactoryTest.java
@@ -15,11 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunctionFactory;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactoryTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactoryTest.java
index 4570fc8..72ffed0 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactoryTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactoryTest.java
@@ -15,10 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunctionFactory;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java
index 369ea33..6fe215d 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/TravellingSalesmanSolver.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
 import java.util.List;
 import java.util.ArrayList;
@@ -23,23 +23,30 @@ import java.util.Set;
 import java.util.HashSet;
 import java.util.Collection;
 import java.util.Iterator;
-import org.apache.commons.math3.ml.neuralnet.Neuron;
-import org.apache.commons.math3.ml.neuralnet.Network;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializer;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializerFactory;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.ml.neuralnet.oned.NeuronString;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well44497b;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.analysis.function.Constant;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
+
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Constant;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializerFactory;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.oned.NeuronString;
+import org.apache.commons.math4.ml.neuralnet.sofm.KohonenTrainingTask;
+import org.apache.commons.math4.ml.neuralnet.sofm.KohonenUpdateAction;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunctionFactory;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunctionFactory;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Solves the "Travelling Salesman's Problem" (i.e. trying to find the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunctionTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunctionTest.java
index ddbdcfc..4c4831e 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunctionTest.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm.util;
+package org.apache.commons.math4.ml.neuralnet.sofm.util;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.ml.neuralnet.sofm.util.ExponentialDecayFunction;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunctionTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunctionTest.java
index 49c9cda..e2d8193 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunctionTest.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm.util;
+package org.apache.commons.math4.ml.neuralnet.sofm.util;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.ml.neuralnet.sofm.util.QuasiSigmoidDecayFunction;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java b/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java
index 9d5f21c..f5395b4 100644
--- a/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2DTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.twod;
+package org.apache.commons.math4.ml.neuralnet.twod;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -25,12 +25,13 @@ import java.io.ObjectOutputStream;
 import java.util.Collection;
 import java.util.HashSet;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializer;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializerFactory;
-import org.apache.commons.math3.ml.neuralnet.Network;
-import org.apache.commons.math3.ml.neuralnet.Neuron;
-import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializerFactory;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.SquareNeighbourhood;
+import org.apache.commons.math4.ml.neuralnet.twod.NeuronSquareMesh2D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/ContinuousOutputModelTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputModelTest.java b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputModelTest.java
index 3a098ba..b08ef1f 100644
--- a/src/test/java/org/apache/commons/math4/ode/ContinuousOutputModelTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/ContinuousOutputModelTest.java
@@ -15,20 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.Random;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-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.nonstiff.DormandPrince54Integrator;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
-import org.apache.commons.math3.ode.sampling.DummyStepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince54Integrator;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.ode.sampling.DummyStepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/FirstOrderConverterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/FirstOrderConverterTest.java b/src/test/java/org/apache/commons/math4/ode/FirstOrderConverterTest.java
index 445888f..0ea620e 100644
--- a/src/test/java/org/apache/commons/math4/ode/FirstOrderConverterTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/FirstOrderConverterTest.java
@@ -15,14 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
-
-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.nonstiff.ClassicalRungeKuttaIntegrator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode;
+
+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.FirstOrderConverter;
+import org.apache.commons.math4.ode.SecondOrderDifferentialEquations;
+import org.apache.commons.math4.ode.nonstiff.ClassicalRungeKuttaIntegrator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/JacobianMatricesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/JacobianMatricesTest.java b/src/test/java/org/apache/commons/math4/ode/JacobianMatricesTest.java
index 2c45656..b50fe7a 100644
--- a/src/test/java/org/apache/commons/math4/ode/JacobianMatricesTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/JacobianMatricesTest.java
@@ -15,16 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
-
-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.JacobianMatrices.MismatchedEquations;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince54Integrator;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode;
+
+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.AbstractIntegrator;
+import org.apache.commons.math4.ode.AbstractParameterizable;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.JacobianMatrices;
+import org.apache.commons.math4.ode.MainStateJacobianProvider;
+import org.apache.commons.math4.ode.ParameterJacobianProvider;
+import org.apache.commons.math4.ode.ParameterizedODE;
+import org.apache.commons.math4.ode.UnknownParameterException;
+import org.apache.commons.math4.ode.JacobianMatrices.MismatchedEquations;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince54Integrator;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem1.java b/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
index 06d19fd..ad21ba4 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem1.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class is used in the junit tests for the ODE integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem2.java b/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
index 64befe2..19dda5a 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem2.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class is used in the junit tests for the ODE integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblem3.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem3.java b/src/test/java/org/apache/commons/math4/ode/TestProblem3.java
index c74bb66..0986cfd 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem3.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem3.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class is used in the junit tests for the ODE integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblem4.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem4.java b/src/test/java/org/apache/commons/math4/ode/TestProblem4.java
index e5c6219..cfb8873 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem4.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem4.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class is used in the junit tests for the ODE integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblem5.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem5.java b/src/test/java/org/apache/commons/math4/ode/TestProblem5.java
index 4c3c44a..615bfca 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem5.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem5.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 /**
  * This class is used in the junit tests for the ODE integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblem6.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblem6.java b/src/test/java/org/apache/commons/math4/ode/TestProblem6.java
index 8530499..1e5d525 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblem6.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblem6.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 /**
  * This class is used in the junit tests for the ODE integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java b/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java
index bfb4ecb..a99613e 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblemAbstract.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.events.EventHandler;
+import org.apache.commons.math4.ode.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.events.EventHandler;
 
 /**
  * This class is used as the base class of the problems that are

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblemFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblemFactory.java b/src/test/java/org/apache/commons/math4/ode/TestProblemFactory.java
index 706e140..8d504e3 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblemFactory.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblemFactory.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 /**
  * This class is used in the junit tests for the ODE integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/TestProblemHandler.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/TestProblemHandler.java b/src/test/java/org/apache/commons/math4/ode/TestProblemHandler.java
index 40ff404..9aadd2c 100644
--- a/src/test/java/org/apache/commons/math4/ode/TestProblemHandler.java
+++ b/src/test/java/org/apache/commons/math4/ode/TestProblemHandler.java
@@ -15,12 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.ode.ODEIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class is used to handle steps for the test problems

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/events/EventFilterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/events/EventFilterTest.java b/src/test/java/org/apache/commons/math4/ode/events/EventFilterTest.java
index 155c46a..c8ea085 100644
--- a/src/test/java/org/apache/commons/math4/ode/events/EventFilterTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/events/EventFilterTest.java
@@ -14,19 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode.events;
-
-import org.apache.commons.math3.analysis.solvers.BracketingNthOrderBrentSolver;
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937a;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.events;
+
+import org.apache.commons.math4.analysis.solvers.BracketingNthOrderBrentSolver;
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.events.EventFilter;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.events.FilterType;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937a;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/events/EventStateTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/events/EventStateTest.java b/src/test/java/org/apache/commons/math4/ode/events/EventStateTest.java
index 6468fdc..b2041dc 100644
--- a/src/test/java/org/apache/commons/math4/ode/events/EventStateTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/events/EventStateTest.java
@@ -15,20 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.events;
-
-
-import org.apache.commons.math3.analysis.solvers.BrentSolver;
-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.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.SecondaryEquations;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
-import org.apache.commons.math3.ode.sampling.AbstractStepInterpolator;
-import org.apache.commons.math3.ode.sampling.DummyStepInterpolator;
+package org.apache.commons.math4.ode.events;
+
+
+import org.apache.commons.math4.analysis.solvers.BrentSolver;
+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.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.SecondaryEquations;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.events.EventState;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
+import org.apache.commons.math4.ode.sampling.DummyStepInterpolator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java b/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java
index 081788d..e489e4e 100644
--- a/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/events/OverlappingEventsTest.java
@@ -14,20 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode.events;
+package org.apache.commons.math4.ode.events;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.solvers.BaseSecantSolver;
-import org.apache.commons.math3.analysis.solvers.PegasusSolver;
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.analysis.solvers.BaseSecantSolver;
+import org.apache.commons.math4.analysis.solvers.PegasusSolver;
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -48,7 +49,7 @@ public class OverlappingEventsTest implements FirstOrderDifferentialEquations {
 
     /** Test for events that occur at the exact same time, but due to numerical
      * calculations occur very close together instead. Uses event type 0. See
-     * {@link org.apache.commons.math3.ode.events.EventHandler#g(double, double[])
+     * {@link org.apache.commons.math4.ode.events.EventHandler#g(double, double[])
      * EventHandler.g(double, double[])}.
      */
     @Test
@@ -60,7 +61,7 @@ public class OverlappingEventsTest implements FirstOrderDifferentialEquations {
 
     /** Test for events that occur at the exact same time, but due to numerical
      * calculations occur very close together instead. Uses event type 1. See
-     * {@link org.apache.commons.math3.ode.events.EventHandler#g(double, double[])
+     * {@link org.apache.commons.math4.ode.events.EventHandler#g(double, double[])
      * EventHandler.g(double, double[])}.
      */
     @Test
@@ -73,7 +74,7 @@ public class OverlappingEventsTest implements FirstOrderDifferentialEquations {
     /** Test for events that occur at the exact same time, but due to numerical
      * calculations occur very close together instead.
      * @param eventType the type of events to use. See
-     * {@link org.apache.commons.math3.ode.events.EventHandler#g(double, double[])
+     * {@link org.apache.commons.math4.ode.events.EventHandler#g(double, double[])
      * EventHandler.g(double, double[])}.
      */
     public void test(int eventType)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/events/ReappearingEventTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/events/ReappearingEventTest.java b/src/test/java/org/apache/commons/math4/ode/events/ReappearingEventTest.java
index eae9247..b53e760 100644
--- a/src/test/java/org/apache/commons/math4/ode/events/ReappearingEventTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/events/ReappearingEventTest.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode.events;
+package org.apache.commons.math4.ode.events;
 
 import org.junit.Assert;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.analysis.solvers.PegasusSolver;
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
-import org.apache.commons.math3.ode.nonstiff.GraggBulirschStoerIntegrator;
+import org.apache.commons.math4.analysis.solvers.PegasusSolver;
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.ode.nonstiff.GraggBulirschStoerIntegrator;
 import org.junit.Test;
 
 public class ReappearingEventTest {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegratorTest.java
index f5a96a6..64ca4cc 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegratorTest.java
@@ -15,19 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblem6;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblem6;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.nonstiff.AdamsBashforthIntegrator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegratorTest.java
index 712eba4..8c24d7b 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegratorTest.java
@@ -15,19 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblem6;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblem6;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.nonstiff.AdamsMoultonIntegrator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
index c527680..6a3b51b 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegratorTest.java
@@ -15,25 +15,27 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemFactory;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemFactory;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.ClassicalRungeKuttaIntegrator;
+import org.apache.commons.math4.ode.nonstiff.RungeKuttaIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java
index 6f618cd..0413da8 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,14 +25,15 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.ClassicalRungeKuttaIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54IntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54IntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54IntegratorTest.java
index 31be298..b4909c9 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54IntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54IntegratorTest.java
@@ -15,23 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-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.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem4;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+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.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem4;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.AdaptiveStepsizeIntegrator;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince54Integrator;
+import org.apache.commons.math4.ode.nonstiff.EmbeddedRungeKuttaIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolatorTest.java
index 2b3b8e7..60c0905 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,16 +25,17 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
-import org.apache.commons.math3.util.FastMath;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince54Integrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853IntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853IntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853IntegratorTest.java
index fcba93c..33c721c 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853IntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853IntegratorTest.java
@@ -15,23 +15,25 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem4;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem4;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.AdaptiveStepsizeIntegrator;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolatorTest.java
index e6b8fd5..a1e1788 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,16 +25,17 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
-import org.apache.commons.math3.util.FastMath;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerIntegratorTest.java
index eaef55b..f5952e0 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerIntegratorTest.java
@@ -15,24 +15,25 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemFactory;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemFactory;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.EulerIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolatorTest.java
index de99547..15094da 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,17 +25,21 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
-import org.apache.commons.math3.util.FastMath;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.EulerIntegrator;
+import org.apache.commons.math4.ode.nonstiff.EulerStepInterpolator;
+import org.apache.commons.math4.ode.nonstiff.RungeKuttaIntegrator;
+import org.apache.commons.math4.ode.nonstiff.RungeKuttaStepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/GillIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillIntegratorTest.java
index e165e20..1265aef 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillIntegratorTest.java
@@ -15,25 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemFactory;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemFactory;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.GillIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolatorTest.java
index d441ac0..4fc1dff 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,14 +25,15 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.GillIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
index 6d24676..ad39b78 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegratorTest.java
@@ -15,24 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem4;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem4;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.AdaptiveStepsizeIntegrator;
+import org.apache.commons.math4.ode.nonstiff.GraggBulirschStoerIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java
index e71e5c0..6893873 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,16 +25,17 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
-import org.apache.commons.math3.util.FastMath;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.GraggBulirschStoerIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54IntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54IntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54IntegratorTest.java
index 65a96f2..3a4e138 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54IntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54IntegratorTest.java
@@ -15,23 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem4;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.ode.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem4;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.HighamHall54Integrator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 


[80/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Acos.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Acos.java b/src/main/java/org/apache/commons/math4/analysis/function/Acos.java
index a9df4b7..1b51cde 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Acos.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Acos.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Arc-cosine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java b/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java
index 58fb19f..3dfcb5e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Acosh.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Hyperbolic arc-cosine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Add.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Add.java b/src/main/java/org/apache/commons/math4/analysis/function/Add.java
index 366a303..68680aa 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Add.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Add.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.BivariateFunction;
 
 /**
  * Add the two operands.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Asin.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Asin.java b/src/main/java/org/apache/commons/math4/analysis/function/Asin.java
index 8fa9bdf..f6e439d 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Asin.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Asin.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Arc-sine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java b/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java
index b5b9fd2..a632acb 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Asinh.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Hyperbolic arc-sine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Atan.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Atan.java b/src/main/java/org/apache/commons/math4/analysis/function/Atan.java
index 36b1265..214428e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Atan.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Atan.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Arc-tangent function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java b/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java
index d5f385f..6673b4a 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Atan2.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Arc-tangent function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java b/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java
index 5c04599..c342b67 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Atanh.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Hyperbolic arc-tangent function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java b/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java
index f26ef71..2253951 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Cbrt.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Cube root function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java b/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java
index 2b9867e..21d8034 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Ceil.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * {@code ceil} function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Constant.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Constant.java b/src/main/java/org/apache/commons/math4/analysis/function/Constant.java
index 4027e59..e2fac7a 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Constant.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Constant.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
 
 /**
  * Constant function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Cos.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Cos.java b/src/main/java/org/apache/commons/math4/analysis/function/Cos.java
index 73a5e6e..a6607bf 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Cos.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Cos.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Cosine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java b/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java
index 185698b..5c9416b 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Cosh.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Hyperbolic cosine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Divide.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Divide.java b/src/main/java/org/apache/commons/math4/analysis/function/Divide.java
index 73413a2..18f8f31 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Divide.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Divide.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.BivariateFunction;
 
 /**
  * Divide the first operand by the second.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Exp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Exp.java b/src/main/java/org/apache/commons/math4/analysis/function/Exp.java
index f656712..6233bbc 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Exp.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Exp.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Exponential function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java b/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java
index 46b0b2f..552411d 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Expm1.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <code>e<sup>x</sup>-1</code> function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Floor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Floor.java b/src/main/java/org/apache/commons/math4/analysis/function/Floor.java
index 8d70627..d630935 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Floor.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Floor.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * {@code floor} function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java b/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
index 8c64c8b..da3eecb 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Gaussian.java
@@ -15,21 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Gaussian_function">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java b/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java
index 0fbad9c..5e43367 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/HarmonicOscillator.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Harmonic_oscillator">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Identity.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Identity.java b/src/main/java/org/apache/commons/math4/analysis/function/Identity.java
index d21f7e0..1309f41 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Identity.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Identity.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
 
 /**
  * Identity function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java b/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java
index e38f689..459eb22 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Inverse.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
 
 /**
  * Inverse function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Log.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Log.java b/src/main/java/org/apache/commons/math4/analysis/function/Log.java
index a1e12dc..dbf332c 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Log.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Log.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Natural logarithm function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Log10.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Log10.java b/src/main/java/org/apache/commons/math4/analysis/function/Log10.java
index 66c03e1..6ccc3cf 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Log10.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Log10.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Base 10 logarithm function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java b/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java
index 4966318..1974f05 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Log1p.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <code>log(1 + p)</code> function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java b/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java
index c90203c..3ca6b71 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Logistic.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Generalised_logistic_function">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Logit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Logit.java b/src/main/java/org/apache/commons/math4/analysis/function/Logit.java
index 39abe4d..83e9ada 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Logit.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Logit.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Logit">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Max.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Max.java b/src/main/java/org/apache/commons/math4/analysis/function/Max.java
index 591ac55..f8ca201 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Max.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Max.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Maximum function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Min.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Min.java b/src/main/java/org/apache/commons/math4/analysis/function/Min.java
index a776b79..ee23e96 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Min.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Min.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Minimum function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Minus.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Minus.java b/src/main/java/org/apache/commons/math4/analysis/function/Minus.java
index e532779..d0546c6 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Minus.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Minus.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
 
 /**
  * Minus function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java b/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java
index b7e771b..a5f6be5 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Multiply.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.BivariateFunction;
 
 /**
  * Multiply the two operands.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Pow.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Pow.java b/src/main/java/org/apache/commons/math4/analysis/function/Pow.java
index 756dc42..475d6b7 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Pow.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Pow.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Power function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Power.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Power.java b/src/main/java/org/apache/commons/math4/analysis/function/Power.java
index 953bcab..12722ca 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Power.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Power.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Power function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Rint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Rint.java b/src/main/java/org/apache/commons/math4/analysis/function/Rint.java
index 4edde58..2b662f5 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Rint.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Rint.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * {@code rint} function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java b/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java
index 54639f9..5a80a0a 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Sigmoid.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Sigmoid_function">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Signum.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Signum.java b/src/main/java/org/apache/commons/math4/analysis/function/Signum.java
index ddde66e..c15512b 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Signum.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Signum.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * {@code signum} function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Sin.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sin.java b/src/main/java/org/apache/commons/math4/analysis/function/Sin.java
index 71c91e7..f094d05 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Sin.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Sin.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Sine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java b/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java
index 553cfff..fc0d66e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Sinc.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Sinc_function">Sinc</a> function,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java b/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java
index 1eac044..db6c311 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Sinh.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Hyperbolic sine function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java b/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java
index 720d44d..97c7980 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Sqrt.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Square-root function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java b/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java
index 51e3678..8d4e419 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/StepFunction.java
@@ -15,15 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
 import java.util.Arrays;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.util.MathArrays;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * <a href="http://en.wikipedia.org/wiki/Step_function">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java b/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java
index 7b87dd6..71dd8e6 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Subtract.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.BivariateFunction;
 
 /**
  * Subtract the second operand from the first.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Tan.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Tan.java b/src/main/java/org/apache/commons/math4/analysis/function/Tan.java
index 03304b4..f2f1d3c 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Tan.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Tan.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Tangent function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java b/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java
index 6c7ef0d..64e9400 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Tanh.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Hyperbolic tangent function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java b/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java
index d075a73..a4b9418 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Ulp.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * {@code ulp} function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/package-info.java b/src/main/java/org/apache/commons/math4/analysis/function/package-info.java
index cb24544..695f689 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/package-info.java
@@ -23,4 +23,4 @@
  *    </p>
  *
  */
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
index 23c25b0..76fcdea 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/BaseAbstractUnivariateIntegrator.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.analysis.integration;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolverUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.Incrementor;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Provide a default implementation for several generic functions.
@@ -80,7 +80,7 @@ public abstract class BaseAbstractUnivariateIntegrator implements UnivariateInte
      *       achieved due to large values or short mantissa length. If this
      *       should be the primary criterion for convergence rather then a
      *       safety measure, set the absolute accuracy to a ridiculously small value,
-     *       like {@link org.apache.commons.math3.util.Precision#SAFE_MIN Precision.SAFE_MIN}.</li>
+     *       like {@link org.apache.commons.math4.util.Precision#SAFE_MIN Precision.SAFE_MIN}.</li>
      *   <li>absolute accuracy:
      *       The default is usually chosen so that results in the interval
      *       -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java
index b7c6b81..826aabc 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegrator.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.integration.gauss.GaussIntegratorFactory;
-import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegrator;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegratorFactory;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This algorithm divides the integration interval into equally-sized

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegrator.java
index 08f4794..94d3325 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegrator.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/Legendre-GaussQuadrature.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java
index aaea286..edcb300 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/MidPointIntegrator.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.integration;
+
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <a href="http://en.wikipedia.org/wiki/Midpoint_method">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java
index 430cd6e..923de73 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/RombergIntegrator.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/RombergIntegration.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java
index b13ff5f..5cfea07 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements <a href="http://mathworld.wolfram.com/SimpsonsRule.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java
index d22d12d..893d602 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/TrapezoidalRule.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java
index f5673fb..bfc351e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
 
 /**
  * Interface for univariate real integration algorithms.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java
index 556fa0c..0b36238 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactory.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
 import java.util.Map;
 import java.util.TreeMap;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Base class for rules that determines the integration nodes and their

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java
index 5c7b37f..f934ce6 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegrator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Class that implements the Gaussian rule for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java
index ebe9a5b..cbfde43 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorFactory.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
 import java.math.BigDecimal;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Class that provides different ways to compute the nodes and weights to be
@@ -39,7 +39,7 @@ public class GaussIntegratorFactory {
     /**
      * Creates a Gauss-Legendre integrator of the given order.
      * The call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
+     * {@link GaussIntegrator#integrate(org.apache.commons.math4.analysis.UnivariateFunction)
      * integrate} method will perform an integration on the natural interval
      * {@code [-1 , 1]}.
      *
@@ -53,7 +53,7 @@ public class GaussIntegratorFactory {
     /**
      * Creates a Gauss-Legendre integrator of the given order.
      * The call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
+     * {@link GaussIntegrator#integrate(org.apache.commons.math4.analysis.UnivariateFunction)
      * integrate} method will perform an integration on the given interval.
      *
      * @param numberOfPoints Order of the integration rule.
@@ -73,7 +73,7 @@ public class GaussIntegratorFactory {
     /**
      * Creates a Gauss-Legendre integrator of the given order.
      * The call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
+     * {@link GaussIntegrator#integrate(org.apache.commons.math4.analysis.UnivariateFunction)
      * integrate} method will perform an integration on the natural interval
      * {@code [-1 , 1]}.
      *
@@ -88,7 +88,7 @@ public class GaussIntegratorFactory {
 
     /**
      * Creates an integrator of the given order, and whose call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
+     * {@link GaussIntegrator#integrate(org.apache.commons.math4.analysis.UnivariateFunction)
      * integrate} method will perform an integration on the given interval.
      *
      * @param numberOfPoints Order of the integration rule.
@@ -108,14 +108,14 @@ public class GaussIntegratorFactory {
     /**
      * Creates a Gauss-Hermite integrator of the given order.
      * The call to the
-     * {@link SymmetricGaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
+     * {@link SymmetricGaussIntegrator#integrate(org.apache.commons.math4.analysis.UnivariateFunction)
      * integrate} method will perform a weighted integration on the interval
      * {@code [-&inf;, +&inf;]}: the computed value is the improper integral of
      * <code>
      *  e<sup>-x<sup>2</sup></sup> f(x)
      * </code>
      * where {@code f(x)} is the function passed to the
-     * {@link SymmetricGaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
+     * {@link SymmetricGaussIntegrator#integrate(org.apache.commons.math4.analysis.UnivariateFunction)
      * integrate} method.
      *
      * @param numberOfPoints Order of the integration rule.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java
index 3d873ab..cf8ccc6 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/HermiteRuleFactory.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Factory that creates a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
index 93e1738..81e6727 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
 import java.math.BigDecimal;
 import java.math.MathContext;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Factory that creates Gauss-type quadrature rule using Legendre polynomials.


[21/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/SubOrientedPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/SubOrientedPoint.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/SubOrientedPoint.java
deleted file mode 100644
index 697cfaf..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/SubOrientedPoint.java
+++ /dev/null
@@ -1,76 +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.geometry.euclidean.oned;
-
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
-
-/** This class represents sub-hyperplane for {@link OrientedPoint}.
- * <p>An hyperplane in 1D is a simple point, its orientation being a
- * boolean.</p>
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.0
- */
-public class SubOrientedPoint extends AbstractSubHyperplane<Euclidean1D, Euclidean1D> {
-
-    /** Simple constructor.
-     * @param hyperplane underlying hyperplane
-     * @param remainingRegion remaining region of the hyperplane
-     */
-    public SubOrientedPoint(final Hyperplane<Euclidean1D> hyperplane,
-                            final Region<Euclidean1D> remainingRegion) {
-        super(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getSize() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean isEmpty() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected AbstractSubHyperplane<Euclidean1D, Euclidean1D> buildNew(final Hyperplane<Euclidean1D> hyperplane,
-                                                                       final Region<Euclidean1D> remainingRegion) {
-        return new SubOrientedPoint(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Side side(final Hyperplane<Euclidean1D> hyperplane) {
-        final double global = hyperplane.getOffset(((OrientedPoint) getHyperplane()).getLocation());
-        return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public SplitSubHyperplane<Euclidean1D> split(final Hyperplane<Euclidean1D> hyperplane) {
-        final double global = hyperplane.getOffset(((OrientedPoint) getHyperplane()).getLocation());
-        return (global < -1.0e-10) ?
-                                    new SplitSubHyperplane<Euclidean1D>(null, this) :
-                                        new SplitSubHyperplane<Euclidean1D>(this, null);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java
deleted file mode 100644
index 1ec7a4e..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.java
+++ /dev/null
@@ -1,356 +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.geometry.euclidean.oned;
-
-import java.text.NumberFormat;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/** This class represents a 1D vector.
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.0
- */
-public class Vector1D implements Vector<Euclidean1D> {
-
-    /** Origin (coordinates: 0). */
-    public static final Vector1D ZERO = new Vector1D(0.0);
-
-    /** Unit (coordinates: 1). */
-    public static final Vector1D ONE  = new Vector1D(1.0);
-
-    // CHECKSTYLE: stop ConstantName
-    /** A vector with all coordinates set to NaN. */
-    public static final Vector1D NaN = new Vector1D(Double.NaN);
-    // CHECKSTYLE: resume ConstantName
-
-    /** A vector with all coordinates set to positive infinity. */
-    public static final Vector1D POSITIVE_INFINITY =
-        new Vector1D(Double.POSITIVE_INFINITY);
-
-    /** A vector with all coordinates set to negative infinity. */
-    public static final Vector1D NEGATIVE_INFINITY =
-        new Vector1D(Double.NEGATIVE_INFINITY);
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 7556674948671647925L;
-
-    /** Abscissa. */
-    private final double x;
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param x abscissa
-     * @see #getX()
-     */
-    public Vector1D(double x) {
-        this.x = x;
-    }
-
-    /** Multiplicative constructor
-     * Build a vector from another one and a scale factor.
-     * The vector built will be a * u
-     * @param a scale factor
-     * @param u base (unscaled) vector
-     */
-    public Vector1D(double a, Vector1D u) {
-        this.x = a * u.x;
-    }
-
-    /** Linear constructor
-     * Build a vector from two other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     */
-    public Vector1D(double a1, Vector1D u1, double a2, Vector1D u2) {
-        this.x = a1 * u1.x + a2 * u2.x;
-    }
-
-    /** Linear constructor
-     * Build a vector from three other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     */
-    public Vector1D(double a1, Vector1D u1, double a2, Vector1D u2,
-                   double a3, Vector1D u3) {
-        this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x;
-    }
-
-    /** Linear constructor
-     * Build a vector from four other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     * @param a4 fourth scale factor
-     * @param u4 fourth base (unscaled) vector
-     */
-    public Vector1D(double a1, Vector1D u1, double a2, Vector1D u2,
-                   double a3, Vector1D u3, double a4, Vector1D u4) {
-        this.x = a1 * u1.x + a2 * u2.x + a3 * u3.x + a4 * u4.x;
-    }
-
-    /** Get the abscissa of the vector.
-     * @return abscissa of the vector
-     * @see #Vector1D(double)
-     */
-    public double getX() {
-        return x;
-    }
-
-    /** {@inheritDoc} */
-    public Space getSpace() {
-        return Euclidean1D.getInstance();
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D getZero() {
-        return ZERO;
-    }
-
-    /** {@inheritDoc} */
-    public double getNorm1() {
-        return FastMath.abs(x);
-    }
-
-    /** {@inheritDoc} */
-    public double getNorm() {
-        return FastMath.abs(x);
-    }
-
-    /** {@inheritDoc} */
-    public double getNormSq() {
-        return x * x;
-    }
-
-    /** {@inheritDoc} */
-    public double getNormInf() {
-        return FastMath.abs(x);
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D add(Vector<Euclidean1D> v) {
-        Vector1D v1 = (Vector1D) v;
-        return new Vector1D(x + v1.getX());
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D add(double factor, Vector<Euclidean1D> v) {
-        Vector1D v1 = (Vector1D) v;
-        return new Vector1D(x + factor * v1.getX());
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D subtract(Vector<Euclidean1D> p) {
-        Vector1D p3 = (Vector1D) p;
-        return new Vector1D(x - p3.x);
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D subtract(double factor, Vector<Euclidean1D> v) {
-        Vector1D v1 = (Vector1D) v;
-        return new Vector1D(x - factor * v1.getX());
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D normalize() throws MathArithmeticException {
-        double s = getNorm();
-        if (s == 0) {
-            throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
-        }
-        return scalarMultiply(1 / s);
-    }
-    /** {@inheritDoc} */
-    public Vector1D negate() {
-        return new Vector1D(-x);
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D scalarMultiply(double a) {
-        return new Vector1D(a * x);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isNaN() {
-        return Double.isNaN(x);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isInfinite() {
-        return !isNaN() && Double.isInfinite(x);
-    }
-
-    /** {@inheritDoc} */
-    public double distance1(Vector<Euclidean1D> p) {
-        Vector1D p3 = (Vector1D) p;
-        final double dx = FastMath.abs(p3.x - x);
-        return dx;
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.3, replaced with {@link #distance(Point)}
-     */
-    @Deprecated
-    public double distance(Vector<Euclidean1D> p) {
-        return distance((Point<Euclidean1D>) p);
-    }
-
-    /** {@inheritDoc} */
-    public double distance(Point<Euclidean1D> p) {
-        Vector1D p3 = (Vector1D) p;
-        final double dx = p3.x - x;
-        return FastMath.abs(dx);
-    }
-
-    /** {@inheritDoc} */
-    public double distanceInf(Vector<Euclidean1D> p) {
-        Vector1D p3 = (Vector1D) p;
-        final double dx = FastMath.abs(p3.x - x);
-        return dx;
-    }
-
-    /** {@inheritDoc} */
-    public double distanceSq(Vector<Euclidean1D> p) {
-        Vector1D p3 = (Vector1D) p;
-        final double dx = p3.x - x;
-        return dx * dx;
-    }
-
-    /** {@inheritDoc} */
-    public double dotProduct(final Vector<Euclidean1D> v) {
-        final Vector1D v1 = (Vector1D) v;
-        return x * v1.x;
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>p1.subtract(p2).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the distance between p1 and p2 according to the L<sub>2</sub> norm
-     */
-    public static double distance(Vector1D p1, Vector1D p2) {
-        return p1.distance(p2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>p1.subtract(p2).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the distance between p1 and p2 according to the L<sub>&infin;</sub> norm
-     */
-    public static double distanceInf(Vector1D p1, Vector1D p2) {
-        return p1.distanceInf(p2);
-    }
-
-    /** Compute the square of the distance between two vectors.
-     * <p>Calling this method is equivalent to calling:
-     * <code>p1.subtract(p2).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the square of the distance between p1 and p2
-     */
-    public static double distanceSq(Vector1D p1, Vector1D p2) {
-        return p1.distanceSq(p2);
-    }
-
-    /**
-     * Test for the equality of two 1D vectors.
-     * <p>
-     * If all coordinates of two 1D vectors are exactly the same, and none are
-     * <code>Double.NaN</code>, the two 1D vectors are considered to be equal.
-     * </p>
-     * <p>
-     * <code>NaN</code> coordinates are considered to affect globally the vector
-     * and be equals to each other - i.e, if either (or all) coordinates of the
-     * 1D vector are equal to <code>Double.NaN</code>, the 1D vector is equal to
-     * {@link #NaN}.
-     * </p>
-     *
-     * @param other Object to test for equality to this
-     * @return true if two 1D vector objects are equal, false if
-     *         object is null, not an instance of Vector1D, or
-     *         not equal to this Vector1D instance
-     *
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof Vector1D) {
-            final Vector1D rhs = (Vector1D)other;
-            if (rhs.isNaN()) {
-                return this.isNaN();
-            }
-
-            return x == rhs.x;
-        }
-        return false;
-    }
-
-    /**
-     * Get a hashCode for the 1D vector.
-     * <p>
-     * All NaN values have the same hash code.</p>
-     *
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN()) {
-            return 7785;
-        }
-        return 997 * MathUtils.hash(x);
-    }
-
-    /** Get a string representation of this vector.
-     * @return a string representation of this vector
-     */
-    @Override
-    public String toString() {
-        return Vector1DFormat.getInstance().format(this);
-    }
-
-    /** {@inheritDoc} */
-    public String toString(final NumberFormat format) {
-        return new Vector1DFormat(format).format(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java
deleted file mode 100644
index 27f1905..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.java
+++ /dev/null
@@ -1,135 +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.geometry.euclidean.oned;
-
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.VectorFormat;
-import org.apache.commons.math3.util.CompositeFormat;
-
-/**
- * Formats a 1D vector in components list format "{x}".
- * <p>The prefix and suffix "{" and "}" can be replaced by
- * any user-defined strings. The number format for components can be configured.</p>
- * <p>White space is ignored at parse time, even if it is in the prefix, suffix
- * or separator specifications. So even if the default separator does include a space
- * character that is used at format time, both input string "{1}" and
- * " { 1 } " will be parsed without error and the same vector will be
- * returned. In the second case, however, the parse position after parsing will be
- * just after the closing curly brace, i.e. just before the trailing space.</p>
- * <p><b>Note:</b> using "," as a separator may interfere with the grouping separator
- * of the default {@link NumberFormat} for the current locale. Thus it is advised
- * to use a {@link NumberFormat} instance with disabled grouping in such a case.</p>
- *
- * @since 3.0
- */
-public class Vector1DFormat extends VectorFormat<Euclidean1D> {
-
-    /**
-     * Create an instance with default settings.
-     * <p>The instance uses the default prefix, suffix and separator:
-     * "{", "}", and "; " and the default number format for components.</p>
-     */
-    public Vector1DFormat() {
-        super(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR,
-              CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with a custom number format for components.
-     * @param format the custom format for components.
-     */
-    public Vector1DFormat(final NumberFormat format) {
-        super(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, format);
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix and separator.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     */
-    public Vector1DFormat(final String prefix, final String suffix) {
-        super(prefix, suffix, DEFAULT_SEPARATOR, CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix, separator and format
-     * for components.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     * @param format the custom format for components.
-     */
-    public Vector1DFormat(final String prefix, final String suffix,
-                         final NumberFormat format) {
-        super(prefix, suffix, DEFAULT_SEPARATOR, format);
-    }
-
-    /**
-     * Returns the default 1D vector format for the current locale.
-     * @return the default 1D vector format.
-     */
-    public static Vector1DFormat getInstance() {
-        return getInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default 1D vector format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the 1D vector format specific to the given locale.
-     */
-    public static Vector1DFormat getInstance(final Locale locale) {
-        return new Vector1DFormat(CompositeFormat.getDefaultNumberFormat(locale));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public StringBuffer format(final Vector<Euclidean1D> vector, final StringBuffer toAppendTo,
-                               final FieldPosition pos) {
-        final Vector1D p1 = (Vector1D) vector;
-        return format(toAppendTo, pos, p1.getX());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Vector1D parse(final String source) throws MathParseException {
-        ParsePosition parsePosition = new ParsePosition(0);
-        Vector1D result = parse(source, parsePosition);
-        if (parsePosition.getIndex() == 0) {
-            throw new MathParseException(source,
-                                         parsePosition.getErrorIndex(),
-                                         Vector1D.class);
-        }
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Vector1D parse(final String source, final ParsePosition pos) {
-        final double[] coordinates = parseCoordinates(1, source, pos);
-        if (coordinates == null) {
-            return null;
-        }
-        return new Vector1D(coordinates[0]);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/package-info.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/package-info.java
deleted file mode 100644
index 0fa3788..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- *
- * <p>
- * This package provides basic 1D geometry components.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.euclidean.oned;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/CardanEulerSingularityException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/CardanEulerSingularityException.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/CardanEulerSingularityException.java
deleted file mode 100644
index 728074d..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/CardanEulerSingularityException.java
+++ /dev/null
@@ -1,44 +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.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/** This class represents exceptions thrown while extractiong Cardan
- * or Euler angles from a rotation.
-
- * @since 1.2
- */
-public class CardanEulerSingularityException
-  extends MathIllegalStateException {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -1360952845582206770L;
-
-    /**
-     * Simple constructor.
-     * build an exception with a default message.
-     * @param isCardan if true, the rotation is related to Cardan angles,
-     * if false it is related to EulerAngles
-     */
-    public CardanEulerSingularityException(boolean isCardan) {
-        super(isCardan ? LocalizedFormats.CARDAN_ANGLES_SINGULARITY : LocalizedFormats.EULER_ANGLES_SINGULARITY);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Euclidean3D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Euclidean3D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Euclidean3D.java
deleted file mode 100644
index dc06936..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Euclidean3D.java
+++ /dev/null
@@ -1,74 +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.geometry.euclidean.threed;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-
-/**
- * This class implements a three-dimensional space.
- * @since 3.0
- */
-public class Euclidean3D implements Serializable, Space {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 6249091865814886817L;
-
-    /** Private constructor for the singleton.
-     */
-    private Euclidean3D() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static Euclidean3D getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public int getDimension() {
-        return 3;
-    }
-
-    /** {@inheritDoc} */
-    public Euclidean2D getSubSpace() {
-        return Euclidean2D.getInstance();
-    }
-
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final Euclidean3D INSTANCE = new Euclidean3D();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-}


[32/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/LaplaceDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/LaplaceDistribution.java b/src/main/java/org/apache/commons/math3/distribution/LaplaceDistribution.java
deleted file mode 100644
index 0514bff..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/LaplaceDistribution.java
+++ /dev/null
@@ -1,160 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * This class implements the Laplace distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Laplace_distribution">Laplace distribution (Wikipedia)</a>
- *
- * @since 3.4
- */
-public class LaplaceDistribution extends AbstractRealDistribution {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20141003;
-
-    /** The location parameter. */
-    private final double mu;
-    /** The scale parameter. */
-    private final double beta;
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mu location parameter
-     * @param beta scale parameter (must be positive)
-     * @throws NotStrictlyPositiveException if {@code beta <= 0}
-     */
-    public LaplaceDistribution(double mu, double beta) {
-        this(new Well19937c(), mu, beta);
-    }
-
-    /**
-     * Build a new instance.
-     *
-     * @param rng Random number generator
-     * @param mu location parameter
-     * @param beta scale parameter (must be positive)
-     * @throws NotStrictlyPositiveException if {@code beta <= 0}
-     */
-    public LaplaceDistribution(RandomGenerator rng, double mu, double beta) {
-        super(rng);
-
-        if (beta <= 0.0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NOT_POSITIVE_SCALE, beta);
-        }
-
-        this.mu = mu;
-        this.beta = beta;
-    }
-
-    /**
-     * Access the location parameter, {@code mu}.
-     *
-     * @return the location parameter.
-     */
-    public double getLocation() {
-        return mu;
-    }
-
-    /**
-     * Access the scale parameter, {@code beta}.
-     *
-     * @return the scale parameter.
-     */
-    public double getScale() {
-        return beta;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        return FastMath.exp(-FastMath.abs(x - mu) / beta) / (2.0 * beta);
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x) {
-        if (x <= mu) {
-            return FastMath.exp((x - mu) / beta) / 2.0;
-        } else {
-            return 1.0 - FastMath.exp((mu - x) / beta) / 2.0;
-        }
-    }
-
-    @Override
-    public double inverseCumulativeProbability(double p) throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0.0, 1.0);
-        } else if (p == 0) {
-            return Double.NEGATIVE_INFINITY;
-        } else if (p == 1) {
-            return Double.POSITIVE_INFINITY;
-        }
-        double x = (p > 0.5) ? -Math.log(2.0 - 2.0 * p) : Math.log(2.0 * p);
-        return mu + beta * x;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalMean() {
-        return mu;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalVariance() {
-        return 2.0 * beta * beta;
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportLowerBound() {
-        return Double.NEGATIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/LevyDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/LevyDistribution.java b/src/main/java/org/apache/commons/math3/distribution/LevyDistribution.java
deleted file mode 100644
index 4580e50..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/LevyDistribution.java
+++ /dev/null
@@ -1,192 +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.distribution;
-
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Erf;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * This class implements the <a href="http://en.wikipedia.org/wiki/L%C3%A9vy_distribution">
- * L&eacute;vy distribution</a>.
- *
- * @since 3.2
- */
-public class LevyDistribution extends AbstractRealDistribution {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20130314L;
-
-    /** Location parameter. */
-    private final double mu;
-
-    /** Scale parameter. */
-    private final double c;  // Setting this to 1 returns a cumProb of 1.0
-
-    /** Half of c (for calculations). */
-    private final double halfC;
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mu location parameter
-     * @param c scale parameter
-     * @since 3.4
-     */
-    public LevyDistribution(final double mu, final double c) {
-        this(new Well19937c(), mu, c);
-    }
-
-    /**
-     * Creates a LevyDistribution.
-     * @param rng random generator to be used for sampling
-     * @param mu location
-     * @param c scale parameter
-     */
-    public LevyDistribution(final RandomGenerator rng, final double mu, final double c) {
-        super(rng);
-        this.mu    = mu;
-        this.c     = c;
-        this.halfC = 0.5 * c;
-    }
-
-    /** {@inheritDoc}
-    * <p>
-    * From Wikipedia: The probability density function of the L&eacute;vy distribution
-    * over the domain is
-    * </p>
-    * <pre>
-    * f(x; &mu;, c) = &radic;(c / 2&pi;) * e<sup>-c / 2 (x - &mu;)</sup> / (x - &mu;)<sup>3/2</sup>
-    * </pre>
-    * <p>
-    * For this distribution, {@code X}, this method returns {@code P(X < x)}.
-    * If {@code x} is less than location parameter &mu;, {@code Double.NaN} is
-    * returned, as in these cases the distribution is not defined.
-    * </p>
-    */
-    public double density(final double x) {
-        if (x < mu) {
-            return Double.NaN;
-        }
-
-        final double delta = x - mu;
-        final double f     = halfC / delta;
-        return FastMath.sqrt(f / FastMath.PI) * FastMath.exp(-f) /delta;
-    }
-
-    /** {@inheritDoc}
-     *
-     * See documentation of {@link #density(double)} for computation details.
-     */
-    @Override
-    public double logDensity(double x) {
-        if (x < mu) {
-            return Double.NaN;
-        }
-
-        final double delta = x - mu;
-        final double f     = halfC / delta;
-        return 0.5 * FastMath.log(f / FastMath.PI) - f - FastMath.log(delta);
-    }
-
-    /** {@inheritDoc}
-     * <p>
-     * From Wikipedia: the cumulative distribution function is
-     * </p>
-     * <pre>
-     * f(x; u, c) = erfc (&radic; (c / 2 (x - u )))
-     * </pre>
-     */
-    public double cumulativeProbability(final double x) {
-        if (x < mu) {
-            return Double.NaN;
-        }
-        return Erf.erfc(FastMath.sqrt(halfC / (x - mu)));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double inverseCumulativeProbability(final double p) throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-        final double t = Erf.erfcInv(p);
-        return mu + halfC / (t * t);
-    }
-
-    /** Get the scale parameter of the distribution.
-     * @return scale parameter of the distribution
-     */
-    public double getScale() {
-        return c;
-    }
-
-    /** Get the location parameter of the distribution.
-     * @return location parameter of the distribution
-     */
-    public double getLocation() {
-        return mu;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalMean() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalVariance() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportLowerBound() {
-        return mu;
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        // there is a division by x-mu in the computation, so density
-        // is not finite at lower bound, bound must be excluded
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        // upper bound is infinite, so it must be excluded
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java b/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java
deleted file mode 100644
index b8148b0..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java
+++ /dev/null
@@ -1,366 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Erf;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the log-normal (gaussian) distribution.
- *
- * <p>
- * <strong>Parameters:</strong>
- * {@code X} is log-normally distributed if its natural logarithm {@code log(X)}
- * is normally distributed. The probability distribution function of {@code X}
- * is given by (for {@code x > 0})
- * </p>
- * <p>
- * {@code exp(-0.5 * ((ln(x) - m) / s)^2) / (s * sqrt(2 * pi) * x)}
- * </p>
- * <ul>
- * <li>{@code m} is the <em>scale</em> parameter: this is the mean of the
- * normally distributed natural logarithm of this distribution,</li>
- * <li>{@code s} is the <em>shape</em> parameter: this is the standard
- * deviation of the normally distributed natural logarithm of this
- * distribution.
- * </ul>
- *
- * @see <a href="http://en.wikipedia.org/wiki/Log-normal_distribution">
- * Log-normal distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/LogNormalDistribution.html">
- * Log Normal distribution (MathWorld)</a>
- *
- * @since 3.0
- */
-public class LogNormalDistribution extends AbstractRealDistribution {
-    /** Default inverse cumulative probability accuracy. */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20120112;
-
-    /** &radic;(2 &pi;) */
-    private static final double SQRT2PI = FastMath.sqrt(2 * FastMath.PI);
-
-    /** &radic;(2) */
-    private static final double SQRT2 = FastMath.sqrt(2.0);
-
-    /** The scale parameter of this distribution. */
-    private final double scale;
-
-    /** The shape parameter of this distribution. */
-    private final double shape;
-    /** The value of {@code log(shape) + 0.5 * log(2*PI)} stored for faster computation. */
-    private final double logShapePlusHalfLog2Pi;
-
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Create a log-normal distribution, where the mean and standard deviation
-     * of the {@link NormalDistribution normally distributed} natural
-     * logarithm of the log-normal distribution are equal to zero and one
-     * respectively. In other words, the scale of the returned distribution is
-     * {@code 0}, while its shape is {@code 1}.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     */
-    public LogNormalDistribution() {
-        this(0, 1);
-    }
-
-    /**
-     * Create a log-normal distribution using the specified scale and shape.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param scale the scale parameter of this distribution
-     * @param shape the shape parameter of this distribution
-     * @throws NotStrictlyPositiveException if {@code shape <= 0}.
-     */
-    public LogNormalDistribution(double scale, double shape)
-        throws NotStrictlyPositiveException {
-        this(scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create a log-normal distribution using the specified scale, shape and
-     * inverse cumulative distribution accuracy.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param scale the scale parameter of this distribution
-     * @param shape the shape parameter of this distribution
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NotStrictlyPositiveException if {@code shape <= 0}.
-     */
-    public LogNormalDistribution(double scale, double shape, double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        this(new Well19937c(), scale, shape, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a log-normal distribution.
-     *
-     * @param rng Random number generator.
-     * @param scale Scale parameter of this distribution.
-     * @param shape Shape parameter of this distribution.
-     * @throws NotStrictlyPositiveException if {@code shape <= 0}.
-     * @since 3.3
-     */
-    public LogNormalDistribution(RandomGenerator rng, double scale, double shape)
-        throws NotStrictlyPositiveException {
-        this(rng, scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a log-normal distribution.
-     *
-     * @param rng Random number generator.
-     * @param scale Scale parameter of this distribution.
-     * @param shape Shape parameter of this distribution.
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NotStrictlyPositiveException if {@code shape <= 0}.
-     * @since 3.1
-     */
-    public LogNormalDistribution(RandomGenerator rng,
-                                 double scale,
-                                 double shape,
-                                 double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (shape <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SHAPE, shape);
-        }
-
-        this.scale = scale;
-        this.shape = shape;
-        this.logShapePlusHalfLog2Pi = FastMath.log(shape) + 0.5 * FastMath.log(2 * FastMath.PI);
-        this.solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * Returns the scale parameter of this distribution.
-     *
-     * @return the scale parameter
-     */
-    public double getScale() {
-        return scale;
-    }
-
-    /**
-     * Returns the shape parameter of this distribution.
-     *
-     * @return the shape parameter
-     */
-    public double getShape() {
-        return shape;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For scale {@code m}, and shape {@code s} of this distribution, the PDF
-     * is given by
-     * <ul>
-     * <li>{@code 0} if {@code x <= 0},</li>
-     * <li>{@code exp(-0.5 * ((ln(x) - m) / s)^2) / (s * sqrt(2 * pi) * x)}
-     * otherwise.</li>
-     * </ul>
-     */
-    public double density(double x) {
-        if (x <= 0) {
-            return 0;
-        }
-        final double x0 = FastMath.log(x) - scale;
-        final double x1 = x0 / shape;
-        return FastMath.exp(-0.5 * x1 * x1) / (shape * SQRT2PI * x);
-    }
-
-    /** {@inheritDoc}
-     *
-     * See documentation of {@link #density(double)} for computation details.
-     */
-    @Override
-    public double logDensity(double x) {
-        if (x <= 0) {
-            return Double.NEGATIVE_INFINITY;
-        }
-        final double logX = FastMath.log(x);
-        final double x0 = logX - scale;
-        final double x1 = x0 / shape;
-        return -0.5 * x1 * x1 - (logShapePlusHalfLog2Pi + logX);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For scale {@code m}, and shape {@code s} of this distribution, the CDF
-     * is given by
-     * <ul>
-     * <li>{@code 0} if {@code x <= 0},</li>
-     * <li>{@code 0} if {@code ln(x) - m < 0} and {@code m - ln(x) > 40 * s}, as
-     * in these cases the actual value is within {@code Double.MIN_VALUE} of 0,
-     * <li>{@code 1} if {@code ln(x) - m >= 0} and {@code ln(x) - m > 40 * s},
-     * as in these cases the actual value is within {@code Double.MIN_VALUE} of
-     * 1,</li>
-     * <li>{@code 0.5 + 0.5 * erf((ln(x) - m) / (s * sqrt(2))} otherwise.</li>
-     * </ul>
-     */
-    public double cumulativeProbability(double x)  {
-        if (x <= 0) {
-            return 0;
-        }
-        final double dev = FastMath.log(x) - scale;
-        if (FastMath.abs(dev) > 40 * shape) {
-            return dev < 0 ? 0.0d : 1.0d;
-        }
-        return 0.5 + 0.5 * Erf.erf(dev / (shape * SQRT2));
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
-     */
-    @Override@Deprecated
-    public double cumulativeProbability(double x0, double x1)
-        throws NumberIsTooLargeException {
-        return probability(x0, x1);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double probability(double x0,
-                              double x1)
-        throws NumberIsTooLargeException {
-        if (x0 > x1) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
-                                                x0, x1, true);
-        }
-        if (x0 <= 0 || x1 <= 0) {
-            return super.probability(x0, x1);
-        }
-        final double denom = shape * SQRT2;
-        final double v0 = (FastMath.log(x0) - scale) / denom;
-        final double v1 = (FastMath.log(x1) - scale) / denom;
-        return 0.5 * Erf.erf(v0, v1);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For scale {@code m} and shape {@code s}, the mean is
-     * {@code exp(m + s^2 / 2)}.
-     */
-    public double getNumericalMean() {
-        double s = shape;
-        return FastMath.exp(scale + (s * s / 2));
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For scale {@code m} and shape {@code s}, the variance is
-     * {@code (exp(s^2) - 1) * exp(2 * m + s^2)}.
-     */
-    public double getNumericalVariance() {
-        final double s = shape;
-        final double ss = s * s;
-        return (FastMath.expm1(ss)) * FastMath.exp(2 * scale + ss);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the parameters.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity
-     * no matter the parameters.
-     *
-     * @return upper bound of the support (always
-     * {@code Double.POSITIVE_INFINITY})
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double sample()  {
-        final double n = random.nextGaussian();
-        return FastMath.exp(scale + shape * n);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java b/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java
deleted file mode 100644
index 59313f5..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/LogisticDistribution.java
+++ /dev/null
@@ -1,160 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * This class implements the Logistic distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Logistic_distribution">Logistic Distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/LogisticDistribution.html">Logistic Distribution (Mathworld)</a>
- *
- * @since 3.4
- */
-public class LogisticDistribution extends AbstractRealDistribution {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20141003;
-
-    /** The location parameter. */
-    private final double mu;
-    /** The scale parameter. */
-    private final double s;
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mu location parameter
-     * @param s scale parameter (must be positive)
-     * @throws NotStrictlyPositiveException if {@code beta <= 0}
-     */
-    public LogisticDistribution(double mu, double s) {
-        this(new Well19937c(), mu, s);
-    }
-
-    /**
-     * Build a new instance.
-     *
-     * @param rng Random number generator
-     * @param mu location parameter
-     * @param s scale parameter (must be positive)
-     * @throws NotStrictlyPositiveException if {@code beta <= 0}
-     */
-    public LogisticDistribution(RandomGenerator rng, double mu, double s) {
-        super(rng);
-
-        if (s <= 0.0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NOT_POSITIVE_SCALE, s);
-        }
-
-        this.mu = mu;
-        this.s = s;
-    }
-
-    /**
-     * Access the location parameter, {@code mu}.
-     *
-     * @return the location parameter.
-     */
-    public double getLocation() {
-        return mu;
-    }
-
-    /**
-     * Access the scale parameter, {@code s}.
-     *
-     * @return the scale parameter.
-     */
-    public double getScale() {
-        return s;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        double z = (x - mu) / s;
-        double v = FastMath.exp(-z);
-        return 1 / s * v / ((1.0 + v) * (1.0 + v));
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x) {
-        double z = 1 / s * (x - mu);
-        return 1.0 / (1.0 + FastMath.exp(-z));
-    }
-
-    @Override
-    public double inverseCumulativeProbability(double p) throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0.0, 1.0);
-        } else if (p == 0) {
-            return 0.0;
-        } else if (p == 1) {
-            return Double.POSITIVE_INFINITY;
-        }
-        return s * Math.log(p / (1.0 - p)) + mu;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalMean() {
-        return mu;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalVariance() {
-        return (MathUtils.PI_SQUARED / 3.0) * (1.0 / (s * s));
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportLowerBound() {
-        return Double.NEGATIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java b/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java
deleted file mode 100644
index 0cf88c2..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java
+++ /dev/null
@@ -1,113 +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.distribution;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Multivariate normal mixture distribution.
- * This class is mainly syntactic sugar.
- *
- * @see MixtureMultivariateRealDistribution
- * @since 3.2
- */
-public class MixtureMultivariateNormalDistribution
-    extends MixtureMultivariateRealDistribution<MultivariateNormalDistribution> {
-
-    /**
-     * Creates a multivariate normal mixture distribution.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link org.apache.commons.math3.random.Well19937c Well19937c} as random
-     * generator to be used for sampling only (see {@link #sample()} and
-     * {@link #sample(int)}). In case no sampling is needed for the created
-     * distribution, it is advised to pass {@code null} as random generator via
-     * the appropriate constructors to avoid the additional initialisation
-     * overhead.
-     *
-     * @param weights Weights of each component.
-     * @param means Mean vector for each component.
-     * @param covariances Covariance matrix for each component.
-     */
-    public MixtureMultivariateNormalDistribution(double[] weights,
-                                                 double[][] means,
-                                                 double[][][] covariances) {
-        super(createComponents(weights, means, covariances));
-    }
-
-    /**
-     * Creates a mixture model from a list of distributions and their
-     * associated weights.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link org.apache.commons.math3.random.Well19937c Well19937c} as random
-     * generator to be used for sampling only (see {@link #sample()} and
-     * {@link #sample(int)}). In case no sampling is needed for the created
-     * distribution, it is advised to pass {@code null} as random generator via
-     * the appropriate constructors to avoid the additional initialisation
-     * overhead.
-     *
-     * @param components List of (weight, distribution) pairs from which to sample.
-     */
-    public MixtureMultivariateNormalDistribution(List<Pair<Double, MultivariateNormalDistribution>> components) {
-        super(components);
-    }
-
-    /**
-     * Creates a mixture model from a list of distributions and their
-     * associated weights.
-     *
-     * @param rng Random number generator.
-     * @param components Distributions from which to sample.
-     * @throws NotPositiveException if any of the weights is negative.
-     * @throws DimensionMismatchException if not all components have the same
-     * number of variables.
-     */
-    public MixtureMultivariateNormalDistribution(RandomGenerator rng,
-                                                 List<Pair<Double, MultivariateNormalDistribution>> components)
-        throws NotPositiveException, DimensionMismatchException {
-        super(rng, components);
-    }
-
-    /**
-     * @param weights Weights of each component.
-     * @param means Mean vector for each component.
-     * @param covariances Covariance matrix for each component.
-     * @return the list of components.
-     */
-    private static List<Pair<Double, MultivariateNormalDistribution>> createComponents(double[] weights,
-                                                                                       double[][] means,
-                                                                                       double[][][] covariances) {
-        final List<Pair<Double, MultivariateNormalDistribution>> mvns
-            = new ArrayList<Pair<Double, MultivariateNormalDistribution>>(weights.length);
-
-        for (int i = 0; i < weights.length; i++) {
-            final MultivariateNormalDistribution dist
-                = new MultivariateNormalDistribution(means[i], covariances[i]);
-
-            mvns.add(new Pair<Double, MultivariateNormalDistribution>(weights[i], dist));
-        }
-
-        return mvns;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java
deleted file mode 100644
index f0939f6..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java
+++ /dev/null
@@ -1,171 +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.distribution;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Class for representing <a href="http://en.wikipedia.org/wiki/Mixture_model">
- * mixture model</a> distributions.
- *
- * @param <T> Type of the mixture components.
- *
- * @since 3.1
- */
-public class MixtureMultivariateRealDistribution<T extends MultivariateRealDistribution>
-    extends AbstractMultivariateRealDistribution {
-    /** Normalized weight of each mixture component. */
-    private final double[] weight;
-    /** Mixture components. */
-    private final List<T> distribution;
-
-    /**
-     * Creates a mixture model from a list of distributions and their
-     * associated weights.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param components List of (weight, distribution) pairs from which to sample.
-     */
-    public MixtureMultivariateRealDistribution(List<Pair<Double, T>> components) {
-        this(new Well19937c(), components);
-    }
-
-    /**
-     * Creates a mixture model from a list of distributions and their
-     * associated weights.
-     *
-     * @param rng Random number generator.
-     * @param components Distributions from which to sample.
-     * @throws NotPositiveException if any of the weights is negative.
-     * @throws DimensionMismatchException if not all components have the same
-     * number of variables.
-     */
-    public MixtureMultivariateRealDistribution(RandomGenerator rng,
-                                               List<Pair<Double, T>> components) {
-        super(rng, components.get(0).getSecond().getDimension());
-
-        final int numComp = components.size();
-        final int dim = getDimension();
-        double weightSum = 0;
-        for (int i = 0; i < numComp; i++) {
-            final Pair<Double, T> comp = components.get(i);
-            if (comp.getSecond().getDimension() != dim) {
-                throw new DimensionMismatchException(comp.getSecond().getDimension(), dim);
-            }
-            if (comp.getFirst() < 0) {
-                throw new NotPositiveException(comp.getFirst());
-            }
-            weightSum += comp.getFirst();
-        }
-
-        // Check for overflow.
-        if (Double.isInfinite(weightSum)) {
-            throw new MathArithmeticException(LocalizedFormats.OVERFLOW);
-        }
-
-        // Store each distribution and its normalized weight.
-        distribution = new ArrayList<T>();
-        weight = new double[numComp];
-        for (int i = 0; i < numComp; i++) {
-            final Pair<Double, T> comp = components.get(i);
-            weight[i] = comp.getFirst() / weightSum;
-            distribution.add(comp.getSecond());
-        }
-    }
-
-    /** {@inheritDoc} */
-    public double density(final double[] values) {
-        double p = 0;
-        for (int i = 0; i < weight.length; i++) {
-            p += weight[i] * distribution.get(i).density(values);
-        }
-        return p;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] sample() {
-        // Sampled values.
-        double[] vals = null;
-
-        // Determine which component to sample from.
-        final double randomValue = random.nextDouble();
-        double sum = 0;
-
-        for (int i = 0; i < weight.length; i++) {
-            sum += weight[i];
-            if (randomValue <= sum) {
-                // pick model i
-                vals = distribution.get(i).sample();
-                break;
-            }
-        }
-
-        if (vals == null) {
-            // This should never happen, but it ensures we won't return a null in
-            // case the loop above has some floating point inequality problem on
-            // the final iteration.
-            vals = distribution.get(weight.length - 1).sample();
-        }
-
-        return vals;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void reseedRandomGenerator(long seed) {
-        // Seed needs to be propagated to underlying components
-        // in order to maintain consistency between runs.
-        super.reseedRandomGenerator(seed);
-
-        for (int i = 0; i < distribution.size(); i++) {
-            // Make each component's seed different in order to avoid
-            // using the same sequence of random numbers.
-            distribution.get(i).reseedRandomGenerator(i + 1 + seed);
-        }
-    }
-
-    /**
-     * Gets the distributions that make up the mixture model.
-     *
-     * @return the component distributions and associated weights.
-     */
-    public List<Pair<Double, T>> getComponents() {
-        final List<Pair<Double, T>> list = new ArrayList<Pair<Double, T>>(weight.length);
-
-        for (int i = 0; i < weight.length; i++) {
-            list.add(new Pair<Double, T>(weight[i], distribution.get(i)));
-        }
-
-        return list;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/MultivariateNormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/MultivariateNormalDistribution.java b/src/main/java/org/apache/commons/math3/distribution/MultivariateNormalDistribution.java
deleted file mode 100644
index 7fc8b74..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/MultivariateNormalDistribution.java
+++ /dev/null
@@ -1,247 +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.distribution;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Implementation of the multivariate normal (Gaussian) distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Multivariate_normal_distribution">
- * Multivariate normal distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/MultivariateNormalDistribution.html">
- * Multivariate normal distribution (MathWorld)</a>
- *
- * @since 3.1
- */
-public class MultivariateNormalDistribution
-    extends AbstractMultivariateRealDistribution {
-    /** Vector of means. */
-    private final double[] means;
-    /** Covariance matrix. */
-    private final RealMatrix covarianceMatrix;
-    /** The matrix inverse of the covariance matrix. */
-    private final RealMatrix covarianceMatrixInverse;
-    /** The determinant of the covariance matrix. */
-    private final double covarianceMatrixDeterminant;
-    /** Matrix used in computation of samples. */
-    private final RealMatrix samplingMatrix;
-
-    /**
-     * Creates a multivariate normal distribution with the given mean vector and
-     * covariance matrix.
-     * <br/>
-     * The number of dimensions is equal to the length of the mean vector
-     * and to the number of rows and columns of the covariance matrix.
-     * It is frequently written as "p" in formulae.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param means Vector of means.
-     * @param covariances Covariance matrix.
-     * @throws DimensionMismatchException if the arrays length are
-     * inconsistent.
-     * @throws SingularMatrixException if the eigenvalue decomposition cannot
-     * be performed on the provided covariance matrix.
-     * @throws NonPositiveDefiniteMatrixException if any of the eigenvalues is
-     * negative.
-     */
-    public MultivariateNormalDistribution(final double[] means,
-                                          final double[][] covariances)
-        throws SingularMatrixException,
-               DimensionMismatchException,
-               NonPositiveDefiniteMatrixException {
-        this(new Well19937c(), means, covariances);
-    }
-
-    /**
-     * Creates a multivariate normal distribution with the given mean vector and
-     * covariance matrix.
-     * <br/>
-     * The number of dimensions is equal to the length of the mean vector
-     * and to the number of rows and columns of the covariance matrix.
-     * It is frequently written as "p" in formulae.
-     *
-     * @param rng Random Number Generator.
-     * @param means Vector of means.
-     * @param covariances Covariance matrix.
-     * @throws DimensionMismatchException if the arrays length are
-     * inconsistent.
-     * @throws SingularMatrixException if the eigenvalue decomposition cannot
-     * be performed on the provided covariance matrix.
-     * @throws NonPositiveDefiniteMatrixException if any of the eigenvalues is
-     * negative.
-     */
-    public MultivariateNormalDistribution(RandomGenerator rng,
-                                          final double[] means,
-                                          final double[][] covariances)
-            throws SingularMatrixException,
-                   DimensionMismatchException,
-                   NonPositiveDefiniteMatrixException {
-        super(rng, means.length);
-
-        final int dim = means.length;
-
-        if (covariances.length != dim) {
-            throw new DimensionMismatchException(covariances.length, dim);
-        }
-
-        for (int i = 0; i < dim; i++) {
-            if (dim != covariances[i].length) {
-                throw new DimensionMismatchException(covariances[i].length, dim);
-            }
-        }
-
-        this.means = MathArrays.copyOf(means);
-
-        covarianceMatrix = new Array2DRowRealMatrix(covariances);
-
-        // Covariance matrix eigen decomposition.
-        final EigenDecomposition covMatDec = new EigenDecomposition(covarianceMatrix);
-
-        // Compute and store the inverse.
-        covarianceMatrixInverse = covMatDec.getSolver().getInverse();
-        // Compute and store the determinant.
-        covarianceMatrixDeterminant = covMatDec.getDeterminant();
-
-        // Eigenvalues of the covariance matrix.
-        final double[] covMatEigenvalues = covMatDec.getRealEigenvalues();
-
-        for (int i = 0; i < covMatEigenvalues.length; i++) {
-            if (covMatEigenvalues[i] < 0) {
-                throw new NonPositiveDefiniteMatrixException(covMatEigenvalues[i], i, 0);
-            }
-        }
-
-        // Matrix where each column is an eigenvector of the covariance matrix.
-        final Array2DRowRealMatrix covMatEigenvectors = new Array2DRowRealMatrix(dim, dim);
-        for (int v = 0; v < dim; v++) {
-            final double[] evec = covMatDec.getEigenvector(v).toArray();
-            covMatEigenvectors.setColumn(v, evec);
-        }
-
-        final RealMatrix tmpMatrix = covMatEigenvectors.transpose();
-
-        // Scale each eigenvector by the square root of its eigenvalue.
-        for (int row = 0; row < dim; row++) {
-            final double factor = FastMath.sqrt(covMatEigenvalues[row]);
-            for (int col = 0; col < dim; col++) {
-                tmpMatrix.multiplyEntry(row, col, factor);
-            }
-        }
-
-        samplingMatrix = covMatEigenvectors.multiply(tmpMatrix);
-    }
-
-    /**
-     * Gets the mean vector.
-     *
-     * @return the mean vector.
-     */
-    public double[] getMeans() {
-        return MathArrays.copyOf(means);
-    }
-
-    /**
-     * Gets the covariance matrix.
-     *
-     * @return the covariance matrix.
-     */
-    public RealMatrix getCovariances() {
-        return covarianceMatrix.copy();
-    }
-
-    /** {@inheritDoc} */
-    public double density(final double[] vals) throws DimensionMismatchException {
-        final int dim = getDimension();
-        if (vals.length != dim) {
-            throw new DimensionMismatchException(vals.length, dim);
-        }
-
-        return FastMath.pow(2 * FastMath.PI, -0.5 * dim) *
-            FastMath.pow(covarianceMatrixDeterminant, -0.5) *
-            getExponentTerm(vals);
-    }
-
-    /**
-     * Gets the square root of each element on the diagonal of the covariance
-     * matrix.
-     *
-     * @return the standard deviations.
-     */
-    public double[] getStandardDeviations() {
-        final int dim = getDimension();
-        final double[] std = new double[dim];
-        final double[][] s = covarianceMatrix.getData();
-        for (int i = 0; i < dim; i++) {
-            std[i] = FastMath.sqrt(s[i][i]);
-        }
-        return std;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] sample() {
-        final int dim = getDimension();
-        final double[] normalVals = new double[dim];
-
-        for (int i = 0; i < dim; i++) {
-            normalVals[i] = random.nextGaussian();
-        }
-
-        final double[] vals = samplingMatrix.operate(normalVals);
-
-        for (int i = 0; i < dim; i++) {
-            vals[i] += means[i];
-        }
-
-        return vals;
-    }
-
-    /**
-     * Computes the term used in the exponent (see definition of the distribution).
-     *
-     * @param values Values at which to compute density.
-     * @return the multiplication factor of density calculations.
-     */
-    private double getExponentTerm(final double[] values) {
-        final double[] centered = new double[values.length];
-        for (int i = 0; i < centered.length; i++) {
-            centered[i] = values[i] - getMeans()[i];
-        }
-        final double[] preMultiplied = covarianceMatrixInverse.preMultiply(centered);
-        double sum = 0;
-        for (int i = 0; i < preMultiplied.length; i++) {
-            sum += preMultiplied[i] * centered[i];
-        }
-        return FastMath.exp(-0.5 * sum);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/MultivariateRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/MultivariateRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/MultivariateRealDistribution.java
deleted file mode 100644
index cde1f74..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/MultivariateRealDistribution.java
+++ /dev/null
@@ -1,78 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-
-/**
- * Base interface for multivariate distributions on the reals.
- *
- * This is based largely on the RealDistribution interface, but cumulative
- * distribution functions are not required because they are often quite
- * difficult to compute for multivariate distributions.
- *
- * @since 3.1
- */
-public interface MultivariateRealDistribution {
-    /**
-     * Returns the probability density function (PDF) of this distribution
-     * evaluated at the specified point {@code x}. In general, the PDF is the
-     * derivative of the cumulative distribution function. If the derivative
-     * does not exist at {@code x}, then an appropriate replacement should be
-     * returned, e.g. {@code Double.POSITIVE_INFINITY}, {@code Double.NaN}, or
-     * the limit inferior or limit superior of the difference quotient.
-     *
-     * @param x Point at which the PDF is evaluated.
-     * @return the value of the probability density function at point {@code x}.
-     */
-    double density(double[] x);
-
-    /**
-     * Reseeds the random generator used to generate samples.
-     *
-     * @param seed Seed with which to initialize the random number generator.
-     */
-    void reseedRandomGenerator(long seed);
-
-    /**
-     * Gets the number of random variables of the distribution.
-     * It is the size of the array returned by the {@link #sample() sample}
-     * method.
-     *
-     * @return the number of variables.
-     */
-    int getDimension();
-
-    /**
-     * Generates a random value vector sampled from this distribution.
-     *
-     * @return a random value vector.
-     */
-    double[] sample();
-
-    /**
-     * Generates a list of a random value vectors from the distribution.
-     *
-     * @param sampleSize the number of random vectors to generate.
-     * @return an array representing the random samples.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
-     * if {@code sampleSize} is not positive.
-     *
-     * @see #sample()
-     */
-    double[][] sample(int sampleSize) throws NotStrictlyPositiveException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/NakagamiDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/NakagamiDistribution.java b/src/main/java/org/apache/commons/math3/distribution/NakagamiDistribution.java
deleted file mode 100644
index 2b1f81f..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/NakagamiDistribution.java
+++ /dev/null
@@ -1,188 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * This class implements the Nakagami distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Nakagami_distribution">Nakagami Distribution (Wikipedia)</a>
- *
- * @since 3.4
- */
-public class NakagamiDistribution extends AbstractRealDistribution {
-
-    /** Default inverse cumulative probability accuracy. */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20141003;
-
-    /** The shape parameter. */
-    private final double mu;
-    /** The scale parameter. */
-    private final double omega;
-    /** Inverse cumulative probability accuracy. */
-    private final double inverseAbsoluteAccuracy;
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mu shape parameter
-     * @param omega scale parameter (must be positive)
-     * @throws NumberIsTooSmallException if {@code mu < 0.5}
-     * @throws NotStrictlyPositiveException if {@code omega <= 0}
-     */
-    public NakagamiDistribution(double mu, double omega) {
-        this(mu, omega, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mu shape parameter
-     * @param omega scale parameter (must be positive)
-     * @param inverseAbsoluteAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NumberIsTooSmallException if {@code mu < 0.5}
-     * @throws NotStrictlyPositiveException if {@code omega <= 0}
-     */
-    public NakagamiDistribution(double mu, double omega, double inverseAbsoluteAccuracy) {
-        this(new Well19937c(), mu, omega, inverseAbsoluteAccuracy);
-    }
-
-    /**
-     * Build a new instance.
-     *
-     * @param rng Random number generator
-     * @param mu shape parameter
-     * @param omega scale parameter (must be positive)
-     * @param inverseAbsoluteAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NumberIsTooSmallException if {@code mu < 0.5}
-     * @throws NotStrictlyPositiveException if {@code omega <= 0}
-     */
-    public NakagamiDistribution(RandomGenerator rng, double mu, double omega, double inverseAbsoluteAccuracy) {
-        super(rng);
-
-        if (mu < 0.5) {
-            throw new NumberIsTooSmallException(mu, 0.5, true);
-        }
-        if (omega <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NOT_POSITIVE_SCALE, omega);
-        }
-
-        this.mu = mu;
-        this.omega = omega;
-        this.inverseAbsoluteAccuracy = inverseAbsoluteAccuracy;
-    }
-
-    /**
-     * Access the shape parameter, {@code mu}.
-     *
-     * @return the shape parameter.
-     */
-    public double getShape() {
-        return mu;
-    }
-
-    /**
-     * Access the scale parameter, {@code omega}.
-     *
-     * @return the scale parameter.
-     */
-    public double getScale() {
-        return omega;
-    }
-
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return inverseAbsoluteAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        if (x <= 0) {
-            return 0.0;
-        }
-        return 2.0 * FastMath.pow(mu, mu) / (Gamma.gamma(mu) * FastMath.pow(omega, mu)) *
-                     FastMath.pow(x, 2 * mu - 1) * FastMath.exp(-mu * x * x / omega);
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x) {
-        return Gamma.regularizedGammaP(mu, mu * x * x / omega);
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalMean() {
-        return Gamma.gamma(mu + 0.5) / Gamma.gamma(mu) * FastMath.sqrt(omega / mu);
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalVariance() {
-        double v = Gamma.gamma(mu + 0.5) / Gamma.gamma(mu);
-        return omega * (1 - 1 / mu * v * v);
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java b/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java
deleted file mode 100644
index 0fc839f..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java
+++ /dev/null
@@ -1,311 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Erf;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the normal (gaussian) distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Normal_distribution">Normal distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/NormalDistribution.html">Normal distribution (MathWorld)</a>
- */
-public class NormalDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 8589540077390120676L;
-    /** &radic;(2) */
-    private static final double SQRT2 = FastMath.sqrt(2.0);
-    /** Mean of this distribution. */
-    private final double mean;
-    /** Standard deviation of this distribution. */
-    private final double standardDeviation;
-    /** The value of {@code log(sd) + 0.5*log(2*pi)} stored for faster computation. */
-    private final double logStandardDeviationPlusHalfLog2Pi;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Create a normal distribution with mean equal to zero and standard
-     * deviation equal to one.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     */
-    public NormalDistribution() {
-        this(0, 1);
-    }
-
-    /**
-     * Create a normal distribution using the given mean and standard deviation.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mean Mean for this distribution.
-     * @param sd Standard deviation for this distribution.
-     * @throws NotStrictlyPositiveException if {@code sd <= 0}.
-     */
-    public NormalDistribution(double mean, double sd)
-        throws NotStrictlyPositiveException {
-        this(mean, sd, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create a normal distribution using the given mean, standard deviation and
-     * inverse cumulative distribution accuracy.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mean Mean for this distribution.
-     * @param sd Standard deviation for this distribution.
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NotStrictlyPositiveException if {@code sd <= 0}.
-     * @since 2.1
-     */
-    public NormalDistribution(double mean, double sd, double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        this(new Well19937c(), mean, sd, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a normal distribution.
-     *
-     * @param rng Random number generator.
-     * @param mean Mean for this distribution.
-     * @param sd Standard deviation for this distribution.
-     * @throws NotStrictlyPositiveException if {@code sd <= 0}.
-     * @since 3.3
-     */
-    public NormalDistribution(RandomGenerator rng, double mean, double sd)
-        throws NotStrictlyPositiveException {
-        this(rng, mean, sd, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a normal distribution.
-     *
-     * @param rng Random number generator.
-     * @param mean Mean for this distribution.
-     * @param sd Standard deviation for this distribution.
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NotStrictlyPositiveException if {@code sd <= 0}.
-     * @since 3.1
-     */
-    public NormalDistribution(RandomGenerator rng,
-                              double mean,
-                              double sd,
-                              double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (sd <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.STANDARD_DEVIATION, sd);
-        }
-
-        this.mean = mean;
-        standardDeviation = sd;
-        logStandardDeviationPlusHalfLog2Pi = FastMath.log(sd) + 0.5 * FastMath.log(2 * FastMath.PI);
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * Access the mean.
-     *
-     * @return the mean for this distribution.
-     */
-    public double getMean() {
-        return mean;
-    }
-
-    /**
-     * Access the standard deviation.
-     *
-     * @return the standard deviation for this distribution.
-     */
-    public double getStandardDeviation() {
-        return standardDeviation;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        return FastMath.exp(logDensity(x));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logDensity(double x) {
-        final double x0 = x - mean;
-        final double x1 = x0 / standardDeviation;
-        return -0.5 * x1 * x1 - logStandardDeviationPlusHalfLog2Pi;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * If {@code x} is more than 40 standard deviations from the mean, 0 or 1
-     * is returned, as in these cases the actual value is within
-     * {@code Double.MIN_VALUE} of 0 or 1.
-     */
-    public double cumulativeProbability(double x)  {
-        final double dev = x - mean;
-        if (FastMath.abs(dev) > 40 * standardDeviation) {
-            return dev < 0 ? 0.0d : 1.0d;
-        }
-        return 0.5 * (1 + Erf.erf(dev / (standardDeviation * SQRT2)));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    @Override
-    public double inverseCumulativeProbability(final double p) throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-        return mean + standardDeviation * SQRT2 * Erf.erfInv(2 * p - 1);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
-     */
-    @Override@Deprecated
-    public double cumulativeProbability(double x0, double x1)
-        throws NumberIsTooLargeException {
-        return probability(x0, x1);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double probability(double x0,
-                              double x1)
-        throws NumberIsTooLargeException {
-        if (x0 > x1) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
-                                                x0, x1, true);
-        }
-        final double denom = standardDeviation * SQRT2;
-        final double v0 = (x0 - mean) / denom;
-        final double v1 = (x1 - mean) / denom;
-        return 0.5 * Erf.erf(v0, v1);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For mean parameter {@code mu}, the mean is {@code mu}.
-     */
-    public double getNumericalMean() {
-        return getMean();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For standard deviation parameter {@code s}, the variance is {@code s^2}.
-     */
-    public double getNumericalVariance() {
-        final double s = getStandardDeviation();
-        return s * s;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always negative infinity
-     * no matter the parameters.
-     *
-     * @return lower bound of the support (always
-     * {@code Double.NEGATIVE_INFINITY})
-     */
-    public double getSupportLowerBound() {
-        return Double.NEGATIVE_INFINITY;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity
-     * no matter the parameters.
-     *
-     * @return upper bound of the support (always
-     * {@code Double.POSITIVE_INFINITY})
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double sample()  {
-        return standardDeviation * random.nextGaussian() + mean;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java
deleted file mode 100644
index 3c4d77a..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java
+++ /dev/null
@@ -1,318 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the Pareto distribution.
- *
- * <p>
- * <strong>Parameters:</strong>
- * The probability distribution function of {@code X} is given by (for {@code x >= k}):
- * <pre>
- *  α * k^α / x^(α + 1)
- * </pre>
- * <p>
- * <ul>
- * <li>{@code k} is the <em>scale</em> parameter: this is the minimum possible value of {@code X},</li>
- * <li>{@code α} is the <em>shape</em> parameter: this is the Pareto index</li>
- * </ul>
- *
- * @see <a href="http://en.wikipedia.org/wiki/Pareto_distribution">
- * Pareto distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/ParetoDistribution.html">
- * Pareto distribution (MathWorld)</a>
- *
- * @since 3.3
- */
-public class ParetoDistribution extends AbstractRealDistribution {
-
-    /** Default inverse cumulative probability accuracy. */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20130424;
-
-    /** The scale parameter of this distribution. */
-    private final double scale;
-
-    /** The shape parameter of this distribution. */
-    private final double shape;
-
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Create a Pareto distribution with a scale of {@code 1} and a shape of {@code 1}.
-     */
-    public ParetoDistribution() {
-        this(1, 1);
-    }
-
-    /**
-     * Create a Pareto distribution using the specified scale and shape.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param scale the scale parameter of this distribution
-     * @param shape the shape parameter of this distribution
-     * @throws NotStrictlyPositiveException if {@code scale <= 0} or {@code shape <= 0}.
-     */
-    public ParetoDistribution(double scale, double shape)
-        throws NotStrictlyPositiveException {
-        this(scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create a Pareto distribution using the specified scale, shape and
-     * inverse cumulative distribution accuracy.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param scale the scale parameter of this distribution
-     * @param shape the shape parameter of this distribution
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NotStrictlyPositiveException if {@code scale <= 0} or {@code shape <= 0}.
-     */
-    public ParetoDistribution(double scale, double shape, double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        this(new Well19937c(), scale, shape, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a Pareto distribution.
-     *
-     * @param rng Random number generator.
-     * @param scale Scale parameter of this distribution.
-     * @param shape Shape parameter of this distribution.
-     * @throws NotStrictlyPositiveException if {@code scale <= 0} or {@code shape <= 0}.
-     */
-    public ParetoDistribution(RandomGenerator rng, double scale, double shape)
-        throws NotStrictlyPositiveException {
-        this(rng, scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a Pareto distribution.
-     *
-     * @param rng Random number generator.
-     * @param scale Scale parameter of this distribution.
-     * @param shape Shape parameter of this distribution.
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NotStrictlyPositiveException if {@code scale <= 0} or {@code shape <= 0}.
-     */
-    public ParetoDistribution(RandomGenerator rng,
-                              double scale,
-                              double shape,
-                              double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (scale <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SCALE, scale);
-        }
-
-        if (shape <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SHAPE, shape);
-        }
-
-        this.scale = scale;
-        this.shape = shape;
-        this.solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * Returns the scale parameter of this distribution.
-     *
-     * @return the scale parameter
-     */
-    public double getScale() {
-        return scale;
-    }
-
-    /**
-     * Returns the shape parameter of this distribution.
-     *
-     * @return the shape parameter
-     */
-    public double getShape() {
-        return shape;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * For scale {@code k}, and shape {@code α} of this distribution, the PDF
-     * is given by
-     * <ul>
-     * <li>{@code 0} if {@code x < k},</li>
-     * <li>{@code α * k^α / x^(α + 1)} otherwise.</li>
-     * </ul>
-     */
-    public double density(double x) {
-        if (x < scale) {
-            return 0;
-        }
-        return FastMath.pow(scale, shape) / FastMath.pow(x, shape + 1) * shape;
-    }
-
-    /** {@inheritDoc}
-     *
-     * See documentation of {@link #density(double)} for computation details.
-     */
-    @Override
-    public double logDensity(double x) {
-        if (x < scale) {
-            return Double.NEGATIVE_INFINITY;
-        }
-        return FastMath.log(scale) * shape - FastMath.log(x) * (shape + 1) + FastMath.log(shape);
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * For scale {@code k}, and shape {@code α} of this distribution, the CDF is given by
-     * <ul>
-     * <li>{@code 0} if {@code x < k},</li>
-     * <li>{@code 1 - (k / x)^α} otherwise.</li>
-     * </ul>
-     */
-    public double cumulativeProbability(double x)  {
-        if (x <= scale) {
-            return 0;
-        }
-        return 1 - FastMath.pow(scale / x, shape);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @deprecated See {@link RealDistribution#cumulativeProbability(double,double)}
-     */
-    @Override
-    @Deprecated
-    public double cumulativeProbability(double x0, double x1)
-        throws NumberIsTooLargeException {
-        return probability(x0, x1);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * For scale {@code k} and shape {@code α}, the mean is given by
-     * <ul>
-     * <li>{@code ∞} if {@code α <= 1},</li>
-     * <li>{@code α * k / (α - 1)} otherwise.</li>
-     * </ul>
-     */
-    public double getNumericalMean() {
-        if (shape <= 1) {
-            return Double.POSITIVE_INFINITY;
-        }
-        return shape * scale / (shape - 1);
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * For scale {@code k} and shape {@code α}, the variance is given by
-     * <ul>
-     * <li>{@code ∞} if {@code 1 < α <= 2},</li>
-     * <li>{@code k^2 * α / ((α - 1)^2 * (α - 2))} otherwise.</li>
-     * </ul>
-     */
-    public double getNumericalVariance() {
-        if (shape <= 2) {
-            return Double.POSITIVE_INFINITY;
-        }
-        double s = shape - 1;
-        return scale * scale * shape / (s * s) / (shape - 2);
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * The lower bound of the support is equal to the scale parameter {@code k}.
-     *
-     * @return lower bound of the support
-     */
-    public double getSupportLowerBound() {
-        return scale;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * The upper bound of the support is always positive infinity no matter the parameters.
-     *
-     * @return upper bound of the support (always {@code Double.POSITIVE_INFINITY})
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double sample()  {
-        final double n = random.nextDouble();
-        return scale / FastMath.pow(n, 1 / shape);
-    }
-}


[08/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/Array2DRowFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/Array2DRowFieldMatrix.java b/src/main/java/org/apache/commons/math3/linear/Array2DRowFieldMatrix.java
deleted file mode 100644
index b02e69f..0000000
--- a/src/main/java/org/apache/commons/math3/linear/Array2DRowFieldMatrix.java
+++ /dev/null
@@ -1,612 +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.linear;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Implementation of FieldMatrix<T> using a {@link FieldElement}[][] array to store entries.
- * <p>
- * As specified in the {@link FieldMatrix} interface, matrix element indexing
- * is 0-based -- e.g., <code>getEntry(0, 0)</code>
- * returns the element in the first row, first column of the matrix.</li></ul>
- * </p>
- *
- * @param <T> the type of the field elements
- */
-public class Array2DRowFieldMatrix<T extends FieldElement<T>>
-    extends AbstractFieldMatrix<T>
-    implements Serializable {
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 7260756672015356458L;
-    /** Entries of the matrix */
-    private T[][] data;
-
-    /**
-     * Creates a matrix with no data
-     * @param field field to which the elements belong
-     */
-    public Array2DRowFieldMatrix(final Field<T> field) {
-        super(field);
-    }
-
-    /**
-     * Create a new {@code FieldMatrix<T>} with the supplied row and column dimensions.
-     *
-     * @param field Field to which the elements belong.
-     * @param rowDimension Number of rows in the new matrix.
-     * @param columnDimension Number of columns in the new matrix.
-     * @throws NotStrictlyPositiveException if row or column dimension is not positive.
-     */
-    public Array2DRowFieldMatrix(final Field<T> field, final int rowDimension,
-                                 final int columnDimension)
-        throws NotStrictlyPositiveException {
-        super(field, rowDimension, columnDimension);
-        data = MathArrays.buildArray(field, rowDimension, columnDimension);
-    }
-
-    /**
-     * Create a new {@code FieldMatrix<T>} using the input array as the underlying
-     * data array.
-     * <p>The input array is copied, not referenced. This constructor has
-     * the same effect as calling {@link #Array2DRowFieldMatrix(FieldElement[][], boolean)}
-     * with the second argument set to {@code true}.</p>
-     *
-     * @param d Data for the new matrix.
-     * @throws DimensionMismatchException if {@code d} is not rectangular.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws NoDataException if there are not at least one row and one column.
-     * @see #Array2DRowFieldMatrix(FieldElement[][], boolean)
-     */
-    public Array2DRowFieldMatrix(final T[][] d)
-        throws DimensionMismatchException, NullArgumentException,
-        NoDataException {
-        this(extractField(d), d);
-    }
-
-    /**
-     * Create a new {@code FieldMatrix<T>} using the input array as the underlying
-     * data array.
-     * <p>The input array is copied, not referenced. This constructor has
-     * the same effect as calling {@link #Array2DRowFieldMatrix(FieldElement[][], boolean)}
-     * with the second argument set to {@code true}.</p>
-     *
-     * @param field Field to which the elements belong.
-     * @param d Data for the new matrix.
-     * @throws DimensionMismatchException if {@code d} is not rectangular.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws NoDataException if there are not at least one row and one column.
-     * @see #Array2DRowFieldMatrix(FieldElement[][], boolean)
-     */
-    public Array2DRowFieldMatrix(final Field<T> field, final T[][] d)
-        throws DimensionMismatchException, NullArgumentException,
-        NoDataException {
-        super(field);
-        copyIn(d);
-    }
-
-    /**
-     * Create a new {@code FieldMatrix<T>} using the input array as the underlying
-     * data array.
-     * <p>If an array is built specially in order to be embedded in a
-     * {@code FieldMatrix<T>} and not used directly, the {@code copyArray} may be
-     * set to {@code false}. This will prevent the copying and improve
-     * performance as no new array will be built and no data will be copied.</p>
-     *
-     * @param d Data for the new matrix.
-     * @param copyArray Whether to copy or reference the input array.
-     * @throws DimensionMismatchException if {@code d} is not rectangular.
-     * @throws NoDataException if there are not at least one row and one column.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @see #Array2DRowFieldMatrix(FieldElement[][])
-     */
-    public Array2DRowFieldMatrix(final T[][] d, final boolean copyArray)
-        throws DimensionMismatchException, NoDataException,
-        NullArgumentException {
-        this(extractField(d), d, copyArray);
-    }
-
-    /**
-     * Create a new {@code FieldMatrix<T>} using the input array as the underlying
-     * data array.
-     * <p>If an array is built specially in order to be embedded in a
-     * {@code FieldMatrix<T>} and not used directly, the {@code copyArray} may be
-     * set to {@code false}. This will prevent the copying and improve
-     * performance as no new array will be built and no data will be copied.</p>
-     *
-     * @param field Field to which the elements belong.
-     * @param d Data for the new matrix.
-     * @param copyArray Whether to copy or reference the input array.
-     * @throws DimensionMismatchException if {@code d} is not rectangular.
-     * @throws NoDataException if there are not at least one row and one column.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @see #Array2DRowFieldMatrix(FieldElement[][])
-     */
-    public Array2DRowFieldMatrix(final Field<T> field, final T[][] d, final boolean copyArray)
-        throws DimensionMismatchException, NoDataException, NullArgumentException {
-        super(field);
-        if (copyArray) {
-            copyIn(d);
-        } else {
-            MathUtils.checkNotNull(d);
-            final int nRows = d.length;
-            if (nRows == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-            }
-            final int nCols = d[0].length;
-            if (nCols == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-            }
-            for (int r = 1; r < nRows; r++) {
-                if (d[r].length != nCols) {
-                    throw new DimensionMismatchException(nCols, d[r].length);
-                }
-            }
-            data = d;
-        }
-    }
-
-    /**
-     * Create a new (column) {@code FieldMatrix<T>} using {@code v} as the
-     * data for the unique column of the created matrix.
-     * The input array is copied.
-     *
-     * @param v Column vector holding data for new matrix.
-     * @throws NoDataException if v is empty
-     */
-    public Array2DRowFieldMatrix(final T[] v) throws NoDataException {
-        this(extractField(v), v);
-    }
-
-    /**
-     * Create a new (column) {@code FieldMatrix<T>} using {@code v} as the
-     * data for the unique column of the created matrix.
-     * The input array is copied.
-     *
-     * @param field Field to which the elements belong.
-     * @param v Column vector holding data for new matrix.
-     */
-    public Array2DRowFieldMatrix(final Field<T> field, final T[] v) {
-        super(field);
-        final int nRows = v.length;
-        data = MathArrays.buildArray(getField(), nRows, 1);
-        for (int row = 0; row < nRows; row++) {
-            data[row][0] = v[row];
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> createMatrix(final int rowDimension,
-                                       final int columnDimension)
-        throws NotStrictlyPositiveException {
-        return new Array2DRowFieldMatrix<T>(getField(), rowDimension, columnDimension);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public FieldMatrix<T> copy() {
-        return new Array2DRowFieldMatrix<T>(getField(), copyOut(), false);
-    }
-
-    /**
-     * Add {@code m} to this matrix.
-     *
-     * @param m Matrix to be added.
-     * @return {@code this} + m.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as this matrix.
-     */
-    public Array2DRowFieldMatrix<T> add(final Array2DRowFieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        // safety check
-        checkAdditionCompatible(m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final T[][] outData = MathArrays.buildArray(getField(), rowCount, columnCount);
-        for (int row = 0; row < rowCount; row++) {
-            final T[] dataRow    = data[row];
-            final T[] mRow       = m.data[row];
-            final T[] outDataRow = outData[row];
-            for (int col = 0; col < columnCount; col++) {
-                outDataRow[col] = dataRow[col].add(mRow[col]);
-            }
-        }
-
-        return new Array2DRowFieldMatrix<T>(getField(), outData, false);
-    }
-
-    /**
-     * Subtract {@code m} from this matrix.
-     *
-     * @param m Matrix to be subtracted.
-     * @return {@code this} + m.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as this matrix.
-     */
-    public Array2DRowFieldMatrix<T> subtract(final Array2DRowFieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        // safety check
-        checkSubtractionCompatible(m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final T[][] outData = MathArrays.buildArray(getField(), rowCount, columnCount);
-        for (int row = 0; row < rowCount; row++) {
-            final T[] dataRow    = data[row];
-            final T[] mRow       = m.data[row];
-            final T[] outDataRow = outData[row];
-            for (int col = 0; col < columnCount; col++) {
-                outDataRow[col] = dataRow[col].subtract(mRow[col]);
-            }
-        }
-
-        return new Array2DRowFieldMatrix<T>(getField(), outData, false);
-
-    }
-
-    /**
-     * Postmultiplying this matrix by {@code m}.
-     *
-     * @param m Matrix to postmultiply by.
-     * @return {@code this} * m.
-     * @throws DimensionMismatchException if the number of columns of this
-     * matrix is not equal to the number of rows of {@code m}.
-     */
-    public Array2DRowFieldMatrix<T> multiply(final Array2DRowFieldMatrix<T> m)
-        throws DimensionMismatchException {
-        // safety check
-        checkMultiplicationCompatible(m);
-
-        final int nRows = this.getRowDimension();
-        final int nCols = m.getColumnDimension();
-        final int nSum = this.getColumnDimension();
-        final T[][] outData = MathArrays.buildArray(getField(), nRows, nCols);
-        for (int row = 0; row < nRows; row++) {
-            final T[] dataRow    = data[row];
-            final T[] outDataRow = outData[row];
-            for (int col = 0; col < nCols; col++) {
-                T sum = getField().getZero();
-                for (int i = 0; i < nSum; i++) {
-                    sum = sum.add(dataRow[i].multiply(m.data[i][col]));
-                }
-                outDataRow[col] = sum;
-            }
-        }
-
-        return new Array2DRowFieldMatrix<T>(getField(), outData, false);
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[][] getData() {
-        return copyOut();
-    }
-
-    /**
-     * Get a reference to the underlying data array.
-     * This methods returns internal data, <strong>not</strong> fresh copy of it.
-     *
-     * @return the 2-dimensional array of entries.
-     */
-    public T[][] getDataRef() {
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSubMatrix(final T[][] subMatrix, final int row,
-                             final int column)
-        throws OutOfRangeException, NullArgumentException, NoDataException,
-        DimensionMismatchException {
-        if (data == null) {
-            if (row > 0) {
-                throw new MathIllegalStateException(LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
-            }
-            if (column > 0) {
-                throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
-            }
-            final int nRows = subMatrix.length;
-            if (nRows == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-            }
-
-            final int nCols = subMatrix[0].length;
-            if (nCols == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-            }
-            data = MathArrays.buildArray(getField(), subMatrix.length, nCols);
-            for (int i = 0; i < data.length; ++i) {
-                if (subMatrix[i].length != nCols) {
-                    throw new DimensionMismatchException(nCols, subMatrix[i].length);
-                }
-                System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
-            }
-        } else {
-            super.setSubMatrix(subMatrix, row, column);
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T getEntry(final int row, final int column)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        return data[row][column];
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setEntry(final int row, final int column, final T value)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        data[row][column] = value;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void addToEntry(final int row, final int column, final T increment)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        data[row][column] = data[row][column].add(increment);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void multiplyEntry(final int row, final int column, final T factor)
-        throws OutOfRangeException {
-        checkRowIndex(row);
-        checkColumnIndex(column);
-
-        data[row][column] = data[row][column].multiply(factor);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getRowDimension() {
-        return (data == null) ? 0 : data.length;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getColumnDimension() {
-        return ((data == null) || (data[0] == null)) ? 0 : data[0].length;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[] operate(final T[] v) throws DimensionMismatchException {
-        final int nRows = this.getRowDimension();
-        final int nCols = this.getColumnDimension();
-        if (v.length != nCols) {
-            throw new DimensionMismatchException(v.length, nCols);
-        }
-        final T[] out = MathArrays.buildArray(getField(), nRows);
-        for (int row = 0; row < nRows; row++) {
-            final T[] dataRow = data[row];
-            T sum = getField().getZero();
-            for (int i = 0; i < nCols; i++) {
-                sum = sum.add(dataRow[i].multiply(v[i]));
-            }
-            out[row] = sum;
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T[] preMultiply(final T[] v) throws DimensionMismatchException {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (v.length != nRows) {
-            throw new DimensionMismatchException(v.length, nRows);
-        }
-
-        final T[] out = MathArrays.buildArray(getField(), nCols);
-        for (int col = 0; col < nCols; ++col) {
-            T sum = getField().getZero();
-            for (int i = 0; i < nRows; ++i) {
-                sum = sum.add(data[i][col].multiply(v[i]));
-            }
-            out[col] = sum;
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int i = 0; i < rows; ++i) {
-            final T[] rowI = data[i];
-            for (int j = 0; j < columns; ++j) {
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int i = 0; i < rows; ++i) {
-            final T[] rowI = data[i];
-            for (int j = 0; j < columns; ++j) {
-                visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor,
-                            final int startRow, final int endRow,
-                            final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int i = startRow; i <= endRow; ++i) {
-            final T[] rowI = data[i];
-            for (int j = startColumn; j <= endColumn; ++j) {
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor,
-                            final int startRow, final int endRow,
-                            final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int i = startRow; i <= endRow; ++i) {
-            final T[] rowI = data[i];
-            for (int j = startColumn; j <= endColumn; ++j) {
-                visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInColumnOrder(final FieldMatrixChangingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int j = 0; j < columns; ++j) {
-            for (int i = 0; i < rows; ++i) {
-                final T[] rowI = data[i];
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInColumnOrder(final FieldMatrixPreservingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int j = 0; j < columns; ++j) {
-            for (int i = 0; i < rows; ++i) {
-                visitor.visit(i, j, data[i][j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInColumnOrder(final FieldMatrixChangingVisitor<T> visitor,
-                               final int startRow, final int endRow,
-                               final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-    checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int j = startColumn; j <= endColumn; ++j) {
-            for (int i = startRow; i <= endRow; ++i) {
-                final T[] rowI = data[i];
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public T walkInColumnOrder(final FieldMatrixPreservingVisitor<T> visitor,
-                               final int startRow, final int endRow,
-                               final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int j = startColumn; j <= endColumn; ++j) {
-            for (int i = startRow; i <= endRow; ++i) {
-                visitor.visit(i, j, data[i][j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Get a fresh copy of the underlying data array.
-     *
-     * @return a copy of the underlying data array.
-     */
-    private T[][] copyOut() {
-        final int nRows = this.getRowDimension();
-        final T[][] out = MathArrays.buildArray(getField(), nRows, getColumnDimension());
-        // can't copy 2-d array in one shot, otherwise get row references
-        for (int i = 0; i < nRows; i++) {
-            System.arraycopy(data[i], 0, out[i], 0, data[i].length);
-        }
-        return out;
-    }
-
-    /**
-     * Replace data with a fresh copy of the input array.
-     *
-     * @param in Data to copy.
-     * @throws NoDataException if the input array is empty.
-     * @throws DimensionMismatchException if the input array is not rectangular.
-     * @throws NullArgumentException if the input array is {@code null}.
-     */
-    private void copyIn(final T[][] in)
-        throws NullArgumentException, NoDataException,
-        DimensionMismatchException {
-        setSubMatrix(in, 0, 0);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/Array2DRowRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/Array2DRowRealMatrix.java b/src/main/java/org/apache/commons/math3/linear/Array2DRowRealMatrix.java
deleted file mode 100644
index 6302cf3..0000000
--- a/src/main/java/org/apache/commons/math3/linear/Array2DRowRealMatrix.java
+++ /dev/null
@@ -1,548 +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.linear;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Implementation of {@link RealMatrix} using a {@code double[][]} array to
- * store entries.
- *
- */
-public class Array2DRowRealMatrix extends AbstractRealMatrix implements Serializable {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -1067294169172445528L;
-
-    /** Entries of the matrix. */
-    private double data[][];
-
-    /**
-     * Creates a matrix with no data
-     */
-    public Array2DRowRealMatrix() {}
-
-    /**
-     * Create a new RealMatrix with the supplied row and column dimensions.
-     *
-     * @param rowDimension Number of rows in the new matrix.
-     * @param columnDimension Number of columns in the new matrix.
-     * @throws NotStrictlyPositiveException if the row or column dimension is
-     * not positive.
-     */
-    public Array2DRowRealMatrix(final int rowDimension,
-                                final int columnDimension)
-        throws NotStrictlyPositiveException {
-        super(rowDimension, columnDimension);
-        data = new double[rowDimension][columnDimension];
-    }
-
-    /**
-     * Create a new {@code RealMatrix} using the input array as the underlying
-     * data array.
-     * <p>The input array is copied, not referenced. This constructor has
-     * the same effect as calling {@link #Array2DRowRealMatrix(double[][], boolean)}
-     * with the second argument set to {@code true}.</p>
-     *
-     * @param d Data for the new matrix.
-     * @throws DimensionMismatchException if {@code d} is not rectangular.
-     * @throws NoDataException if {@code d} row or column dimension is zero.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @see #Array2DRowRealMatrix(double[][], boolean)
-     */
-    public Array2DRowRealMatrix(final double[][] d)
-        throws DimensionMismatchException, NoDataException, NullArgumentException {
-        copyIn(d);
-    }
-
-    /**
-     * Create a new RealMatrix using the input array as the underlying
-     * data array.
-     * If an array is built specially in order to be embedded in a
-     * RealMatrix and not used directly, the {@code copyArray} may be
-     * set to {@code false}. This will prevent the copying and improve
-     * performance as no new array will be built and no data will be copied.
-     *
-     * @param d Data for new matrix.
-     * @param copyArray if {@code true}, the input array will be copied,
-     * otherwise it will be referenced.
-     * @throws DimensionMismatchException if {@code d} is not rectangular.
-     * @throws NoDataException if {@code d} row or column dimension is zero.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @see #Array2DRowRealMatrix(double[][])
-     */
-    public Array2DRowRealMatrix(final double[][] d, final boolean copyArray)
-        throws DimensionMismatchException, NoDataException,
-        NullArgumentException {
-        if (copyArray) {
-            copyIn(d);
-        } else {
-            if (d == null) {
-                throw new NullArgumentException();
-            }
-            final int nRows = d.length;
-            if (nRows == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-            }
-            final int nCols = d[0].length;
-            if (nCols == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-            }
-            for (int r = 1; r < nRows; r++) {
-                if (d[r].length != nCols) {
-                    throw new DimensionMismatchException(d[r].length, nCols);
-                }
-            }
-            data = d;
-        }
-    }
-
-    /**
-     * Create a new (column) RealMatrix using {@code v} as the
-     * data for the unique column of the created matrix.
-     * The input array is copied.
-     *
-     * @param v Column vector holding data for new matrix.
-     */
-    public Array2DRowRealMatrix(final double[] v) {
-        final int nRows = v.length;
-        data = new double[nRows][1];
-        for (int row = 0; row < nRows; row++) {
-            data[row][0] = v[row];
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealMatrix createMatrix(final int rowDimension,
-                                   final int columnDimension)
-        throws NotStrictlyPositiveException {
-        return new Array2DRowRealMatrix(rowDimension, columnDimension);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealMatrix copy() {
-        return new Array2DRowRealMatrix(copyOut(), false);
-    }
-
-    /**
-     * Compute the sum of {@code this} and {@code m}.
-     *
-     * @param m Matrix to be added.
-     * @return {@code this + m}.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this}.
-     */
-    public Array2DRowRealMatrix add(final Array2DRowRealMatrix m)
-        throws MatrixDimensionMismatchException {
-        // Safety check.
-        MatrixUtils.checkAdditionCompatible(this, m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final double[][] outData = new double[rowCount][columnCount];
-        for (int row = 0; row < rowCount; row++) {
-            final double[] dataRow    = data[row];
-            final double[] mRow       = m.data[row];
-            final double[] outDataRow = outData[row];
-            for (int col = 0; col < columnCount; col++) {
-                outDataRow[col] = dataRow[col] + mRow[col];
-            }
-        }
-
-        return new Array2DRowRealMatrix(outData, false);
-    }
-
-    /**
-     * Returns {@code this} minus {@code m}.
-     *
-     * @param m Matrix to be subtracted.
-     * @return {@code this - m}
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this}.
-     */
-    public Array2DRowRealMatrix subtract(final Array2DRowRealMatrix m)
-        throws MatrixDimensionMismatchException {
-        MatrixUtils.checkSubtractionCompatible(this, m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final double[][] outData = new double[rowCount][columnCount];
-        for (int row = 0; row < rowCount; row++) {
-            final double[] dataRow    = data[row];
-            final double[] mRow       = m.data[row];
-            final double[] outDataRow = outData[row];
-            for (int col = 0; col < columnCount; col++) {
-                outDataRow[col] = dataRow[col] - mRow[col];
-            }
-        }
-
-        return new Array2DRowRealMatrix(outData, false);
-    }
-
-    /**
-     * Returns the result of postmultiplying {@code this} by {@code m}.
-     *
-     * @param m matrix to postmultiply by
-     * @return {@code this * m}
-     * @throws DimensionMismatchException if
-     * {@code columnDimension(this) != rowDimension(m)}
-     */
-    public Array2DRowRealMatrix multiply(final Array2DRowRealMatrix m)
-        throws DimensionMismatchException {
-        MatrixUtils.checkMultiplicationCompatible(this, m);
-
-        final int nRows = this.getRowDimension();
-        final int nCols = m.getColumnDimension();
-        final int nSum = this.getColumnDimension();
-
-        final double[][] outData = new double[nRows][nCols];
-        // Will hold a column of "m".
-        final double[] mCol = new double[nSum];
-        final double[][] mData = m.data;
-
-        // Multiply.
-        for (int col = 0; col < nCols; col++) {
-            // Copy all elements of column "col" of "m" so that
-            // will be in contiguous memory.
-            for (int mRow = 0; mRow < nSum; mRow++) {
-                mCol[mRow] = mData[mRow][col];
-            }
-
-            for (int row = 0; row < nRows; row++) {
-                final double[] dataRow = data[row];
-                double sum = 0;
-                for (int i = 0; i < nSum; i++) {
-                    sum += dataRow[i] * mCol[i];
-                }
-                outData[row][col] = sum;
-            }
-        }
-
-        return new Array2DRowRealMatrix(outData, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[][] getData() {
-        return copyOut();
-    }
-
-    /**
-     * Get a reference to the underlying data array.
-     *
-     * @return 2-dimensional array of entries.
-     */
-    public double[][] getDataRef() {
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSubMatrix(final double[][] subMatrix, final int row,
-                             final int column)
-        throws NoDataException, OutOfRangeException,
-        DimensionMismatchException, NullArgumentException {
-        if (data == null) {
-            if (row > 0) {
-                throw new MathIllegalStateException(LocalizedFormats.FIRST_ROWS_NOT_INITIALIZED_YET, row);
-            }
-            if (column > 0) {
-                throw new MathIllegalStateException(LocalizedFormats.FIRST_COLUMNS_NOT_INITIALIZED_YET, column);
-            }
-            MathUtils.checkNotNull(subMatrix);
-            final int nRows = subMatrix.length;
-            if (nRows == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-            }
-
-            final int nCols = subMatrix[0].length;
-            if (nCols == 0) {
-                throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-            }
-            data = new double[subMatrix.length][nCols];
-            for (int i = 0; i < data.length; ++i) {
-                if (subMatrix[i].length != nCols) {
-                    throw new DimensionMismatchException(subMatrix[i].length, nCols);
-                }
-                System.arraycopy(subMatrix[i], 0, data[i + row], column, nCols);
-            }
-        } else {
-            super.setSubMatrix(subMatrix, row, column);
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getEntry(final int row, final int column)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        return data[row][column];
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setEntry(final int row, final int column, final double value)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        data[row][column] = value;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void addToEntry(final int row, final int column,
-                           final double increment)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        data[row][column] += increment;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void multiplyEntry(final int row, final int column,
-                              final double factor)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        data[row][column] *= factor;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getRowDimension() {
-        return (data == null) ? 0 : data.length;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getColumnDimension() {
-        return ((data == null) || (data[0] == null)) ? 0 : data[0].length;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] operate(final double[] v)
-        throws DimensionMismatchException {
-        final int nRows = this.getRowDimension();
-        final int nCols = this.getColumnDimension();
-        if (v.length != nCols) {
-            throw new DimensionMismatchException(v.length, nCols);
-        }
-        final double[] out = new double[nRows];
-        for (int row = 0; row < nRows; row++) {
-            final double[] dataRow = data[row];
-            double sum = 0;
-            for (int i = 0; i < nCols; i++) {
-                sum += dataRow[i] * v[i];
-            }
-            out[row] = sum;
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] preMultiply(final double[] v)
-        throws DimensionMismatchException {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (v.length != nRows) {
-            throw new DimensionMismatchException(v.length, nRows);
-        }
-
-        final double[] out = new double[nCols];
-        for (int col = 0; col < nCols; ++col) {
-            double sum = 0;
-            for (int i = 0; i < nRows; ++i) {
-                sum += data[i][col] * v[i];
-            }
-            out[col] = sum;
-        }
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixChangingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int i = 0; i < rows; ++i) {
-            final double[] rowI = data[i];
-            for (int j = 0; j < columns; ++j) {
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixPreservingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int i = 0; i < rows; ++i) {
-            final double[] rowI = data[i];
-            for (int j = 0; j < columns; ++j) {
-                visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixChangingVisitor visitor,
-                                 final int startRow, final int endRow,
-                                 final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int i = startRow; i <= endRow; ++i) {
-            final double[] rowI = data[i];
-            for (int j = startColumn; j <= endColumn; ++j) {
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixPreservingVisitor visitor,
-                                 final int startRow, final int endRow,
-                                 final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int i = startRow; i <= endRow; ++i) {
-            final double[] rowI = data[i];
-            for (int j = startColumn; j <= endColumn; ++j) {
-                visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInColumnOrder(final RealMatrixChangingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int j = 0; j < columns; ++j) {
-            for (int i = 0; i < rows; ++i) {
-                final double[] rowI = data[i];
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int j = 0; j < columns; ++j) {
-            for (int i = 0; i < rows; ++i) {
-                visitor.visit(i, j, data[i][j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInColumnOrder(final RealMatrixChangingVisitor visitor,
-                                    final int startRow, final int endRow,
-                                    final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int j = startColumn; j <= endColumn; ++j) {
-            for (int i = startRow; i <= endRow; ++i) {
-                final double[] rowI = data[i];
-                rowI[j] = visitor.visit(i, j, rowI[j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor,
-                                    final int startRow, final int endRow,
-                                    final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int j = startColumn; j <= endColumn; ++j) {
-            for (int i = startRow; i <= endRow; ++i) {
-                visitor.visit(i, j, data[i][j]);
-            }
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Get a fresh copy of the underlying data array.
-     *
-     * @return a copy of the underlying data array.
-     */
-    private double[][] copyOut() {
-        final int nRows = this.getRowDimension();
-        final double[][] out = new double[nRows][this.getColumnDimension()];
-        // can't copy 2-d array in one shot, otherwise get row references
-        for (int i = 0; i < nRows; i++) {
-            System.arraycopy(data[i], 0, out[i], 0, data[i].length);
-        }
-        return out;
-    }
-
-    /**
-     * Replace data with a fresh copy of the input array.
-     *
-     * @param in Data to copy.
-     * @throws NoDataException if the input array is empty.
-     * @throws DimensionMismatchException if the input array is not rectangular.
-     * @throws NullArgumentException if the input array is {@code null}.
-     */
-    private void copyIn(final double[][] in)
-        throws DimensionMismatchException, NoDataException, NullArgumentException {
-        setSubMatrix(in, 0, 0);
-    }
-}


[28/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/filter/KalmanFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/filter/KalmanFilter.java b/src/main/java/org/apache/commons/math3/filter/KalmanFilter.java
deleted file mode 100644
index 2f204bf..0000000
--- a/src/main/java/org/apache/commons/math3/filter/KalmanFilter.java
+++ /dev/null
@@ -1,388 +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.filter;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.CholeskyDecomposition;
-import org.apache.commons.math3.linear.MatrixDimensionMismatchException;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.NonSquareMatrixException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Implementation of a Kalman filter to estimate the state <i>x<sub>k</sub></i>
- * of a discrete-time controlled process that is governed by the linear
- * stochastic difference equation:
- *
- * <pre>
- * <i>x<sub>k</sub></i> = <b>A</b><i>x<sub>k-1</sub></i> + <b>B</b><i>u<sub>k-1</sub></i> + <i>w<sub>k-1</sub></i>
- * </pre>
- *
- * with a measurement <i>x<sub>k</sub></i> that is
- *
- * <pre>
- * <i>z<sub>k</sub></i> = <b>H</b><i>x<sub>k</sub></i> + <i>v<sub>k</sub></i>.
- * </pre>
- *
- * <p>
- * The random variables <i>w<sub>k</sub></i> and <i>v<sub>k</sub></i> represent
- * the process and measurement noise and are assumed to be independent of each
- * other and distributed with normal probability (white noise).
- * <p>
- * The Kalman filter cycle involves the following steps:
- * <ol>
- * <li>predict: project the current state estimate ahead in time</li>
- * <li>correct: adjust the projected estimate by an actual measurement</li>
- * </ol>
- * <p>
- * The Kalman filter is initialized with a {@link ProcessModel} and a
- * {@link MeasurementModel}, which contain the corresponding transformation and
- * noise covariance matrices. The parameter names used in the respective models
- * correspond to the following names commonly used in the mathematical
- * literature:
- * <ul>
- * <li>A - state transition matrix</li>
- * <li>B - control input matrix</li>
- * <li>H - measurement matrix</li>
- * <li>Q - process noise covariance matrix</li>
- * <li>R - measurement noise covariance matrix</li>
- * <li>P - error covariance matrix</li>
- * </ul>
- *
- * @see <a href="http://www.cs.unc.edu/~welch/kalman/">Kalman filter
- *      resources</a>
- * @see <a href="http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf">An
- *      introduction to the Kalman filter by Greg Welch and Gary Bishop</a>
- * @see <a href="http://academic.csuohio.edu/simond/courses/eec644/kalman.pdf">
- *      Kalman filter example by Dan Simon</a>
- * @see ProcessModel
- * @see MeasurementModel
- * @since 3.0
- */
-public class KalmanFilter {
-    /** The process model used by this filter instance. */
-    private final ProcessModel processModel;
-    /** The measurement model used by this filter instance. */
-    private final MeasurementModel measurementModel;
-    /** The transition matrix, equivalent to A. */
-    private RealMatrix transitionMatrix;
-    /** The transposed transition matrix. */
-    private RealMatrix transitionMatrixT;
-    /** The control matrix, equivalent to B. */
-    private RealMatrix controlMatrix;
-    /** The measurement matrix, equivalent to H. */
-    private RealMatrix measurementMatrix;
-    /** The transposed measurement matrix. */
-    private RealMatrix measurementMatrixT;
-    /** The internal state estimation vector, equivalent to x hat. */
-    private RealVector stateEstimation;
-    /** The error covariance matrix, equivalent to P. */
-    private RealMatrix errorCovariance;
-
-    /**
-     * Creates a new Kalman filter with the given process and measurement models.
-     *
-     * @param process
-     *            the model defining the underlying process dynamics
-     * @param measurement
-     *            the model defining the given measurement characteristics
-     * @throws NullArgumentException
-     *             if any of the given inputs is null (except for the control matrix)
-     * @throws NonSquareMatrixException
-     *             if the transition matrix is non square
-     * @throws DimensionMismatchException
-     *             if the column dimension of the transition matrix does not match the dimension of the
-     *             initial state estimation vector
-     * @throws MatrixDimensionMismatchException
-     *             if the matrix dimensions do not fit together
-     */
-    public KalmanFilter(final ProcessModel process, final MeasurementModel measurement)
-            throws NullArgumentException, NonSquareMatrixException, DimensionMismatchException,
-                   MatrixDimensionMismatchException {
-
-        MathUtils.checkNotNull(process);
-        MathUtils.checkNotNull(measurement);
-
-        this.processModel = process;
-        this.measurementModel = measurement;
-
-        transitionMatrix = processModel.getStateTransitionMatrix();
-        MathUtils.checkNotNull(transitionMatrix);
-        transitionMatrixT = transitionMatrix.transpose();
-
-        // create an empty matrix if no control matrix was given
-        if (processModel.getControlMatrix() == null) {
-            controlMatrix = new Array2DRowRealMatrix();
-        } else {
-            controlMatrix = processModel.getControlMatrix();
-        }
-
-        measurementMatrix = measurementModel.getMeasurementMatrix();
-        MathUtils.checkNotNull(measurementMatrix);
-        measurementMatrixT = measurementMatrix.transpose();
-
-        // check that the process and measurement noise matrices are not null
-        // they will be directly accessed from the model as they may change
-        // over time
-        RealMatrix processNoise = processModel.getProcessNoise();
-        MathUtils.checkNotNull(processNoise);
-        RealMatrix measNoise = measurementModel.getMeasurementNoise();
-        MathUtils.checkNotNull(measNoise);
-
-        // set the initial state estimate to a zero vector if it is not
-        // available from the process model
-        if (processModel.getInitialStateEstimate() == null) {
-            stateEstimation = new ArrayRealVector(transitionMatrix.getColumnDimension());
-        } else {
-            stateEstimation = processModel.getInitialStateEstimate();
-        }
-
-        if (transitionMatrix.getColumnDimension() != stateEstimation.getDimension()) {
-            throw new DimensionMismatchException(transitionMatrix.getColumnDimension(),
-                                                 stateEstimation.getDimension());
-        }
-
-        // initialize the error covariance to the process noise if it is not
-        // available from the process model
-        if (processModel.getInitialErrorCovariance() == null) {
-            errorCovariance = processNoise.copy();
-        } else {
-            errorCovariance = processModel.getInitialErrorCovariance();
-        }
-
-        // sanity checks, the control matrix B may be null
-
-        // A must be a square matrix
-        if (!transitionMatrix.isSquare()) {
-            throw new NonSquareMatrixException(
-                    transitionMatrix.getRowDimension(),
-                    transitionMatrix.getColumnDimension());
-        }
-
-        // row dimension of B must be equal to A
-        // if no control matrix is available, the row and column dimension will be 0
-        if (controlMatrix != null &&
-            controlMatrix.getRowDimension() > 0 &&
-            controlMatrix.getColumnDimension() > 0 &&
-            controlMatrix.getRowDimension() != transitionMatrix.getRowDimension()) {
-            throw new MatrixDimensionMismatchException(controlMatrix.getRowDimension(),
-                                                       controlMatrix.getColumnDimension(),
-                                                       transitionMatrix.getRowDimension(),
-                                                       controlMatrix.getColumnDimension());
-        }
-
-        // Q must be equal to A
-        MatrixUtils.checkAdditionCompatible(transitionMatrix, processNoise);
-
-        // column dimension of H must be equal to row dimension of A
-        if (measurementMatrix.getColumnDimension() != transitionMatrix.getRowDimension()) {
-            throw new MatrixDimensionMismatchException(measurementMatrix.getRowDimension(),
-                                                       measurementMatrix.getColumnDimension(),
-                                                       measurementMatrix.getRowDimension(),
-                                                       transitionMatrix.getRowDimension());
-        }
-
-        // row dimension of R must be equal to row dimension of H
-        if (measNoise.getRowDimension() != measurementMatrix.getRowDimension()) {
-            throw new MatrixDimensionMismatchException(measNoise.getRowDimension(),
-                                                       measNoise.getColumnDimension(),
-                                                       measurementMatrix.getRowDimension(),
-                                                       measNoise.getColumnDimension());
-        }
-    }
-
-    /**
-     * Returns the dimension of the state estimation vector.
-     *
-     * @return the state dimension
-     */
-    public int getStateDimension() {
-        return stateEstimation.getDimension();
-    }
-
-    /**
-     * Returns the dimension of the measurement vector.
-     *
-     * @return the measurement vector dimension
-     */
-    public int getMeasurementDimension() {
-        return measurementMatrix.getRowDimension();
-    }
-
-    /**
-     * Returns the current state estimation vector.
-     *
-     * @return the state estimation vector
-     */
-    public double[] getStateEstimation() {
-        return stateEstimation.toArray();
-    }
-
-    /**
-     * Returns a copy of the current state estimation vector.
-     *
-     * @return the state estimation vector
-     */
-    public RealVector getStateEstimationVector() {
-        return stateEstimation.copy();
-    }
-
-    /**
-     * Returns the current error covariance matrix.
-     *
-     * @return the error covariance matrix
-     */
-    public double[][] getErrorCovariance() {
-        return errorCovariance.getData();
-    }
-
-    /**
-     * Returns a copy of the current error covariance matrix.
-     *
-     * @return the error covariance matrix
-     */
-    public RealMatrix getErrorCovarianceMatrix() {
-        return errorCovariance.copy();
-    }
-
-    /**
-     * Predict the internal state estimation one time step ahead.
-     */
-    public void predict() {
-        predict((RealVector) null);
-    }
-
-    /**
-     * Predict the internal state estimation one time step ahead.
-     *
-     * @param u
-     *            the control vector
-     * @throws DimensionMismatchException
-     *             if the dimension of the control vector does not fit
-     */
-    public void predict(final double[] u) throws DimensionMismatchException {
-        predict(new ArrayRealVector(u, false));
-    }
-
-    /**
-     * Predict the internal state estimation one time step ahead.
-     *
-     * @param u
-     *            the control vector
-     * @throws DimensionMismatchException
-     *             if the dimension of the control vector does not match
-     */
-    public void predict(final RealVector u) throws DimensionMismatchException {
-        // sanity checks
-        if (u != null &&
-            u.getDimension() != controlMatrix.getColumnDimension()) {
-            throw new DimensionMismatchException(u.getDimension(),
-                                                 controlMatrix.getColumnDimension());
-        }
-
-        // project the state estimation ahead (a priori state)
-        // xHat(k)- = A * xHat(k-1) + B * u(k-1)
-        stateEstimation = transitionMatrix.operate(stateEstimation);
-
-        // add control input if it is available
-        if (u != null) {
-            stateEstimation = stateEstimation.add(controlMatrix.operate(u));
-        }
-
-        // project the error covariance ahead
-        // P(k)- = A * P(k-1) * A' + Q
-        errorCovariance = transitionMatrix.multiply(errorCovariance)
-                .multiply(transitionMatrixT)
-                .add(processModel.getProcessNoise());
-    }
-
-    /**
-     * Correct the current state estimate with an actual measurement.
-     *
-     * @param z
-     *            the measurement vector
-     * @throws NullArgumentException
-     *             if the measurement vector is {@code null}
-     * @throws DimensionMismatchException
-     *             if the dimension of the measurement vector does not fit
-     * @throws SingularMatrixException
-     *             if the covariance matrix could not be inverted
-     */
-    public void correct(final double[] z)
-            throws NullArgumentException, DimensionMismatchException, SingularMatrixException {
-        correct(new ArrayRealVector(z, false));
-    }
-
-    /**
-     * Correct the current state estimate with an actual measurement.
-     *
-     * @param z
-     *            the measurement vector
-     * @throws NullArgumentException
-     *             if the measurement vector is {@code null}
-     * @throws DimensionMismatchException
-     *             if the dimension of the measurement vector does not fit
-     * @throws SingularMatrixException
-     *             if the covariance matrix could not be inverted
-     */
-    public void correct(final RealVector z)
-            throws NullArgumentException, DimensionMismatchException, SingularMatrixException {
-
-        // sanity checks
-        MathUtils.checkNotNull(z);
-        if (z.getDimension() != measurementMatrix.getRowDimension()) {
-            throw new DimensionMismatchException(z.getDimension(),
-                                                 measurementMatrix.getRowDimension());
-        }
-
-        // S = H * P(k) * H' + R
-        RealMatrix s = measurementMatrix.multiply(errorCovariance)
-            .multiply(measurementMatrixT)
-            .add(measurementModel.getMeasurementNoise());
-
-        // Inn = z(k) - H * xHat(k)-
-        RealVector innovation = z.subtract(measurementMatrix.operate(stateEstimation));
-
-        // calculate gain matrix
-        // K(k) = P(k)- * H' * (H * P(k)- * H' + R)^-1
-        // K(k) = P(k)- * H' * S^-1
-
-        // instead of calculating the inverse of S we can rearrange the formula,
-        // and then solve the linear equation A x X = B with A = S', X = K' and B = (H * P)'
-
-        // K(k) * S = P(k)- * H'
-        // S' * K(k)' = H * P(k)-'
-        RealMatrix kalmanGain = new CholeskyDecomposition(s).getSolver()
-                .solve(measurementMatrix.multiply(errorCovariance.transpose()))
-                .transpose();
-
-        // update estimate with measurement z(k)
-        // xHat(k) = xHat(k)- + K * Inn
-        stateEstimation = stateEstimation.add(kalmanGain.operate(innovation));
-
-        // update covariance of prediction error
-        // P(k) = (I - K * H) * P(k)-
-        RealMatrix identity = MatrixUtils.createRealIdentityMatrix(kalmanGain.getRowDimension());
-        errorCovariance = identity.subtract(kalmanGain.multiply(measurementMatrix)).multiply(errorCovariance);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/filter/MeasurementModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/filter/MeasurementModel.java b/src/main/java/org/apache/commons/math3/filter/MeasurementModel.java
deleted file mode 100644
index 2e0a379..0000000
--- a/src/main/java/org/apache/commons/math3/filter/MeasurementModel.java
+++ /dev/null
@@ -1,44 +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.filter;
-
-import org.apache.commons.math3.linear.RealMatrix;
-
-/**
- * Defines the measurement model for the use with a {@link KalmanFilter}.
- *
- * @since 3.0
- */
-public interface MeasurementModel {
-    /**
-     * Returns the measurement matrix.
-     *
-     * @return the measurement matrix
-     */
-    RealMatrix getMeasurementMatrix();
-
-    /**
-     * Returns the measurement noise matrix. This method is called by the {@link KalmanFilter} every
-     * correction step, so implementations of this interface may return a modified measurement noise
-     * depending on the current iteration step.
-     *
-     * @return the measurement noise matrix
-     * @see KalmanFilter#correct(double[])
-     * @see KalmanFilter#correct(org.apache.commons.math3.linear.RealVector)
-     */
-    RealMatrix getMeasurementNoise();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/filter/ProcessModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/filter/ProcessModel.java b/src/main/java/org/apache/commons/math3/filter/ProcessModel.java
deleted file mode 100644
index 179ed1b..0000000
--- a/src/main/java/org/apache/commons/math3/filter/ProcessModel.java
+++ /dev/null
@@ -1,73 +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.filter;
-
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-
-/**
- * Defines the process dynamics model for the use with a {@link KalmanFilter}.
- *
- * @since 3.0
- */
-public interface ProcessModel {
-    /**
-     * Returns the state transition matrix.
-     *
-     * @return the state transition matrix
-     */
-    RealMatrix getStateTransitionMatrix();
-
-    /**
-     * Returns the control matrix.
-     *
-     * @return the control matrix
-     */
-    RealMatrix getControlMatrix();
-
-    /**
-     * Returns the process noise matrix. This method is called by the {@link KalmanFilter} every
-     * prediction step, so implementations of this interface may return a modified process noise
-     * depending on the current iteration step.
-     *
-     * @return the process noise matrix
-     * @see KalmanFilter#predict()
-     * @see KalmanFilter#predict(double[])
-     * @see KalmanFilter#predict(RealVector)
-     */
-    RealMatrix getProcessNoise();
-
-    /**
-     * Returns the initial state estimation vector.
-     * <p>
-     * <b>Note:</b> if the return value is zero, the Kalman filter will initialize the
-     * state estimation with a zero vector.
-     *
-     * @return the initial state estimation vector
-     */
-    RealVector getInitialStateEstimate();
-
-    /**
-     * Returns the initial error covariance matrix.
-     * <p>
-     * <b>Note:</b> if the return value is zero, the Kalman filter will initialize the
-     * error covariance with the process noise matrix.
-     *
-     * @return the initial error covariance matrix
-     */
-    RealMatrix getInitialErrorCovariance();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/filter/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/filter/package-info.java b/src/main/java/org/apache/commons/math3/filter/package-info.java
deleted file mode 100644
index 4e76536..0000000
--- a/src/main/java/org/apache/commons/math3/filter/package-info.java
+++ /dev/null
@@ -1,20 +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.
- */
-/**
- * Implementations of common discrete-time linear filters.
- */
-package org.apache.commons.math3.filter;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/AbstractCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/AbstractCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/AbstractCurveFitter.java
deleted file mode 100644
index 6f39c23..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/AbstractCurveFitter.java
+++ /dev/null
@@ -1,147 +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.fitting;
-
-import java.util.Collection;
-
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer;
-
-/**
- * Base class that contains common code for fitting parametric univariate
- * real functions <code>y = f(p<sub>i</sub>;x)</code>, where {@code x} is
- * the independent variable and the <code>p<sub>i</sub></code> are the
- * <em>parameters</em>.
- * <br/>
- * A fitter will find the optimal values of the parameters by
- * <em>fitting</em> the curve so it remains very close to a set of
- * {@code N} observed points <code>(x<sub>k</sub>, y<sub>k</sub>)</code>,
- * {@code 0 <= k < N}.
- * <br/>
- * An algorithm usually performs the fit by finding the parameter
- * values that minimizes the objective function
- * <pre><code>
- *  &sum;y<sub>k</sub> - f(x<sub>k</sub>)<sup>2</sup>,
- * </code></pre>
- * which is actually a least-squares problem.
- * This class contains boilerplate code for calling the
- * {@link #fit(Collection)} method for obtaining the parameters.
- * The problem setup, such as the choice of optimization algorithm
- * for fitting a specific function is delegated to subclasses.
- *
- * @since 3.3
- */
-public abstract class AbstractCurveFitter {
-    /**
-     * Fits a curve.
-     * This method computes the coefficients of the curve that best
-     * fit the sample of observed points.
-     *
-     * @param points Observations.
-     * @return the fitted parameters.
-     */
-    public double[] fit(Collection<WeightedObservedPoint> points) {
-        // Perform the fit.
-        return getOptimizer().optimize(getProblem(points)).getPoint().toArray();
-    }
-
-    /**
-     * Creates an optimizer set up to fit the appropriate curve.
-     * <p>
-     * The default implementation uses a {@link LevenbergMarquardtOptimizer
-     * Levenberg-Marquardt} optimizer.
-     * </p>
-     * @return the optimizer to use for fitting the curve to the
-     * given {@code points}.
-     */
-    protected LeastSquaresOptimizer getOptimizer() {
-        return new LevenbergMarquardtOptimizer();
-    }
-
-    /**
-     * Creates a least squares problem corresponding to the appropriate curve.
-     *
-     * @param points Sample points.
-     * @return the least squares problem to use for fitting the curve to the
-     * given {@code points}.
-     */
-    protected abstract LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> points);
-
-    /**
-     * Vector function for computing function theoretical values.
-     */
-    protected static class TheoreticalValuesFunction {
-        /** Function to fit. */
-        private final ParametricUnivariateFunction f;
-        /** Observations. */
-        private final double[] points;
-
-        /**
-         * @param f function to fit.
-         * @param observations Observations.
-         */
-        public TheoreticalValuesFunction(final ParametricUnivariateFunction f,
-                                         final Collection<WeightedObservedPoint> observations) {
-            this.f = f;
-
-            final int len = observations.size();
-            this.points = new double[len];
-            int i = 0;
-            for (WeightedObservedPoint obs : observations) {
-                this.points[i++] = obs.getX();
-            }
-        }
-
-        /**
-         * @return the model function values.
-         */
-        public MultivariateVectorFunction getModelFunction() {
-            return new MultivariateVectorFunction() {
-                /** {@inheritDoc} */
-                public double[] value(double[] p) {
-                    final int len = points.length;
-                    final double[] values = new double[len];
-                    for (int i = 0; i < len; i++) {
-                        values[i] = f.value(points[i], p);
-                    }
-
-                    return values;
-                }
-            };
-        }
-
-        /**
-         * @return the model function Jacobian.
-         */
-        public MultivariateMatrixFunction getModelFunctionJacobian() {
-            return new MultivariateMatrixFunction() {
-                public double[][] value(double[] p) {
-                    final int len = points.length;
-                    final double[][] jacobian = new double[len][];
-                    for (int i = 0; i < len; i++) {
-                        jacobian[i] = f.gradient(points[i], p);
-                    }
-                    return jacobian;
-                }
-            };
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/CurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/CurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/CurveFitter.java
deleted file mode 100644
index 0ddeacc..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/CurveFitter.java
+++ /dev/null
@@ -1,232 +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.fitting;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
-
-/**
- * Fitter for parametric univariate real functions y = f(x).
- * <br/>
- * When a univariate real function y = f(x) does depend on some
- * unknown parameters p<sub>0</sub>, p<sub>1</sub> ... p<sub>n-1</sub>,
- * this class can be used to find these parameters. It does this
- * by <em>fitting</em> the curve so it remains very close to a set of
- * observed points (x<sub>0</sub>, y<sub>0</sub>), (x<sub>1</sub>,
- * y<sub>1</sub>) ... (x<sub>k-1</sub>, y<sub>k-1</sub>). This fitting
- * is done by finding the parameters values that minimizes the objective
- * function &sum;(y<sub>i</sub>-f(x<sub>i</sub>))<sup>2</sup>. This is
- * really a least squares problem.
- *
- * @param <T> Function to use for the fit.
- *
- * @since 2.0
- * @deprecated As of 3.3. Please use {@link AbstractCurveFitter} and
- * {@link WeightedObservedPoints} instead.
- */
-@Deprecated
-public class CurveFitter<T extends ParametricUnivariateFunction> {
-    /** Optimizer to use for the fitting. */
-    private final MultivariateVectorOptimizer optimizer;
-    /** Observed points. */
-    private final List<WeightedObservedPoint> observations;
-
-    /**
-     * Simple constructor.
-     *
-     * @param optimizer Optimizer to use for the fitting.
-     * @since 3.1
-     */
-    public CurveFitter(final MultivariateVectorOptimizer optimizer) {
-        this.optimizer = optimizer;
-        observations = new ArrayList<WeightedObservedPoint>();
-    }
-
-    /** Add an observed (x,y) point to the sample with unit weight.
-     * <p>Calling this method is equivalent to call
-     * {@code addObservedPoint(1.0, x, y)}.</p>
-     * @param x abscissa of the point
-     * @param y observed value of the point at x, after fitting we should
-     * have f(x) as close as possible to this value
-     * @see #addObservedPoint(double, double, double)
-     * @see #addObservedPoint(WeightedObservedPoint)
-     * @see #getObservations()
-     */
-    public void addObservedPoint(double x, double y) {
-        addObservedPoint(1.0, x, y);
-    }
-
-    /** Add an observed weighted (x,y) point to the sample.
-     * @param weight weight of the observed point in the fit
-     * @param x abscissa of the point
-     * @param y observed value of the point at x, after fitting we should
-     * have f(x) as close as possible to this value
-     * @see #addObservedPoint(double, double)
-     * @see #addObservedPoint(WeightedObservedPoint)
-     * @see #getObservations()
-     */
-    public void addObservedPoint(double weight, double x, double y) {
-        observations.add(new WeightedObservedPoint(weight, x, y));
-    }
-
-    /** Add an observed weighted (x,y) point to the sample.
-     * @param observed observed point to add
-     * @see #addObservedPoint(double, double)
-     * @see #addObservedPoint(double, double, double)
-     * @see #getObservations()
-     */
-    public void addObservedPoint(WeightedObservedPoint observed) {
-        observations.add(observed);
-    }
-
-    /** Get the observed points.
-     * @return observed points
-     * @see #addObservedPoint(double, double)
-     * @see #addObservedPoint(double, double, double)
-     * @see #addObservedPoint(WeightedObservedPoint)
-     */
-    public WeightedObservedPoint[] getObservations() {
-        return observations.toArray(new WeightedObservedPoint[observations.size()]);
-    }
-
-    /**
-     * Remove all observations.
-     */
-    public void clearObservations() {
-        observations.clear();
-    }
-
-    /**
-     * Fit a curve.
-     * This method compute the coefficients of the curve that best
-     * fit the sample of observed points previously given through calls
-     * to the {@link #addObservedPoint(WeightedObservedPoint)
-     * addObservedPoint} method.
-     *
-     * @param f parametric function to fit.
-     * @param initialGuess first guess of the function parameters.
-     * @return the fitted parameters.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if the start point dimension is wrong.
-     */
-    public double[] fit(T f, final double[] initialGuess) {
-        return fit(Integer.MAX_VALUE, f, initialGuess);
-    }
-
-    /**
-     * Fit a curve.
-     * This method compute the coefficients of the curve that best
-     * fit the sample of observed points previously given through calls
-     * to the {@link #addObservedPoint(WeightedObservedPoint)
-     * addObservedPoint} method.
-     *
-     * @param f parametric function to fit.
-     * @param initialGuess first guess of the function parameters.
-     * @param maxEval Maximum number of function evaluations.
-     * @return the fitted parameters.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-     * if the number of allowed evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if the start point dimension is wrong.
-     * @since 3.0
-     */
-    public double[] fit(int maxEval, T f,
-                        final double[] initialGuess) {
-        // Prepare least squares problem.
-        double[] target  = new double[observations.size()];
-        double[] weights = new double[observations.size()];
-        int i = 0;
-        for (WeightedObservedPoint point : observations) {
-            target[i]  = point.getY();
-            weights[i] = point.getWeight();
-            ++i;
-        }
-
-        // Input to the optimizer: the model and its Jacobian.
-        final TheoreticalValuesFunction model = new TheoreticalValuesFunction(f);
-
-        // Perform the fit.
-        final PointVectorValuePair optimum
-            = optimizer.optimize(new MaxEval(maxEval),
-                                 model.getModelFunction(),
-                                 model.getModelFunctionJacobian(),
-                                 new Target(target),
-                                 new Weight(weights),
-                                 new InitialGuess(initialGuess));
-        // Extract the coefficients.
-        return optimum.getPointRef();
-    }
-
-    /** Vectorial function computing function theoretical values. */
-    private class TheoreticalValuesFunction {
-        /** Function to fit. */
-        private final ParametricUnivariateFunction f;
-
-        /**
-         * @param f function to fit.
-         */
-        public TheoreticalValuesFunction(final ParametricUnivariateFunction f) {
-            this.f = f;
-        }
-
-        /**
-         * @return the model function values.
-         */
-        public ModelFunction getModelFunction() {
-            return new ModelFunction(new MultivariateVectorFunction() {
-                    /** {@inheritDoc} */
-                    public double[] value(double[] point) {
-                        // compute the residuals
-                        final double[] values = new double[observations.size()];
-                        int i = 0;
-                        for (WeightedObservedPoint observed : observations) {
-                            values[i++] = f.value(observed.getX(), point);
-                        }
-
-                        return values;
-                    }
-                });
-        }
-
-        /**
-         * @return the model function Jacobian.
-         */
-        public ModelFunctionJacobian getModelFunctionJacobian() {
-            return new ModelFunctionJacobian(new MultivariateMatrixFunction() {
-                    public double[][] value(double[] point) {
-                        final double[][] jacobian = new double[observations.size()][];
-                        int i = 0;
-                        for (WeightedObservedPoint observed : observations) {
-                            jacobian[i++] = f.gradient(observed.getX(), point);
-                        }
-                        return jacobian;
-                    }
-                });
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java b/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java
deleted file mode 100644
index 64e0bda..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/GaussianCurveFitter.java
+++ /dev/null
@@ -1,430 +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.fitting;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Fits points to a {@link
- * org.apache.commons.math3.analysis.function.Gaussian.Parametric Gaussian}
- * function.
- * <br/>
- * The {@link #withStartPoint(double[]) initial guess values} must be passed
- * in the following order:
- * <ul>
- *  <li>Normalization</li>
- *  <li>Mean</li>
- *  <li>Sigma</li>
- * </ul>
- * The optimal values will be returned in the same order.
- *
- * <p>
- * Usage example:
- * <pre>
- *   WeightedObservedPoints obs = new WeightedObservedPoints();
- *   obs.add(4.0254623,  531026.0);
- *   obs.add(4.03128248, 984167.0);
- *   obs.add(4.03839603, 1887233.0);
- *   obs.add(4.04421621, 2687152.0);
- *   obs.add(4.05132976, 3461228.0);
- *   obs.add(4.05326982, 3580526.0);
- *   obs.add(4.05779662, 3439750.0);
- *   obs.add(4.0636168,  2877648.0);
- *   obs.add(4.06943698, 2175960.0);
- *   obs.add(4.07525716, 1447024.0);
- *   obs.add(4.08237071, 717104.0);
- *   obs.add(4.08366408, 620014.0);
- *   double[] parameters = GaussianCurveFitter.create().fit(obs.toList());
- * </pre>
- *
- * @since 3.3
- */
-public class GaussianCurveFitter extends AbstractCurveFitter {
-    /** Parametric function to be fitted. */
-    private static final Gaussian.Parametric FUNCTION = new Gaussian.Parametric() {
-            @Override
-            public double value(double x, double ... p) {
-                double v = Double.POSITIVE_INFINITY;
-                try {
-                    v = super.value(x, p);
-                } catch (NotStrictlyPositiveException e) { // NOPMD
-                    // Do nothing.
-                }
-                return v;
-            }
-
-            @Override
-            public double[] gradient(double x, double ... p) {
-                double[] v = { Double.POSITIVE_INFINITY,
-                               Double.POSITIVE_INFINITY,
-                               Double.POSITIVE_INFINITY };
-                try {
-                    v = super.gradient(x, p);
-                } catch (NotStrictlyPositiveException e) { // NOPMD
-                    // Do nothing.
-                }
-                return v;
-            }
-        };
-    /** Initial guess. */
-    private final double[] initialGuess;
-    /** Maximum number of iterations of the optimization algorithm. */
-    private final int maxIter;
-
-    /**
-     * Contructor used by the factory methods.
-     *
-     * @param initialGuess Initial guess. If set to {@code null}, the initial guess
-     * will be estimated using the {@link ParameterGuesser}.
-     * @param maxIter Maximum number of iterations of the optimization algorithm.
-     */
-    private GaussianCurveFitter(double[] initialGuess,
-                                int maxIter) {
-        this.initialGuess = initialGuess;
-        this.maxIter = maxIter;
-    }
-
-    /**
-     * Creates a default curve fitter.
-     * The initial guess for the parameters will be {@link ParameterGuesser}
-     * computed automatically, and the maximum number of iterations of the
-     * optimization algorithm is set to {@link Integer#MAX_VALUE}.
-     *
-     * @return a curve fitter.
-     *
-     * @see #withStartPoint(double[])
-     * @see #withMaxIterations(int)
-     */
-    public static GaussianCurveFitter create() {
-        return new GaussianCurveFitter(null, Integer.MAX_VALUE);
-    }
-
-    /**
-     * Configure the start point (initial guess).
-     * @param newStart new start point (initial guess)
-     * @return a new instance.
-     */
-    public GaussianCurveFitter withStartPoint(double[] newStart) {
-        return new GaussianCurveFitter(newStart.clone(),
-                                       maxIter);
-    }
-
-    /**
-     * Configure the maximum number of iterations.
-     * @param newMaxIter maximum number of iterations
-     * @return a new instance.
-     */
-    public GaussianCurveFitter withMaxIterations(int newMaxIter) {
-        return new GaussianCurveFitter(initialGuess,
-                                       newMaxIter);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected LeastSquaresProblem getProblem(Collection<WeightedObservedPoint> observations) {
-
-        // Prepare least-squares problem.
-        final int len = observations.size();
-        final double[] target  = new double[len];
-        final double[] weights = new double[len];
-
-        int i = 0;
-        for (WeightedObservedPoint obs : observations) {
-            target[i]  = obs.getY();
-            weights[i] = obs.getWeight();
-            ++i;
-        }
-
-        final AbstractCurveFitter.TheoreticalValuesFunction model =
-                new AbstractCurveFitter.TheoreticalValuesFunction(FUNCTION, observations);
-
-        final double[] startPoint = initialGuess != null ?
-            initialGuess :
-            // Compute estimation.
-            new ParameterGuesser(observations).guess();
-
-        // Return a new least squares problem set up to fit a Gaussian curve to the
-        // observed points.
-        return new LeastSquaresBuilder().
-                maxEvaluations(Integer.MAX_VALUE).
-                maxIterations(maxIter).
-                start(startPoint).
-                target(target).
-                weight(new DiagonalMatrix(weights)).
-                model(model.getModelFunction(), model.getModelFunctionJacobian()).
-                build();
-
-    }
-
-    /**
-     * Guesses the parameters {@code norm}, {@code mean}, and {@code sigma}
-     * of a {@link org.apache.commons.math3.analysis.function.Gaussian.Parametric}
-     * based on the specified observed points.
-     */
-    public static class ParameterGuesser {
-        /** Normalization factor. */
-        private final double norm;
-        /** Mean. */
-        private final double mean;
-        /** Standard deviation. */
-        private final double sigma;
-
-        /**
-         * Constructs instance with the specified observed points.
-         *
-         * @param observations Observed points from which to guess the
-         * parameters of the Gaussian.
-         * @throws NullArgumentException if {@code observations} is
-         * {@code null}.
-         * @throws NumberIsTooSmallException if there are less than 3
-         * observations.
-         */
-        public ParameterGuesser(Collection<WeightedObservedPoint> observations) {
-            if (observations == null) {
-                throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY);
-            }
-            if (observations.size() < 3) {
-                throw new NumberIsTooSmallException(observations.size(), 3, true);
-            }
-
-            final List<WeightedObservedPoint> sorted = sortObservations(observations);
-            final double[] params = basicGuess(sorted.toArray(new WeightedObservedPoint[0]));
-
-            norm = params[0];
-            mean = params[1];
-            sigma = params[2];
-        }
-
-        /**
-         * Gets an estimation of the parameters.
-         *
-         * @return the guessed parameters, in the following order:
-         * <ul>
-         *  <li>Normalization factor</li>
-         *  <li>Mean</li>
-         *  <li>Standard deviation</li>
-         * </ul>
-         */
-        public double[] guess() {
-            return new double[] { norm, mean, sigma };
-        }
-
-        /**
-         * Sort the observations.
-         *
-         * @param unsorted Input observations.
-         * @return the input observations, sorted.
-         */
-        private List<WeightedObservedPoint> sortObservations(Collection<WeightedObservedPoint> unsorted) {
-            final List<WeightedObservedPoint> observations = new ArrayList<WeightedObservedPoint>(unsorted);
-
-            final Comparator<WeightedObservedPoint> cmp = new Comparator<WeightedObservedPoint>() {
-                public int compare(WeightedObservedPoint p1,
-                                   WeightedObservedPoint p2) {
-                    if (p1 == null && p2 == null) {
-                        return 0;
-                    }
-                    if (p1 == null) {
-                        return -1;
-                    }
-                    if (p2 == null) {
-                        return 1;
-                    }
-                    if (p1.getX() < p2.getX()) {
-                        return -1;
-                    }
-                    if (p1.getX() > p2.getX()) {
-                        return 1;
-                    }
-                    if (p1.getY() < p2.getY()) {
-                        return -1;
-                    }
-                    if (p1.getY() > p2.getY()) {
-                        return 1;
-                    }
-                    if (p1.getWeight() < p2.getWeight()) {
-                        return -1;
-                    }
-                    if (p1.getWeight() > p2.getWeight()) {
-                        return 1;
-                    }
-                    return 0;
-                }
-            };
-
-            Collections.sort(observations, cmp);
-            return observations;
-        }
-
-        /**
-         * Guesses the parameters based on the specified observed points.
-         *
-         * @param points Observed points, sorted.
-         * @return the guessed parameters (normalization factor, mean and
-         * sigma).
-         */
-        private double[] basicGuess(WeightedObservedPoint[] points) {
-            final int maxYIdx = findMaxY(points);
-            final double n = points[maxYIdx].getY();
-            final double m = points[maxYIdx].getX();
-
-            double fwhmApprox;
-            try {
-                final double halfY = n + ((m - n) / 2);
-                final double fwhmX1 = interpolateXAtY(points, maxYIdx, -1, halfY);
-                final double fwhmX2 = interpolateXAtY(points, maxYIdx, 1, halfY);
-                fwhmApprox = fwhmX2 - fwhmX1;
-            } catch (OutOfRangeException e) {
-                // TODO: Exceptions should not be used for flow control.
-                fwhmApprox = points[points.length - 1].getX() - points[0].getX();
-            }
-            final double s = fwhmApprox / (2 * FastMath.sqrt(2 * FastMath.log(2)));
-
-            return new double[] { n, m, s };
-        }
-
-        /**
-         * Finds index of point in specified points with the largest Y.
-         *
-         * @param points Points to search.
-         * @return the index in specified points array.
-         */
-        private int findMaxY(WeightedObservedPoint[] points) {
-            int maxYIdx = 0;
-            for (int i = 1; i < points.length; i++) {
-                if (points[i].getY() > points[maxYIdx].getY()) {
-                    maxYIdx = i;
-                }
-            }
-            return maxYIdx;
-        }
-
-        /**
-         * Interpolates using the specified points to determine X at the
-         * specified Y.
-         *
-         * @param points Points to use for interpolation.
-         * @param startIdx Index within points from which to start the search for
-         * interpolation bounds points.
-         * @param idxStep Index step for searching interpolation bounds points.
-         * @param y Y value for which X should be determined.
-         * @return the value of X for the specified Y.
-         * @throws ZeroException if {@code idxStep} is 0.
-         * @throws OutOfRangeException if specified {@code y} is not within the
-         * range of the specified {@code points}.
-         */
-        private double interpolateXAtY(WeightedObservedPoint[] points,
-                                       int startIdx,
-                                       int idxStep,
-                                       double y)
-            throws OutOfRangeException {
-            if (idxStep == 0) {
-                throw new ZeroException();
-            }
-            final WeightedObservedPoint[] twoPoints
-                = getInterpolationPointsForY(points, startIdx, idxStep, y);
-            final WeightedObservedPoint p1 = twoPoints[0];
-            final WeightedObservedPoint p2 = twoPoints[1];
-            if (p1.getY() == y) {
-                return p1.getX();
-            }
-            if (p2.getY() == y) {
-                return p2.getX();
-            }
-            return p1.getX() + (((y - p1.getY()) * (p2.getX() - p1.getX())) /
-                                (p2.getY() - p1.getY()));
-        }
-
-        /**
-         * Gets the two bounding interpolation points from the specified points
-         * suitable for determining X at the specified Y.
-         *
-         * @param points Points to use for interpolation.
-         * @param startIdx Index within points from which to start search for
-         * interpolation bounds points.
-         * @param idxStep Index step for search for interpolation bounds points.
-         * @param y Y value for which X should be determined.
-         * @return the array containing two points suitable for determining X at
-         * the specified Y.
-         * @throws ZeroException if {@code idxStep} is 0.
-         * @throws OutOfRangeException if specified {@code y} is not within the
-         * range of the specified {@code points}.
-         */
-        private WeightedObservedPoint[] getInterpolationPointsForY(WeightedObservedPoint[] points,
-                                                                   int startIdx,
-                                                                   int idxStep,
-                                                                   double y)
-            throws OutOfRangeException {
-            if (idxStep == 0) {
-                throw new ZeroException();
-            }
-            for (int i = startIdx;
-                 idxStep < 0 ? i + idxStep >= 0 : i + idxStep < points.length;
-                 i += idxStep) {
-                final WeightedObservedPoint p1 = points[i];
-                final WeightedObservedPoint p2 = points[i + idxStep];
-                if (isBetween(y, p1.getY(), p2.getY())) {
-                    if (idxStep < 0) {
-                        return new WeightedObservedPoint[] { p2, p1 };
-                    } else {
-                        return new WeightedObservedPoint[] { p1, p2 };
-                    }
-                }
-            }
-
-            // Boundaries are replaced by dummy values because the raised
-            // exception is caught and the message never displayed.
-            // TODO: Exceptions should not be used for flow control.
-            throw new OutOfRangeException(y,
-                                          Double.NEGATIVE_INFINITY,
-                                          Double.POSITIVE_INFINITY);
-        }
-
-        /**
-         * Determines whether a value is between two other values.
-         *
-         * @param value Value to test whether it is between {@code boundary1}
-         * and {@code boundary2}.
-         * @param boundary1 One end of the range.
-         * @param boundary2 Other end of the range.
-         * @return {@code true} if {@code value} is between {@code boundary1} and
-         * {@code boundary2} (inclusive), {@code false} otherwise.
-         */
-        private boolean isBetween(double value,
-                                  double boundary1,
-                                  double boundary2) {
-            return (value >= boundary1 && value <= boundary2) ||
-                (value >= boundary2 && value <= boundary1);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/GaussianFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/GaussianFitter.java b/src/main/java/org/apache/commons/math3/fitting/GaussianFitter.java
deleted file mode 100644
index 3946540..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/GaussianFitter.java
+++ /dev/null
@@ -1,364 +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.fitting;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Fits points to a {@link
- * org.apache.commons.math3.analysis.function.Gaussian.Parametric Gaussian} function.
- * <p>
- * Usage example:
- * <pre>
- *   GaussianFitter fitter = new GaussianFitter(
- *     new LevenbergMarquardtOptimizer());
- *   fitter.addObservedPoint(4.0254623,  531026.0);
- *   fitter.addObservedPoint(4.03128248, 984167.0);
- *   fitter.addObservedPoint(4.03839603, 1887233.0);
- *   fitter.addObservedPoint(4.04421621, 2687152.0);
- *   fitter.addObservedPoint(4.05132976, 3461228.0);
- *   fitter.addObservedPoint(4.05326982, 3580526.0);
- *   fitter.addObservedPoint(4.05779662, 3439750.0);
- *   fitter.addObservedPoint(4.0636168,  2877648.0);
- *   fitter.addObservedPoint(4.06943698, 2175960.0);
- *   fitter.addObservedPoint(4.07525716, 1447024.0);
- *   fitter.addObservedPoint(4.08237071, 717104.0);
- *   fitter.addObservedPoint(4.08366408, 620014.0);
- *   double[] parameters = fitter.fit();
- * </pre>
- *
- * @since 2.2
- * @deprecated As of 3.3. Please use {@link GaussianCurveFitter} and
- * {@link WeightedObservedPoints} instead.
- */
-@Deprecated
-public class GaussianFitter extends CurveFitter<Gaussian.Parametric> {
-    /**
-     * Constructs an instance using the specified optimizer.
-     *
-     * @param optimizer Optimizer to use for the fitting.
-     */
-    public GaussianFitter(MultivariateVectorOptimizer optimizer) {
-        super(optimizer);
-    }
-
-    /**
-     * Fits a Gaussian function to the observed points.
-     *
-     * @param initialGuess First guess values in the following order:
-     * <ul>
-     *  <li>Norm</li>
-     *  <li>Mean</li>
-     *  <li>Sigma</li>
-     * </ul>
-     * @return the parameters of the Gaussian function that best fits the
-     * observed points (in the same order as above).
-     * @since 3.0
-     */
-    public double[] fit(double[] initialGuess) {
-        final Gaussian.Parametric f = new Gaussian.Parametric() {
-                @Override
-                public double value(double x, double ... p) {
-                    double v = Double.POSITIVE_INFINITY;
-                    try {
-                        v = super.value(x, p);
-                    } catch (NotStrictlyPositiveException e) { // NOPMD
-                        // Do nothing.
-                    }
-                    return v;
-                }
-
-                @Override
-                public double[] gradient(double x, double ... p) {
-                    double[] v = { Double.POSITIVE_INFINITY,
-                                   Double.POSITIVE_INFINITY,
-                                   Double.POSITIVE_INFINITY };
-                    try {
-                        v = super.gradient(x, p);
-                    } catch (NotStrictlyPositiveException e) { // NOPMD
-                        // Do nothing.
-                    }
-                    return v;
-                }
-            };
-
-        return fit(f, initialGuess);
-    }
-
-    /**
-     * Fits a Gaussian function to the observed points.
-     *
-     * @return the parameters of the Gaussian function that best fits the
-     * observed points (in the same order as above).
-     */
-    public double[] fit() {
-        final double[] guess = (new ParameterGuesser(getObservations())).guess();
-        return fit(guess);
-    }
-
-    /**
-     * Guesses the parameters {@code norm}, {@code mean}, and {@code sigma}
-     * of a {@link org.apache.commons.math3.analysis.function.Gaussian.Parametric}
-     * based on the specified observed points.
-     */
-    public static class ParameterGuesser {
-        /** Normalization factor. */
-        private final double norm;
-        /** Mean. */
-        private final double mean;
-        /** Standard deviation. */
-        private final double sigma;
-
-        /**
-         * Constructs instance with the specified observed points.
-         *
-         * @param observations Observed points from which to guess the
-         * parameters of the Gaussian.
-         * @throws NullArgumentException if {@code observations} is
-         * {@code null}.
-         * @throws NumberIsTooSmallException if there are less than 3
-         * observations.
-         */
-        public ParameterGuesser(WeightedObservedPoint[] observations) {
-            if (observations == null) {
-                throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY);
-            }
-            if (observations.length < 3) {
-                throw new NumberIsTooSmallException(observations.length, 3, true);
-            }
-
-            final WeightedObservedPoint[] sorted = sortObservations(observations);
-            final double[] params = basicGuess(sorted);
-
-            norm = params[0];
-            mean = params[1];
-            sigma = params[2];
-        }
-
-        /**
-         * Gets an estimation of the parameters.
-         *
-         * @return the guessed parameters, in the following order:
-         * <ul>
-         *  <li>Normalization factor</li>
-         *  <li>Mean</li>
-         *  <li>Standard deviation</li>
-         * </ul>
-         */
-        public double[] guess() {
-            return new double[] { norm, mean, sigma };
-        }
-
-        /**
-         * Sort the observations.
-         *
-         * @param unsorted Input observations.
-         * @return the input observations, sorted.
-         */
-        private WeightedObservedPoint[] sortObservations(WeightedObservedPoint[] unsorted) {
-            final WeightedObservedPoint[] observations = unsorted.clone();
-            final Comparator<WeightedObservedPoint> cmp
-                = new Comparator<WeightedObservedPoint>() {
-                public int compare(WeightedObservedPoint p1,
-                                   WeightedObservedPoint p2) {
-                    if (p1 == null && p2 == null) {
-                        return 0;
-                    }
-                    if (p1 == null) {
-                        return -1;
-                    }
-                    if (p2 == null) {
-                        return 1;
-                    }
-                    if (p1.getX() < p2.getX()) {
-                        return -1;
-                    }
-                    if (p1.getX() > p2.getX()) {
-                        return 1;
-                    }
-                    if (p1.getY() < p2.getY()) {
-                        return -1;
-                    }
-                    if (p1.getY() > p2.getY()) {
-                        return 1;
-                    }
-                    if (p1.getWeight() < p2.getWeight()) {
-                        return -1;
-                    }
-                    if (p1.getWeight() > p2.getWeight()) {
-                        return 1;
-                    }
-                    return 0;
-                }
-            };
-
-            Arrays.sort(observations, cmp);
-            return observations;
-        }
-
-        /**
-         * Guesses the parameters based on the specified observed points.
-         *
-         * @param points Observed points, sorted.
-         * @return the guessed parameters (normalization factor, mean and
-         * sigma).
-         */
-        private double[] basicGuess(WeightedObservedPoint[] points) {
-            final int maxYIdx = findMaxY(points);
-            final double n = points[maxYIdx].getY();
-            final double m = points[maxYIdx].getX();
-
-            double fwhmApprox;
-            try {
-                final double halfY = n + ((m - n) / 2);
-                final double fwhmX1 = interpolateXAtY(points, maxYIdx, -1, halfY);
-                final double fwhmX2 = interpolateXAtY(points, maxYIdx, 1, halfY);
-                fwhmApprox = fwhmX2 - fwhmX1;
-            } catch (OutOfRangeException e) {
-                // TODO: Exceptions should not be used for flow control.
-                fwhmApprox = points[points.length - 1].getX() - points[0].getX();
-            }
-            final double s = fwhmApprox / (2 * FastMath.sqrt(2 * FastMath.log(2)));
-
-            return new double[] { n, m, s };
-        }
-
-        /**
-         * Finds index of point in specified points with the largest Y.
-         *
-         * @param points Points to search.
-         * @return the index in specified points array.
-         */
-        private int findMaxY(WeightedObservedPoint[] points) {
-            int maxYIdx = 0;
-            for (int i = 1; i < points.length; i++) {
-                if (points[i].getY() > points[maxYIdx].getY()) {
-                    maxYIdx = i;
-                }
-            }
-            return maxYIdx;
-        }
-
-        /**
-         * Interpolates using the specified points to determine X at the
-         * specified Y.
-         *
-         * @param points Points to use for interpolation.
-         * @param startIdx Index within points from which to start the search for
-         * interpolation bounds points.
-         * @param idxStep Index step for searching interpolation bounds points.
-         * @param y Y value for which X should be determined.
-         * @return the value of X for the specified Y.
-         * @throws ZeroException if {@code idxStep} is 0.
-         * @throws OutOfRangeException if specified {@code y} is not within the
-         * range of the specified {@code points}.
-         */
-        private double interpolateXAtY(WeightedObservedPoint[] points,
-                                       int startIdx,
-                                       int idxStep,
-                                       double y)
-            throws OutOfRangeException {
-            if (idxStep == 0) {
-                throw new ZeroException();
-            }
-            final WeightedObservedPoint[] twoPoints
-                = getInterpolationPointsForY(points, startIdx, idxStep, y);
-            final WeightedObservedPoint p1 = twoPoints[0];
-            final WeightedObservedPoint p2 = twoPoints[1];
-            if (p1.getY() == y) {
-                return p1.getX();
-            }
-            if (p2.getY() == y) {
-                return p2.getX();
-            }
-            return p1.getX() + (((y - p1.getY()) * (p2.getX() - p1.getX())) /
-                                (p2.getY() - p1.getY()));
-        }
-
-        /**
-         * Gets the two bounding interpolation points from the specified points
-         * suitable for determining X at the specified Y.
-         *
-         * @param points Points to use for interpolation.
-         * @param startIdx Index within points from which to start search for
-         * interpolation bounds points.
-         * @param idxStep Index step for search for interpolation bounds points.
-         * @param y Y value for which X should be determined.
-         * @return the array containing two points suitable for determining X at
-         * the specified Y.
-         * @throws ZeroException if {@code idxStep} is 0.
-         * @throws OutOfRangeException if specified {@code y} is not within the
-         * range of the specified {@code points}.
-         */
-        private WeightedObservedPoint[] getInterpolationPointsForY(WeightedObservedPoint[] points,
-                                                                   int startIdx,
-                                                                   int idxStep,
-                                                                   double y)
-            throws OutOfRangeException {
-            if (idxStep == 0) {
-                throw new ZeroException();
-            }
-            for (int i = startIdx;
-                 idxStep < 0 ? i + idxStep >= 0 : i + idxStep < points.length;
-                 i += idxStep) {
-                final WeightedObservedPoint p1 = points[i];
-                final WeightedObservedPoint p2 = points[i + idxStep];
-                if (isBetween(y, p1.getY(), p2.getY())) {
-                    if (idxStep < 0) {
-                        return new WeightedObservedPoint[] { p2, p1 };
-                    } else {
-                        return new WeightedObservedPoint[] { p1, p2 };
-                    }
-                }
-            }
-
-            // Boundaries are replaced by dummy values because the raised
-            // exception is caught and the message never displayed.
-            // TODO: Exceptions should not be used for flow control.
-            throw new OutOfRangeException(y,
-                                          Double.NEGATIVE_INFINITY,
-                                          Double.POSITIVE_INFINITY);
-        }
-
-        /**
-         * Determines whether a value is between two other values.
-         *
-         * @param value Value to test whether it is between {@code boundary1}
-         * and {@code boundary2}.
-         * @param boundary1 One end of the range.
-         * @param boundary2 Other end of the range.
-         * @return {@code true} if {@code value} is between {@code boundary1} and
-         * {@code boundary2} (inclusive), {@code false} otherwise.
-         */
-        private boolean isBetween(double value,
-                                  double boundary1,
-                                  double boundary2) {
-            return (value >= boundary1 && value <= boundary2) ||
-                (value >= boundary2 && value <= boundary1);
-        }
-    }
-}


[82/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
Update for next development iteration: commons-math4


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

Branch: refs/heads/master
Commit: e4e1ac23c734f65686be4bc0e503f82f941afd4d
Parents: a7b4803
Author: Thomas Neidhart <th...@gmail.com>
Authored: Mon Feb 16 23:37:23 2015 +0100
Committer: Thomas Neidhart <th...@gmail.com>
Committed: Mon Feb 16 23:37:23 2015 +0100

----------------------------------------------------------------------
 README.md                                       |   2 +-
 build.xml                                       |   6 +-
 clirr-ignored.xml                               | 140 +++++++++---------
 findbugs-exclude-filter.xml                     | 142 +++++++++----------
 pom.xml                                         |  34 ++---
 src/changes/changes.xml                         |   2 +-
 .../java/org/apache/commons/math4/Field.java    |   2 +-
 .../org/apache/commons/math4/FieldElement.java  |   6 +-
 .../apache/commons/math4/RealFieldElement.java  |   4 +-
 .../math4/analysis/BivariateFunction.java       |   2 +-
 .../DifferentiableMultivariateFunction.java     |   4 +-
 ...ifferentiableMultivariateVectorFunction.java |   4 +-
 .../DifferentiableUnivariateFunction.java       |   4 +-
 .../DifferentiableUnivariateMatrixFunction.java |   4 +-
 .../DifferentiableUnivariateVectorFunction.java |   4 +-
 .../commons/math4/analysis/FunctionUtils.java   |  22 +--
 .../math4/analysis/MultivariateFunction.java    |   6 +-
 .../analysis/MultivariateMatrixFunction.java    |   2 +-
 .../analysis/MultivariateVectorFunction.java    |   2 +-
 .../analysis/ParametricUnivariateFunction.java  |   2 +-
 .../math4/analysis/TrivariateFunction.java      |   2 +-
 .../math4/analysis/UnivariateFunction.java      |   2 +-
 .../analysis/UnivariateMatrixFunction.java      |   2 +-
 .../analysis/UnivariateVectorFunction.java      |   2 +-
 .../analysis/differentiation/DSCompiler.java    |  18 +--
 .../differentiation/DerivativeStructure.java    |  20 +--
 .../FiniteDifferencesDifferentiator.java        |  18 +--
 .../differentiation/GradientFunction.java       |   4 +-
 .../differentiation/JacobianFunction.java       |   4 +-
 .../MultivariateDifferentiableFunction.java     |   6 +-
 ...ultivariateDifferentiableVectorFunction.java |   6 +-
 .../differentiation/SparseGradient.java         |  18 +--
 .../UnivariateDifferentiableFunction.java       |   6 +-
 .../UnivariateDifferentiableMatrixFunction.java |   6 +-
 .../UnivariateDifferentiableVectorFunction.java |   6 +-
 .../UnivariateFunctionDifferentiator.java       |   4 +-
 .../UnivariateMatrixFunctionDifferentiator.java |   4 +-
 .../UnivariateVectorFunctionDifferentiator.java |   4 +-
 .../analysis/differentiation/package-info.java  |  12 +-
 .../commons/math4/analysis/function/Abs.java    |   6 +-
 .../commons/math4/analysis/function/Acos.java   |  14 +-
 .../commons/math4/analysis/function/Acosh.java  |  14 +-
 .../commons/math4/analysis/function/Add.java    |   4 +-
 .../commons/math4/analysis/function/Asin.java   |  14 +-
 .../commons/math4/analysis/function/Asinh.java  |  14 +-
 .../commons/math4/analysis/function/Atan.java   |  14 +-
 .../commons/math4/analysis/function/Atan2.java  |   6 +-
 .../commons/math4/analysis/function/Atanh.java  |  14 +-
 .../commons/math4/analysis/function/Cbrt.java   |  14 +-
 .../commons/math4/analysis/function/Ceil.java   |   6 +-
 .../math4/analysis/function/Constant.java       |   8 +-
 .../commons/math4/analysis/function/Cos.java    |  14 +-
 .../commons/math4/analysis/function/Cosh.java   |  10 +-
 .../commons/math4/analysis/function/Divide.java |   4 +-
 .../commons/math4/analysis/function/Exp.java    |  14 +-
 .../commons/math4/analysis/function/Expm1.java  |  14 +-
 .../commons/math4/analysis/function/Floor.java  |   6 +-
 .../math4/analysis/function/Gaussian.java       |  24 ++--
 .../analysis/function/HarmonicOscillator.java   |  22 +--
 .../math4/analysis/function/Identity.java       |   8 +-
 .../math4/analysis/function/Inverse.java        |  12 +-
 .../commons/math4/analysis/function/Log.java    |  14 +-
 .../commons/math4/analysis/function/Log10.java  |  14 +-
 .../commons/math4/analysis/function/Log1p.java  |  14 +-
 .../math4/analysis/function/Logistic.java       |  24 ++--
 .../commons/math4/analysis/function/Logit.java  |  24 ++--
 .../commons/math4/analysis/function/Max.java    |   6 +-
 .../commons/math4/analysis/function/Min.java    |   6 +-
 .../commons/math4/analysis/function/Minus.java  |   8 +-
 .../math4/analysis/function/Multiply.java       |   4 +-
 .../commons/math4/analysis/function/Pow.java    |   6 +-
 .../commons/math4/analysis/function/Power.java  |  16 +--
 .../commons/math4/analysis/function/Rint.java   |   6 +-
 .../math4/analysis/function/Sigmoid.java        |  20 +--
 .../commons/math4/analysis/function/Signum.java |   6 +-
 .../commons/math4/analysis/function/Sin.java    |  10 +-
 .../commons/math4/analysis/function/Sinc.java   |  18 +--
 .../commons/math4/analysis/function/Sinh.java   |  10 +-
 .../commons/math4/analysis/function/Sqrt.java   |  14 +-
 .../math4/analysis/function/StepFunction.java   |  15 +-
 .../math4/analysis/function/Subtract.java       |   4 +-
 .../commons/math4/analysis/function/Tan.java    |  14 +-
 .../commons/math4/analysis/function/Tanh.java   |  14 +-
 .../commons/math4/analysis/function/Ulp.java    |   6 +-
 .../math4/analysis/function/package-info.java   |   2 +-
 .../BaseAbstractUnivariateIntegrator.java       |  26 ++--
 .../IterativeLegendreGaussIntegrator.java       |  22 +--
 .../integration/LegendreGaussIntegrator.java    |  16 +--
 .../integration/MidPointIntegrator.java         |  18 +--
 .../analysis/integration/RombergIntegrator.java |  14 +-
 .../analysis/integration/SimpsonIntegrator.java |  14 +-
 .../integration/TrapezoidIntegrator.java        |  16 +--
 .../integration/UnivariateIntegrator.java       |  12 +-
 .../integration/gauss/BaseRuleFactory.java      |  11 +-
 .../integration/gauss/GaussIntegrator.java      |  12 +-
 .../gauss/GaussIntegratorFactory.java           |  20 +--
 .../integration/gauss/HermiteRuleFactory.java   |   8 +-
 .../gauss/LegendreHighPrecisionRuleFactory.java |   6 +-
 .../integration/gauss/LegendreRuleFactory.java  |   6 +-
 .../gauss/SymmetricGaussIntegrator.java         |  10 +-
 .../integration/gauss/package-info.java         |   2 +-
 .../analysis/integration/package-info.java      |   2 +-
 .../interpolation/AkimaSplineInterpolator.java  |  24 ++--
 .../BicubicInterpolatingFunction.java           |  15 +-
 .../interpolation/BicubicInterpolator.java      |  12 +-
 .../BicubicSplineInterpolatingFunction.java     |  17 +--
 .../BicubicSplineInterpolator.java              |  18 +--
 .../BivariateGridInterpolator.java              |  12 +-
 .../DividedDifferenceInterpolator.java          |  13 +-
 .../interpolation/FieldHermiteInterpolator.java |  20 +--
 .../interpolation/HermiteInterpolator.java      |  18 +--
 .../interpolation/LinearInterpolator.java       |  16 +--
 .../interpolation/LoessInterpolator.java        |  30 ++--
 .../MicrosphereInterpolatingFunction.java       |  18 +--
 .../interpolation/MicrosphereInterpolator.java  |  16 +--
 .../interpolation/MultivariateInterpolator.java |  12 +-
 .../interpolation/NevilleInterpolator.java      |  10 +-
 ...ewiseBicubicSplineInterpolatingFunction.java |  21 +--
 .../PiecewiseBicubicSplineInterpolator.java     |  12 +-
 ...hingPolynomialBicubicSplineInterpolator.java |  26 ++--
 .../interpolation/SplineInterpolator.java       |  16 +--
 .../TricubicInterpolatingFunction.java          |  16 +--
 .../interpolation/TricubicInterpolator.java     |  12 +-
 .../TricubicSplineInterpolatingFunction.java    |  16 +--
 .../TricubicSplineInterpolator.java             |  12 +-
 .../TrivariateGridInterpolator.java             |  12 +-
 .../interpolation/UnivariateInterpolator.java   |   8 +-
 .../UnivariatePeriodicInterpolator.java         |  14 +-
 .../analysis/interpolation/package-info.java    |   2 +-
 .../commons/math4/analysis/package-info.java    |   2 +-
 .../polynomials/PolynomialFunction.java         |  22 +--
 .../PolynomialFunctionLagrangeForm.java         |  22 +--
 .../PolynomialFunctionNewtonForm.java           |  18 +--
 .../polynomials/PolynomialSplineFunction.java   |  24 ++--
 .../analysis/polynomials/PolynomialsUtils.java  |   8 +-
 .../analysis/polynomials/package-info.java      |   2 +-
 .../AbstractDifferentiableUnivariateSolver.java |   8 +-
 .../solvers/AbstractPolynomialSolver.java       |   4 +-
 .../AbstractUnivariateDifferentiableSolver.java |   8 +-
 .../solvers/AbstractUnivariateSolver.java       |   4 +-
 .../math4/analysis/solvers/AllowedSolution.java |   6 +-
 .../solvers/BaseAbstractUnivariateSolver.java   |  18 +--
 .../analysis/solvers/BaseSecantSolver.java      |  10 +-
 .../analysis/solvers/BaseUnivariateSolver.java  |  12 +-
 .../math4/analysis/solvers/BisectionSolver.java |   6 +-
 .../solvers/BracketedUnivariateSolver.java      |  12 +-
 .../solvers/BracketingNthOrderBrentSolver.java  |  18 +--
 .../math4/analysis/solvers/BrentSolver.java     |  12 +-
 .../solvers/DifferentiableUnivariateSolver.java |   4 +-
 .../math4/analysis/solvers/IllinoisSolver.java  |   2 +-
 .../math4/analysis/solvers/LaguerreSolver.java  |  30 ++--
 .../math4/analysis/solvers/MullerSolver.java    |  10 +-
 .../math4/analysis/solvers/MullerSolver2.java   |  10 +-
 .../analysis/solvers/NewtonRaphsonSolver.java   |  14 +-
 .../math4/analysis/solvers/NewtonSolver.java    |  12 +-
 .../math4/analysis/solvers/PegasusSolver.java   |   2 +-
 .../analysis/solvers/PolynomialSolver.java      |   4 +-
 .../analysis/solvers/RegulaFalsiSolver.java     |   2 +-
 .../math4/analysis/solvers/RiddersSolver.java   |   8 +-
 .../math4/analysis/solvers/SecantSolver.java    |   8 +-
 .../solvers/UnivariateDifferentiableSolver.java |   4 +-
 .../analysis/solvers/UnivariateSolver.java      |   4 +-
 .../analysis/solvers/UnivariateSolverUtils.java |  18 +--
 .../math4/analysis/solvers/package-info.java    |   2 +-
 .../apache/commons/math4/complex/Complex.java   |  20 +--
 .../commons/math4/complex/ComplexField.java     |   6 +-
 .../commons/math4/complex/ComplexFormat.java    |  14 +-
 .../commons/math4/complex/ComplexUtils.java     |  10 +-
 .../commons/math4/complex/Quaternion.java       |  15 +-
 .../commons/math4/complex/RootsOfUnity.java     |  14 +-
 .../commons/math4/complex/package-info.java     |   2 +-
 .../dfp/BracketingNthOrderBrentSolverDFP.java   |  16 +--
 .../java/org/apache/commons/math4/dfp/Dfp.java  |  12 +-
 .../org/apache/commons/math4/dfp/DfpDec.java    |   2 +-
 .../org/apache/commons/math4/dfp/DfpField.java  |   6 +-
 .../org/apache/commons/math4/dfp/DfpMath.java   |   2 +-
 .../math4/dfp/UnivariateDfpFunction.java        |   2 +-
 .../apache/commons/math4/dfp/package-info.java  |   2 +-
 .../AbstractIntegerDistribution.java            |  18 +--
 .../AbstractMultivariateRealDistribution.java   |   8 +-
 .../distribution/AbstractRealDistribution.java  |  20 +--
 .../math4/distribution/BetaDistribution.java    |  16 +--
 .../distribution/BinomialDistribution.java      |  18 +--
 .../math4/distribution/CauchyDistribution.java  |  14 +-
 .../distribution/ChiSquaredDistribution.java    |   6 +-
 .../distribution/ConstantRealDistribution.java  |   4 +-
 .../distribution/EnumeratedDistribution.java    |  24 ++--
 .../EnumeratedIntegerDistribution.java          |  18 +--
 .../EnumeratedRealDistribution.java             |  20 +--
 .../distribution/ExponentialDistribution.java   |  20 +--
 .../math4/distribution/FDistribution.java       |  14 +-
 .../math4/distribution/GammaDistribution.java   |  16 +--
 .../distribution/GeometricDistribution.java     |  12 +-
 .../math4/distribution/GumbelDistribution.java  |  18 +--
 .../HypergeometricDistribution.java             |  16 +--
 .../math4/distribution/IntegerDistribution.java |   8 +-
 .../KolmogorovSmirnovDistribution.java          |  46 +++---
 .../math4/distribution/LaplaceDistribution.java |  16 +--
 .../math4/distribution/LevyDistribution.java    |  12 +-
 .../distribution/LogNormalDistribution.java     |  18 +--
 .../distribution/LogisticDistribution.java      |  18 +--
 .../MixtureMultivariateNormalDistribution.java  |  14 +-
 .../MixtureMultivariateRealDistribution.java    |  16 +--
 .../MultivariateNormalDistribution.java         |  24 ++--
 .../MultivariateRealDistribution.java           |   6 +-
 .../distribution/NakagamiDistribution.java      |  18 +--
 .../math4/distribution/NormalDistribution.java  |  18 +--
 .../math4/distribution/ParetoDistribution.java  |  14 +-
 .../math4/distribution/PascalDistribution.java  |  20 +--
 .../math4/distribution/PoissonDistribution.java |  18 +--
 .../math4/distribution/RealDistribution.java    |   8 +-
 .../distribution/SaddlePointExpansion.java      |   8 +-
 .../math4/distribution/TDistribution.java       |  16 +--
 .../distribution/TriangularDistribution.java    |  16 +--
 .../UniformIntegerDistribution.java             |  10 +-
 .../distribution/UniformRealDistribution.java   |  12 +-
 .../math4/distribution/WeibullDistribution.java |  18 +--
 .../math4/distribution/ZipfDistribution.java    |  12 +-
 ...ateNormalMixtureExpectationMaximization.java |  32 ++---
 .../distribution/fitting/package-info.java      |   2 +-
 .../math4/distribution/package-info.java        |   2 +-
 .../math4/exception/ConvergenceException.java   |   6 +-
 .../exception/DimensionMismatchException.java   |   6 +-
 .../exception/InsufficientDataException.java    |   6 +-
 .../exception/MathArithmeticException.java      |  10 +-
 .../exception/MathIllegalArgumentException.java |   8 +-
 .../exception/MathIllegalNumberException.java   |   4 +-
 .../exception/MathIllegalStateException.java    |  10 +-
 .../math4/exception/MathInternalError.java      |   6 +-
 .../math4/exception/MathParseException.java     |   6 +-
 .../math4/exception/MathRuntimeException.java   |   8 +-
 .../MathUnsupportedOperationException.java      |  10 +-
 .../exception/MaxCountExceededException.java    |   6 +-
 .../MultiDimensionMismatchException.java        |   6 +-
 .../math4/exception/NoBracketingException.java  |   6 +-
 .../math4/exception/NoDataException.java        |   6 +-
 .../NonMonotonicSequenceException.java          |   6 +-
 .../math4/exception/NotANumberException.java    |   4 +-
 .../exception/NotFiniteNumberException.java     |   6 +-
 .../math4/exception/NotPositiveException.java   |   4 +-
 .../exception/NotStrictlyPositiveException.java |   4 +-
 .../math4/exception/NullArgumentException.java  |   6 +-
 .../exception/NumberIsTooLargeException.java    |   6 +-
 .../exception/NumberIsTooSmallException.java    |   6 +-
 .../math4/exception/OutOfRangeException.java    |   6 +-
 .../exception/TooManyEvaluationsException.java  |   4 +-
 .../exception/TooManyIterationsException.java   |   4 +-
 .../commons/math4/exception/ZeroException.java  |   6 +-
 .../commons/math4/exception/package-info.java   |   2 +-
 .../commons/math4/exception/util/ArgUtils.java  |   2 +-
 .../math4/exception/util/DummyLocalizable.java  |   2 +-
 .../math4/exception/util/ExceptionContext.java  |   2 +-
 .../util/ExceptionContextProvider.java          |   2 +-
 .../math4/exception/util/Localizable.java       |   2 +-
 .../math4/exception/util/LocalizedFormats.java  |   2 +-
 .../math4/exception/util/package-info.java      |   2 +-
 .../math4/filter/DefaultMeasurementModel.java   |  12 +-
 .../math4/filter/DefaultProcessModel.java       |  18 +--
 .../commons/math4/filter/KalmanFilter.java      |  28 ++--
 .../commons/math4/filter/MeasurementModel.java  |   6 +-
 .../commons/math4/filter/ProcessModel.java      |   6 +-
 .../commons/math4/filter/package-info.java      |   2 +-
 .../math4/fitting/AbstractCurveFitter.java      |  14 +-
 .../commons/math4/fitting/CurveFitter.java      |  31 ++--
 .../math4/fitting/GaussianCurveFitter.java      |  28 ++--
 .../commons/math4/fitting/GaussianFitter.java   |  25 ++--
 .../math4/fitting/HarmonicCurveFitter.java      |  22 +--
 .../commons/math4/fitting/HarmonicFitter.java   |  16 +--
 .../math4/fitting/PolynomialCurveFitter.java    |  14 +-
 .../commons/math4/fitting/PolynomialFitter.java |  12 +-
 .../math4/fitting/SimpleCurveFitter.java        |  10 +-
 .../math4/fitting/WeightedObservedPoint.java    |   2 +-
 .../math4/fitting/WeightedObservedPoints.java   |   2 +-
 .../leastsquares/AbstractEvaluation.java        |  16 +--
 .../leastsquares/DenseWeightedEvaluation.java   |   8 +-
 .../leastsquares/EvaluationRmsChecker.java      |   8 +-
 .../leastsquares/GaussNewtonOptimizer.java      |  36 ++---
 .../leastsquares/LeastSquaresAdapter.java       |   8 +-
 .../leastsquares/LeastSquaresBuilder.java       |  20 +--
 .../leastsquares/LeastSquaresFactory.java       |  46 +++---
 .../leastsquares/LeastSquaresOptimizer.java     |   2 +-
 .../leastsquares/LeastSquaresProblem.java       |  18 +--
 .../LevenbergMarquardtOptimizer.java            |  20 +--
 .../MultivariateJacobianFunction.java           |   8 +-
 .../math4/fitting/leastsquares/OptimumImpl.java |  10 +-
 .../leastsquares/ParameterValidator.java        |   4 +-
 .../leastsquares/ValueAndJacobianFunction.java  |   6 +-
 .../fitting/leastsquares/package-info.java      |  10 +-
 .../commons/math4/fitting/package-info.java     |   2 +-
 .../commons/math4/fraction/AbstractFormat.java  |   6 +-
 .../commons/math4/fraction/BigFraction.java     |  20 +--
 .../math4/fraction/BigFractionField.java        |   6 +-
 .../math4/fraction/BigFractionFormat.java       |   8 +-
 .../apache/commons/math4/fraction/Fraction.java |  14 +-
 .../fraction/FractionConversionException.java   |   6 +-
 .../commons/math4/fraction/FractionField.java   |   6 +-
 .../commons/math4/fraction/FractionFormat.java  |   8 +-
 .../math4/fraction/ProperBigFractionFormat.java |   6 +-
 .../math4/fraction/ProperFractionFormat.java    |  10 +-
 .../commons/math4/fraction/package-info.java    |   2 +-
 .../math4/genetics/AbstractListChromosome.java  |   2 +-
 .../math4/genetics/BinaryChromosome.java        |   5 +-
 .../commons/math4/genetics/BinaryMutation.java  |   6 +-
 .../commons/math4/genetics/Chromosome.java      |   2 +-
 .../commons/math4/genetics/ChromosomePair.java  |   2 +-
 .../commons/math4/genetics/CrossoverPolicy.java |   4 +-
 .../commons/math4/genetics/CycleCrossover.java  |   8 +-
 .../math4/genetics/ElitisticListPopulation.java |  14 +-
 .../apache/commons/math4/genetics/Fitness.java  |   2 +-
 .../math4/genetics/FixedElapsedTime.java        |   4 +-
 .../math4/genetics/FixedGenerationCount.java    |   4 +-
 .../math4/genetics/GeneticAlgorithm.java        |  10 +-
 .../InvalidRepresentationException.java         |   6 +-
 .../commons/math4/genetics/ListPopulation.java  |  12 +-
 .../commons/math4/genetics/MutationPolicy.java  |   4 +-
 .../commons/math4/genetics/NPointCrossover.java |  14 +-
 .../math4/genetics/OnePointCrossover.java       |   8 +-
 .../math4/genetics/OrderedCrossover.java        |  12 +-
 .../math4/genetics/PermutationChromosome.java   |   2 +-
 .../commons/math4/genetics/Population.java      |   4 +-
 .../commons/math4/genetics/RandomKey.java       |   8 +-
 .../math4/genetics/RandomKeyMutation.java       |   6 +-
 .../commons/math4/genetics/SelectionPolicy.java |   4 +-
 .../math4/genetics/StoppingCondition.java       |   2 +-
 .../math4/genetics/TournamentSelection.java     |   6 +-
 .../math4/genetics/UniformCrossover.java        |  12 +-
 .../commons/math4/genetics/package-info.java    |   2 +-
 .../apache/commons/math4/geometry/Point.java    |   2 +-
 .../apache/commons/math4/geometry/Space.java    |   4 +-
 .../apache/commons/math4/geometry/Vector.java   |   4 +-
 .../commons/math4/geometry/VectorFormat.java    |   6 +-
 .../math4/geometry/enclosing/Encloser.java      |   6 +-
 .../math4/geometry/enclosing/EnclosingBall.java |   6 +-
 .../enclosing/SupportBallGenerator.java         |   6 +-
 .../math4/geometry/enclosing/WelzlEncloser.java |   8 +-
 .../math4/geometry/enclosing/package-info.java  |   2 +-
 .../geometry/euclidean/oned/Euclidean1D.java    |   8 +-
 .../math4/geometry/euclidean/oned/Interval.java |   4 +-
 .../geometry/euclidean/oned/IntervalsSet.java   |  18 +--
 .../geometry/euclidean/oned/OrientedPoint.java  |  12 +-
 .../euclidean/oned/SubOrientedPoint.java        |  10 +-
 .../math4/geometry/euclidean/oned/Vector1D.java |  16 +--
 .../geometry/euclidean/oned/Vector1DFormat.java |  10 +-
 .../geometry/euclidean/oned/package-info.java   |   2 +-
 .../threed/CardanEulerSingularityException.java |   6 +-
 .../geometry/euclidean/threed/Euclidean3D.java  |   6 +-
 .../euclidean/threed/FieldRotation.java         |  16 +--
 .../euclidean/threed/FieldVector3D.java         |  14 +-
 .../math4/geometry/euclidean/threed/Line.java   |  24 ++--
 .../threed/NotARotationMatrixException.java     |   6 +-
 .../euclidean/threed/OutlineExtractor.java      |  36 ++---
 .../math4/geometry/euclidean/threed/Plane.java  |  32 ++---
 .../euclidean/threed/PolyhedronsSet.java        |  36 ++---
 .../geometry/euclidean/threed/Rotation.java     |  12 +-
 .../euclidean/threed/RotationOrder.java         |   2 +-
 .../geometry/euclidean/threed/Segment.java      |   2 +-
 .../euclidean/threed/SphereGenerator.java       |  16 +--
 .../euclidean/threed/SphericalCoordinates.java  |   4 +-
 .../geometry/euclidean/threed/SubLine.java      |  16 +--
 .../geometry/euclidean/threed/SubPlane.java     |  36 ++---
 .../geometry/euclidean/threed/Vector3D.java     |  20 +--
 .../euclidean/threed/Vector3DFormat.java        |  10 +-
 .../geometry/euclidean/threed/package-info.java |   2 +-
 .../geometry/euclidean/twod/DiskGenerator.java  |  10 +-
 .../geometry/euclidean/twod/Euclidean2D.java    |   6 +-
 .../math4/geometry/euclidean/twod/Line.java     |  40 +++---
 .../geometry/euclidean/twod/NestedLoops.java    |  16 +--
 .../geometry/euclidean/twod/PolygonsSet.java    |  36 ++---
 .../math4/geometry/euclidean/twod/Segment.java  |   6 +-
 .../math4/geometry/euclidean/twod/SubLine.java  |  30 ++--
 .../math4/geometry/euclidean/twod/Vector2D.java |  20 +--
 .../geometry/euclidean/twod/Vector2DFormat.java |  10 +-
 .../hull/AbstractConvexHullGenerator2D.java     |  12 +-
 .../twod/hull/AklToussaintHeuristic.java        |   4 +-
 .../euclidean/twod/hull/ConvexHull2D.java       |  26 ++--
 .../twod/hull/ConvexHullGenerator2D.java        |  12 +-
 .../euclidean/twod/hull/MonotoneChain.java      |  10 +-
 .../euclidean/twod/hull/package-info.java       |   2 +-
 .../geometry/euclidean/twod/package-info.java   |   2 +-
 .../commons/math4/geometry/hull/ConvexHull.java |  10 +-
 .../geometry/hull/ConvexHullGenerator.java      |  10 +-
 .../math4/geometry/hull/package-info.java       |   2 +-
 .../commons/math4/geometry/package-info.java    |   2 +-
 .../geometry/partitioning/AbstractRegion.java   |   8 +-
 .../partitioning/AbstractSubHyperplane.java     |   4 +-
 .../math4/geometry/partitioning/BSPTree.java    |  16 +--
 .../geometry/partitioning/BSPTreeVisitor.java   |   4 +-
 .../partitioning/BoundaryAttribute.java         |   4 +-
 .../geometry/partitioning/BoundaryBuilder.java  |   4 +-
 .../partitioning/BoundaryProjection.java        |   6 +-
 .../partitioning/BoundaryProjector.java         |  10 +-
 .../partitioning/BoundarySizeVisitor.java       |   4 +-
 .../geometry/partitioning/Characterization.java |   6 +-
 .../math4/geometry/partitioning/Embedding.java  |  12 +-
 .../math4/geometry/partitioning/Hyperplane.java |   6 +-
 .../geometry/partitioning/InsideFinder.java     |   4 +-
 .../math4/geometry/partitioning/NodesSet.java   |   4 +-
 .../math4/geometry/partitioning/Region.java     |   6 +-
 .../geometry/partitioning/RegionFactory.java    |  10 +-
 .../math4/geometry/partitioning/Side.java       |   2 +-
 .../geometry/partitioning/SubHyperplane.java    |   4 +-
 .../math4/geometry/partitioning/Transform.java  |   6 +-
 .../geometry/partitioning/package-info.java     |   8 +-
 .../partitioning/utilities/AVLTree.java         |   2 +-
 .../partitioning/utilities/OrderedTuple.java    |   4 +-
 .../partitioning/utilities/package-info.java    |   2 +-
 .../math4/geometry/spherical/oned/Arc.java      |  14 +-
 .../math4/geometry/spherical/oned/ArcsSet.java  |  34 ++---
 .../geometry/spherical/oned/LimitAngle.java     |  10 +-
 .../math4/geometry/spherical/oned/S1Point.java  |  12 +-
 .../math4/geometry/spherical/oned/Sphere1D.java |   8 +-
 .../geometry/spherical/oned/SubLimitAngle.java  |  10 +-
 .../geometry/spherical/oned/package-info.java   |   2 +-
 .../math4/geometry/spherical/twod/Circle.java   |  32 ++---
 .../math4/geometry/spherical/twod/Edge.java     |  10 +-
 .../geometry/spherical/twod/EdgesBuilder.java   |  20 +--
 .../spherical/twod/PropertiesComputer.java      |  14 +-
 .../math4/geometry/spherical/twod/S2Point.java  |  18 +--
 .../math4/geometry/spherical/twod/Sphere2D.java |   6 +-
 .../spherical/twod/SphericalPolygonsSet.java    |  38 ++---
 .../geometry/spherical/twod/SubCircle.java      |  20 +--
 .../math4/geometry/spherical/twod/Vertex.java   |   2 +-
 .../geometry/spherical/twod/package-info.java   |   2 +-
 .../math4/linear/AbstractFieldMatrix.java       |  24 ++--
 .../math4/linear/AbstractRealMatrix.java        |  22 +--
 .../apache/commons/math4/linear/AnyMatrix.java  |   2 +-
 .../math4/linear/Array2DRowFieldMatrix.java     |  26 ++--
 .../math4/linear/Array2DRowRealMatrix.java      |  20 +--
 .../commons/math4/linear/ArrayFieldVector.java  |  28 ++--
 .../commons/math4/linear/ArrayRealVector.java   |  22 +--
 .../math4/linear/BiDiagonalTransformer.java     |   4 +-
 .../commons/math4/linear/BlockFieldMatrix.java  |  26 ++--
 .../commons/math4/linear/BlockRealMatrix.java   |  20 +--
 .../math4/linear/CholeskyDecomposition.java     |   6 +-
 .../commons/math4/linear/ConjugateGradient.java |  12 +-
 .../math4/linear/DecompositionSolver.java       |   6 +-
 .../DefaultFieldMatrixChangingVisitor.java      |   4 +-
 .../DefaultFieldMatrixPreservingVisitor.java    |   4 +-
 .../DefaultIterativeLinearSolverEvent.java      |   4 +-
 .../DefaultRealMatrixChangingVisitor.java       |   2 +-
 .../DefaultRealMatrixPreservingVisitor.java     |   2 +-
 .../commons/math4/linear/DiagonalMatrix.java    |  18 +--
 .../math4/linear/EigenDecomposition.java        |  20 +--
 .../math4/linear/FieldDecompositionSolver.java  |   8 +-
 .../math4/linear/FieldLUDecomposition.java      |  10 +-
 .../commons/math4/linear/FieldMatrix.java       |  24 ++--
 .../linear/FieldMatrixChangingVisitor.java      |   4 +-
 .../linear/FieldMatrixPreservingVisitor.java    |   4 +-
 .../commons/math4/linear/FieldVector.java       |  18 +--
 .../linear/FieldVectorChangingVisitor.java      |   4 +-
 .../linear/FieldVectorPreservingVisitor.java    |   4 +-
 .../math4/linear/HessenbergTransformer.java     |   6 +-
 .../linear/IllConditionedOperatorException.java |   6 +-
 .../math4/linear/IterativeLinearSolver.java     |  18 +--
 .../linear/IterativeLinearSolverEvent.java      |   6 +-
 .../math4/linear/JacobiPreconditioner.java      |   6 +-
 .../commons/math4/linear/LUDecomposition.java   |   6 +-
 .../MatrixDimensionMismatchException.java       |   6 +-
 .../commons/math4/linear/MatrixUtils.java       |  38 ++---
 .../NonPositiveDefiniteMatrixException.java     |   8 +-
 .../NonPositiveDefiniteOperatorException.java   |   6 +-
 .../linear/NonSelfAdjointOperatorException.java |   6 +-
 .../math4/linear/NonSquareMatrixException.java  |   6 +-
 .../linear/NonSquareOperatorException.java      |   6 +-
 .../linear/NonSymmetricMatrixException.java     |   6 +-
 .../commons/math4/linear/OpenMapRealMatrix.java |  12 +-
 .../commons/math4/linear/OpenMapRealVector.java |  18 +--
 .../PreconditionedIterativeLinearSolver.java    |  18 +--
 .../commons/math4/linear/QRDecomposition.java   |   6 +-
 .../commons/math4/linear/RRQRDecomposition.java |   4 +-
 .../math4/linear/RealLinearOperator.java        |   6 +-
 .../apache/commons/math4/linear/RealMatrix.java |  18 +--
 .../math4/linear/RealMatrixChangingVisitor.java |   2 +-
 .../commons/math4/linear/RealMatrixFormat.java  |   6 +-
 .../linear/RealMatrixPreservingVisitor.java     |   2 +-
 .../apache/commons/math4/linear/RealVector.java |  28 ++--
 .../math4/linear/RealVectorChangingVisitor.java |   2 +-
 .../commons/math4/linear/RealVectorFormat.java  |   6 +-
 .../linear/RealVectorPreservingVisitor.java     |   2 +-
 .../RectangularCholeskyDecomposition.java       |   6 +-
 .../commons/math4/linear/SchurTransformer.java  |  10 +-
 .../math4/linear/SingularMatrixException.java   |   6 +-
 .../math4/linear/SingularOperatorException.java |   6 +-
 .../linear/SingularValueDecomposition.java      |  14 +-
 .../commons/math4/linear/SparseFieldMatrix.java |  10 +-
 .../commons/math4/linear/SparseFieldVector.java |  26 ++--
 .../commons/math4/linear/SparseRealMatrix.java  |   2 +-
 .../commons/math4/linear/SparseRealVector.java  |   2 +-
 .../org/apache/commons/math4/linear/SymmLQ.java |  22 +--
 .../math4/linear/TriDiagonalTransformer.java    |   4 +-
 .../commons/math4/linear/package-info.java      |   2 +-
 .../math4/ml/clustering/CentroidCluster.java    |   2 +-
 .../commons/math4/ml/clustering/Cluster.java    |   2 +-
 .../math4/ml/clustering/Clusterable.java        |   2 +-
 .../commons/math4/ml/clustering/Clusterer.java  |   8 +-
 .../math4/ml/clustering/DBSCANClusterer.java    |  12 +-
 .../math4/ml/clustering/DoublePoint.java        |   2 +-
 .../ml/clustering/FuzzyKMeansClusterer.java     |  26 ++--
 .../ml/clustering/KMeansPlusPlusClusterer.java  |  22 +--
 .../MultiKMeansPlusPlusClusterer.java           |  10 +-
 .../clustering/evaluation/ClusterEvaluator.java |  14 +-
 .../evaluation/SumOfClusterVariances.java       |  10 +-
 .../ml/clustering/evaluation/package-info.java  |   2 +-
 .../math4/ml/clustering/package-info.java       |   2 +-
 .../math4/ml/distance/CanberraDistance.java     |   4 +-
 .../math4/ml/distance/ChebyshevDistance.java    |   4 +-
 .../math4/ml/distance/DistanceMeasure.java      |   2 +-
 .../math4/ml/distance/EarthMoversDistance.java  |   4 +-
 .../math4/ml/distance/EuclideanDistance.java    |   4 +-
 .../math4/ml/distance/ManhattanDistance.java    |   4 +-
 .../commons/math4/ml/distance/package-info.java |   2 +-
 .../math4/ml/neuralnet/FeatureInitializer.java  |   2 +-
 .../ml/neuralnet/FeatureInitializerFactory.java |  16 +--
 .../commons/math4/ml/neuralnet/MapUtils.java    |  15 +-
 .../commons/math4/ml/neuralnet/Network.java     |   7 +-
 .../commons/math4/ml/neuralnet/Neuron.java      |   7 +-
 .../math4/ml/neuralnet/SquareNeighbourhood.java |   2 +-
 .../math4/ml/neuralnet/UpdateAction.java        |   2 +-
 .../math4/ml/neuralnet/oned/NeuronString.java   |  11 +-
 .../math4/ml/neuralnet/oned/package-info.java   |   2 +-
 .../math4/ml/neuralnet/package-info.java        |   2 +-
 .../ml/neuralnet/sofm/KohonenTrainingTask.java  |   5 +-
 .../ml/neuralnet/sofm/KohonenUpdateAction.java  |  17 +--
 .../neuralnet/sofm/LearningFactorFunction.java  |   2 +-
 .../sofm/LearningFactorFunctionFactory.java     |  22 +--
 .../sofm/NeighbourhoodSizeFunction.java         |   2 +-
 .../sofm/NeighbourhoodSizeFunctionFactory.java  |  22 +--
 .../math4/ml/neuralnet/sofm/package-info.java   |   2 +-
 .../sofm/util/ExponentialDecayFunction.java     |   8 +-
 .../sofm/util/QuasiSigmoidDecayFunction.java    |   8 +-
 .../ml/neuralnet/sofm/util/package-info.java    |   2 +-
 .../ml/neuralnet/twod/NeuronSquareMesh2D.java   |  19 +--
 .../math4/ml/neuralnet/twod/package-info.java   |   2 +-
 .../apache/commons/math4/ml/package-info.java   |   2 +-
 .../commons/math4/ode/AbstractIntegrator.java   |  30 ++--
 .../math4/ode/AbstractParameterizable.java      |   2 +-
 .../math4/ode/ContinuousOutputModel.java        |  26 ++--
 .../commons/math4/ode/EquationsMapper.java      |   4 +-
 .../math4/ode/ExpandableStatefulODE.java        |   6 +-
 .../commons/math4/ode/FirstOrderConverter.java  |   2 +-
 .../ode/FirstOrderDifferentialEquations.java    |   6 +-
 .../commons/math4/ode/FirstOrderIntegrator.java |  16 +--
 .../commons/math4/ode/JacobianMatrices.java     |  10 +-
 .../math4/ode/MainStateJacobianProvider.java    |   6 +-
 .../commons/math4/ode/MultistepIntegrator.java  |  30 ++--
 .../apache/commons/math4/ode/ODEIntegrator.java |   8 +-
 .../math4/ode/ParameterConfiguration.java       |   2 +-
 .../math4/ode/ParameterJacobianProvider.java    |   6 +-
 .../math4/ode/ParameterJacobianWrapper.java     |   6 +-
 .../commons/math4/ode/Parameterizable.java      |   2 +-
 .../commons/math4/ode/ParameterizedODE.java     |   2 +-
 .../commons/math4/ode/ParameterizedWrapper.java |   6 +-
 .../ode/SecondOrderDifferentialEquations.java   |   2 +-
 .../math4/ode/SecondOrderIntegrator.java        |   6 +-
 .../commons/math4/ode/SecondaryEquations.java   |   6 +-
 .../math4/ode/UnknownParameterException.java    |   6 +-
 .../commons/math4/ode/events/EventFilter.java   |   4 +-
 .../commons/math4/ode/events/EventHandler.java  |  24 ++--
 .../commons/math4/ode/events/EventState.java    |  28 ++--
 .../commons/math4/ode/events/FilterType.java    |   8 +-
 .../commons/math4/ode/events/Transformer.java   |   6 +-
 .../commons/math4/ode/events/package-info.java  |   4 +-
 .../ode/nonstiff/AdamsBashforthIntegrator.java  |  22 +--
 .../math4/ode/nonstiff/AdamsIntegrator.java     |  16 +--
 .../ode/nonstiff/AdamsMoultonIntegrator.java    |  22 +--
 .../ode/nonstiff/AdamsNordsieckTransformer.java |  22 +--
 .../nonstiff/AdaptiveStepsizeIntegrator.java    |  20 +--
 .../nonstiff/ClassicalRungeKuttaIntegrator.java |   2 +-
 .../ClassicalRungeKuttaStepInterpolator.java    |   4 +-
 .../ode/nonstiff/DormandPrince54Integrator.java |   4 +-
 .../DormandPrince54StepInterpolator.java        |   8 +-
 .../nonstiff/DormandPrince853Integrator.java    |   4 +-
 .../DormandPrince853StepInterpolator.java       |  10 +-
 .../nonstiff/EmbeddedRungeKuttaIntegrator.java  |  16 +--
 .../math4/ode/nonstiff/EulerIntegrator.java     |   2 +-
 .../ode/nonstiff/EulerStepInterpolator.java     |   6 +-
 .../math4/ode/nonstiff/GillIntegrator.java      |   4 +-
 .../ode/nonstiff/GillStepInterpolator.java      |   8 +-
 .../nonstiff/GraggBulirschStoerIntegrator.java  |  24 ++--
 .../GraggBulirschStoerStepInterpolator.java     |  10 +-
 .../ode/nonstiff/HighamHall54Integrator.java    |   4 +-
 .../nonstiff/HighamHall54StepInterpolator.java  |   6 +-
 .../math4/ode/nonstiff/LutherIntegrator.java    |   4 +-
 .../ode/nonstiff/LutherStepInterpolator.java    |   8 +-
 .../math4/ode/nonstiff/MidpointIntegrator.java  |   2 +-
 .../ode/nonstiff/MidpointStepInterpolator.java  |   6 +-
 .../ode/nonstiff/RungeKuttaIntegrator.java      |  18 +--
 .../nonstiff/RungeKuttaStepInterpolator.java    |   8 +-
 .../ode/nonstiff/ThreeEighthesIntegrator.java   |   2 +-
 .../nonstiff/ThreeEighthesStepInterpolator.java |   6 +-
 .../math4/ode/nonstiff/package-info.java        |   2 +-
 .../apache/commons/math4/ode/package-info.java  |  60 ++++----
 .../ode/sampling/AbstractStepInterpolator.java  |  12 +-
 .../math4/ode/sampling/DummyStepHandler.java    |   2 +-
 .../math4/ode/sampling/FixedStepHandler.java    |   2 +-
 .../ode/sampling/NordsieckStepInterpolator.java |  14 +-
 .../commons/math4/ode/sampling/StepHandler.java |  10 +-
 .../math4/ode/sampling/StepInterpolator.java    |  16 +--
 .../math4/ode/sampling/StepNormalizer.java      |   8 +-
 .../ode/sampling/StepNormalizerBounds.java      |   2 +-
 .../math4/ode/sampling/StepNormalizerMode.java  |   2 +-
 .../math4/ode/sampling/package-info.java        |  14 +-
 .../math4/optim/AbstractConvergenceChecker.java |   2 +-
 .../optim/AbstractOptimizationProblem.java      |   8 +-
 .../BaseMultiStartMultivariateOptimizer.java    |  10 +-
 .../math4/optim/BaseMultivariateOptimizer.java  |   8 +-
 .../commons/math4/optim/BaseOptimizer.java      |   8 +-
 .../commons/math4/optim/ConvergenceChecker.java |   8 +-
 .../commons/math4/optim/InitialGuess.java       |   2 +-
 .../org/apache/commons/math4/optim/MaxEval.java |   4 +-
 .../org/apache/commons/math4/optim/MaxIter.java |   4 +-
 .../commons/math4/optim/OptimizationData.java   |   2 +-
 .../math4/optim/OptimizationProblem.java        |   4 +-
 .../commons/math4/optim/PointValuePair.java     |   7 +-
 .../math4/optim/PointVectorValuePair.java       |   7 +-
 .../commons/math4/optim/SimpleBounds.java       |   2 +-
 .../commons/math4/optim/SimplePointChecker.java |   8 +-
 .../commons/math4/optim/SimpleValueChecker.java |   6 +-
 .../math4/optim/SimpleVectorValueChecker.java   |   6 +-
 .../math4/optim/linear/LinearConstraint.java    |   9 +-
 .../math4/optim/linear/LinearConstraintSet.java |   4 +-
 .../optim/linear/LinearObjectiveFunction.java   |  13 +-
 .../math4/optim/linear/LinearOptimizer.java     |  11 +-
 .../linear/NoFeasibleSolutionException.java     |   6 +-
 .../optim/linear/NonNegativeConstraint.java     |   4 +-
 .../math4/optim/linear/PivotSelectionRule.java  |   4 +-
 .../math4/optim/linear/Relationship.java        |   2 +-
 .../math4/optim/linear/SimplexSolver.java       |  18 +--
 .../math4/optim/linear/SimplexTableau.java      |  14 +-
 .../math4/optim/linear/SolutionCallback.java    |   6 +-
 .../linear/UnboundedSolutionException.java      |   6 +-
 .../math4/optim/linear/package-info.java        |   2 +-
 .../math4/optim/nonlinear/scalar/GoalType.java  |   4 +-
 .../scalar/GradientMultivariateOptimizer.java   |  12 +-
 .../nonlinear/scalar/LeastSquaresConverter.java |  10 +-
 .../optim/nonlinear/scalar/LineSearch.java      |  22 +--
 .../scalar/MultiStartMultivariateOptimizer.java |  13 +-
 .../MultivariateFunctionMappingAdapter.java     |  28 ++--
 .../MultivariateFunctionPenaltyAdapter.java     |  18 +--
 .../nonlinear/scalar/MultivariateOptimizer.java |  14 +-
 .../nonlinear/scalar/ObjectiveFunction.java     |   6 +-
 .../scalar/ObjectiveFunctionGradient.java       |   6 +-
 .../NonLinearConjugateGradientOptimizer.java    |  26 ++--
 .../scalar/gradient/Preconditioner.java         |   2 +-
 .../nonlinear/scalar/gradient/package-info.java |   2 +-
 .../scalar/noderiv/AbstractSimplex.java         |  26 ++--
 .../scalar/noderiv/BOBYQAOptimizer.java         |  26 ++--
 .../scalar/noderiv/CMAESOptimizer.java          |  36 ++---
 .../scalar/noderiv/MultiDirectionalSimplex.java |  12 +-
 .../scalar/noderiv/NelderMeadSimplex.java       |  10 +-
 .../scalar/noderiv/PowellOptimizer.java         |  30 ++--
 .../scalar/noderiv/SimplexOptimizer.java        |  27 ++--
 .../nonlinear/scalar/noderiv/package-info.java  |   2 +-
 .../optim/nonlinear/scalar/package-info.java    |   2 +-
 .../JacobianMultivariateVectorOptimizer.java    |  18 +--
 .../optim/nonlinear/vector/ModelFunction.java   |   8 +-
 .../nonlinear/vector/ModelFunctionJacobian.java |   8 +-
 .../MultiStartMultivariateVectorOptimizer.java  |  19 +--
 .../vector/MultivariateVectorOptimizer.java     |  18 +--
 .../math4/optim/nonlinear/vector/Target.java    |   6 +-
 .../math4/optim/nonlinear/vector/Weight.java    |  12 +-
 .../jacobian/AbstractLeastSquaresOptimizer.java |  40 +++---
 .../vector/jacobian/GaussNewtonOptimizer.java   |  34 ++---
 .../jacobian/LevenbergMarquardtOptimizer.java   |  21 +--
 .../nonlinear/vector/jacobian/package-info.java |   4 +-
 .../optim/nonlinear/vector/package-info.java    |   4 +-
 .../commons/math4/optim/package-info.java       |  36 ++---
 .../math4/optim/univariate/BracketFinder.java   |  16 +--
 .../math4/optim/univariate/BrentOptimizer.java  |  14 +-
 .../MultiStartUnivariateOptimizer.java          |  17 +--
 .../math4/optim/univariate/SearchInterval.java  |   8 +-
 .../SimpleUnivariateValueChecker.java           |  10 +-
 .../univariate/UnivariateObjectiveFunction.java |   6 +-
 .../optim/univariate/UnivariateOptimizer.java   |  14 +-
 .../univariate/UnivariatePointValuePair.java    |   2 +-
 .../math4/optim/univariate/package-info.java    |   2 +-
 .../AbstractConvergenceChecker.java             |   4 +-
 .../BaseMultivariateMultiStartOptimizer.java    |  14 +-
 .../optimization/BaseMultivariateOptimizer.java |  16 +--
 .../BaseMultivariateSimpleBoundsOptimizer.java  |  18 +--
 ...seMultivariateVectorMultiStartOptimizer.java |  16 +--
 .../BaseMultivariateVectorOptimizer.java        |  14 +-
 .../math4/optimization/BaseOptimizer.java       |  10 +-
 .../math4/optimization/ConvergenceChecker.java  |   8 +-
 ...entiableMultivariateMultiStartOptimizer.java |   6 +-
 .../DifferentiableMultivariateOptimizer.java    |   4 +-
 ...leMultivariateVectorMultiStartOptimizer.java |   6 +-
 ...fferentiableMultivariateVectorOptimizer.java |   4 +-
 .../commons/math4/optimization/GoalType.java    |   2 +-
 .../math4/optimization/InitialGuess.java        |   2 +-
 .../optimization/LeastSquaresConverter.java     |  10 +-
 ...ariateDifferentiableMultiStartOptimizer.java |   6 +-
 .../MultivariateDifferentiableOptimizer.java    |   4 +-
 ...DifferentiableVectorMultiStartOptimizer.java |   6 +-
 ...ltivariateDifferentiableVectorOptimizer.java |   4 +-
 .../MultivariateMultiStartOptimizer.java        |   6 +-
 .../optimization/MultivariateOptimizer.java     |   4 +-
 .../math4/optimization/OptimizationData.java    |   2 +-
 .../math4/optimization/PointValuePair.java      |   6 +-
 .../optimization/PointVectorValuePair.java      |   6 +-
 .../math4/optimization/SimpleBounds.java        |   2 +-
 .../math4/optimization/SimplePointChecker.java  |   8 +-
 .../math4/optimization/SimpleValueChecker.java  |   6 +-
 .../optimization/SimpleVectorValueChecker.java  |   6 +-
 .../commons/math4/optimization/Target.java      |   2 +-
 .../commons/math4/optimization/Weight.java      |   8 +-
 .../optimization/direct/AbstractSimplex.java    |  26 ++--
 .../optimization/direct/BOBYQAOptimizer.java    |  28 ++--
 .../BaseAbstractMultivariateOptimizer.java      |  38 ++---
 ...stractMultivariateSimpleBoundsOptimizer.java |  22 +--
 ...BaseAbstractMultivariateVectorOptimizer.java |  38 ++---
 .../optimization/direct/CMAESOptimizer.java     |  44 +++---
 .../direct/MultiDirectionalSimplex.java         |  12 +-
 .../MultivariateFunctionMappingAdapter.java     |  22 +--
 .../MultivariateFunctionPenaltyAdapter.java     |  12 +-
 .../optimization/direct/NelderMeadSimplex.java  |  10 +-
 .../optimization/direct/PowellOptimizer.java    |  34 ++---
 .../optimization/direct/SimplexOptimizer.java   |  20 +--
 .../math4/optimization/direct/package-info.java |   2 +-
 .../math4/optimization/fitting/CurveFitter.java |  24 ++--
 .../optimization/fitting/GaussianFitter.java    |  24 ++--
 .../optimization/fitting/HarmonicFitter.java    |  16 +--
 .../optimization/fitting/PolynomialFitter.java  |  14 +-
 .../fitting/WeightedObservedPoint.java          |   2 +-
 .../optimization/fitting/package-info.java      |   2 +-
 .../AbstractDifferentiableOptimizer.java        |  20 +--
 .../general/AbstractLeastSquaresOptimizer.java  |  86 +++++------
 .../AbstractScalarDifferentiableOptimizer.java  |  32 ++---
 .../general/ConjugateGradientFormula.java       |   2 +-
 .../general/GaussNewtonOptimizer.java           |  32 ++---
 .../general/LevenbergMarquardtOptimizer.java    |  16 +--
 .../NonLinearConjugateGradientOptimizer.java    |  22 +--
 .../optimization/general/Preconditioner.java    |   2 +-
 .../optimization/general/package-info.java      |   2 +-
 .../linear/AbstractLinearOptimizer.java         |  10 +-
 .../optimization/linear/LinearConstraint.java   |   8 +-
 .../linear/LinearObjectiveFunction.java         |   8 +-
 .../optimization/linear/LinearOptimizer.java    |   8 +-
 .../linear/NoFeasibleSolutionException.java     |   6 +-
 .../math4/optimization/linear/Relationship.java |   2 +-
 .../optimization/linear/SimplexSolver.java      |   8 +-
 .../optimization/linear/SimplexTableau.java     |  18 +--
 .../linear/UnboundedSolutionException.java      |   6 +-
 .../math4/optimization/linear/package-info.java |   2 +-
 .../math4/optimization/package-info.java        |  30 ++--
 .../BaseAbstractUnivariateOptimizer.java        |  16 +--
 .../univariate/BaseUnivariateOptimizer.java     |  20 +--
 .../optimization/univariate/BracketFinder.java  |  16 +--
 .../optimization/univariate/BrentOptimizer.java |  14 +-
 .../SimpleUnivariateValueChecker.java           |  10 +-
 .../UnivariateMultiStartOptimizer.java          |  18 +--
 .../univariate/UnivariateOptimizer.java         |   4 +-
 .../univariate/UnivariatePointValuePair.java    |   2 +-
 .../optimization/univariate/package-info.java   |   2 +-
 .../org/apache/commons/math4/package-info.java  |   2 +-
 .../apache/commons/math4/primes/PollardRho.java |   4 +-
 .../org/apache/commons/math4/primes/Primes.java |   6 +-
 .../commons/math4/primes/SmallPrimes.java       |   4 +-
 .../commons/math4/primes/package-info.java      |   2 +-
 .../math4/random/AbstractRandomGenerator.java   |   6 +-
 .../commons/math4/random/AbstractWell.java      |   4 +-
 .../math4/random/BitsStreamGenerator.java       |   6 +-
 .../random/CorrelatedRandomVectorGenerator.java |  12 +-
 .../math4/random/EmpiricalDistribution.java     |  30 ++--
 .../math4/random/GaussianRandomGenerator.java   |   2 +-
 .../math4/random/HaltonSequenceGenerator.java   |  12 +-
 .../commons/math4/random/ISAACRandom.java       |   4 +-
 .../math4/random/JDKRandomGenerator.java        |   2 +-
 .../commons/math4/random/MersenneTwister.java   |   4 +-
 .../math4/random/NormalizedRandomGenerator.java |   2 +-
 .../commons/math4/random/RandomAdaptor.java     |   2 +-
 .../apache/commons/math4/random/RandomData.java |  10 +-
 .../math4/random/RandomDataGenerator.java       |  50 +++----
 .../commons/math4/random/RandomDataImpl.java    |  42 +++---
 .../commons/math4/random/RandomGenerator.java   |   2 +-
 .../math4/random/RandomGeneratorFactory.java    |   5 +-
 .../math4/random/RandomVectorGenerator.java     |   2 +-
 .../math4/random/SobolSequenceGenerator.java    |  16 +--
 .../math4/random/StableRandomGenerator.java     |  10 +-
 .../random/SynchronizedRandomGenerator.java     |   2 +-
 .../UncorrelatedRandomVectorGenerator.java      |   4 +-
 .../math4/random/UniformRandomGenerator.java    |   4 +-
 .../random/UnitSphereRandomVectorGenerator.java |   4 +-
 .../commons/math4/random/ValueServer.java       |  12 +-
 .../apache/commons/math4/random/Well1024a.java  |   2 +-
 .../apache/commons/math4/random/Well19937a.java |   2 +-
 .../apache/commons/math4/random/Well19937c.java |   2 +-
 .../apache/commons/math4/random/Well44497a.java |   2 +-
 .../apache/commons/math4/random/Well44497b.java |   2 +-
 .../apache/commons/math4/random/Well512a.java   |   2 +-
 .../commons/math4/random/package-info.java      |  38 ++---
 .../apache/commons/math4/special/BesselJ.java   |  18 +--
 .../org/apache/commons/math4/special/Beta.java  |  18 +--
 .../org/apache/commons/math4/special/Erf.java   |   8 +-
 .../org/apache/commons/math4/special/Gamma.java |  12 +-
 .../commons/math4/special/package-info.java     |   2 +-
 .../apache/commons/math4/stat/Frequency.java    |  10 +-
 .../apache/commons/math4/stat/StatUtils.java    |  72 +++++-----
 .../commons/math4/stat/clustering/Cluster.java  |   4 +-
 .../math4/stat/clustering/Clusterable.java      |   4 +-
 .../math4/stat/clustering/DBSCANClusterer.java  |  10 +-
 .../stat/clustering/EuclideanDoublePoint.java   |   6 +-
 .../stat/clustering/EuclideanIntegerPoint.java  |   6 +-
 .../clustering/KMeansPlusPlusClusterer.java     |  16 +--
 .../math4/stat/clustering/package-info.java     |   4 +-
 .../math4/stat/correlation/Covariance.java      |  16 +--
 .../stat/correlation/KendallsCorrelation.java   |  14 +-
 .../stat/correlation/PearsonsCorrelation.java   |  22 +--
 .../stat/correlation/SpearmansCorrelation.java  |  18 +--
 .../StorelessBivariateCovariance.java           |   6 +-
 .../stat/correlation/StorelessCovariance.java   |  12 +-
 .../math4/stat/correlation/package-info.java    |   2 +-
 .../AbstractStorelessUnivariateStatistic.java   |  20 +--
 .../AbstractUnivariateStatistic.java            |  14 +-
 .../descriptive/AggregateSummaryStatistics.java |   4 +-
 .../stat/descriptive/DescriptiveStatistics.java |  36 ++---
 .../MultivariateSummaryStatistics.java          |  34 ++---
 .../StatisticalMultivariateSummary.java         |   4 +-
 .../stat/descriptive/StatisticalSummary.java    |   2 +-
 .../descriptive/StatisticalSummaryValues.java   |   8 +-
 .../StorelessUnivariateStatistic.java           |   4 +-
 .../stat/descriptive/SummaryStatistics.java     |  32 ++---
 .../SynchronizedDescriptiveStatistics.java      |  10 +-
 ...nchronizedMultivariateSummaryStatistics.java |  10 +-
 .../SynchronizedSummaryStatistics.java          |  10 +-
 .../stat/descriptive/UnivariateStatistic.java   |   6 +-
 .../stat/descriptive/WeightedEvaluation.java    |   4 +-
 .../stat/descriptive/moment/FirstMoment.java    |   8 +-
 .../stat/descriptive/moment/FourthMoment.java   |   6 +-
 .../stat/descriptive/moment/GeometricMean.java  |  20 +--
 .../math4/stat/descriptive/moment/Kurtosis.java |  12 +-
 .../math4/stat/descriptive/moment/Mean.java     |  14 +-
 .../stat/descriptive/moment/SecondMoment.java   |   6 +-
 .../stat/descriptive/moment/SemiVariance.java   |  10 +-
 .../math4/stat/descriptive/moment/Skewness.java |  12 +-
 .../descriptive/moment/StandardDeviation.java   |  12 +-
 .../stat/descriptive/moment/ThirdMoment.java    |   6 +-
 .../math4/stat/descriptive/moment/Variance.java |  14 +-
 .../descriptive/moment/VectorialCovariance.java |   8 +-
 .../stat/descriptive/moment/VectorialMean.java  |   4 +-
 .../stat/descriptive/moment/package-info.java   |   2 +-
 .../math4/stat/descriptive/package-info.java    |   2 +-
 .../math4/stat/descriptive/rank/Max.java        |  10 +-
 .../math4/stat/descriptive/rank/Median.java     |  10 +-
 .../math4/stat/descriptive/rank/Min.java        |  10 +-
 .../descriptive/rank/PSquarePercentile.java     |  26 ++--
 .../math4/stat/descriptive/rank/Percentile.java |  30 ++--
 .../stat/descriptive/rank/package-info.java     |   2 +-
 .../math4/stat/descriptive/summary/Product.java |  14 +-
 .../math4/stat/descriptive/summary/Sum.java     |  10 +-
 .../stat/descriptive/summary/SumOfLogs.java     |  14 +-
 .../stat/descriptive/summary/SumOfSquares.java  |  10 +-
 .../stat/descriptive/summary/package-info.java  |   2 +-
 .../stat/inference/AlternativeHypothesis.java   |   2 +-
 .../math4/stat/inference/BinomialTest.java      |  16 +--
 .../math4/stat/inference/ChiSquareTest.java     |  26 ++--
 .../commons/math4/stat/inference/GTest.java     |  22 +--
 .../stat/inference/KolmogorovSmirnovTest.java   |  64 ++++-----
 .../math4/stat/inference/MannWhitneyUTest.java  |  22 +--
 .../math4/stat/inference/OneWayAnova.java       |  30 ++--
 .../commons/math4/stat/inference/TTest.java     |  32 ++---
 .../commons/math4/stat/inference/TestUtils.java | 128 ++++++++---------
 .../stat/inference/WilcoxonSignedRankTest.java  |  26 ++--
 .../math4/stat/inference/package-info.java      |   2 +-
 .../stat/interval/AgrestiCoullInterval.java     |   6 +-
 .../interval/BinomialConfidenceInterval.java    |  10 +-
 .../stat/interval/ClopperPearsonInterval.java   |   4 +-
 .../math4/stat/interval/ConfidenceInterval.java |   6 +-
 .../math4/stat/interval/IntervalUtils.java      |  12 +-
 .../interval/NormalApproximationInterval.java   |   6 +-
 .../stat/interval/WilsonScoreInterval.java      |   6 +-
 .../math4/stat/interval/package-info.java       |   2 +-
 .../apache/commons/math4/stat/package-info.java |   2 +-
 .../commons/math4/stat/ranking/NaNStrategy.java |   2 +-
 .../math4/stat/ranking/NaturalRanking.java      |  12 +-
 .../math4/stat/ranking/RankingAlgorithm.java    |   2 +-
 .../math4/stat/ranking/TiesStrategy.java        |   2 +-
 .../math4/stat/ranking/package-info.java        |   2 +-
 .../AbstractMultipleLinearRegression.java       |  28 ++--
 .../regression/GLSMultipleLinearRegression.java |  10 +-
 .../regression/MillerUpdatingRegression.java    |  11 +-
 .../regression/ModelSpecificationException.java |   6 +-
 .../regression/MultipleLinearRegression.java    |   2 +-
 .../regression/OLSMultipleLinearRegression.java |  28 ++--
 .../stat/regression/RegressionResults.java      |   9 +-
 .../math4/stat/regression/SimpleRegression.java |  18 +--
 .../UpdatingMultipleLinearRegression.java       |   6 +-
 .../math4/stat/regression/package-info.java     |   2 +-
 .../math4/transform/DctNormalization.java       |   2 +-
 .../math4/transform/DftNormalization.java       |   2 +-
 .../math4/transform/DstNormalization.java       |   2 +-
 .../math4/transform/FastCosineTransformer.java  |  20 +--
 .../math4/transform/FastFourierTransformer.java |  26 ++--
 .../transform/FastHadamardTransformer.java      |  16 +--
 .../math4/transform/FastSineTransformer.java    |  20 +--
 .../math4/transform/RealTransformer.java        |  12 +-
 .../commons/math4/transform/TransformType.java  |   2 +-
 .../commons/math4/transform/TransformUtils.java |  10 +-
 .../commons/math4/transform/package-info.java   |   2 +-
 .../commons/math4/util/ArithmeticUtils.java     |  12 +-
 .../org/apache/commons/math4/util/BigReal.java  |  10 +-
 .../apache/commons/math4/util/BigRealField.java |   6 +-
 .../math4/util/CentralPivotingStrategy.java     |   4 +-
 .../apache/commons/math4/util/Combinations.java |  17 +--
 .../commons/math4/util/CombinatoricsUtils.java  |  10 +-
 .../commons/math4/util/CompositeFormat.java     |   2 +-
 .../commons/math4/util/ContinuedFraction.java   |   8 +-
 .../apache/commons/math4/util/Decimal64.java    |   8 +-
 .../commons/math4/util/Decimal64Field.java      |   6 +-
 .../commons/math4/util/DefaultTransformer.java  |   8 +-
 .../apache/commons/math4/util/DoubleArray.java  |   2 +-
 .../org/apache/commons/math4/util/FastMath.java |   6 +-
 .../apache/commons/math4/util/FastMathCalc.java |   4 +-
 .../math4/util/FastMathLiteralArrays.java       |   2 +-
 .../apache/commons/math4/util/Incrementor.java  |   6 +-
 .../commons/math4/util/IterationEvent.java      |   2 +-
 .../commons/math4/util/IterationListener.java   |   2 +-
 .../commons/math4/util/IterationManager.java    |   6 +-
 .../apache/commons/math4/util/KthSelector.java  |   4 +-
 .../apache/commons/math4/util/MathArrays.java   |  34 ++---
 .../apache/commons/math4/util/MathUtils.java    |  12 +-
 .../math4/util/MedianOf3PivotingStrategy.java   |   4 +-
 .../math4/util/MultidimensionalCounter.java     |   9 +-
 .../commons/math4/util/NumberTransformer.java   |   4 +-
 .../math4/util/OpenIntToDoubleHashMap.java      |   2 +-
 .../math4/util/OpenIntToFieldHashMap.java       |   6 +-
 .../org/apache/commons/math4/util/Pair.java     |   2 +-
 .../math4/util/PivotingStrategyInterface.java   |   4 +-
 .../apache/commons/math4/util/Precision.java    |   8 +-
 .../math4/util/RandomPivotingStrategy.java      |   6 +-
 .../math4/util/ResizableDoubleArray.java        |  16 +--
 .../commons/math4/util/TransformerMap.java      |   6 +-
 .../apache/commons/math4/util/package-info.java |   2 +-
 src/site/apt/userguide/special.apt              |   6 +-
 src/site/design/differentiation.puml            |   2 +-
 src/site/design/oneD.puml                       |   2 +-
 src/site/design/partitioning.puml               |   2 +-
 src/site/design/solver.puml                     |   2 +-
 src/site/design/threeD.puml                     |   2 +-
 src/site/design/twoD.puml                       |   2 +-
 src/site/xdoc/proposal.xml                      |   2 +-
 src/site/xdoc/userguide/analysis.xml            | 136 +++++++++---------
 src/site/xdoc/userguide/complex.xml             |  10 +-
 src/site/xdoc/userguide/distribution.xml        |  22 +--
 src/site/xdoc/userguide/exceptions.xml          |  14 +-
 src/site/xdoc/userguide/filter.xml              |   6 +-
 src/site/xdoc/userguide/fitting.xml             |  26 ++--
 src/site/xdoc/userguide/fraction.xml            |   6 +-
 src/site/xdoc/userguide/genetics.xml            |  28 ++--
 src/site/xdoc/userguide/geometry.xml            |  30 ++--
 src/site/xdoc/userguide/linear.xml              |  34 ++---
 src/site/xdoc/userguide/ml.xml                  |  22 +--
 src/site/xdoc/userguide/ode.xml                 |  62 ++++----
 src/site/xdoc/userguide/optimization.xml        |  58 ++++----
 src/site/xdoc/userguide/overview.xml            |  38 ++---
 src/site/xdoc/userguide/random.xml              |  66 ++++-----
 src/site/xdoc/userguide/stat.xml                | 112 +++++++--------
 src/site/xdoc/userguide/transform.xml           |   8 +-
 src/site/xdoc/userguide/utilities.xml           |  18 +--
 src/test/R/KolmogorovSmirnovTestCases.R         |   2 +-
 src/test/R/LevyDistributionTestCases.R          |   2 +-
 src/test/R/gumbelTestCases.R                    |   2 +-
 src/test/R/laplaceTestCases.R                   |   2 +-
 src/test/R/logisticsTestCases.R                 |   2 +-
 src/test/R/nakagamiTestCases.R                  |   2 +-
 .../math4/ExtendedFieldElementAbstractTest.java |  11 +-
 .../org/apache/commons/math4/PerfTestUtils.java |  11 +-
 .../java/org/apache/commons/math4/Retry.java    |   2 +-
 .../org/apache/commons/math4/RetryRunner.java   |   2 +-
 .../apache/commons/math4/RetryRunnerTest.java   |   5 +-
 .../org/apache/commons/math4/TestUtils.java     |  22 +--
 .../math4/analysis/FunctionUtilsTest.java       |  55 +++----
 .../math4/analysis/MonitoredFunction.java       |   4 +-
 .../commons/math4/analysis/QuinticFunction.java |   8 +-
 .../commons/math4/analysis/SumSincFunction.java |   6 +-
 .../commons/math4/analysis/XMinus5Function.java |   8 +-
 .../differentiation/DSCompilerTest.java         |   7 +-
 .../DerivativeStructureTest.java                |  21 +--
 .../FiniteDifferencesDifferentiatorTest.java    |  34 +++--
 .../differentiation/GradientFunctionTest.java   |  13 +-
 .../differentiation/JacobianFunctionTest.java   |  10 +-
 .../differentiation/SparseGradientTest.java     |  13 +-
 .../math4/analysis/function/GaussianTest.java   |  19 +--
 .../function/HarmonicOscillatorTest.java        |  15 +-
 .../math4/analysis/function/LogisticTest.java   |  19 +--
 .../math4/analysis/function/LogitTest.java      |  27 ++--
 .../math4/analysis/function/SigmoidTest.java    |  12 +-
 .../math4/analysis/function/SincTest.java       |  15 +-
 .../math4/analysis/function/SqrtTest.java       |  12 +-
 .../analysis/function/StepFunctionTest.java     |  14 +-
 .../IterativeLegendreGaussIntegratorTest.java   |  19 +--
 .../LegendreGaussIntegratorTest.java            |  17 ++-
 .../integration/MidPointIntegratorTest.java     |  16 ++-
 .../integration/RombergIntegratorTest.java      |  16 ++-
 .../integration/SimpsonIntegratorTest.java      |  16 ++-
 .../integration/TrapezoidIntegratorTest.java    |  16 ++-
 .../integration/gauss/BaseRuleFactoryTest.java  |   6 +-
 .../integration/gauss/GaussIntegratorTest.java  |   9 +-
 .../gauss/GaussianQuadratureAbstractTest.java   |   7 +-
 .../gauss/HermiteParametricTest.java            |   6 +-
 .../analysis/integration/gauss/HermiteTest.java |   9 +-
 .../LegendreHighPrecisionParametricTest.java    |   4 +-
 .../gauss/LegendreHighPrecisionTest.java        |  15 +-
 .../gauss/LegendreParametricTest.java           |   4 +-
 .../integration/gauss/LegendreTest.java         |  15 +-
 .../AkimaSplineInterpolatorTest.java            |  26 ++--
 .../BicubicInterpolatingFunctionTest.java       |  23 +--
 .../interpolation/BicubicInterpolatorTest.java  |  19 +--
 .../BicubicSplineInterpolatingFunctionTest.java |  20 +--
 .../BicubicSplineInterpolatorTest.java          |  16 ++-
 .../DividedDifferenceInterpolatorTest.java      |  16 ++-
 .../FieldHermiteInterpolatorTest.java           |  15 +-
 .../interpolation/HermiteInterpolatorTest.java  |  11 +-
 .../interpolation/LinearInterpolatorTest.java   |  20 +--
 .../interpolation/LoessInterpolatorTest.java    |  20 +--
 .../MicrosphereInterpolatorTest.java            |   8 +-
 .../interpolation/NevilleInterpolatorTest.java  |  16 ++-
 ...eBicubicSplineInterpolatingFunctionTest.java |  23 +--
 .../PiecewiseBicubicSplineInterpolatorTest.java |  24 ++--
 ...PolynomialBicubicSplineInterpolatorTest.java |  14 +-
 .../interpolation/SplineInterpolatorTest.java   |  22 +--
 .../TricubicInterpolatingFunctionTest.java      |  21 +--
 .../interpolation/TricubicInterpolatorTest.java |  14 +-
 ...TricubicSplineInterpolatingFunctionTest.java |  11 +-
 .../TricubicSplineInterpolatorTest.java         |  14 +-
 .../UnivariatePeriodicInterpolatorTest.java     |  13 +-
 .../PolynomialFunctionLagrangeFormTest.java     |   5 +-
 .../PolynomialFunctionNewtonFormTest.java       |   7 +-
 .../polynomials/PolynomialFunctionTest.java     |   8 +-
 .../PolynomialSplineFunctionTest.java           |  12 +-
 .../polynomials/PolynomialsUtilsTest.java       |  16 ++-
 .../solvers/BaseSecantSolverAbstractTest.java   |  22 +--
 .../analysis/solvers/BisectionSolverTest.java   |  11 +-
 .../BracketingNthOrderBrentSolverTest.java      |  20 +--
 .../math4/analysis/solvers/BrentSolverTest.java |  32 +++--
 .../analysis/solvers/IllinoisSolverTest.java    |   5 +-
 .../analysis/solvers/LaguerreSolverTest.java    |  17 +--
 .../analysis/solvers/MullerSolver2Test.java     |  18 +--
 .../analysis/solvers/MullerSolverTest.java      |  18 +--
 .../solvers/NewtonRaphsonSolverTest.java        |  11 +-
 .../analysis/solvers/NewtonSolverTest.java      |  19 +--
 .../analysis/solvers/PegasusSolverTest.java     |   5 +-
 .../analysis/solvers/RegulaFalsiSolverTest.java |  10 +-
 .../analysis/solvers/RiddersSolverTest.java     |  18 +--
 .../analysis/solvers/SecantSolverTest.java      |   5 +-
 .../solvers/UnivariateSolverUtilsTest.java      |  17 +--
 .../commons/math4/complex/ComplexFieldTest.java |   6 +-
 .../complex/ComplexFormatAbstractTest.java      |   7 +-
 .../math4/complex/ComplexFormatTest.java        |   2 +-
 .../commons/math4/complex/ComplexTest.java      |  25 ++--
 .../commons/math4/complex/ComplexUtilsTest.java |   8 +-
 .../math4/complex/FrenchComplexFormatTest.java  |   2 +-
 .../commons/math4/complex/QuaternionTest.java   |  15 +-
 .../commons/math4/complex/RootsOfUnityTest.java |   9 +-
 .../BracketingNthOrderBrentSolverDFPTest.java   |  15 +-
 .../org/apache/commons/math4/dfp/Decimal10.java |   6 +-
 .../apache/commons/math4/dfp/DfpDecTest.java    |   5 +-
 .../apache/commons/math4/dfp/DfpMathTest.java   |   5 +-
 .../org/apache/commons/math4/dfp/DfpTest.java   |  10 +-
 .../AbstractIntegerDistributionTest.java        |   3 +-
 .../AbstractRealDistributionTest.java           |  11 +-
 .../distribution/BetaDistributionTest.java      |   3 +-
 .../distribution/BinomialDistributionTest.java  |   4 +-
 .../distribution/CauchyDistributionTest.java    |   6 +-
 .../ChiSquaredDistributionTest.java             |   3 +-
 .../ConstantRealDistributionTest.java           |   4 +-
 .../EnumeratedIntegerDistributionTest.java      |  15 +-
 .../EnumeratedRealDistributionTest.java         |  18 +--
 .../ExponentialDistributionTest.java            |   9 +-
 .../math4/distribution/FDistributionTest.java   |   5 +-
 .../distribution/GammaDistributionTest.java     |  13 +-
 .../distribution/GeometricDistributionTest.java |   4 +-
 .../distribution/GumbelDistributionTest.java    |   5 +-
 .../HypergeometricDistributionTest.java         |  14 +-
 .../IntegerDistributionAbstractTest.java        |  10 +-
 .../KolmogorovSmirnovDistributionTest.java      |   3 +-
 .../distribution/LaplaceDistributionTest.java   |   5 +-
 .../distribution/LevyDistributionTest.java      |   7 +-
 .../distribution/LogNormalDistributionTest.java |   5 +-
 .../distribution/LogisticsDistributionTest.java |   5 +-
 .../MultivariateNormalDistributionTest.java     |   9 +-
 ...riateNormalMixtureModelDistributionTest.java |  11 +-
 .../distribution/NakagamiDistributionTest.java  |   5 +-
 .../distribution/NormalDistributionTest.java    |   5 +-
 .../distribution/ParetoDistributionTest.java    |   5 +-
 .../distribution/PascalDistributionTest.java    |   5 +-
 .../distribution/PoissonDistributionTest.java   |   8 +-
 .../RealDistributionAbstractTest.java           |  18 +--
 .../math4/distribution/TDistributionTest.java   |   7 +-
 .../TriangularDistributionTest.java             |   7 +-
 .../UniformIntegerDistributionTest.java         |   6 +-
 .../UniformRealDistributionTest.java            |   5 +-
 .../distribution/WeibullDistributionTest.java   |   9 +-
 .../distribution/ZipfDistributionTest.java      |   9 +-
 ...ormalMixtureExpectationMaximizationTest.java |  21 +--
 .../DimensionMismatchExceptionTest.java         |   3 +-
 .../MaxCountExceededExceptionTest.java          |   3 +-
 .../NonMonotonicSequenceExceptionTest.java      |   6 +-
 .../exception/NotPositiveExceptionTest.java     |   3 +-
 .../NotStrictlyPositiveExceptionTest.java       |   3 +-
 .../NumberIsTooLargeExceptionTest.java          |   3 +-
 .../NumberIsTooSmallExceptionTest.java          |   3 +-
 .../exception/OutOfRangeExceptionTest.java      |   3 +-
 .../TooManyEvaluationsExceptionTest.java        |   3 +-
 .../math4/exception/util/ArgUtilsTest.java      |   3 +-
 .../exception/util/ExceptionContextTest.java    |   4 +-
 .../exception/util/LocalizedFormatsTest.java    |   3 +-
 .../commons/math4/filter/KalmanFilterTest.java  |  33 +++--
 .../commons/math4/fitting/CurveFitterTest.java  |   9 +-
 .../math4/fitting/GaussianCurveFitterTest.java  |   8 +-
 .../math4/fitting/GaussianFitterTest.java       |   7 +-
 .../math4/fitting/HarmonicCurveFitterTest.java  |  15 +-
 .../math4/fitting/HarmonicFitterTest.java       |  16 ++-
 .../fitting/PolynomialCurveFitterTest.java      |  16 ++-
 .../math4/fitting/PolynomialFitterTest.java     |  28 ++--
 .../math4/fitting/SimpleCurveFitterTest.java    |  18 +--
 .../fitting/WeightedObservedPointsTest.java     |   7 +-
 ...stractLeastSquaresOptimizerAbstractTest.java |  42 +++---
 .../fitting/leastsquares/CircleProblem.java     |  11 +-
 .../fitting/leastsquares/CircleVectorial.java   |   9 +-
 .../leastsquares/EvaluationRmsCheckerTest.java  |  11 +-
 .../fitting/leastsquares/EvaluationTest.java    |  37 ++---
 .../leastsquares/EvaluationTestValidation.java  |  20 +--
 .../GaussNewtonOptimizerWithCholeskyTest.java   |  13 +-
 .../GaussNewtonOptimizerWithLUTest.java         |  13 +-
 .../GaussNewtonOptimizerWithQRTest.java         |  13 +-
 .../GaussNewtonOptimizerWithSVDTest.java        |  23 +--
 .../LevenbergMarquardtOptimizerTest.java        |  37 ++---
 .../math4/fitting/leastsquares/MinpackTest.java |  18 ++-
 .../RandomCirclePointGenerator.java             |  18 +--
 .../RandomStraightLinePointGenerator.java       |  13 +-
 .../StatisticalReferenceDataset.java            |   9 +-
 .../StatisticalReferenceDatasetFactory.java     |   5 +-
 .../leastsquares/StraightLineProblem.java       |  11 +-
 .../math4/fraction/BigFractionFieldTest.java    |   6 +-
 .../math4/fraction/BigFractionFormatTest.java   |   9 +-
 .../commons/math4/fraction/BigFractionTest.java |  16 ++-
 .../math4/fraction/FractionFieldTest.java       |   6 +-
 .../math4/fraction/FractionFormatTest.java      |   9 +-
 .../commons/math4/fraction/FractionTest.java    |  16 ++-
 .../math4/genetics/BinaryChromosomeTest.java    |   4 +-
 .../math4/genetics/BinaryMutationTest.java      |   4 +-
 .../commons/math4/genetics/ChromosomeTest.java  |   5 +-
 .../math4/genetics/CycleCrossoverTest.java      |  13 +-
 .../math4/genetics/DummyBinaryChromosome.java   |   5 +-
 .../math4/genetics/DummyListChromosome.java     |   5 +-
 .../commons/math4/genetics/DummyRandomKey.java  |   5 +-
 .../genetics/ElitisticListPopulationTest.java   |   7 +-
 .../math4/genetics/FitnessCachingTest.java      |  12 +-
 .../math4/genetics/FixedElapsedTimeTest.java    |   7 +-
 .../genetics/FixedGenerationCountTest.java      |   5 +-
 .../genetics/GeneticAlgorithmTestBinary.java    |  13 +-
 .../GeneticAlgorithmTestPermutations.java       |  15 +-
 .../math4/genetics/ListPopulationTest.java      |  12 +-
 .../math4/genetics/NPointCrossoverTest.java     |  13 +-
 .../math4/genetics/OnePointCrossoverTest.java   |   5 +-
 .../math4/genetics/OrderedCrossoverTest.java    |  11 +-
 .../math4/genetics/RandomKeyMutationTest.java   |   6 +-
 .../commons/math4/genetics/RandomKeyTest.java   |   3 +-
 .../math4/genetics/TournamentSelectionTest.java |   6 +-
 .../math4/genetics/UniformCrossoverTest.java    |  14 +-
 .../geometry/enclosing/WelzlEncloser2DTest.java |  14 +-
 .../geometry/enclosing/WelzlEncloser3DTest.java |  16 ++-
 .../euclidean/oned/Euclidean1DTest.java         |   7 +-
 .../oned/FrenchVector1DFormatTest.java          |   2 +-
 .../geometry/euclidean/oned/IntervalTest.java   |   9 +-
 .../euclidean/oned/IntervalsSetTest.java        |  17 +--
 .../oned/Vector1DFormatAbstractTest.java        |   6 +-
 .../euclidean/oned/Vector1DFormatTest.java      |   2 +-
 .../geometry/euclidean/oned/Vector1DTest.java   |  13 +-
 .../euclidean/threed/Euclidean3DTest.java       |   9 +-
 .../euclidean/threed/FieldRotationDSTest.java   |  29 ++--
 .../euclidean/threed/FieldRotationDfpTest.java  |  27 ++--
 .../euclidean/threed/FieldVector3DTest.java     |  16 ++-
 .../threed/FrenchVector3DFormatTest.java        |   2 +-
 .../geometry/euclidean/threed/LineTest.java     |  12 +-
 .../geometry/euclidean/threed/PlaneTest.java    |  16 +--
 .../euclidean/threed/PolyhedronsSetTest.java    |  36 +++--
 .../euclidean/threed/RotationOrderTest.java     |   4 +-
 .../geometry/euclidean/threed/RotationTest.java |  17 ++-
 .../euclidean/threed/SphereGeneratorTest.java   |  15 +-
 .../threed/SphericalCoordinatesTest.java        |  14 +-
 .../geometry/euclidean/threed/SubLineTest.java  |  14 +-
 .../threed/Vector3DFormatAbstractTest.java      |   8 +-
 .../euclidean/threed/Vector3DFormatTest.java    |   2 +-
 .../geometry/euclidean/threed/Vector3DTest.java |  18 +--
 .../euclidean/twod/DiskGeneratorTest.java       |  13 +-
 .../euclidean/twod/Euclidean2DTest.java         |  10 +-
 .../twod/FrenchVector2DFormatTest.java          |   2 +-
 .../math4/geometry/euclidean/twod/LineTest.java |  21 +--
 .../euclidean/twod/PolygonsSetTest.java         |  31 ++--
 .../geometry/euclidean/twod/SegmentTest.java    |   9 +-
 .../geometry/euclidean/twod/SubLineTest.java    |  12 +-
 .../twod/Vector2DFormatAbstractTest.java        |   6 +-
 .../euclidean/twod/Vector2DFormatTest.java      |   2 +-
 .../geometry/euclidean/twod/Vector2DTest.java   |   3 +-
 .../twod/hull/AklToussaintHeuristicTest.java    |   7 +-
 .../hull/ConvexHullGenerator2DAbstractTest.java |  24 ++--
 .../euclidean/twod/hull/MonotoneChainTest.java  |   9 +-
 .../partitioning/utilities/AVLTreeTest.java     |   4 +-
 .../math4/geometry/spherical/oned/ArcTest.java  |  13 +-
 .../geometry/spherical/oned/ArcsSetTest.java    |  28 ++--
 .../geometry/spherical/oned/LimitAngleTest.java |   6 +-
 .../geometry/spherical/oned/S1PointTest.java    |  10 +-
 .../geometry/spherical/oned/Sphere1Test.java    |   7 +-
 .../geometry/spherical/twod/CircleTest.java     |  33 +++--
 .../geometry/spherical/twod/S2PointTest.java    |  12 +-
 .../twod/SphericalPolygonsSetTest.java          |  33 +++--
 .../geometry/spherical/twod/SubCircleTest.java  |  23 +--
 .../math4/linear/Array2DRowRealMatrixTest.java  |  31 ++--
 .../math4/linear/ArrayFieldVectorTest.java      |  23 +--
 .../math4/linear/ArrayRealVectorTest.java       |   6 +-
 .../math4/linear/BiDiagonalTransformerTest.java |  10 +-
 .../math4/linear/BlockFieldMatrixTest.java      |  30 ++--
 .../math4/linear/BlockRealMatrixTest.java       |  26 ++--
 .../math4/linear/CholeskyDecompositionTest.java |  10 +-
 .../math4/linear/CholeskySolverTest.java        |   8 +-
 .../math4/linear/ConjugateGradientTest.java     |  25 +++-
 .../math4/linear/DiagonalMatrixTest.java        |  22 +--
 .../math4/linear/EigenDecompositionTest.java    |  20 ++-
 .../commons/math4/linear/EigenSolverTest.java   |  12 +-
 .../math4/linear/FieldLUDecompositionTest.java  |  13 +-
 .../commons/math4/linear/FieldLUSolverTest.java |  15 +-
 .../math4/linear/FieldMatrixImplTest.java       |  34 +++--
 .../linear/FrenchRealVectorFormatTest.java      |   2 +-
 .../math4/linear/HessenbergTransformerTest.java |   8 +-
 .../commons/math4/linear/HilbertMatrix.java     |   7 +-
 .../math4/linear/InverseHilbertMatrix.java      |  11 +-
 .../math4/linear/LUDecompositionTest.java       |   6 +-
 .../commons/math4/linear/LUSolverTest.java      |  10 +-
 .../MatrixDimensionMismatchExceptionTest.java   |   3 +-
 .../commons/math4/linear/MatrixUtilsTest.java   |  30 ++--
 .../math4/linear/OpenMapRealMatrixTest.java     |   5 +-
 .../math4/linear/QRDecompositionTest.java       |  12 +-
 .../commons/math4/linear/QRSolverTest.java      |  13 +-
 .../math4/linear/RRQRDecompositionTest.java     |  10 +-
 .../commons/math4/linear/RRQRSolverTest.java    |  13 +-
 .../linear/RealMatrixFormatAbstractTest.java    |   8 +-
 .../math4/linear/RealMatrixFormatTest.java      |   2 +-
 .../math4/linear/RealVectorAbstractTest.java    |  73 +++++-----
 .../linear/RealVectorFormatAbstractTest.java    |   7 +-
 .../math4/linear/RealVectorFormatTest.java      |   2 +-
 .../commons/math4/linear/RealVectorTest.java    |   5 +-
 .../RectangularCholeskyDecompositionTest.java   |   5 +-
 .../math4/linear/SchurTransformerTest.java      |   8 +-
 .../linear/SingularValueDecompositionTest.java  |   6 +-
 .../math4/linear/SingularValueSolverTest.java   |  13 +-
 .../math4/linear/SparseFieldMatrixTest.java     |  28 ++--
 .../math4/linear/SparseFieldVectorTest.java     |  19 ++-
 .../math4/linear/SparseRealMatrixTest.java      |  22 +--
 .../math4/linear/SparseRealVectorTest.java      |  48 ++++---
 .../apache/commons/math4/linear/SymmLQTest.java |  24 +++-
 .../linear/TriDiagonalTransformerTest.java      |   9 +-
 .../linear/UnmodifiableArrayRealVectorTest.java |   5 +-
 .../UnmodifiableOpenMapRealVectorTest.java      |   6 +-
 .../UnmodifiableRealVectorAbstractTest.java     |  15 +-
 .../ml/clustering/DBSCANClustererTest.java      |   9 +-
 .../ml/clustering/FuzzyKMeansClustererTest.java |  18 ++-
 .../clustering/KMeansPlusPlusClustererTest.java |  14 +-
 .../MultiKMeansPlusPlusClustererTest.java       |   7 +-
 .../evaluation/SumOfClusterVariancesTest.java   |  10 +-
 .../math4/ml/distance/CanberraDistanceTest.java |   4 +-
 .../ml/distance/ChebyshevDistanceTest.java      |   4 +-
 .../ml/distance/EarthMoversDistanceTest.java    |   6 +-
 .../ml/distance/EuclideanDistanceTest.java      |   6 +-
 .../ml/distance/ManhattanDistanceTest.java      |   4 +-
 .../math4/ml/neuralnet/MapUtilsTest.java        |  14 +-
 .../commons/math4/ml/neuralnet/NetworkTest.java |   9 +-
 .../commons/math4/ml/neuralnet/NeuronTest.java  |   4 +-
 .../ml/neuralnet/OffsetFeatureInitializer.java  |   4 +-
 .../ml/neuralnet/oned/NeuronStringTest.java     |  11 +-
 .../neuralnet/sofm/KohonenTrainingTaskTest.java |   9 +-
 .../neuralnet/sofm/KohonenUpdateActionTest.java |  27 ++--
 .../sofm/LearningFactorFunctionFactoryTest.java |  10 +-
 .../NeighbourhoodSizeFunctionFactoryTest.java   |   8 +-
 .../sofm/TravellingSalesmanSolver.java          |  43 +++---
 .../sofm/util/ExponentialDecayFunctionTest.java |   7 +-
 .../util/QuasiSigmoidDecayFunctionTest.java     |   7 +-
 .../neuralnet/twod/NeuronSquareMesh2DTest.java  |  15 +-
 .../math4/ode/ContinuousOutputModelTest.java    |  25 ++--
 .../math4/ode/FirstOrderConverterTest.java      |  18 +--
 .../commons/math4/ode/JacobianMatricesTest.java |  30 ++--
 .../apache/commons/math4/ode/TestProblem1.java  |   4 +-
 .../apache/commons/math4/ode/TestProblem2.java  |   4 +-
 .../apache/commons/math4/ode/TestProblem3.java  |   4 +-
 .../apache/commons/math4/ode/TestProblem4.java  |   6 +-
 .../apache/commons/math4/ode/TestProblem5.java  |   2 +-
 .../apache/commons/math4/ode/TestProblem6.java  |   2 +-
 .../commons/math4/ode/TestProblemAbstract.java  |   6 +-
 .../commons/math4/ode/TestProblemFactory.java   |   2 +-
 .../commons/math4/ode/TestProblemHandler.java   |  11 +-
 .../math4/ode/events/EventFilterTest.java       |  29 ++--
 .../math4/ode/events/EventStateTest.java        |  30 ++--
 .../math4/ode/events/OverlappingEventsTest.java |  27 ++--
 .../math4/ode/events/ReappearingEventTest.java  |  22 +--
 .../nonstiff/AdamsBashforthIntegratorTest.java  |  27 ++--
 .../nonstiff/AdamsMoultonIntegratorTest.java    |  27 ++--
 .../ClassicalRungeKuttaIntegratorTest.java      |  40 +++---
 ...ClassicalRungeKuttaStepInterpolatorTest.java |  19 +--
 .../nonstiff/DormandPrince54IntegratorTest.java |  37 ++---
 .../DormandPrince54StepInterpolatorTest.java    |  23 +--
 .../DormandPrince853IntegratorTest.java         |  36 ++---
 .../DormandPrince853StepInterpolatorTest.java   |  23 +--
 .../math4/ode/nonstiff/EulerIntegratorTest.java |  37 ++---
 .../ode/nonstiff/EulerStepInterpolatorTest.java |  28 ++--
 .../math4/ode/nonstiff/GillIntegratorTest.java  |  39 ++---
 .../ode/nonstiff/GillStepInterpolatorTest.java  |  19 +--
 .../GraggBulirschStoerIntegratorTest.java       |  38 ++---
 .../GraggBulirschStoerStepInterpolatorTest.java |  23 +--
 .../nonstiff/HighamHall54IntegratorTest.java    |  35 ++---
 .../HighamHall54StepInterpolatorTest.java       |  23 +--
 .../ode/nonstiff/LutherIntegratorTest.java      |  40 +++---
 .../nonstiff/LutherStepInterpolatorTest.java    |  19 +--
 .../ode/nonstiff/MidpointIntegratorTest.java    |  37 ++---
 .../nonstiff/MidpointStepInterpolatorTest.java  |  21 +--
 .../commons/math4/ode/nonstiff/StepProblem.java |   6 +-
 .../nonstiff/ThreeEighthesIntegratorTest.java   |  39 ++---
 .../ThreeEighthesStepInterpolatorTest.java      |  19 +--
 .../ode/sampling/DummyStepInterpolator.java     |   9 +-
 .../ode/sampling/DummyStepInterpolatorTest.java |   7 +-
 .../sampling/NordsieckStepInterpolatorTest.java |  19 +--
 .../ode/sampling/StepInterpolatorTestUtils.java |  22 +--
 .../StepNormalizerOutputOverlapTest.java        |   2 +-
 .../ode/sampling/StepNormalizerOutputTest.java  |   2 +-
 .../sampling/StepNormalizerOutputTestBase.java  |  20 +--
 .../math4/ode/sampling/StepNormalizerTest.java  |  20 +--
 .../commons/math4/optim/PointValuePairTest.java |   5 +-
 .../math4/optim/PointVectorValuePairTest.java   |   5 +-
 .../math4/optim/SimplePointCheckerTest.java     |   6 +-
 .../math4/optim/SimpleValueCheckerTest.java     |   6 +-
 .../optim/SimpleVectorValueCheckerTest.java     |   6 +-
 .../math4/optim/linear/SimplexSolverTest.java   |  22 ++-
 .../math4/optim/linear/SimplexTableauTest.java  |  11 +-
 .../MultiStartMultivariateOptimizerTest.java    |  34 +++--
 .../MultivariateFunctionMappingAdapterTest.java |  21 +--
 .../MultivariateFunctionPenaltyAdapterTest.java |  23 +--
 .../nonlinear/scalar/gradient/CircleScalar.java |  12 +-
 ...NonLinearConjugateGradientOptimizerTest.java |  34 ++---
 .../scalar/noderiv/BOBYQAOptimizerTest.java     |  27 ++--
 .../scalar/noderiv/CMAESOptimizerTest.java      |  35 ++---
 .../scalar/noderiv/PowellOptimizerTest.java     |  25 ++--
 .../SimplexOptimizerMultiDirectionalTest.java   |  25 ++--
 .../noderiv/SimplexOptimizerNelderMeadTest.java |  36 ++---
 ...ltiStartMultivariateVectorOptimizerTest.java |  40 +++---
 ...stractLeastSquaresOptimizerAbstractTest.java |  33 ++---
 .../AbstractLeastSquaresOptimizerTest.java      |  15 +-
 ...ractLeastSquaresOptimizerTestValidation.java |  21 +--
 .../vector/jacobian/CircleProblem.java          |  14 +-
 .../vector/jacobian/CircleVectorial.java        |  12 +-
 .../jacobian/GaussNewtonOptimizerTest.java      |  22 +--
 .../LevenbergMarquardtOptimizerTest.java        |  38 ++---
 .../nonlinear/vector/jacobian/MinpackTest.java  |  25 ++--
 .../jacobian/RandomCirclePointGenerator.java    |  18 +--
 .../RandomStraightLinePointGenerator.java       |  12 +-
 .../jacobian/StatisticalReferenceDataset.java   |  12 +-
 .../StatisticalReferenceDatasetFactory.java     |   4 +-
 .../vector/jacobian/StraightLineProblem.java    |  14 +-
 .../optim/univariate/BracketFinderTest.java     |   7 +-
 .../optim/univariate/BrentOptimizerTest.java    |  34 +++--
 .../MultiStartUnivariateOptimizerTest.java      |  24 ++--
 .../SimpleUnivariateValueCheckerTest.java       |   6 +-
 ...teDifferentiableMultiStartOptimizerTest.java |  26 ++--
 ...erentiableVectorMultiStartOptimizerTest.java |  31 ++--
 .../MultivariateMultiStartOptimizerTest.java    |  20 +--
 .../math4/optimization/PointValuePairTest.java  |   5 +-
 .../optimization/PointVectorValuePairTest.java  |   5 +-
 .../optimization/SimplePointCheckerTest.java    |   6 +-
 .../optimization/SimpleValueCheckerTest.java    |   6 +-
 .../SimpleVectorValueCheckerTest.java           |   6 +-
 .../direct/BOBYQAOptimizerTest.java             |  23 +--
 .../optimization/direct/CMAESOptimizerTest.java |  31 ++--
 .../MultivariateFunctionMappingAdapterTest.java |  11 +-
 .../MultivariateFunctionPenaltyAdapterTest.java |  13 +-
 .../direct/PowellOptimizerTest.java             |  17 +--
 .../SimplexOptimizerMultiDirectionalTest.java   |  16 ++-
 .../direct/SimplexOptimizerNelderMeadTest.java  |  26 ++--
 .../optimization/fitting/CurveFitterTest.java   |   9 +-
 .../fitting/GaussianFitterTest.java             |   7 +-
 .../fitting/HarmonicFitterTest.java             |  16 ++-
 .../fitting/PolynomialFitterTest.java           |  28 ++--
 ...stractLeastSquaresOptimizerAbstractTest.java |  23 +--
 .../AbstractLeastSquaresOptimizerTest.java      |   7 +-
 ...ractLeastSquaresOptimizerTestValidation.java |  13 +-
 .../optimization/general/CircleProblem.java     |  10 +-
 .../optimization/general/CircleScalar.java      |   8 +-
 .../optimization/general/CircleVectorial.java   |   8 +-
 .../general/GaussNewtonOptimizerTest.java       |  10 +-
 .../LevenbergMarquardtOptimizerTest.java        |  24 ++--
 .../math4/optimization/general/MinpackTest.java |  13 +-
 ...NonLinearConjugateGradientOptimizerTest.java |  23 +--
 .../general/RandomCirclePointGenerator.java     |  18 +--
 .../RandomStraightLinePointGenerator.java       |  12 +-
 .../general/StatisticalReferenceDataset.java    |   8 +-
 .../StatisticalReferenceDatasetFactory.java     |   4 +-
 .../general/StraightLineProblem.java            |  10 +-
 .../optimization/linear/SimplexSolverTest.java  |  14 +-
 .../optimization/linear/SimplexTableauTest.java |  10 +-
 .../univariate/BracketFinderTest.java           |   7 +-
 .../univariate/BrentOptimizerTest.java          |  34 +++--
 .../SimpleUnivariateValueCheckerTest.java       |   6 +-
 .../UnivariateMultiStartOptimizerTest.java      |  18 ++-
 .../apache/commons/math4/primes/PrimesTest.java |   8 +-
 .../random/AbstractRandomGeneratorTest.java     |   4 +-
 .../math4/random/BitsStreamGeneratorTest.java   |   5 +-
 .../CorrelatedRandomVectorGeneratorTest.java    |  24 ++--
 .../math4/random/EmpiricalDistributionTest.java |  28 ++--
 .../random/GaussianRandomGeneratorTest.java     |   7 +-
 .../random/HaltonSequenceGeneratorTest.java     |  10 +-
 .../apache/commons/math4/random/ISAACTest.java  |   4 +-
 .../math4/random/MersenneTwisterTest.java       |   4 +-
 .../commons/math4/random/RandomAdaptorTest.java |   4 +-
 .../math4/random/RandomDataGeneratorTest.java   |  55 +++----
 .../random/RandomGeneratorAbstractTest.java     |  15 +-
 .../random/RandomGeneratorFactoryTest.java      |   5 +-
 .../random/SobolSequenceGeneratorTest.java      |   7 +-
 .../math4/random/StableRandomGeneratorTest.java |  11 +-
 .../random/SynchronizedRandomGeneratorTest.java |   5 +-
 .../math4/random/TestRandomGenerator.java       |   4 +-
 .../UncorrelatedRandomVectorGeneratorTest.java  |  13 +-
 .../random/UniformRandomGeneratorTest.java      |   7 +-
 .../UnitSphereRandomVectorGeneratorTest.java    |   7 +-
 .../commons/math4/random/ValueServerTest.java   |  12 +-
 .../commons/math4/random/Well1024aTest.java     |   5 +-
 .../commons/math4/random/Well19937aTest.java    |   4 +-
 .../commons/math4/random/Well19937cTest.java    |   4 +-
 .../commons/math4/random/Well44497aTest.java    |   4 +-
 .../commons/math4/random/Well44497bTest.java    |   4 +-
 .../commons/math4/random/Well512aTest.java      |   4 +-
 .../commons/math4/special/BesselJTest.java      |   5 +-
 .../apache/commons/math4/special/BetaTest.java  |  13 +-
 .../apache/commons/math4/special/ErfTest.java   |   8 +-
 .../apache/commons/math4/special/GammaTest.java |  11 +-
 .../commons/math4/stat/CertifiedDataTest.java   |   7 +-
 .../commons/math4/stat/FrequencyTest.java       |   8 +-
 .../commons/math4/stat/StatUtilsTest.java       |  13 +-
 .../stat/clustering/DBSCANClustererTest.java    |  10 +-
 .../clustering/EuclideanDoublePointTest.java    |   7 +-
 .../clustering/EuclideanIntegerPointTest.java   |   7 +-
 .../clustering/KMeansPlusPlusClustererTest.java |   8 +-
 .../math4/stat/correlation/CovarianceTest.java  |  15 +-
 .../correlation/KendallsCorrelationTest.java    |   9 +-
 .../correlation/PearsonsCorrelationTest.java    |  14 +-
 .../SpearmansRankCorrelationTest.java           |  15 +-
 .../correlation/StorelessCovarianceTest.java    |  12 +-
 .../stat/data/CertifiedDataAbstractTest.java    |   9 +-
 .../apache/commons/math4/stat/data/LewTest.java |   4 +-
 .../commons/math4/stat/data/LotteryTest.java    |   4 +-
 .../AbstractUnivariateStatisticTest.java        |   6 +-
 .../AggregateSummaryStatisticsTest.java         |  19 +--
 .../descriptive/DescriptiveStatisticsTest.java  |  26 ++--
 .../stat/descriptive/ListUnivariateImpl.java    |  14 +-
 .../descriptive/ListUnivariateImplTest.java     |   8 +-
 .../MixedListUnivariateImplTest.java            |  10 +-
 .../MultivariateSummaryStatisticsTest.java      |  13 +-
 .../StatisticalSummaryValuesTest.java           |   6 +-
 ...torelessUnivariateStatisticAbstractTest.java |  10 +-
 .../stat/descriptive/SummaryStatisticsTest.java |  17 +--
 .../SynchronizedDescriptiveStatisticsTest.java  |   5 +-
 ...onizedMultivariateSummaryStatisticsTest.java |   5 +-
 .../SynchronizedSummaryStatisticsTest.java      |   5 +-
 .../UnivariateStatisticAbstractTest.java        |  17 +--
 .../descriptive/moment/FirstMomentTest.java     |  11 +-
 .../descriptive/moment/FourthMomentTest.java    |  11 +-
 .../descriptive/moment/GeometricMeanTest.java   |   7 +-
 .../descriptive/moment/InteractionTest.java     |   7 +-
 .../stat/descriptive/moment/KurtosisTest.java   |   7 +-
 .../math4/stat/descriptive/moment/MeanTest.java |   7 +-
 .../descriptive/moment/SecondMomentTest.java    |  11 +-
 .../descriptive/moment/SemiVarianceTest.java    |   9 +-
 .../stat/descriptive/moment/SkewnessTest.java   |   7 +-
 .../moment/StandardDeviationTest.java           |  11 +-
 .../descriptive/moment/ThirdMomentTest.java     |  11 +-
 .../stat/descriptive/moment/VarianceTest.java   |  12 +-
 .../moment/VectorialCovarianceTest.java         |  10 +-
 .../descriptive/moment/VectorialMeanTest.java   |   8 +-
 .../math4/stat/descriptive/rank/MaxTest.java    |   7 +-
 .../math4/stat/descriptive/rank/MedianTest.java |  33 ++---
 .../math4/stat/descriptive/rank/MinTest.java    |   7 +-
 .../descriptive/rank/PSquarePercentileTest.java |  28 ++--
 .../stat/descriptive/rank/PercentileTest.java   |  41 +++---
 .../stat/descriptive/summary/ProductTest.java   |   9 +-
 .../stat/descriptive/summary/SumLogTest.java    |   9 +-
 .../stat/descriptive/summary/SumSqTest.java     |   9 +-
 .../math4/stat/descriptive/summary/SumTest.java |   9 +-
 .../math4/stat/inference/BinomialTestTest.java  |   8 +-
 .../math4/stat/inference/ChiSquareTestTest.java |  17 +--
 .../commons/math4/stat/inference/GTestTest.java |  17 +--
 .../inference/KolmogorovSmirnovTestTest.java    |  11 +-
 .../stat/inference/MannWhitneyUTestTest.java    |   7 +-
 .../math4/stat/inference/OneWayAnovaTest.java   |   7 +-
 .../commons/math4/stat/inference/TTestTest.java |  11 +-
 .../math4/stat/inference/TestUtilsTest.java     |  26 ++--
 .../inference/WilcoxonSignedRankTestTest.java   |  11 +-
 .../stat/interval/AgrestiCoullIntervalTest.java |   8 +-
 .../BinomialConfidenceIntervalAbstractTest.java |   8 +-
 .../interval/ClopperPearsonIntervalTest.java    |   8 +-
 .../math4/stat/interval/IntervalUtilsTest.java  |   8 +-
 .../NormalApproximationIntervalTest.java        |   8 +-
 .../stat/interval/WilsonScoreIntervalTest.java  |   8 +-
 .../math4/stat/ranking/NaturalRankingTest.java  |  14 +-
 .../GLSMultipleLinearRegressionTest.java        |  24 ++--
 .../MillerUpdatingRegressionTest.java           |  15 +-
 .../MultipleLinearRegressionAbstractTest.java   |   8 +-
 .../OLSMultipleLinearRegressionTest.java        |  19 +--
 .../stat/regression/SimpleRegressionTest.java   |  14 +-
 .../transform/FastCosineTransformerTest.java    |  17 ++-
 .../transform/FastFourierTransformerTest.java   |  22 +--
 .../transform/FastHadamardTransformerTest.java  |   8 +-
 .../transform/FastSineTransformerTest.java      |  19 ++-
 .../transform/RealTransformerAbstractTest.java  |  14 +-
 .../commons/math4/util/ArithmeticUtilsTest.java |   9 +-
 .../commons/math4/util/BigRealFieldTest.java    |   6 +-
 .../apache/commons/math4/util/BigRealTest.java  |   8 +-
 .../commons/math4/util/CombinationsTest.java    |  11 +-
 .../math4/util/CombinatoricsUtilsTest.java      |  13 +-
 .../math4/util/ContinuedFractionTest.java       |   3 +-
 .../commons/math4/util/Decimal64Test.java       |   6 +-
 .../math4/util/DefaultTransformerTest.java      |  10 +-
 .../math4/util/DoubleArrayAbstractTest.java     |   5 +-
 .../util/FastMathStrictComparisonTest.java      |   6 +-
 .../apache/commons/math4/util/FastMathTest.java |  20 +--
 .../math4/util/FastMathTestPerformance.java     |   5 +-
 .../commons/math4/util/IncrementorTest.java     |   7 +-
 .../commons/math4/util/MathArraysTest.java      |  27 ++--
 .../commons/math4/util/MathUtilsTest.java       |  20 +--
 .../math4/util/MultidimensionalCounterTest.java |  10 +-
 .../math4/util/OpenIntToDoubleHashMapTest.java  |   4 +-
 .../commons/math4/util/OpenIntToFieldTest.java  |  11 +-
 .../org/apache/commons/math4/util/PairTest.java |   3 +-
 .../commons/math4/util/PrecisionTest.java       |  10 +-
 .../math4/util/ResizableDoubleArrayTest.java    |   9 +-
 .../org/apache/commons/math4/util/TestBean.java |   6 +-
 .../commons/math4/util/TransformerMapTest.java  |   7 +-
 .../special/RealFunctionValidation/README.txt   |   4 +-
 .../RealFunctionValidation.java                 |   4 +-
 .../RealFunctionValidation.sh                   |   8 +-
 .../maxima/special/reference/gamma.properties   |   2 +-
 .../maxima/special/reference/logBeta.properties |   2 +-
 .../special/reference/logGamma.properties       |   2 +-
 src/userguide/README                            |   4 +-
 .../userguide/ClusterAlgorithmComparison.java   |  36 ++---
 .../commons/math4/userguide/ExampleUtils.java   |   2 +-
 .../LowDiscrepancyGeneratorComparison.java      |  26 ++--
 .../userguide/RealDistributionComparison.java   |  36 ++---
 .../userguide/filter/CannonballExample.java     |  28 ++--
 .../filter/ConstantVoltageExample.java          |  28 ++--
 .../userguide/genetics/HelloWorldExample.java   |  28 ++--
 .../genetics/ImageEvolutionExample.java         |  18 +--
 .../math4/userguide/genetics/Polygon.java       |   8 +-
 .../userguide/genetics/PolygonChromosome.java   |   8 +-
 .../genetics/RandomPolygonMutation.java         |   6 +-
 .../userguide/geometry/GeometryExample.java     |  32 ++---
 .../math4/userguide/sofm/ChineseRings.java      |  12 +-
 .../userguide/sofm/ChineseRingsClassifier.java  |  40 +++---
 src/userguide/pom.xml                           |  26 +---
 1555 files changed, 10146 insertions(+), 8936 deletions(-)
----------------------------------------------------------------------



[76/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/PolynomialFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/PolynomialFitter.java b/src/main/java/org/apache/commons/math4/fitting/PolynomialFitter.java
index ec242c1..38ebe91 100644
--- a/src/main/java/org/apache/commons/math4/fitting/PolynomialFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/PolynomialFitter.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.MultivariateVectorOptimizer;
 
 /**
  * Polynomial fitting is a very simple case of {@link CurveFitter curve fitting}.
@@ -47,9 +47,9 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
      * increasing order of the polynomial's degree.
      * @param maxEval Maximum number of evaluations of the polynomial.
      * @return the coefficients of the polynomial that best fits the observed points.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException if
      * the number of evaluations exceeds {@code maxEval}.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
+     * @throws org.apache.commons.math4.exception.ConvergenceException
      * if the algorithm failed to converge.
      */
     public double[] fit(int maxEval, double[] guess) {
@@ -63,7 +63,7 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
      * @param guess First guess for the coefficients. They must be sorted in
      * increasing order of the polynomial's degree.
      * @return the coefficients of the polynomial that best fits the observed points.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
+     * @throws org.apache.commons.math4.exception.ConvergenceException
      * if the algorithm failed to converge.
      */
     public double[] fit(double[] guess) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/SimpleCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/SimpleCurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/SimpleCurveFitter.java
index 3f6b7d6..54f6cbf 100644
--- a/src/main/java/org/apache/commons/math4/fitting/SimpleCurveFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/SimpleCurveFitter.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.linear.DiagonalMatrix;
 
 /**
  * Fits points to a user-defined {@link ParametricUnivariateFunction function}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoint.java b/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoint.java
index 00292c9..a036098 100644
--- a/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoint.java
+++ b/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoint.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java b/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java
index 9eba337..520af88 100644
--- a/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java
+++ b/src/main/java/org/apache/commons/math4/fitting/WeightedObservedPoints.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.List;
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/AbstractEvaluation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/AbstractEvaluation.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/AbstractEvaluation.java
index b164380..2326b38 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/AbstractEvaluation.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/AbstractEvaluation.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.DecompositionSolver;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * An implementation of {@link Evaluation} that is designed for extension. All of the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/DenseWeightedEvaluation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/DenseWeightedEvaluation.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/DenseWeightedEvaluation.java
index 89f5f1f..a2f1335 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/DenseWeightedEvaluation.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/DenseWeightedEvaluation.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * Applies a dense weight matrix to an evaluation.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
index ceb5988..2430ec8 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/EvaluationRmsChecker.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Check if an optimization has converged based on the change in computed RMS.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java
index bc4503c..39c5803 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/GaussNewtonOptimizer.java
@@ -14,25 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.CholeskyDecomposition;
-import org.apache.commons.math3.linear.LUDecomposition;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.linear.SingularValueDecomposition;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.CholeskyDecomposition;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonPositiveDefiniteMatrixException;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.linear.SingularValueDecomposition;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.util.Incrementor;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Gauss-Newton least-squares solver.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java
index 1c09874..4744305 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresAdapter.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Incrementor;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * An adapter that delegates to another implementation of {@link LeastSquaresProblem}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresBuilder.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresBuilder.java
index 7b14b37..5f6beae 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresBuilder.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresBuilder.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
-
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointVectorValuePair;
+package org.apache.commons.math4.fitting.leastsquares;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.PointVectorValuePair;
 
 /**
  * A mutable builder for {@link LeastSquaresProblem}s.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java
index d483c26..8f96d87 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresFactory.java
@@ -14,25 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.AbstractOptimizationProblem;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.Pair;
+package org.apache.commons.math4.fitting.leastsquares;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.AbstractOptimizationProblem;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Incrementor;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * A Factory for creating {@link LeastSquaresProblem}s.
@@ -45,7 +45,7 @@ public class LeastSquaresFactory {
     private LeastSquaresFactory() {}
 
     /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
+     * Create a {@link org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem}
      * from the given elements. There will be no weights applied (unit weights).
      *
      * @param model          the model function. Produces the computed values.
@@ -87,7 +87,7 @@ public class LeastSquaresFactory {
     }
 
     /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
+     * Create a {@link org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem}
      * from the given elements. There will be no weights applied (unit weights).
      *
      * @param model          the model function. Produces the computed values.
@@ -116,7 +116,7 @@ public class LeastSquaresFactory {
     }
 
     /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
+     * Create a {@link org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem}
      * from the given elements.
      *
      * @param model          the model function. Produces the computed values.
@@ -145,7 +145,7 @@ public class LeastSquaresFactory {
     }
 
     /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
+     * Create a {@link org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem}
      * from the given elements.
      * <p>
      * This factory method is provided for continuity with previous interfaces. Newer

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresOptimizer.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresOptimizer.java
index 50d5b8a..79f09ab 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresOptimizer.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 /**
  * An algorithm that can be applied to a non-linear least squares problem.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresProblem.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresProblem.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresProblem.java
index 097ff81..dfc5b5e 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresProblem.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LeastSquaresProblem.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.OptimizationProblem;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.OptimizationProblem;
 
 /**
  * The data necessary to define a non-linear least squares problem.
@@ -67,7 +67,7 @@ public interface LeastSquaresProblem extends OptimizationProblem<LeastSquaresPro
      *
      * @param point the parameter values.
      * @return the model's value and derivative at the given point.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      *          if the maximal number of evaluations (of the model vector function) is
      *          exceeded.
      */
@@ -89,7 +89,7 @@ public interface LeastSquaresProblem extends OptimizationProblem<LeastSquaresPro
          *
          * @param threshold Singularity threshold.
          * @return the covariance matrix.
-         * @throws org.apache.commons.math3.linear.SingularMatrixException
+         * @throws org.apache.commons.math4.linear.SingularMatrixException
          *          if the covariance matrix cannot be computed (singular problem).
          */
         RealMatrix getCovariances(double threshold);
@@ -104,7 +104,7 @@ public interface LeastSquaresProblem extends OptimizationProblem<LeastSquaresPro
          * @param covarianceSingularityThreshold Singularity threshold (see {@link
          *                                       #getCovariances(double) computeCovariances}).
          * @return an estimate of the standard deviation of the optimized parameters
-         * @throws org.apache.commons.math3.linear.SingularMatrixException
+         * @throws org.apache.commons.math4.linear.SingularMatrixException
          *          if the covariance matrix cannot be computed.
          */
         RealVector getSigma(double covarianceSingularityThreshold);
@@ -121,7 +121,7 @@ public interface LeastSquaresProblem extends OptimizationProblem<LeastSquaresPro
          * Get the weighted Jacobian matrix.
          *
          * @return the weighted Jacobian: W<sup>1/2</sup> J.
-         * @throws org.apache.commons.math3.exception.DimensionMismatchException
+         * @throws org.apache.commons.math4.exception.DimensionMismatchException
          * if the Jacobian dimension does not match problem dimension.
          */
         RealMatrix getJacobian();
@@ -141,7 +141,7 @@ public interface LeastSquaresProblem extends OptimizationProblem<LeastSquaresPro
          * then multiplied by the square root of the weight matrix.
          *
          * @return the weighted residuals: W<sup>1/2</sup> K.
-         * @throws org.apache.commons.math3.exception.DimensionMismatchException
+         * @throws org.apache.commons.math4.exception.DimensionMismatchException
          * if the residuals have the wrong length.
          */
         RealVector getResiduals();

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
index 358d240..3e5ea1a 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/LevenbergMarquardtOptimizer.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Incrementor;
+import org.apache.commons.math4.util.Precision;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/MultivariateJacobianFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/MultivariateJacobianFunction.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/MultivariateJacobianFunction.java
index e673855..9f127ce 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/MultivariateJacobianFunction.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/MultivariateJacobianFunction.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * A interface for functions that compute a vector of values and can compute their

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java
index 698f86c..e01b750 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/OptimumImpl.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem.Evaluation;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * A pedantic implementation of {@link Optimum}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/ParameterValidator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/ParameterValidator.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/ParameterValidator.java
index d5b8529..915f322 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/ParameterValidator.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/ParameterValidator.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.linear.RealVector;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * Interface for validating a set of model parameters.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/ValueAndJacobianFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/ValueAndJacobianFunction.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/ValueAndJacobianFunction.java
index 180e328..dd88fee 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/ValueAndJacobianFunction.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/ValueAndJacobianFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;
 
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * A interface for functions that compute a vector of values and can compute their

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/leastsquares/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/leastsquares/package-info.java b/src/main/java/org/apache/commons/math4/fitting/leastsquares/package-info.java
index 98623b5..b565376 100644
--- a/src/main/java/org/apache/commons/math4/fitting/leastsquares/package-info.java
+++ b/src/main/java/org/apache/commons/math4/fitting/leastsquares/package-info.java
@@ -18,22 +18,22 @@
 /**
  * This package provides algorithms that minimize the residuals
  * between observations and model values.
- * The {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer
+ * The {@link org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer
  * least-squares optimizers} minimize the distance (called
  * <em>cost</em> or <em>&chi;<sup>2</sup></em>) between model and
  * observations.
  *
  * <br/>
  * Algorithms in this category need access to a <em>problem</em>
- * (represented by a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem
+ * (represented by a {@link org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem
  * LeastSquaresProblem}).
  * Such a model predicts a set of values which the algorithm tries to match
  * with a set of given set of observed values.
  * <br/>
  * The problem can be created progressively using a {@link
- * org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder builder} or it can
- * be created at once using a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresFactory
+ * org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder builder} or it can
+ * be created at once using a {@link org.apache.commons.math4.fitting.leastsquares.LeastSquaresFactory
  * factory}.
  * @since 3.3
  */
-package org.apache.commons.math3.fitting.leastsquares;
+package org.apache.commons.math4.fitting.leastsquares;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/package-info.java b/src/main/java/org/apache/commons/math4/fitting/package-info.java
index 460e3f7..1cc86f1 100644
--- a/src/main/java/org/apache/commons/math4/fitting/package-info.java
+++ b/src/main/java/org/apache/commons/math4/fitting/package-info.java
@@ -23,4 +23,4 @@
  * were the objective function is the squared sum of the residuals
  * \( f(x_i) - y_i \) for observed points \( (x_i, y_i) \).
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/AbstractFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/AbstractFormat.java b/src/main/java/org/apache/commons/math4/fraction/AbstractFormat.java
index fcb9d41..1359c0e 100644
--- a/src/main/java/org/apache/commons/math4/fraction/AbstractFormat.java
+++ b/src/main/java/org/apache/commons/math4/fraction/AbstractFormat.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.io.Serializable;
 import java.text.FieldPosition;
@@ -23,8 +23,8 @@ import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Common part shared by both {@link FractionFormat} and {@link BigFractionFormat}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/BigFraction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/BigFraction.java b/src/main/java/org/apache/commons/math4/fraction/BigFraction.java
index e16c593..5c2f24b 100644
--- a/src/main/java/org/apache/commons/math4/fraction/BigFraction.java
+++ b/src/main/java/org/apache/commons/math4/fraction/BigFraction.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Representation of a rational number without any overflow. This class is

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/BigFractionField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/BigFractionField.java b/src/main/java/org/apache/commons/math4/fraction/BigFractionField.java
index 81170f8..4cf4d8f 100644
--- a/src/main/java/org/apache/commons/math4/fraction/BigFractionField.java
+++ b/src/main/java/org/apache/commons/math4/fraction/BigFractionField.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Representation of the fractional numbers  without any overflow field.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/BigFractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/BigFractionFormat.java b/src/main/java/org/apache/commons/math4/fraction/BigFractionFormat.java
index 196dcd5..a940a9d 100644
--- a/src/main/java/org/apache/commons/math4/fraction/BigFractionFormat.java
+++ b/src/main/java/org/apache/commons/math4/fraction/BigFractionFormat.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.io.Serializable;
 import java.math.BigInteger;
@@ -24,9 +24,9 @@ import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Formats a BigFraction number in proper format or improper format.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/Fraction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/Fraction.java b/src/main/java/org/apache/commons/math4/fraction/Fraction.java
index 1752043..7c193f3 100644
--- a/src/main/java/org/apache/commons/math4/fraction/Fraction.java
+++ b/src/main/java/org/apache/commons/math4/fraction/Fraction.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.io.Serializable;
 import java.math.BigInteger;
 
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Representation of a rational number.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/FractionConversionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/FractionConversionException.java b/src/main/java/org/apache/commons/math4/fraction/FractionConversionException.java
index a16a97a..f74a7cf 100644
--- a/src/main/java/org/apache/commons/math4/fraction/FractionConversionException.java
+++ b/src/main/java/org/apache/commons/math4/fraction/FractionConversionException.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Error thrown when a double value cannot be converted to a fraction

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/FractionField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/FractionField.java b/src/main/java/org/apache/commons/math4/fraction/FractionField.java
index 2928509..8a49265 100644
--- a/src/main/java/org/apache/commons/math4/fraction/FractionField.java
+++ b/src/main/java/org/apache/commons/math4/fraction/FractionField.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Representation of the fractional numbers field.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/FractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/FractionFormat.java b/src/main/java/org/apache/commons/math4/fraction/FractionFormat.java
index 06c5a10..9c8b1fe 100644
--- a/src/main/java/org/apache/commons/math4/fraction/FractionFormat.java
+++ b/src/main/java/org/apache/commons/math4/fraction/FractionFormat.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Formats a Fraction number in proper format or improper format.  The number

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/ProperBigFractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/ProperBigFractionFormat.java b/src/main/java/org/apache/commons/math4/fraction/ProperBigFractionFormat.java
index 4f84acd..ae601c8 100644
--- a/src/main/java/org/apache/commons/math4/fraction/ProperBigFractionFormat.java
+++ b/src/main/java/org/apache/commons/math4/fraction/ProperBigFractionFormat.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.math.BigInteger;
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Formats a BigFraction number in proper format.  The number format for each of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/ProperFractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/ProperFractionFormat.java b/src/main/java/org/apache/commons/math4/fraction/ProperFractionFormat.java
index 9dc6778..1843f8a 100644
--- a/src/main/java/org/apache/commons/math4/fraction/ProperFractionFormat.java
+++ b/src/main/java/org/apache/commons/math4/fraction/ProperFractionFormat.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Formats a Fraction number in proper format.  The number format for each of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fraction/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fraction/package-info.java b/src/main/java/org/apache/commons/math4/fraction/package-info.java
index f5425c6..2547102 100644
--- a/src/main/java/org/apache/commons/math4/fraction/package-info.java
+++ b/src/main/java/org/apache/commons/math4/fraction/package-info.java
@@ -19,4 +19,4 @@
  *    Fraction number type and fraction number formatting.
  *
  */
-package org.apache.commons.math3.fraction;
+package org.apache.commons.math4.fraction;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java b/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java
index 60450ba..e470d34 100644
--- a/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java
+++ b/src/main/java/org/apache/commons/math4/genetics/AbstractListChromosome.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java b/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java
index 47d317c..e1efea9 100644
--- a/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java
+++ b/src/main/java/org/apache/commons/math4/genetics/BinaryChromosome.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/BinaryMutation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/BinaryMutation.java b/src/main/java/org/apache/commons/math4/genetics/BinaryMutation.java
index 0802fc6..e2ba8c2 100644
--- a/src/main/java/org/apache/commons/math4/genetics/BinaryMutation.java
+++ b/src/main/java/org/apache/commons/math4/genetics/BinaryMutation.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Mutation for {@link BinaryChromosome}s. Randomly changes one gene.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/Chromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/Chromosome.java b/src/main/java/org/apache/commons/math4/genetics/Chromosome.java
index 22e4750..09b3392 100644
--- a/src/main/java/org/apache/commons/math4/genetics/Chromosome.java
+++ b/src/main/java/org/apache/commons/math4/genetics/Chromosome.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 /**
  * Individual in a population. Chromosomes are compared based on their fitness.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/ChromosomePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/ChromosomePair.java b/src/main/java/org/apache/commons/math4/genetics/ChromosomePair.java
index ef8769d..dc76451 100644
--- a/src/main/java/org/apache/commons/math4/genetics/ChromosomePair.java
+++ b/src/main/java/org/apache/commons/math4/genetics/ChromosomePair.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 /**
  * A pair of {@link Chromosome} objects.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/CrossoverPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/CrossoverPolicy.java b/src/main/java/org/apache/commons/math4/genetics/CrossoverPolicy.java
index 9af56f1..e6a2b23 100644
--- a/src/main/java/org/apache/commons/math4/genetics/CrossoverPolicy.java
+++ b/src/main/java/org/apache/commons/math4/genetics/CrossoverPolicy.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Policy used to create a pair of new chromosomes by performing a crossover

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java b/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java
index 364b16b..021f61a 100644
--- a/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java
+++ b/src/main/java/org/apache/commons/math4/genetics/CycleCrossover.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Cycle Crossover [CX] builds offspring from <b>ordered</b> chromosomes by identifying cycles

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/ElitisticListPopulation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/ElitisticListPopulation.java b/src/main/java/org/apache/commons/math4/genetics/ElitisticListPopulation.java
index a426bc2..b7834ff 100644
--- a/src/main/java/org/apache/commons/math4/genetics/ElitisticListPopulation.java
+++ b/src/main/java/org/apache/commons/math4/genetics/ElitisticListPopulation.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Population of chromosomes which uses elitism (certain percentage of the best

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/Fitness.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/Fitness.java b/src/main/java/org/apache/commons/math4/genetics/Fitness.java
index 40d6192..15ce9c5 100644
--- a/src/main/java/org/apache/commons/math4/genetics/Fitness.java
+++ b/src/main/java/org/apache/commons/math4/genetics/Fitness.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 /**
  * Fitness of a chromosome.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/FixedElapsedTime.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/FixedElapsedTime.java b/src/main/java/org/apache/commons/math4/genetics/FixedElapsedTime.java
index 3879a8c..9eafc0b 100644
--- a/src/main/java/org/apache/commons/math4/genetics/FixedElapsedTime.java
+++ b/src/main/java/org/apache/commons/math4/genetics/FixedElapsedTime.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /**
  * Stops after a fixed amount of time has elapsed.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/FixedGenerationCount.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/FixedGenerationCount.java b/src/main/java/org/apache/commons/math4/genetics/FixedGenerationCount.java
index 64362fc..70ae10d 100644
--- a/src/main/java/org/apache/commons/math4/genetics/FixedGenerationCount.java
+++ b/src/main/java/org/apache/commons/math4/genetics/FixedGenerationCount.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /**
  * Stops after a fixed number of generations. Each time {@link #isSatisfied(Population)} is invoked, a generation

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java b/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java
index 2f3d684..bf77606 100644
--- a/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java
+++ b/src/main/java/org/apache/commons/math4/genetics/GeneticAlgorithm.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * Implementation of a genetic algorithm. All factors that govern the operation

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/InvalidRepresentationException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/InvalidRepresentationException.java b/src/main/java/org/apache/commons/math4/genetics/InvalidRepresentationException.java
index 7ca3a9a..7cac69b 100644
--- a/src/main/java/org/apache/commons/math4/genetics/InvalidRepresentationException.java
+++ b/src/main/java/org/apache/commons/math4/genetics/InvalidRepresentationException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * Exception indicating that the representation of a chromosome is not valid.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java b/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java
index ce45234..b0358c9 100644
--- a/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java
+++ b/src/main/java/org/apache/commons/math4/genetics/ListPopulation.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -22,11 +22,11 @@ import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Population of chromosomes represented by a {@link List}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/MutationPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/MutationPolicy.java b/src/main/java/org/apache/commons/math4/genetics/MutationPolicy.java
index b981881..999d14b 100644
--- a/src/main/java/org/apache/commons/math4/genetics/MutationPolicy.java
+++ b/src/main/java/org/apache/commons/math4/genetics/MutationPolicy.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Algorithm used to mutate a chromosome.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java b/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java
index a1a7d99..0b16c95 100644
--- a/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java
+++ b/src/main/java/org/apache/commons/math4/genetics/NPointCrossover.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * N-point crossover policy. For each iteration a random crossover point is

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java b/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java
index b1ea47b..03559d2 100644
--- a/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java
+++ b/src/main/java/org/apache/commons/math4/genetics/OnePointCrossover.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java b/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java
index e796f53..f9dbb2f 100644
--- a/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java
+++ b/src/main/java/org/apache/commons/math4/genetics/OrderedCrossover.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -22,11 +22,11 @@ import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Order 1 Crossover [OX1] builds offspring from <b>ordered</b> chromosomes by copying a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/PermutationChromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/PermutationChromosome.java b/src/main/java/org/apache/commons/math4/genetics/PermutationChromosome.java
index d02cf2c..3bc6748 100644
--- a/src/main/java/org/apache/commons/math4/genetics/PermutationChromosome.java
+++ b/src/main/java/org/apache/commons/math4/genetics/PermutationChromosome.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.List;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/Population.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/Population.java b/src/main/java/org/apache/commons/math4/genetics/Population.java
index 8cc6d8b..0c3e365 100644
--- a/src/main/java/org/apache/commons/math4/genetics/Population.java
+++ b/src/main/java/org/apache/commons/math4/genetics/Population.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/RandomKey.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/RandomKey.java b/src/main/java/org/apache/commons/math4/genetics/RandomKey.java
index 52db4a7..0eb679a 100644
--- a/src/main/java/org/apache/commons/math4/genetics/RandomKey.java
+++ b/src/main/java/org/apache/commons/math4/genetics/RandomKey.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -22,9 +22,9 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Random Key chromosome is used for permutation representation. It is a vector

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/RandomKeyMutation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/RandomKeyMutation.java b/src/main/java/org/apache/commons/math4/genetics/RandomKeyMutation.java
index 9fb16fb..54edfbb 100644
--- a/src/main/java/org/apache/commons/math4/genetics/RandomKeyMutation.java
+++ b/src/main/java/org/apache/commons/math4/genetics/RandomKeyMutation.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Mutation operator for {@link RandomKey}s. Changes a randomly chosen element

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/SelectionPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/SelectionPolicy.java b/src/main/java/org/apache/commons/math4/genetics/SelectionPolicy.java
index 5240f75..156653b 100644
--- a/src/main/java/org/apache/commons/math4/genetics/SelectionPolicy.java
+++ b/src/main/java/org/apache/commons/math4/genetics/SelectionPolicy.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Algorithm used to select a chromosome pair from a population.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/StoppingCondition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/StoppingCondition.java b/src/main/java/org/apache/commons/math4/genetics/StoppingCondition.java
index 0e21628..094b697 100644
--- a/src/main/java/org/apache/commons/math4/genetics/StoppingCondition.java
+++ b/src/main/java/org/apache/commons/math4/genetics/StoppingCondition.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 /**
  * Algorithm used to determine when to stop evolution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java b/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java
index 95051ee..871c17d 100644
--- a/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java
+++ b/src/main/java/org/apache/commons/math4/genetics/TournamentSelection.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Tournament selection scheme. Each of the two selected chromosomes is selected

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java b/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java
index 2a63bbb..1427d24 100644
--- a/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java
+++ b/src/main/java/org/apache/commons/math4/genetics/UniformCrossover.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * Perform Uniform Crossover [UX] on the specified chromosomes. A fixed mixing

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/genetics/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/genetics/package-info.java b/src/main/java/org/apache/commons/math4/genetics/package-info.java
index 5c145e8..02eb5c9 100644
--- a/src/main/java/org/apache/commons/math4/genetics/package-info.java
+++ b/src/main/java/org/apache/commons/math4/genetics/package-info.java
@@ -17,4 +17,4 @@
 /**
  * This package provides Genetic Algorithms components and implementations.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/Point.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/Point.java b/src/main/java/org/apache/commons/math4/geometry/Point.java
index 1504d2e..d45421a 100644
--- a/src/main/java/org/apache/commons/math4/geometry/Point.java
+++ b/src/main/java/org/apache/commons/math4/geometry/Point.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry;
+package org.apache.commons.math4.geometry;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/Space.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/Space.java b/src/main/java/org/apache/commons/math4/geometry/Space.java
index 7f72439..8413c7c 100644
--- a/src/main/java/org/apache/commons/math4/geometry/Space.java
+++ b/src/main/java/org/apache/commons/math4/geometry/Space.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry;
+package org.apache.commons.math4.geometry;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
 
 /** This interface represents a generic space, with affine and vectorial counterparts.
  * @see Vector

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/Vector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/Vector.java b/src/main/java/org/apache/commons/math4/geometry/Vector.java
index f22f7a1..9e740b3 100644
--- a/src/main/java/org/apache/commons/math4/geometry/Vector.java
+++ b/src/main/java/org/apache/commons/math4/geometry/Vector.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry;
+package org.apache.commons.math4.geometry;
 
 import java.text.NumberFormat;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathArithmeticException;
 
 /** This interface represents a generic vector in a vectorial space or a point in an affine space.
  * @param <S> Type of the space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/VectorFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/VectorFormat.java b/src/main/java/org/apache/commons/math4/geometry/VectorFormat.java
index b58d765..7278a2f 100644
--- a/src/main/java/org/apache/commons/math4/geometry/VectorFormat.java
+++ b/src/main/java/org/apache/commons/math4/geometry/VectorFormat.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry;
+package org.apache.commons.math4.geometry;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.util.CompositeFormat;
-import org.apache.commons.math3.exception.MathParseException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.util.CompositeFormat;
 
 /**
  * Formats a vector in components list format "{x; y; ...}".

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/enclosing/Encloser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/enclosing/Encloser.java b/src/main/java/org/apache/commons/math4/geometry/enclosing/Encloser.java
index 9b2588a..5997779 100644
--- a/src/main/java/org/apache/commons/math4/geometry/enclosing/Encloser.java
+++ b/src/main/java/org/apache/commons/math4/geometry/enclosing/Encloser.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.enclosing;
+package org.apache.commons.math4.geometry.enclosing;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** Interface for algorithms computing enclosing balls.
  * @param <S> Space type.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java b/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java
index eedbd46..64caf28 100644
--- a/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java
+++ b/src/main/java/org/apache/commons/math4/geometry/enclosing/EnclosingBall.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.enclosing;
+package org.apache.commons.math4.geometry.enclosing;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** This class represents a ball enclosing some points.
  * @param <S> Space type.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/enclosing/SupportBallGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/enclosing/SupportBallGenerator.java b/src/main/java/org/apache/commons/math4/geometry/enclosing/SupportBallGenerator.java
index 3a0f875..9886d97 100644
--- a/src/main/java/org/apache/commons/math4/geometry/enclosing/SupportBallGenerator.java
+++ b/src/main/java/org/apache/commons/math4/geometry/enclosing/SupportBallGenerator.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.enclosing;
+package org.apache.commons.math4.geometry.enclosing;
 
 import java.util.List;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** Interface for generating balls based on support points.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java b/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java
index 987e7d9..0891d99 100644
--- a/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java
+++ b/src/main/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.enclosing;
+package org.apache.commons.math4.geometry.enclosing;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /** Class implementing Emo Welzl algorithm to find the smallest enclosing ball in linear time.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/enclosing/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/enclosing/package-info.java b/src/main/java/org/apache/commons/math4/geometry/enclosing/package-info.java
index 20462a1..7456a41 100644
--- a/src/main/java/org/apache/commons/math4/geometry/enclosing/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/enclosing/package-info.java
@@ -21,4 +21,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.enclosing;
+package org.apache.commons.math4.geometry.enclosing;


[48/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.java
deleted file mode 100644
index 7c45d18..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.java
+++ /dev/null
@@ -1,1195 +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.analysis.differentiation;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/** Class representing both the value and the differentials of a function.
- * <p>This class is the workhorse of the differentiation package.</p>
- * <p>This class is an implementation of the extension to Rall's
- * numbers described in Dan Kalman's paper <a
- * href="http://www1.american.edu/cas/mathstat/People/kalman/pdffiles/mmgautodiff.pdf">Doubly
- * Recursive Multivariate Automatic Differentiation</a>, Mathematics Magazine, vol. 75,
- * no. 3, June 2002.</p>. Rall's numbers are an extension to the real numbers used
- * throughout mathematical expressions; they hold the derivative together with the
- * value of a function. Dan Kalman's derivative structures hold all partial derivatives
- * up to any specified order, with respect to any number of free parameters. Rall's
- * numbers therefore can be seen as derivative structures for order one derivative and
- * one free parameter, and real numbers can be seen as derivative structures with zero
- * order derivative and no free parameters.</p>
- * <p>{@link DerivativeStructure} instances can be used directly thanks to
- * the arithmetic operators to the mathematical functions provided as
- * methods by this class (+, -, *, /, %, sin, cos ...).</p>
- * <p>Implementing complex expressions by hand using these classes is
- * a tedious and error-prone task but has the advantage of having no limitation
- * on the derivation order despite no requiring users to compute the derivatives by
- * themselves. Implementing complex expression can also be done by developing computation
- * code using standard primitive double values and to use {@link
- * UnivariateFunctionDifferentiator differentiators} to create the {@link
- * DerivativeStructure}-based instances. This method is simpler but may be limited in
- * the accuracy and derivation orders and may be computationally intensive (this is
- * typically the case for {@link FiniteDifferencesDifferentiator finite differences
- * differentiator}.</p>
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @see DSCompiler
- * @since 3.1
- */
-public class DerivativeStructure implements RealFieldElement<DerivativeStructure>, Serializable {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20120730L;
-
-    /** Compiler for the current dimensions. */
-    private transient DSCompiler compiler;
-
-    /** Combined array holding all values. */
-    private final double[] data;
-
-    /** Build an instance with all values and derivatives set to 0.
-     * @param compiler compiler to use for computation
-     */
-    private DerivativeStructure(final DSCompiler compiler) {
-        this.compiler = compiler;
-        this.data     = new double[compiler.getSize()];
-    }
-
-    /** Build an instance with all values and derivatives set to 0.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @throws NumberIsTooLargeException if order is too large
-     */
-    public DerivativeStructure(final int parameters, final int order)
-        throws NumberIsTooLargeException {
-        this(DSCompiler.getCompiler(parameters, order));
-    }
-
-    /** Build an instance representing a constant value.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param value value of the constant
-     * @throws NumberIsTooLargeException if order is too large
-     * @see #DerivativeStructure(int, int, int, double)
-     */
-    public DerivativeStructure(final int parameters, final int order, final double value)
-        throws NumberIsTooLargeException {
-        this(parameters, order);
-        this.data[0] = value;
-    }
-
-    /** Build an instance representing a variable.
-     * <p>Instances built using this constructor are considered
-     * to be the free variables with respect to which differentials
-     * are computed. As such, their differential with respect to
-     * themselves is +1.</p>
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param index index of the variable (from 0 to {@code parameters - 1})
-     * @param value value of the variable
-     * @exception NumberIsTooLargeException if {@code index >= parameters}.
-     * @see #DerivativeStructure(int, int, double)
-     */
-    public DerivativeStructure(final int parameters, final int order,
-                               final int index, final double value)
-        throws NumberIsTooLargeException {
-        this(parameters, order, value);
-
-        if (index >= parameters) {
-            throw new NumberIsTooLargeException(index, parameters, false);
-        }
-
-        if (order > 0) {
-            // the derivative of the variable with respect to itself is 1.
-            data[DSCompiler.getCompiler(index, order).getSize()] = 1.0;
-        }
-
-    }
-
-    /** Linear combination constructor.
-     * The derivative structure built will be a1 * ds1 + a2 * ds2
-     * @param a1 first scale factor
-     * @param ds1 first base (unscaled) derivative structure
-     * @param a2 second scale factor
-     * @param ds2 second base (unscaled) derivative structure
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
-                               final double a2, final DerivativeStructure ds2)
-        throws DimensionMismatchException {
-        this(ds1.compiler);
-        compiler.checkCompatibility(ds2.compiler);
-        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0, data, 0);
-    }
-
-    /** Linear combination constructor.
-     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3
-     * @param a1 first scale factor
-     * @param ds1 first base (unscaled) derivative structure
-     * @param a2 second scale factor
-     * @param ds2 second base (unscaled) derivative structure
-     * @param a3 third scale factor
-     * @param ds3 third base (unscaled) derivative structure
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
-                               final double a2, final DerivativeStructure ds2,
-                               final double a3, final DerivativeStructure ds3)
-        throws DimensionMismatchException {
-        this(ds1.compiler);
-        compiler.checkCompatibility(ds2.compiler);
-        compiler.checkCompatibility(ds3.compiler);
-        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0, a3, ds3.data, 0, data, 0);
-    }
-
-    /** Linear combination constructor.
-     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
-     * @param a1 first scale factor
-     * @param ds1 first base (unscaled) derivative structure
-     * @param a2 second scale factor
-     * @param ds2 second base (unscaled) derivative structure
-     * @param a3 third scale factor
-     * @param ds3 third base (unscaled) derivative structure
-     * @param a4 fourth scale factor
-     * @param ds4 fourth base (unscaled) derivative structure
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
-                               final double a2, final DerivativeStructure ds2,
-                               final double a3, final DerivativeStructure ds3,
-                               final double a4, final DerivativeStructure ds4)
-        throws DimensionMismatchException {
-        this(ds1.compiler);
-        compiler.checkCompatibility(ds2.compiler);
-        compiler.checkCompatibility(ds3.compiler);
-        compiler.checkCompatibility(ds4.compiler);
-        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0,
-                                   a3, ds3.data, 0, a4, ds4.data, 0,
-                                   data, 0);
-    }
-
-    /** Build an instance from all its derivatives.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param derivatives derivatives sorted according to
-     * {@link DSCompiler#getPartialDerivativeIndex(int...)}
-     * @exception DimensionMismatchException if derivatives array does not match the
-     * {@link DSCompiler#getSize() size} expected by the compiler
-     * @throws NumberIsTooLargeException if order is too large
-     * @see #getAllDerivatives()
-     */
-    public DerivativeStructure(final int parameters, final int order, final double ... derivatives)
-        throws DimensionMismatchException, NumberIsTooLargeException {
-        this(parameters, order);
-        if (derivatives.length != data.length) {
-            throw new DimensionMismatchException(derivatives.length, data.length);
-        }
-        System.arraycopy(derivatives, 0, data, 0, data.length);
-    }
-
-    /** Copy constructor.
-     * @param ds instance to copy
-     */
-    private DerivativeStructure(final DerivativeStructure ds) {
-        this.compiler = ds.compiler;
-        this.data     = ds.data.clone();
-    }
-
-    /** Get the number of free parameters.
-     * @return number of free parameters
-     */
-    public int getFreeParameters() {
-        return compiler.getFreeParameters();
-    }
-
-    /** Get the derivation order.
-     * @return derivation order
-     */
-    public int getOrder() {
-        return compiler.getOrder();
-    }
-
-    /** Create a constant compatible with instance order and number of parameters.
-     * <p>
-     * This method is a convenience factory method, it simply calls
-     * {@code new DerivativeStructure(getFreeParameters(), getOrder(), c)}
-     * </p>
-     * @param c value of the constant
-     * @return a constant compatible with instance order and number of parameters
-     * @see #DerivativeStructure(int, int, double)
-     * @since 3.3
-     */
-    public DerivativeStructure createConstant(final double c) {
-        return new DerivativeStructure(getFreeParameters(), getOrder(), c);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public double getReal() {
-        return data[0];
-    }
-
-    /** Get the value part of the derivative structure.
-     * @return value part of the derivative structure
-     * @see #getPartialDerivative(int...)
-     */
-    public double getValue() {
-        return data[0];
-    }
-
-    /** Get a partial derivative.
-     * @param orders derivation orders with respect to each variable (if all orders are 0,
-     * the value is returned)
-     * @return partial derivative
-     * @see #getValue()
-     * @exception DimensionMismatchException if the numbers of variables does not
-     * match the instance
-     * @exception NumberIsTooLargeException if sum of derivation orders is larger
-     * than the instance limits
-     */
-    public double getPartialDerivative(final int ... orders)
-        throws DimensionMismatchException, NumberIsTooLargeException {
-        return data[compiler.getPartialDerivativeIndex(orders)];
-    }
-
-    /** Get all partial derivatives.
-     * @return a fresh copy of partial derivatives, in an array sorted according to
-     * {@link DSCompiler#getPartialDerivativeIndex(int...)}
-     */
-    public double[] getAllDerivatives() {
-        return data.clone();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure add(final double a) {
-        final DerivativeStructure ds = new DerivativeStructure(this);
-        ds.data[0] += a;
-        return ds;
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     */
-    public DerivativeStructure add(final DerivativeStructure a)
-        throws DimensionMismatchException {
-        compiler.checkCompatibility(a.compiler);
-        final DerivativeStructure ds = new DerivativeStructure(this);
-        compiler.add(data, 0, a.data, 0, ds.data, 0);
-        return ds;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure subtract(final double a) {
-        return add(-a);
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     */
-    public DerivativeStructure subtract(final DerivativeStructure a)
-        throws DimensionMismatchException {
-        compiler.checkCompatibility(a.compiler);
-        final DerivativeStructure ds = new DerivativeStructure(this);
-        compiler.subtract(data, 0, a.data, 0, ds.data, 0);
-        return ds;
-    }
-
-    /** {@inheritDoc} */
-    public DerivativeStructure multiply(final int n) {
-        return multiply((double) n);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure multiply(final double a) {
-        final DerivativeStructure ds = new DerivativeStructure(this);
-        for (int i = 0; i < ds.data.length; ++i) {
-            ds.data[i] *= a;
-        }
-        return ds;
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     */
-    public DerivativeStructure multiply(final DerivativeStructure a)
-        throws DimensionMismatchException {
-        compiler.checkCompatibility(a.compiler);
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.multiply(data, 0, a.data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure divide(final double a) {
-        final DerivativeStructure ds = new DerivativeStructure(this);
-        for (int i = 0; i < ds.data.length; ++i) {
-            ds.data[i] /= a;
-        }
-        return ds;
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     */
-    public DerivativeStructure divide(final DerivativeStructure a)
-        throws DimensionMismatchException {
-        compiler.checkCompatibility(a.compiler);
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.divide(data, 0, a.data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    public DerivativeStructure remainder(final double a) {
-        final DerivativeStructure ds = new DerivativeStructure(this);
-        ds.data[0] = FastMath.IEEEremainder(ds.data[0], a);
-        return ds;
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure remainder(final DerivativeStructure a)
-        throws DimensionMismatchException {
-        compiler.checkCompatibility(a.compiler);
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.remainder(data, 0, a.data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    public DerivativeStructure negate() {
-        final DerivativeStructure ds = new DerivativeStructure(compiler);
-        for (int i = 0; i < ds.data.length; ++i) {
-            ds.data[i] = -data[i];
-        }
-        return ds;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure abs() {
-        if (Double.doubleToLongBits(data[0]) < 0) {
-            // we use the bits representation to also handle -0.0
-            return negate();
-        } else {
-            return this;
-        }
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure ceil() {
-        return new DerivativeStructure(compiler.getFreeParameters(),
-                                       compiler.getOrder(),
-                                       FastMath.ceil(data[0]));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure floor() {
-        return new DerivativeStructure(compiler.getFreeParameters(),
-                                       compiler.getOrder(),
-                                       FastMath.floor(data[0]));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure rint() {
-        return new DerivativeStructure(compiler.getFreeParameters(),
-                                       compiler.getOrder(),
-                                       FastMath.rint(data[0]));
-    }
-
-    /** {@inheritDoc} */
-    public long round() {
-        return FastMath.round(data[0]);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure signum() {
-        return new DerivativeStructure(compiler.getFreeParameters(),
-                                       compiler.getOrder(),
-                                       FastMath.signum(data[0]));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure copySign(final DerivativeStructure sign){
-        long m = Double.doubleToLongBits(data[0]);
-        long s = Double.doubleToLongBits(sign.data[0]);
-        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
-            return this;
-        }
-        return negate(); // flip sign
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure copySign(final double sign) {
-        long m = Double.doubleToLongBits(data[0]);
-        long s = Double.doubleToLongBits(sign);
-        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
-            return this;
-        }
-        return negate(); // flip sign
-    }
-
-    /**
-     * Return the exponent of the instance value, removing the bias.
-     * <p>
-     * For double numbers of the form 2<sup>x</sup>, the unbiased
-     * exponent is exactly x.
-     * </p>
-     * @return exponent for instance in IEEE754 representation, without bias
-     */
-    public int getExponent() {
-        return FastMath.getExponent(data[0]);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure scalb(final int n) {
-        final DerivativeStructure ds = new DerivativeStructure(compiler);
-        for (int i = 0; i < ds.data.length; ++i) {
-            ds.data[i] = FastMath.scalb(data[i], n);
-        }
-        return ds;
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure hypot(final DerivativeStructure y)
-        throws DimensionMismatchException {
-
-        compiler.checkCompatibility(y.compiler);
-
-        if (Double.isInfinite(data[0]) || Double.isInfinite(y.data[0])) {
-            return new DerivativeStructure(compiler.getFreeParameters(),
-                                           compiler.getFreeParameters(),
-                                           Double.POSITIVE_INFINITY);
-        } else if (Double.isNaN(data[0]) || Double.isNaN(y.data[0])) {
-            return new DerivativeStructure(compiler.getFreeParameters(),
-                                           compiler.getFreeParameters(),
-                                           Double.NaN);
-        } else {
-
-            final int expX = getExponent();
-            final int expY = y.getExponent();
-            if (expX > expY + 27) {
-                // y is neglectible with respect to x
-                return abs();
-            } else if (expY > expX + 27) {
-                // x is neglectible with respect to y
-                return y.abs();
-            } else {
-
-                // find an intermediate scale to avoid both overflow and underflow
-                final int middleExp = (expX + expY) / 2;
-
-                // scale parameters without losing precision
-                final DerivativeStructure scaledX = scalb(-middleExp);
-                final DerivativeStructure scaledY = y.scalb(-middleExp);
-
-                // compute scaled hypotenuse
-                final DerivativeStructure scaledH =
-                        scaledX.multiply(scaledX).add(scaledY.multiply(scaledY)).sqrt();
-
-                // remove scaling
-                return scaledH.scalb(middleExp);
-
-            }
-
-        }
-    }
-
-    /**
-     * Returns the hypotenuse of a triangle with sides {@code x} and {@code y}
-     * - sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)<br/>
-     * avoiding intermediate overflow or underflow.
-     *
-     * <ul>
-     * <li> If either argument is infinite, then the result is positive infinity.</li>
-     * <li> else, if either argument is NaN then the result is NaN.</li>
-     * </ul>
-     *
-     * @param x a value
-     * @param y a value
-     * @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public static DerivativeStructure hypot(final DerivativeStructure x, final DerivativeStructure y)
-        throws DimensionMismatchException {
-        return x.hypot(y);
-    }
-
-    /** Compute composition of the instance by a univariate function.
-     * @param f array of value and derivatives of the function at
-     * the current point (i.e. [f({@link #getValue()}),
-     * f'({@link #getValue()}), f''({@link #getValue()})...]).
-     * @return f(this)
-     * @exception DimensionMismatchException if the number of derivatives
-     * in the array is not equal to {@link #getOrder() order} + 1
-     */
-    public DerivativeStructure compose(final double ... f)
-        throws DimensionMismatchException {
-        if (f.length != getOrder() + 1) {
-            throw new DimensionMismatchException(f.length, getOrder() + 1);
-        }
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.compose(data, 0, f, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    public DerivativeStructure reciprocal() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.pow(data, 0, -1, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure sqrt() {
-        return rootN(2);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure cbrt() {
-        return rootN(3);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure rootN(final int n) {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.rootN(data, 0, n, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    public Field<DerivativeStructure> getField() {
-        return new Field<DerivativeStructure>() {
-
-            /** {@inheritDoc} */
-            public DerivativeStructure getZero() {
-                return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 0.0);
-            }
-
-            /** {@inheritDoc} */
-            public DerivativeStructure getOne() {
-                return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 1.0);
-            }
-
-            /** {@inheritDoc} */
-            public Class<? extends FieldElement<DerivativeStructure>> getRuntimeClass() {
-                return DerivativeStructure.class;
-            }
-
-        };
-    }
-
-    /** Compute a<sup>x</sup> where a is a double and x a {@link DerivativeStructure}
-     * @param a number to exponentiate
-     * @param x power to apply
-     * @return a<sup>x</sup>
-     * @since 3.3
-     */
-    public static DerivativeStructure pow(final double a, final DerivativeStructure x) {
-        final DerivativeStructure result = new DerivativeStructure(x.compiler);
-        x.compiler.pow(a, x.data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure pow(final double p) {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.pow(data, 0, p, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure pow(final int n) {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.pow(data, 0, n, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure pow(final DerivativeStructure e)
-        throws DimensionMismatchException {
-        compiler.checkCompatibility(e.compiler);
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.pow(data, 0, e.data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure exp() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.exp(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure expm1() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.expm1(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure log() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.log(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure log1p() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.log1p(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** Base 10 logarithm.
-     * @return base 10 logarithm of the instance
-     */
-    public DerivativeStructure log10() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.log10(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure cos() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.cos(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure sin() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.sin(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure tan() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.tan(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure acos() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.acos(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure asin() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.asin(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure atan() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.atan(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure atan2(final DerivativeStructure x)
-        throws DimensionMismatchException {
-        compiler.checkCompatibility(x.compiler);
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.atan2(data, 0, x.data, 0, result.data, 0);
-        return result;
-    }
-
-    /** Two arguments arc tangent operation.
-     * @param y first argument of the arc tangent
-     * @param x second argument of the arc tangent
-     * @return atan2(y, x)
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public static DerivativeStructure atan2(final DerivativeStructure y, final DerivativeStructure x)
-        throws DimensionMismatchException {
-        return y.atan2(x);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure cosh() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.cosh(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure sinh() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.sinh(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure tanh() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.tanh(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure acosh() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.acosh(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure asinh() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.asinh(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public DerivativeStructure atanh() {
-        final DerivativeStructure result = new DerivativeStructure(compiler);
-        compiler.atanh(data, 0, result.data, 0);
-        return result;
-    }
-
-    /** Convert radians to degrees, with error of less than 0.5 ULP
-     *  @return instance converted into degrees
-     */
-    public DerivativeStructure toDegrees() {
-        final DerivativeStructure ds = new DerivativeStructure(compiler);
-        for (int i = 0; i < ds.data.length; ++i) {
-            ds.data[i] = FastMath.toDegrees(data[i]);
-        }
-        return ds;
-    }
-
-    /** Convert degrees to radians, with error of less than 0.5 ULP
-     *  @return instance converted into radians
-     */
-    public DerivativeStructure toRadians() {
-        final DerivativeStructure ds = new DerivativeStructure(compiler);
-        for (int i = 0; i < ds.data.length; ++i) {
-            ds.data[i] = FastMath.toRadians(data[i]);
-        }
-        return ds;
-    }
-
-    /** Evaluate Taylor expansion a derivative structure.
-     * @param delta parameters offsets (&Delta;x, &Delta;y, ...)
-     * @return value of the Taylor expansion at x + &Delta;x, y + &Delta;y, ...
-     * @throws MathArithmeticException if factorials becomes too large
-     */
-    public double taylor(final double ... delta) throws MathArithmeticException {
-        return compiler.taylor(data, 0, delta);
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final DerivativeStructure[] a, final DerivativeStructure[] b)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double[] aDouble = new double[a.length];
-        for (int i = 0; i < a.length; ++i) {
-            aDouble[i] = a[i].getValue();
-        }
-        final double[] bDouble = new double[b.length];
-        for (int i = 0; i < b.length; ++i) {
-            bDouble[i] = b[i].getValue();
-        }
-        final double accurateValue = MathArrays.linearCombination(aDouble, bDouble);
-
-        // compute a simple value, with all partial derivatives
-        DerivativeStructure simpleValue = a[0].getField().getZero();
-        for (int i = 0; i < a.length; ++i) {
-            simpleValue = simpleValue.add(a[i].multiply(b[i]));
-        }
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(simpleValue.getFreeParameters(), simpleValue.getOrder(), all);
-
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final double[] a, final DerivativeStructure[] b)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double[] bDouble = new double[b.length];
-        for (int i = 0; i < b.length; ++i) {
-            bDouble[i] = b[i].getValue();
-        }
-        final double accurateValue = MathArrays.linearCombination(a, bDouble);
-
-        // compute a simple value, with all partial derivatives
-        DerivativeStructure simpleValue = b[0].getField().getZero();
-        for (int i = 0; i < a.length; ++i) {
-            simpleValue = simpleValue.add(b[i].multiply(a[i]));
-        }
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(simpleValue.getFreeParameters(), simpleValue.getOrder(), all);
-
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
-                                                 final DerivativeStructure a2, final DerivativeStructure b2)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
-                                                                  a2.getValue(), b2.getValue());
-
-        // compute a simple value, with all partial derivatives
-        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2));
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
-
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
-                                                 final double a2, final DerivativeStructure b2)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double accurateValue = MathArrays.linearCombination(a1, b1.getValue(),
-                                                                  a2, b2.getValue());
-
-        // compute a simple value, with all partial derivatives
-        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2));
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
-
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
-                                                 final DerivativeStructure a2, final DerivativeStructure b2,
-                                                 final DerivativeStructure a3, final DerivativeStructure b3)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
-                                                                  a2.getValue(), b2.getValue(),
-                                                                  a3.getValue(), b3.getValue());
-
-        // compute a simple value, with all partial derivatives
-        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3));
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
-
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
-                                                 final double a2, final DerivativeStructure b2,
-                                                 final double a3, final DerivativeStructure b3)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double accurateValue = MathArrays.linearCombination(a1, b1.getValue(),
-                                                                  a2, b2.getValue(),
-                                                                  a3, b3.getValue());
-
-        // compute a simple value, with all partial derivatives
-        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3));
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
-
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
-                                                 final DerivativeStructure a2, final DerivativeStructure b2,
-                                                 final DerivativeStructure a3, final DerivativeStructure b3,
-                                                 final DerivativeStructure a4, final DerivativeStructure b4)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
-                                                                  a2.getValue(), b2.getValue(),
-                                                                  a3.getValue(), b3.getValue(),
-                                                                  a4.getValue(), b4.getValue());
-
-        // compute a simple value, with all partial derivatives
-        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3)).add(a4.multiply(b4));
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
-
-    }
-
-    /** {@inheritDoc}
-     * @exception DimensionMismatchException if number of free parameters
-     * or orders do not match
-     * @since 3.2
-     */
-    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
-                                                 final double a2, final DerivativeStructure b2,
-                                                 final double a3, final DerivativeStructure b3,
-                                                 final double a4, final DerivativeStructure b4)
-        throws DimensionMismatchException {
-
-        // compute an accurate value, taking care of cancellations
-        final double accurateValue = MathArrays.linearCombination(a1, b1.getValue(),
-                                                                  a2, b2.getValue(),
-                                                                  a3, b3.getValue(),
-                                                                  a4, b4.getValue());
-
-        // compute a simple value, with all partial derivatives
-        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3)).add(b4.multiply(a4));
-
-        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
-        final double[] all = simpleValue.getAllDerivatives();
-        all[0] = accurateValue;
-        return new DerivativeStructure(getFreeParameters(), getOrder(), all);
-
-    }
-
-    /**
-     * Test for the equality of two derivative structures.
-     * <p>
-     * Derivative structures are considered equal if they have the same number
-     * of free parameters, the same derivation order, and the same derivatives.
-     * </p>
-     * @param other Object to test for equality to this
-     * @return true if two derivative structures are equal
-     * @since 3.2
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof DerivativeStructure) {
-            final DerivativeStructure rhs = (DerivativeStructure)other;
-            return (getFreeParameters() == rhs.getFreeParameters()) &&
-                   (getOrder() == rhs.getOrder()) &&
-                   MathArrays.equals(data, rhs.data);
-        }
-
-        return false;
-
-    }
-
-    /**
-     * Get a hashCode for the derivative structure.
-     * @return a hash code value for this object
-     * @since 3.2
-     */
-    @Override
-    public int hashCode() {
-        return 227 + 229 * getFreeParameters() + 233 * getOrder() + 239 * MathUtils.hash(data);
-    }
-
-    /**
-     * Replace the instance with a data transfer object for serialization.
-     * @return data transfer object that will be serialized
-     */
-    private Object writeReplace() {
-        return new DataTransferObject(compiler.getFreeParameters(), compiler.getOrder(), data);
-    }
-
-    /** Internal class used only for serialization. */
-    private static class DataTransferObject implements Serializable {
-
-        /** Serializable UID. */
-        private static final long serialVersionUID = 20120730L;
-
-        /** Number of variables.
-         * @serial
-         */
-        private final int variables;
-
-        /** Derivation order.
-         * @serial
-         */
-        private final int order;
-
-        /** Partial derivatives.
-         * @serial
-         */
-        private final double[] data;
-
-        /** Simple constructor.
-         * @param variables number of variables
-         * @param order derivation order
-         * @param data partial derivatives
-         */
-        public DataTransferObject(final int variables, final int order, final double[] data) {
-            this.variables = variables;
-            this.order     = order;
-            this.data      = data;
-        }
-
-        /** Replace the deserialized data transfer object with a {@link DerivativeStructure}.
-         * @return replacement {@link DerivativeStructure}
-         */
-        private Object readResolve() {
-            return new DerivativeStructure(variables, order, data);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiator.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiator.java
deleted file mode 100644
index ea92809..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiator.java
+++ /dev/null
@@ -1,383 +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.analysis.differentiation;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
-import org.apache.commons.math3.analysis.UnivariateVectorFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
-
-/** Univariate functions differentiator using finite differences.
- * <p>
- * This class creates some wrapper objects around regular
- * {@link UnivariateFunction univariate functions} (or {@link
- * UnivariateVectorFunction univariate vector functions} or {@link
- * UnivariateMatrixFunction univariate matrix functions}). These
- * wrapper objects compute derivatives in addition to function
- * value.
- * </p>
- * <p>
- * The wrapper objects work by calling the underlying function on
- * a sampling grid around the current point and performing polynomial
- * interpolation. A finite differences scheme with n points is
- * theoretically able to compute derivatives up to order n-1, but
- * it is generally better to have a slight margin. The step size must
- * also be small enough in order for the polynomial approximation to
- * be good in the current point neighborhood, but it should not be too
- * small because numerical instability appears quickly (there are several
- * differences of close points). Choosing the number of points and
- * the step size is highly problem dependent.
- * </p>
- * <p>
- * As an example of good and bad settings, lets consider the quintic
- * polynomial function {@code f(x) = (x-1)*(x-0.5)*x*(x+0.5)*(x+1)}.
- * Since it is a polynomial, finite differences with at least 6 points
- * should theoretically recover the exact same polynomial and hence
- * compute accurate derivatives for any order. However, due to numerical
- * errors, we get the following results for a 7 points finite differences
- * for abscissae in the [-10, 10] range:
- * <ul>
- *   <li>step size = 0.25, second order derivative error about 9.97e-10</li>
- *   <li>step size = 0.25, fourth order derivative error about 5.43e-8</li>
- *   <li>step size = 1.0e-6, second order derivative error about 148</li>
- *   <li>step size = 1.0e-6, fourth order derivative error about 6.35e+14</li>
- * </ul>
- * This example shows that the small step size is really bad, even simply
- * for second order derivative!
- * </p>
- * @since 3.1
- */
-public class FiniteDifferencesDifferentiator
-    implements UnivariateFunctionDifferentiator, UnivariateVectorFunctionDifferentiator,
-               UnivariateMatrixFunctionDifferentiator, Serializable {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20120917L;
-
-    /** Number of points to use. */
-    private final int nbPoints;
-
-    /** Step size. */
-    private final double stepSize;
-
-    /** Half sample span. */
-    private final double halfSampleSpan;
-
-    /** Lower bound for independent variable. */
-    private final double tMin;
-
-    /** Upper bound for independent variable. */
-    private final double tMax;
-
-    /**
-     * Build a differentiator with number of points and step size when independent variable is unbounded.
-     * <p>
-     * Beware that wrong settings for the finite differences differentiator
-     * can lead to highly unstable and inaccurate results, especially for
-     * high derivation orders. Using very small step sizes is often a
-     * <em>bad</em> idea.
-     * </p>
-     * @param nbPoints number of points to use
-     * @param stepSize step size (gap between each point)
-     * @exception NotPositiveException if {@code stepsize <= 0} (note that
-     * {@link NotPositiveException} extends {@link NumberIsTooSmallException})
-     * @exception NumberIsTooSmallException {@code nbPoint <= 1}
-     */
-    public FiniteDifferencesDifferentiator(final int nbPoints, final double stepSize)
-        throws NotPositiveException, NumberIsTooSmallException {
-        this(nbPoints, stepSize, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY);
-    }
-
-    /**
-     * Build a differentiator with number of points and step size when independent variable is bounded.
-     * <p>
-     * When the independent variable is bounded (tLower &lt; t &lt; tUpper), the sampling
-     * points used for differentiation will be adapted to ensure the constraint holds
-     * even near the boundaries. This means the sample will not be centered anymore in
-     * these cases. At an extreme case, computing derivatives exactly at the lower bound
-     * will lead the sample to be entirely on the right side of the derivation point.
-     * </p>
-     * <p>
-     * Note that the boundaries are considered to be excluded for function evaluation.
-     * </p>
-     * <p>
-     * Beware that wrong settings for the finite differences differentiator
-     * can lead to highly unstable and inaccurate results, especially for
-     * high derivation orders. Using very small step sizes is often a
-     * <em>bad</em> idea.
-     * </p>
-     * @param nbPoints number of points to use
-     * @param stepSize step size (gap between each point)
-     * @param tLower lower bound for independent variable (may be {@code Double.NEGATIVE_INFINITY}
-     * if there are no lower bounds)
-     * @param tUpper upper bound for independent variable (may be {@code Double.POSITIVE_INFINITY}
-     * if there are no upper bounds)
-     * @exception NotPositiveException if {@code stepsize <= 0} (note that
-     * {@link NotPositiveException} extends {@link NumberIsTooSmallException})
-     * @exception NumberIsTooSmallException {@code nbPoint <= 1}
-     * @exception NumberIsTooLargeException {@code stepSize * (nbPoints - 1) >= tUpper - tLower}
-     */
-    public FiniteDifferencesDifferentiator(final int nbPoints, final double stepSize,
-                                           final double tLower, final double tUpper)
-            throws NotPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-
-        if (nbPoints <= 1) {
-            throw new NumberIsTooSmallException(stepSize, 1, false);
-        }
-        this.nbPoints = nbPoints;
-
-        if (stepSize <= 0) {
-            throw new NotPositiveException(stepSize);
-        }
-        this.stepSize = stepSize;
-
-        halfSampleSpan = 0.5 * stepSize * (nbPoints - 1);
-        if (2 * halfSampleSpan >= tUpper - tLower) {
-            throw new NumberIsTooLargeException(2 * halfSampleSpan, tUpper - tLower, false);
-        }
-        final double safety = FastMath.ulp(halfSampleSpan);
-        this.tMin = tLower + halfSampleSpan + safety;
-        this.tMax = tUpper - halfSampleSpan - safety;
-
-    }
-
-    /**
-     * Get the number of points to use.
-     * @return number of points to use
-     */
-    public int getNbPoints() {
-        return nbPoints;
-    }
-
-    /**
-     * Get the step size.
-     * @return step size
-     */
-    public double getStepSize() {
-        return stepSize;
-    }
-
-    /**
-     * Evaluate derivatives from a sample.
-     * <p>
-     * Evaluation is done using divided differences.
-     * </p>
-     * @param t evaluation abscissa value and derivatives
-     * @param t0 first sample point abscissa
-     * @param y function values sample {@code y[i] = f(t[i]) = f(t0 + i * stepSize)}
-     * @return value and derivatives at {@code t}
-     * @exception NumberIsTooLargeException if the requested derivation order
-     * is larger or equal to the number of points
-     */
-    private DerivativeStructure evaluate(final DerivativeStructure t, final double t0,
-                                         final double[] y)
-        throws NumberIsTooLargeException {
-
-        // create divided differences diagonal arrays
-        final double[] top    = new double[nbPoints];
-        final double[] bottom = new double[nbPoints];
-
-        for (int i = 0; i < nbPoints; ++i) {
-
-            // update the bottom diagonal of the divided differences array
-            bottom[i] = y[i];
-            for (int j = 1; j <= i; ++j) {
-                bottom[i - j] = (bottom[i - j + 1] - bottom[i - j]) / (j * stepSize);
-            }
-
-            // update the top diagonal of the divided differences array
-            top[i] = bottom[0];
-
-        }
-
-        // evaluate interpolation polynomial (represented by top diagonal) at t
-        final int order            = t.getOrder();
-        final int parameters       = t.getFreeParameters();
-        final double[] derivatives = t.getAllDerivatives();
-        final double dt0           = t.getValue() - t0;
-        DerivativeStructure interpolation = new DerivativeStructure(parameters, order, 0.0);
-        DerivativeStructure monomial = null;
-        for (int i = 0; i < nbPoints; ++i) {
-            if (i == 0) {
-                // start with monomial(t) = 1
-                monomial = new DerivativeStructure(parameters, order, 1.0);
-            } else {
-                // monomial(t) = (t - t0) * (t - t1) * ... * (t - t(i-1))
-                derivatives[0] = dt0 - (i - 1) * stepSize;
-                final DerivativeStructure deltaX = new DerivativeStructure(parameters, order, derivatives);
-                monomial = monomial.multiply(deltaX);
-            }
-            interpolation = interpolation.add(monomial.multiply(top[i]));
-        }
-
-        return interpolation;
-
-    }
-
-    /** {@inheritDoc}
-     * <p>The returned object cannot compute derivatives to arbitrary orders. The
-     * value function will throw a {@link NumberIsTooLargeException} if the requested
-     * derivation order is larger or equal to the number of points.
-     * </p>
-     */
-    public UnivariateDifferentiableFunction differentiate(final UnivariateFunction function) {
-        return new UnivariateDifferentiableFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double x) throws MathIllegalArgumentException {
-                return function.value(x);
-            }
-
-            /** {@inheritDoc} */
-            public DerivativeStructure value(final DerivativeStructure t)
-                throws MathIllegalArgumentException {
-
-                // check we can achieve the requested derivation order with the sample
-                if (t.getOrder() >= nbPoints) {
-                    throw new NumberIsTooLargeException(t.getOrder(), nbPoints, false);
-                }
-
-                // compute sample position, trying to be centered if possible
-                final double t0 = FastMath.max(FastMath.min(t.getValue(), tMax), tMin) - halfSampleSpan;
-
-                // compute sample points
-                final double[] y = new double[nbPoints];
-                for (int i = 0; i < nbPoints; ++i) {
-                    y[i] = function.value(t0 + i * stepSize);
-                }
-
-                // evaluate derivatives
-                return evaluate(t, t0, y);
-
-            }
-
-        };
-    }
-
-    /** {@inheritDoc}
-     * <p>The returned object cannot compute derivatives to arbitrary orders. The
-     * value function will throw a {@link NumberIsTooLargeException} if the requested
-     * derivation order is larger or equal to the number of points.
-     * </p>
-     */
-    public UnivariateDifferentiableVectorFunction differentiate(final UnivariateVectorFunction function) {
-        return new UnivariateDifferentiableVectorFunction() {
-
-            /** {@inheritDoc} */
-            public double[]value(final double x) throws MathIllegalArgumentException {
-                return function.value(x);
-            }
-
-            /** {@inheritDoc} */
-            public DerivativeStructure[] value(final DerivativeStructure t)
-                throws MathIllegalArgumentException {
-
-                // check we can achieve the requested derivation order with the sample
-                if (t.getOrder() >= nbPoints) {
-                    throw new NumberIsTooLargeException(t.getOrder(), nbPoints, false);
-                }
-
-                // compute sample position, trying to be centered if possible
-                final double t0 = FastMath.max(FastMath.min(t.getValue(), tMax), tMin) - halfSampleSpan;
-
-                // compute sample points
-                double[][] y = null;
-                for (int i = 0; i < nbPoints; ++i) {
-                    final double[] v = function.value(t0 + i * stepSize);
-                    if (i == 0) {
-                        y = new double[v.length][nbPoints];
-                    }
-                    for (int j = 0; j < v.length; ++j) {
-                        y[j][i] = v[j];
-                    }
-                }
-
-                // evaluate derivatives
-                final DerivativeStructure[] value = new DerivativeStructure[y.length];
-                for (int j = 0; j < value.length; ++j) {
-                    value[j] = evaluate(t, t0, y[j]);
-                }
-
-                return value;
-
-            }
-
-        };
-    }
-
-    /** {@inheritDoc}
-     * <p>The returned object cannot compute derivatives to arbitrary orders. The
-     * value function will throw a {@link NumberIsTooLargeException} if the requested
-     * derivation order is larger or equal to the number of points.
-     * </p>
-     */
-    public UnivariateDifferentiableMatrixFunction differentiate(final UnivariateMatrixFunction function) {
-        return new UnivariateDifferentiableMatrixFunction() {
-
-            /** {@inheritDoc} */
-            public double[][]  value(final double x) throws MathIllegalArgumentException {
-                return function.value(x);
-            }
-
-            /** {@inheritDoc} */
-            public DerivativeStructure[][]  value(final DerivativeStructure t)
-                throws MathIllegalArgumentException {
-
-                // check we can achieve the requested derivation order with the sample
-                if (t.getOrder() >= nbPoints) {
-                    throw new NumberIsTooLargeException(t.getOrder(), nbPoints, false);
-                }
-
-                // compute sample position, trying to be centered if possible
-                final double t0 = FastMath.max(FastMath.min(t.getValue(), tMax), tMin) - halfSampleSpan;
-
-                // compute sample points
-                double[][][] y = null;
-                for (int i = 0; i < nbPoints; ++i) {
-                    final double[][] v = function.value(t0 + i * stepSize);
-                    if (i == 0) {
-                        y = new double[v.length][v[0].length][nbPoints];
-                    }
-                    for (int j = 0; j < v.length; ++j) {
-                        for (int k = 0; k < v[j].length; ++k) {
-                            y[j][k][i] = v[j][k];
-                        }
-                    }
-                }
-
-                // evaluate derivatives
-                final DerivativeStructure[][] value = new DerivativeStructure[y.length][y[0].length];
-                for (int j = 0; j < value.length; ++j) {
-                    for (int k = 0; k < y[j].length; ++k) {
-                        value[j][k] = evaluate(t, t0, y[j][k]);
-                    }
-                }
-
-                return value;
-
-            }
-
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/GradientFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/GradientFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/GradientFunction.java
deleted file mode 100644
index 25aa7c7..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/GradientFunction.java
+++ /dev/null
@@ -1,65 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-
-/** Class representing the gradient of a multivariate function.
- * <p>
- * The vectorial components of the function represent the derivatives
- * with respect to each function parameters.
- * </p>
- * @since 3.1
- */
-public class GradientFunction implements MultivariateVectorFunction {
-
-    /** Underlying real-valued function. */
-    private final MultivariateDifferentiableFunction f;
-
-    /** Simple constructor.
-     * @param f underlying real-valued function
-     */
-    public GradientFunction(final MultivariateDifferentiableFunction f) {
-        this.f = f;
-    }
-
-    /** {@inheritDoc} */
-    public double[] value(double[] point) {
-
-        // set up parameters
-        final DerivativeStructure[] dsX = new DerivativeStructure[point.length];
-        for (int i = 0; i < point.length; ++i) {
-            dsX[i] = new DerivativeStructure(point.length, 1, i, point[i]);
-        }
-
-        // compute the derivatives
-        final DerivativeStructure dsY = f.value(dsX);
-
-        // extract the gradient
-        final double[] y = new double[point.length];
-        final int[] orders = new int[point.length];
-        for (int i = 0; i < point.length; ++i) {
-            orders[i] = 1;
-            y[i] = dsY.getPartialDerivative(orders);
-            orders[i] = 0;
-        }
-
-        return y;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/JacobianFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/JacobianFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/JacobianFunction.java
deleted file mode 100644
index 0de47db..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/JacobianFunction.java
+++ /dev/null
@@ -1,69 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-
-/** Class representing the Jacobian of a multivariate vector function.
- * <p>
- * The rows iterate on the model functions while the columns iterate on the parameters; thus,
- * the numbers of rows is equal to the dimension of the underlying function vector
- * value and the number of columns is equal to the number of free parameters of
- * the underlying function.
- * </p>
- * @since 3.1
- */
-public class JacobianFunction implements MultivariateMatrixFunction {
-
-    /** Underlying vector-valued function. */
-    private final MultivariateDifferentiableVectorFunction f;
-
-    /** Simple constructor.
-     * @param f underlying vector-valued function
-     */
-    public JacobianFunction(final MultivariateDifferentiableVectorFunction f) {
-        this.f = f;
-    }
-
-    /** {@inheritDoc} */
-    public double[][] value(double[] point) {
-
-        // set up parameters
-        final DerivativeStructure[] dsX = new DerivativeStructure[point.length];
-        for (int i = 0; i < point.length; ++i) {
-            dsX[i] = new DerivativeStructure(point.length, 1, i, point[i]);
-        }
-
-        // compute the derivatives
-        final DerivativeStructure[] dsY = f.value(dsX);
-
-        // extract the Jacobian
-        final double[][] y = new double[dsY.length][point.length];
-        final int[] orders = new int[point.length];
-        for (int i = 0; i < dsY.length; ++i) {
-            for (int j = 0; j < point.length; ++j) {
-                orders[j] = 1;
-                y[i][j] = dsY[i].getPartialDerivative(orders);
-                orders[j] = 0;
-            }
-        }
-
-        return y;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java
deleted file mode 100644
index 443671e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableFunction.java
+++ /dev/null
@@ -1,42 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-/**
- * Extension of {@link MultivariateFunction} representing a
- * multivariate differentiable real function.
- * @since 3.1
- */
-public interface MultivariateDifferentiableFunction extends MultivariateFunction {
-
-    /**
-     * Compute the value for the function at the given point.
-     *
-     * @param point Point at which the function must be evaluated.
-     * @return the function value for the given point.
-     * @exception MathIllegalArgumentException if {@code point} does not
-     * satisfy the function's constraints (wrong dimension, argument out of bound,
-     * or unsupported derivative order for example)
-     */
-    DerivativeStructure value(DerivativeStructure[] point)
-        throws MathIllegalArgumentException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
deleted file mode 100644
index a5987ae..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
+++ /dev/null
@@ -1,43 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-
-/**
- * Extension of {@link MultivariateVectorFunction} representing a
- * multivariate differentiable vectorial function.
- * @since 3.1
- */
-public interface MultivariateDifferentiableVectorFunction
-    extends MultivariateVectorFunction {
-
-    /**
-     * Compute the value for the function at the given point.
-     * @param point point at which the function must be evaluated
-     * @return function value for the given point
-     * @exception MathIllegalArgumentException if {@code point} does not
-     * satisfy the function's constraints (wrong dimension, argument out of bound,
-     * or unsupported derivative order for example)
-     */
-    DerivativeStructure[] value(DerivativeStructure[] point)
-        throws MathIllegalArgumentException;
-
-}


[79/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java
index 225fa01..9742b95 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/LegendreRuleFactory.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Factory that creates Gauss-type quadrature rule using Legendre polynomials.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java
index 7fa4884..ee3a466 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/SymmetricGaussIntegrator.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * This class's implements {@link #integrate(UnivariateFunction) integrate}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/gauss/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/package-info.java b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/package-info.java
index 066da30..9fd1bc8 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/gauss/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/gauss/package-info.java
@@ -19,4 +19,4 @@
  * Gauss family of quadrature schemes.
  *
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/integration/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/integration/package-info.java b/src/main/java/org/apache/commons/math4/analysis/integration/package-info.java
index f4df3ba..4afe6b0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/integration/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/integration/package-info.java
@@ -19,4 +19,4 @@
  *     Numerical integration (quadrature) algorithms for univariate real functions.
  *
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
index 5b89dfe..ac54924 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolator.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Computes a cubic spline interpolation for the data set using the Akima

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
index 7fe947f..cea9766 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunction.java
@@ -14,15 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.Arrays;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Function that implements the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java
index 82ab44e..95617f5 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Generates a {@link BicubicInterpolatingFunction bicubic interpolating

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunction.java
index 522c2a5..e9f7e19 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunction.java
@@ -14,15 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.Arrays;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Function that implements the
@@ -32,7 +33,7 @@ import org.apache.commons.math3.util.MathArrays;
  *
  * @since 2.1
  * @deprecated as of 3.4 replaced by
- * {@link org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction}
+ * {@link org.apache.commons.math4.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction}
  */
 @Deprecated
 public class BicubicSplineInterpolatingFunction

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolator.java
index 09acd07..53e726f 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolator.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Generates a bicubic interpolating function. Due to numerical accuracy issues this should not
  * be used.
  *
  * @since 2.2
- * @deprecated as of 3.4 replaced by {@link org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolator}
+ * @deprecated as of 3.4 replaced by {@link org.apache.commons.math4.analysis.interpolation.PiecewiseBicubicSplineInterpolator}
  */
 @Deprecated
 public class BicubicSplineInterpolator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/BivariateGridInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/BivariateGridInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/BivariateGridInterpolator.java
index 94d75ad..97ed969 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/BivariateGridInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/BivariateGridInterpolator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /**
  * Interface representing a bivariate real interpolating function where the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java
index e308160..7624298 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolator.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.io.Serializable;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionNewtonForm;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
+
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunctionLagrangeForm;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunctionNewtonForm;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /**
  * Implements the <a href="

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java
index 9125b83..8945aae 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolator.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /** Polynomial interpolator using both sample values and sample derivatives.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java
index 15ed322..1903579 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.CombinatoricsUtils;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.CombinatoricsUtils;
 
 /** Polynomial interpolator using both sample values and sample derivatives.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java
index 7e0e69b..2eb19f0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolator.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Implements a linear function for interpolation of real univariate functions.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
index 7f0788d..a362511 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolator.java
@@ -14,23 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotFiniteNumberException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implements the <a href="http://en.wikipedia.org/wiki/Local_regression">
@@ -163,7 +163,7 @@ public class LoessInterpolator
      * Compute an interpolating function by performing a loess fit
      * on the data at the original abscissae and then building a cubic spline
      * with a
-     * {@link org.apache.commons.math3.analysis.interpolation.SplineInterpolator}
+     * {@link org.apache.commons.math4.analysis.interpolation.SplineInterpolator}
      * on the resulting fit.
      *
      * @param xval the arguments for the interpolation points
@@ -462,7 +462,7 @@ public class LoessInterpolator
      * Check that all elements of an array are finite real numbers.
      *
      * @param values Values array.
-     * @throws org.apache.commons.math3.exception.NotFiniteNumberException
+     * @throws org.apache.commons.math4.exception.NotFiniteNumberException
      * if one of the values is not a finite real number.
      */
     private static void checkAllFiniteReal(final double[] values) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java
index b747841..a18cbc0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatingFunction.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Interpolating function that implements the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java
index c9881ce..b267874 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolator.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
 
 /**
  * Interpolator that implements the algorithm described in

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/MultivariateInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/MultivariateInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/MultivariateInterpolator.java
index 7d76374..97ae5b6 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/MultivariateInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/MultivariateInterpolator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
 
 /**
  * Interface representing a univariate real interpolating function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java
index 6b47451..ee39b7f 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolator.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunctionLagrangeForm;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java
index 7dd135a..8a53453 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java
@@ -14,18 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.Arrays;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Function that implements the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java
index 826f328..bd3f620 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Generates a piecewise-bicubic interpolating function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
index e1639b2..243da0c 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
-import org.apache.commons.math3.fitting.PolynomialFitter;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.fitting.PolynomialFitter;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Generates a bicubic interpolation function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
index a9ca862..393281e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolator.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Computes a natural (also known as "free", "unclamped") cubic spline interpolation for the data set.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java
index 9344d89..450a2e3 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunction.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.TrivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.TrivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Function that implements the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java
index 531e736..0270882 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Generates a tricubic interpolating function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunction.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunction.java
index 4260606..fa5f76c 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunction.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.TrivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.TrivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Function that implements the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolator.java
index da19986..c068f74 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Generates a tricubic interpolating function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/TrivariateGridInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/TrivariateGridInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/TrivariateGridInterpolator.java
index ec69715..18e264d 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/TrivariateGridInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/TrivariateGridInterpolator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.TrivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.analysis.TrivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /**
  * Interface representing a trivariate real interpolating function where the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariateInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariateInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariateInterpolator.java
index f7a1bd1..349d22d 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariateInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariateInterpolator.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Interface representing a univariate real interpolating function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java
index 6b788b1..88b0f55 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolator.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Adapter for classes implementing the {@link UnivariateInterpolator}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/interpolation/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/interpolation/package-info.java b/src/main/java/org/apache/commons/math4/analysis/interpolation/package-info.java
index b4b25dd..231da35 100644
--- a/src/main/java/org/apache/commons/math4/analysis/interpolation/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/interpolation/package-info.java
@@ -19,4 +19,4 @@
  *     Univariate real functions interpolation algorithms.
  *
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/package-info.java b/src/main/java/org/apache/commons/math4/analysis/package-info.java
index 46e0477..472dcb0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/package-info.java
@@ -29,4 +29,4 @@
  *    </p>
  *
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
index d424a88..886e2d7 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Immutable representation of a real polynomial function with real coefficients.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java
index 9d812df..b499d44 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeForm.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Implements the representation of a real polynomial function in
@@ -90,7 +90,7 @@ public class PolynomialFunctionLagrangeForm implements UnivariateFunction {
      * @return the function value.
      * @throws DimensionMismatchException if {@code x} and {@code y} have
      * different lengths.
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
+     * @throws org.apache.commons.math4.exception.NonMonotonicSequenceException
      * if {@code x} is not sorted in strictly increasing order.
      * @throws NumberIsTooSmallException if the size of {@code x} is less
      * than 2.
@@ -198,7 +198,7 @@ public class PolynomialFunctionLagrangeForm implements UnivariateFunction {
      * @return the function value.
      * @throws DimensionMismatchException if {@code x} and {@code y} have
      * different lengths.
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
+     * @throws org.apache.commons.math4.exception.NonMonotonicSequenceException
      * if {@code x} is not sorted in strictly increasing order.
      * @throws NumberIsTooSmallException if the size of {@code x} is less
      * than 2.
@@ -304,7 +304,7 @@ public class PolynomialFunctionLagrangeForm implements UnivariateFunction {
      * @param abort Whether to throw an exception if {@code x} is not sorted.
      * @throws DimensionMismatchException if the array lengths are different.
      * @throws NumberIsTooSmallException if the number of points is less than 2.
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
+     * @throws org.apache.commons.math4.exception.NonMonotonicSequenceException
      * if {@code x} is not sorted in strictly increasing order and {@code abort}
      * is {@code true}.
      * @return {@code false} if the {@code x} is not sorted in increasing order,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java
index fc2f1fd..a87eee8 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonForm.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implements the representation of a real polynomial function in
@@ -226,7 +226,7 @@ public class PolynomialFunctionNewtonForm implements UnivariateDifferentiableFun
      * @throws NoDataException if any array has zero length.
      * @throws DimensionMismatchException if the size difference between
      * {@code a} and {@code c} is not equal to 1.
-     * @see org.apache.commons.math3.analysis.interpolation.DividedDifferenceInterpolator#computeDividedDifference(double[],
+     * @see org.apache.commons.math4.analysis.interpolation.DividedDifferenceInterpolator#computeDividedDifference(double[],
      * double[])
      */
     protected static void verifyInputArray(double a[], double c[])

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
index 7b402e5..8bf1aaa 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunction.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Represents a polynomial spline function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
index e6eccef..5416e19 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * A collection of static methods that operate on or return polynomials.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/polynomials/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/polynomials/package-info.java b/src/main/java/org/apache/commons/math4/analysis/polynomials/package-info.java
index 85b99f7..8c8232c 100644
--- a/src/main/java/org/apache/commons/math4/analysis/polynomials/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/polynomials/package-info.java
@@ -20,4 +20,4 @@
  *     univariate real functions.
  *
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
index d0fda00..1fba119 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
 
 /**
  * Provide a default implementation for several functions useful to generic

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractPolynomialSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractPolynomialSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractPolynomialSolver.java
index d641e87..ec25f98 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractPolynomialSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractPolynomialSolver.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
 
 /**
  * Base class for solvers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateDifferentiableSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateDifferentiableSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateDifferentiableSolver.java
index 9745e9b..50a1ac0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateDifferentiableSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateDifferentiableSolver.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
 
 /**
  * Provide a default implementation for several functions useful to generic

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateSolver.java
index 078c70f..ebc8cb3 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/AbstractUnivariateSolver.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
 
 /**
  * Base class for solvers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/AllowedSolution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/AllowedSolution.java b/src/main/java/org/apache/commons/math4/analysis/solvers/AllowedSolution.java
index a02a29b..61d5c03 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/AllowedSolution.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/AllowedSolution.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
 
 /** The kinds of solutions that a {@link BracketedUnivariateSolver
@@ -29,8 +29,8 @@ package org.apache.commons.math3.analysis.solvers;
  * or slightly larger than the actual root. Root-finding algorithms generally
  * only guarantee that the returned solution is within the requested
  * tolerances. In certain cases however, in particular for
- * {@link org.apache.commons.math3.ode.events.EventHandler state events} of
- * {@link org.apache.commons.math3.ode.ODEIntegrator ODE solvers}, it
+ * {@link org.apache.commons.math4.ode.events.EventHandler state events} of
+ * {@link org.apache.commons.math4.ode.ODEIntegrator ODE solvers}, it
  * may be necessary to guarantee that a solution is returned that lies on a
  * specific side the solution.</p>
  *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java
index 4fb9ecf..f74e860 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseAbstractUnivariateSolver.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.Incrementor;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Provide a default implementation for several functions useful to generic

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolver.java
index 44a2173..076fe7e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolver.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathInternalError;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Base class for all bracketing <em>Secant</em>-based methods for root-finding

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/BaseUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseUnivariateSolver.java
index f00590e..d5b90dc 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BaseUnivariateSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BaseUnivariateSolver.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
 
 
 /**
@@ -133,9 +133,9 @@ public interface BaseUnivariateSolver<FUNC extends UnivariateFunction> {
      * @param startValue Start value to use.
      * @return a value where the function is zero.
      * @param maxEval Maximum number of evaluations.
-     * @throws org.apache.commons.math3.exception.MathIllegalArgumentException
+     * @throws org.apache.commons.math4.exception.MathIllegalArgumentException
      * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException if
      * the allowed number of evaluations is exceeded.
      */
     double solve(int maxEval, FUNC f, double startValue);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/BisectionSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BisectionSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BisectionSolver.java
index 49f4057..658c2a0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BisectionSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BisectionSolver.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/Bisection.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/BracketedUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BracketedUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BracketedUnivariateSolver.java
index 789fc99..60e8a25 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BracketedUnivariateSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BracketedUnivariateSolver.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
 
 /** Interface for {@link UnivariateSolver (univariate real) root-finding
  * algorithms} that maintain a bracketed solution. There are several advantages
@@ -59,9 +59,9 @@ public interface BracketedUnivariateSolver<FUNC extends UnivariateFunction>
      * @param allowedSolution The kind of solutions that the root-finding algorithm may
      * accept as solutions.
      * @return A value where the function is zero.
-     * @throws org.apache.commons.math3.exception.MathIllegalArgumentException
+     * @throws org.apache.commons.math4.exception.MathIllegalArgumentException
      * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException if
      * the allowed number of evaluations is exceeded.
      */
     double solve(int maxEval, FUNC f, double min, double max,
@@ -81,9 +81,9 @@ public interface BracketedUnivariateSolver<FUNC extends UnivariateFunction>
      * @param allowedSolution The kind of solutions that the root-finding algorithm may
      * accept as solutions.
      * @return A value where the function is zero.
-     * @throws org.apache.commons.math3.exception.MathIllegalArgumentException
+     * @throws org.apache.commons.math4.exception.MathIllegalArgumentException
      * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException if
      * the allowed number of evaluations is exceeded.
      */
     double solve(int maxEval, FUNC f, double min, double max, double startValue,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
index 4981592..4bb46d2 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * This class implements a modification of the <a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
index 0cc8750..0d2afee 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/BrentSolver.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
 
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * This class implements the <a href="http://mathworld.wolfram.com/BrentsMethod.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java
index b9ae158..09a1d20 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/DifferentiableUnivariateSolver.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
 
 
 /**


[78/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/IllinoisSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/IllinoisSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/IllinoisSolver.java
index bd3bc71..051b10e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/IllinoisSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/IllinoisSolver.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/LaguerreSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/LaguerreSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/LaguerreSolver.java
index c127b42..23fd17a 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/LaguerreSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/LaguerreSolver.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.complex.ComplexUtils;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.complex.ComplexUtils;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/LaguerresMethod.html">
@@ -182,7 +182,7 @@ public class LaguerreSolver extends AbstractPolynomialSolver {
      * @param coefficients Polynomial coefficients.
      * @param initial Start value.
      * @return the point at which the function value is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximum number of evaluations is exceeded.
      * @throws NullArgumentException if the {@code coefficients} is
      * {@code null}.
@@ -212,7 +212,7 @@ public class LaguerreSolver extends AbstractPolynomialSolver {
      * @param coefficients Polynomial coefficients.
      * @param initial Start value.
      * @return the point at which the function value is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximum number of evaluations is exceeded.
      * @throws NullArgumentException if the {@code coefficients} is
      * {@code null}.
@@ -262,7 +262,7 @@ public class LaguerreSolver extends AbstractPolynomialSolver {
          * @param coefficients Polynomial coefficients.
          * @param initial Start value.
          * @return the point at which the function value is zero.
-         * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+         * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
          * if the maximum number of evaluations is exceeded.
          * @throws NullArgumentException if the {@code coefficients} is
          * {@code null}.
@@ -311,7 +311,7 @@ public class LaguerreSolver extends AbstractPolynomialSolver {
          * @param coefficients Polynomial coefficients.
          * @param initial Start value.
          * @return the point at which the function value is zero.
-         * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+         * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
          * if the maximum number of evaluations is exceeded.
          * @throws NullArgumentException if the {@code coefficients} is
          * {@code null}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver.java
index 06a7b6b..9a86406 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements the <a href="http://mathworld.wolfram.com/MullersMethod.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver2.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver2.java b/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver2.java
index 2a79c11..1cbfdfd 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver2.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/MullerSolver2.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements the <a href="http://mathworld.wolfram.com/MullersMethod.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolver.java
index 4cf2688..5539e3b 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolver.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements <a href="http://mathworld.wolfram.com/NewtonsMethod.html">
@@ -56,9 +56,9 @@ public class NewtonRaphsonSolver extends AbstractUnivariateDifferentiableSolver
      * @param max Upper bound for the interval.
      * @param maxEval Maximum number of evaluations.
      * @return the value where the function is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximum evaluation count is exceeded.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code min >= max}.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonSolver.java
index 3ba7bf2..f377030 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/NewtonSolver.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements <a href="http://mathworld.wolfram.com/NewtonsMethod.html">
@@ -57,9 +57,9 @@ public class NewtonSolver extends AbstractDifferentiableUnivariateSolver {
      * @param max Upper bound for the interval.
      * @param maxEval Maximum number of evaluations.
      * @return the value where the function is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximum evaluation count is exceeded.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code min >= max}.
      */
     @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/PegasusSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/PegasusSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/PegasusSolver.java
index 0d80895..3abb279 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/PegasusSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/PegasusSolver.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
 /**
  * Implements the <em>Pegasus</em> method for root-finding (approximating

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/PolynomialSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/PolynomialSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/PolynomialSolver.java
index c21f076..e4d0c48 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/PolynomialSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/PolynomialSolver.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
 
 /**
  * Interface for (polynomial) root-finding algorithms.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolver.java
index cfb7055..c59bd89 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolver.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
 /**
  * Implements the <em>Regula Falsi</em> or <em>False position</em> method for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/RiddersSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/RiddersSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/RiddersSolver.java
index d83f595..edce668 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/RiddersSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/RiddersSolver.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <a href="http://mathworld.wolfram.com/RiddersMethod.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/SecantSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/SecantSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/SecantSolver.java
index d866cf8..2600caf 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/SecantSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/SecantSolver.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the <em>Secant</em> method for root-finding (approximating a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateDifferentiableSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateDifferentiableSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateDifferentiableSolver.java
index 82bbead..254085e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateDifferentiableSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateDifferentiableSolver.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolver.java b/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolver.java
index 484e67a..7755041 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolver.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolver.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtils.java b/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtils.java
index 4c2dd90..2521c9b 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtils.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtils.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Utility routines for {@link UnivariateSolver} objects.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/solvers/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/solvers/package-info.java b/src/main/java/org/apache/commons/math4/analysis/solvers/package-info.java
index eb15fbc..95d4660 100644
--- a/src/main/java/org/apache/commons/math4/analysis/solvers/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/solvers/package-info.java
@@ -19,4 +19,4 @@
  *     Root finding algorithms, for univariate real functions.
  *
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/complex/Complex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/Complex.java b/src/main/java/org/apache/commons/math4/complex/Complex.java
index c8bd211..546b8da 100644
--- a/src/main/java/org/apache/commons/math4/complex/Complex.java
+++ b/src/main/java/org/apache/commons/math4/complex/Complex.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Representation of a Complex number, i.e. a number which has both a
@@ -46,8 +46,8 @@ import org.apache.commons.math3.util.Precision;
  * Note that this is in contradiction with 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}
+ * {@link org.apache.commons.math4.util.Precision#equals(double,double,int)
+ * equals for primitive double} in {@link org.apache.commons.math4.util.Precision}
  * conforms with IEEE-754 while this class conforms with the standard behavior
  * for Java object types.
  * <br/>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/complex/ComplexField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/ComplexField.java b/src/main/java/org/apache/commons/math4/complex/ComplexField.java
index 939752d..8a91d00 100644
--- a/src/main/java/org/apache/commons/math4/complex/ComplexField.java
+++ b/src/main/java/org/apache/commons/math4/complex/ComplexField.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Representation of the complex numbers field.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/complex/ComplexFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/ComplexFormat.java b/src/main/java/org/apache/commons/math4/complex/ComplexFormat.java
index affb638..f1ca864 100644
--- a/src/main/java/org/apache/commons/math4/complex/ComplexFormat.java
+++ b/src/main/java/org/apache/commons/math4/complex/ComplexFormat.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.CompositeFormat;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.CompositeFormat;
 
 /**
  * Formats a Complex number in cartesian format "Re(c) + Im(c)i".  'i' can

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/complex/ComplexUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/ComplexUtils.java b/src/main/java/org/apache/commons/math4/complex/ComplexUtils.java
index 55db946..493374f 100644
--- a/src/main/java/org/apache/commons/math4/complex/ComplexUtils.java
+++ b/src/main/java/org/apache/commons/math4/complex/ComplexUtils.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Static implementations of common
- * {@link org.apache.commons.math3.complex.Complex} utilities functions.
+ * {@link org.apache.commons.math4.complex.Complex} utilities functions.
  *
  */
 public class ComplexUtils {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/complex/Quaternion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/Quaternion.java b/src/main/java/org/apache/commons/math4/complex/Quaternion.java
index e845596..505b64e 100644
--- a/src/main/java/org/apache/commons/math4/complex/Quaternion.java
+++ b/src/main/java/org/apache/commons/math4/complex/Quaternion.java
@@ -15,15 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.io.Serializable;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * This class implements <a href="http://mathworld.wolfram.com/Quaternion.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/complex/RootsOfUnity.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/RootsOfUnity.java b/src/main/java/org/apache/commons/math4/complex/RootsOfUnity.java
index 4e63835..80fcb4b 100644
--- a/src/main/java/org/apache/commons/math4/complex/RootsOfUnity.java
+++ b/src/main/java/org/apache/commons/math4/complex/RootsOfUnity.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * A helper class for the computation and caching of the {@code n}-th roots of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/complex/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/complex/package-info.java b/src/main/java/org/apache/commons/math4/complex/package-info.java
index 818806d..43effd5 100644
--- a/src/main/java/org/apache/commons/math4/complex/package-info.java
+++ b/src/main/java/org/apache/commons/math4/complex/package-info.java
@@ -20,4 +20,4 @@
  *     functions.
  *
  */
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFP.java b/src/main/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFP.java
index c0328b6..86edeca 100644
--- a/src/main/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFP.java
+++ b/src/main/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFP.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
 
-import org.apache.commons.math3.analysis.solvers.AllowedSolution;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.solvers.AllowedSolution;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.Incrementor;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * This class implements a modification of the <a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/dfp/Dfp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/dfp/Dfp.java b/src/main/java/org/apache/commons/math4/dfp/Dfp.java
index 19d79a8..52b992c 100644
--- a/src/main/java/org/apache/commons/math4/dfp/Dfp.java
+++ b/src/main/java/org/apache/commons/math4/dfp/Dfp.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  *  Decimal floating point library for Java
@@ -625,12 +625,12 @@ public class Dfp implements RealFieldElement<Dfp> {
         return field.newDfp(sig, code);
     }
 
-    /** Get the {@link org.apache.commons.math3.Field Field} (really a {@link DfpField}) to which the instance belongs.
+    /** Get the {@link org.apache.commons.math4.Field Field} (really a {@link DfpField}) to which the instance belongs.
      * <p>
      * The field is linked to the number of digits and acts as a factory
      * for {@link Dfp} instances.
      * </p>
-     * @return {@link org.apache.commons.math3.Field Field} (really a {@link DfpField}) to which the instance belongs
+     * @return {@link org.apache.commons.math4.Field Field} (really a {@link DfpField}) to which the instance belongs
      */
     public DfpField getField() {
         return field;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/dfp/DfpDec.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/dfp/DfpDec.java b/src/main/java/org/apache/commons/math4/dfp/DfpDec.java
index 20875c0..6da5b2e 100644
--- a/src/main/java/org/apache/commons/math4/dfp/DfpDec.java
+++ b/src/main/java/org/apache/commons/math4/dfp/DfpDec.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
 /** Subclass of {@link Dfp} which hides the radix-10000 artifacts of the superclass.
  * This should give outward appearances of being a decimal number with DIGITS*4-3

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/dfp/DfpField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/dfp/DfpField.java b/src/main/java/org/apache/commons/math4/dfp/DfpField.java
index fcdec82..0e65b59 100644
--- a/src/main/java/org/apache/commons/math4/dfp/DfpField.java
+++ b/src/main/java/org/apache/commons/math4/dfp/DfpField.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
 
 /** Field for Decimal floating point instances.
  * @since 2.2

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/dfp/DfpMath.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/dfp/DfpMath.java b/src/main/java/org/apache/commons/math4/dfp/DfpMath.java
index 3b19cb6..79c6821 100644
--- a/src/main/java/org/apache/commons/math4/dfp/DfpMath.java
+++ b/src/main/java/org/apache/commons/math4/dfp/DfpMath.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
 /** Mathematical routines for use with {@link Dfp}.
  * The constants are defined in {@link DfpField}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/dfp/UnivariateDfpFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/dfp/UnivariateDfpFunction.java b/src/main/java/org/apache/commons/math4/dfp/UnivariateDfpFunction.java
index b627a32..5c4d4e5 100644
--- a/src/main/java/org/apache/commons/math4/dfp/UnivariateDfpFunction.java
+++ b/src/main/java/org/apache/commons/math4/dfp/UnivariateDfpFunction.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
 /**
  * An interface representing a univariate {@link Dfp} function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/dfp/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/dfp/package-info.java b/src/main/java/org/apache/commons/math4/dfp/package-info.java
index 42a4b48..4013231 100644
--- a/src/main/java/org/apache/commons/math4/dfp/package-info.java
+++ b/src/main/java/org/apache/commons/math4/dfp/package-info.java
@@ -85,4 +85,4 @@
  * this can be rendered invisible by a subclass.</p>
  *
  */
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
index 82a96c5..eccf9e7 100644
--- a/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/AbstractIntegerDistribution.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.RandomDataImpl;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomDataImpl;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Base class for integer-valued discrete distributions.  Default

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java
index a1dfd64..48de3c8 100644
--- a/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * Base class for multivariate probability distributions.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
index e3b1fac..f1e0233 100644
--- a/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/AbstractRealDistribution.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.RandomDataImpl;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolverUtils;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomDataImpl;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Base class for probability distributions on the reals.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java b/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java
index 3f62f64..f2fb03c 100644
--- a/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/BetaDistribution.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Beta;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the Beta distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/BinomialDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/BinomialDistribution.java b/src/main/java/org/apache/commons/math4/distribution/BinomialDistribution.java
index f8cea26..bdb356b 100644
--- a/src/main/java/org/apache/commons/math4/distribution/BinomialDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/BinomialDistribution.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Beta;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the binomial distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/CauchyDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/CauchyDistribution.java b/src/main/java/org/apache/commons/math4/distribution/CauchyDistribution.java
index af3d33a..33d908e 100644
--- a/src/main/java/org/apache/commons/math4/distribution/CauchyDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/CauchyDistribution.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the Cauchy distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/ChiSquaredDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/ChiSquaredDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ChiSquaredDistribution.java
index 393d352..2627c33 100644
--- a/src/main/java/org/apache/commons/math4/distribution/ChiSquaredDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/ChiSquaredDistribution.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 
 /**
  * Implementation of the chi-squared distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java
index 0dbb6aa..6149b31 100644
--- a/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/ConstantRealDistribution.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Implementation of the constant real distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java
index 4cb23c1..8e45c0c 100644
--- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedDistribution.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.io.Serializable;
 import java.lang.reflect.Array;
@@ -22,17 +22,17 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * <p>A generic implementation of a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
index 9a07787..05f0d73 100644
--- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistribution.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * <p>Implementation of an integer-valued {@link EnumeratedDistribution}.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java
index 07b96bc..fabfe00 100644
--- a/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/EnumeratedRealDistribution.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.exception.OutOfRangeException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * <p>Implementation of a real-valued {@link EnumeratedDistribution}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java
index 411f1a2..abb9985 100644
--- a/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/ExponentialDistribution.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.ResizableDoubleArray;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.ResizableDoubleArray;
 
 /**
  * Implementation of the exponential distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/FDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/FDistribution.java b/src/main/java/org/apache/commons/math4/distribution/FDistribution.java
index bd98c37..c34d45f 100644
--- a/src/main/java/org/apache/commons/math4/distribution/FDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/FDistribution.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Beta;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the F-distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java b/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java
index 4f60fa9..905c922 100644
--- a/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/GammaDistribution.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the Gamma distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/GeometricDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/GeometricDistribution.java b/src/main/java/org/apache/commons/math4/distribution/GeometricDistribution.java
index f82a3ec..0963376 100644
--- a/src/main/java/org/apache/commons/math4/distribution/GeometricDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/GeometricDistribution.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the geometric distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/GumbelDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/GumbelDistribution.java b/src/main/java/org/apache/commons/math4/distribution/GumbelDistribution.java
index 85dbedd..9ab0ef2 100644
--- a/src/main/java/org/apache/commons/math4/distribution/GumbelDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/GumbelDistribution.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * This class implements the Gumbel distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/HypergeometricDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/HypergeometricDistribution.java b/src/main/java/org/apache/commons/math4/distribution/HypergeometricDistribution.java
index 7a1436a..86e0ad6 100644
--- a/src/main/java/org/apache/commons/math4/distribution/HypergeometricDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/HypergeometricDistribution.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the hypergeometric distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
index 9ab4a04..a905b3b 100644
--- a/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/IntegerDistribution.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Interface for distributions on the integers.
@@ -147,7 +147,7 @@ public interface IntegerDistribution {
      *
      * @param sampleSize the number of random values to generate
      * @return an array representing the random sample
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code sampleSize} is not positive
      * @since 3.0
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistribution.java b/src/main/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistribution.java
index 7af514d..7199121 100644
--- a/src/main/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistribution.java
@@ -15,23 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.fraction.BigFractionField;
-import org.apache.commons.math3.fraction.FractionConversionException;
-import org.apache.commons.math3.linear.Array2DRowFieldMatrix;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.FieldMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.fraction.BigFractionField;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the Kolmogorov-Smirnov distribution.
@@ -69,7 +69,7 @@ import org.apache.commons.math3.util.FastMath;
  * @see <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test">
  * Kolmogorov-Smirnov test (Wikipedia)</a>
  * @deprecated to be removed in version 4.0 -
- *  use {@link org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest}
+ *  use {@link org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest}
  */
 public class KolmogorovSmirnovDistribution implements Serializable {
 
@@ -98,12 +98,12 @@ public class KolmogorovSmirnovDistribution implements Serializable {
      * exact as with
      * {@link KolmogorovSmirnovDistribution#cdfExact(double)} because
      * calculations are based on {@code double} rather than
-     * {@link org.apache.commons.math3.fraction.BigFraction}.
+     * {@link org.apache.commons.math4.fraction.BigFraction}.
      *
      * @param d statistic
      * @return the two-sided probability of {@code P(D_n < d)}
      * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
+     * to a {@link org.apache.commons.math4.fraction.BigFraction} in expressing
      * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
      * {@code 0 <= h < 1}.
      */
@@ -123,7 +123,7 @@ public class KolmogorovSmirnovDistribution implements Serializable {
      * @param d statistic
      * @return the two-sided probability of {@code P(D_n < d)}
      * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
+     * to a {@link org.apache.commons.math4.fraction.BigFraction} in expressing
      * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
      * {@code 0 <= h < 1}.
      */
@@ -137,14 +137,14 @@ public class KolmogorovSmirnovDistribution implements Serializable {
      *
      * @param d statistic
      * @param exact whether the probability should be calculated exact using
-     * {@link org.apache.commons.math3.fraction.BigFraction} everywhere at the
+     * {@link org.apache.commons.math4.fraction.BigFraction} everywhere at the
      * expense of very slow execution time, or if {@code double} should be used
      * convenient places to gain speed. Almost never choose {@code true} in real
      * applications unless you are very sure; {@code true} is almost solely for
      * verification purposes.
      * @return the two-sided probability of {@code P(D_n < d)}
      * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
+     * to a {@link org.apache.commons.math4.fraction.BigFraction} in expressing
      * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
      * {@code 0 <= h < 1}.
      */
@@ -183,13 +183,13 @@ public class KolmogorovSmirnovDistribution implements Serializable {
 
     /**
      * Calculates the exact value of {@code P(D_n < d)} using method described
-     * in [1] and {@link org.apache.commons.math3.fraction.BigFraction} (see
+     * in [1] and {@link org.apache.commons.math4.fraction.BigFraction} (see
      * above).
      *
      * @param d statistic
      * @return the two-sided probability of {@code P(D_n < d)}
      * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
+     * to a {@link org.apache.commons.math4.fraction.BigFraction} in expressing
      * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
      * {@code 0 <= h < 1}.
      */
@@ -221,7 +221,7 @@ public class KolmogorovSmirnovDistribution implements Serializable {
      * @param d statistic
      * @return the two-sided probability of {@code P(D_n < d)}
      * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
+     * to a {@link org.apache.commons.math4.fraction.BigFraction} in expressing
      * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
      * {@code 0 <= h < 1}.
      */
@@ -261,7 +261,7 @@ public class KolmogorovSmirnovDistribution implements Serializable {
      * @return H matrix
      * @throws NumberIsTooLargeException if fractional part is greater than 1
      * @throws FractionConversionException if algorithm fails to convert
-     * {@code h} to a {@link org.apache.commons.math3.fraction.BigFraction} in
+     * {@code h} to a {@link org.apache.commons.math4.fraction.BigFraction} in
      * expressing {@code d} as {@code (k - h) / m} for integer {@code k, m} and
      * {@code 0 <= h < 1}.
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/LaplaceDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/LaplaceDistribution.java b/src/main/java/org/apache/commons/math4/distribution/LaplaceDistribution.java
index 0514bff..d3f21bb 100644
--- a/src/main/java/org/apache/commons/math4/distribution/LaplaceDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/LaplaceDistribution.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements the Laplace distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java b/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
index 4580e50..a2bbab1 100644
--- a/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/LevyDistribution.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Erf;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Erf;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements the <a href="http://en.wikipedia.org/wiki/L%C3%A9vy_distribution">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
index b8148b0..ec43db5 100644
--- a/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/LogNormalDistribution.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Erf;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Erf;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the log-normal (gaussian) distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/LogisticDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/LogisticDistribution.java b/src/main/java/org/apache/commons/math4/distribution/LogisticDistribution.java
index 59313f5..ee29d3f 100644
--- a/src/main/java/org/apache/commons/math4/distribution/LogisticDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/LogisticDistribution.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * This class implements the Logistic distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java
index 0cf88c2..d7cd4cd 100644
--- a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateNormalDistribution.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Multivariate normal mixture distribution.
@@ -38,7 +38,7 @@ public class MixtureMultivariateNormalDistribution
      * Creates a multivariate normal mixture distribution.
      * <p>
      * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link org.apache.commons.math3.random.Well19937c Well19937c} as random
+     * {@link org.apache.commons.math4.random.Well19937c Well19937c} as random
      * generator to be used for sampling only (see {@link #sample()} and
      * {@link #sample(int)}). In case no sampling is needed for the created
      * distribution, it is advised to pass {@code null} as random generator via
@@ -60,7 +60,7 @@ public class MixtureMultivariateNormalDistribution
      * associated weights.
      * <p>
      * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link org.apache.commons.math3.random.Well19937c Well19937c} as random
+     * {@link org.apache.commons.math4.random.Well19937c Well19937c} as random
      * generator to be used for sampling only (see {@link #sample()} and
      * {@link #sample(int)}). In case no sampling is needed for the created
      * distribution, it is advised to pass {@code null} as random generator via

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java
index f0939f6..d8bbb9a 100644
--- a/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/MixtureMultivariateRealDistribution.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Class for representing <a href="http://en.wikipedia.org/wiki/Mixture_model">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java
index 7fc8b74..345fc5f 100644
--- a/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/MultivariateNormalDistribution.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.NonPositiveDefiniteMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Implementation of the multivariate normal (Gaussian) distribution.


[59/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
index 8b91685..a18b864 100644
--- a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
+++ b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestBinary.java
@@ -14,12 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.LinkedList;
 import java.util.List;
 
+import org.apache.commons.math4.genetics.AbstractListChromosome;
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.BinaryMutation;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.genetics.FixedGenerationCount;
+import org.apache.commons.math4.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.genetics.OnePointCrossover;
+import org.apache.commons.math4.genetics.Population;
+import org.apache.commons.math4.genetics.StoppingCondition;
+import org.apache.commons.math4.genetics.TournamentSelection;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java
index 228eb69..4ce2bb1 100644
--- a/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java
+++ b/src/test/java/org/apache/commons/math4/genetics/GeneticAlgorithmTestPermutations.java
@@ -14,13 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.genetics.AbstractListChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.genetics.FixedGenerationCount;
+import org.apache.commons.math4.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.genetics.OnePointCrossover;
+import org.apache.commons.math4.genetics.Population;
+import org.apache.commons.math4.genetics.RandomKey;
+import org.apache.commons.math4.genetics.RandomKeyMutation;
+import org.apache.commons.math4.genetics.StoppingCondition;
+import org.apache.commons.math4.genetics.TournamentSelection;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java b/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java
index 9234492..9261fe3 100644
--- a/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/ListPopulationTest.java
@@ -14,15 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ListPopulation;
+import org.apache.commons.math4.genetics.Population;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java
index f290841..363b161 100644
--- a/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/NPointCrossoverTest.java
@@ -14,13 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ChromosomePair;
+import org.apache.commons.math4.genetics.CrossoverPolicy;
+import org.apache.commons.math4.genetics.NPointCrossover;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java
index 69ccab4..6f431e2 100644
--- a/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/OnePointCrossoverTest.java
@@ -14,8 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.ChromosomePair;
+import org.apache.commons.math4.genetics.OnePointCrossover;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java
index 73fd633..720eb23 100644
--- a/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/OrderedCrossoverTest.java
@@ -14,14 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ChromosomePair;
+import org.apache.commons.math4.genetics.CrossoverPolicy;
+import org.apache.commons.math4.genetics.OrderedCrossover;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/RandomKeyMutationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/RandomKeyMutationTest.java b/src/test/java/org/apache/commons/math4/genetics/RandomKeyMutationTest.java
index 580c848..3488f25 100644
--- a/src/test/java/org/apache/commons/math4/genetics/RandomKeyMutationTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/RandomKeyMutationTest.java
@@ -14,9 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.MutationPolicy;
+import org.apache.commons.math4.genetics.RandomKey;
+import org.apache.commons.math4.genetics.RandomKeyMutation;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/RandomKeyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/RandomKeyTest.java b/src/test/java/org/apache/commons/math4/genetics/RandomKeyTest.java
index 4ae518f..040edc9 100644
--- a/src/test/java/org/apache/commons/math4/genetics/RandomKeyTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/RandomKeyTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 
 import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
 
+import org.apache.commons.math4.genetics.RandomKey;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/TournamentSelectionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/TournamentSelectionTest.java b/src/test/java/org/apache/commons/math4/genetics/TournamentSelectionTest.java
index 55cad32..4f132db 100644
--- a/src/test/java/org/apache/commons/math4/genetics/TournamentSelectionTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/TournamentSelectionTest.java
@@ -14,8 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ChromosomePair;
+import org.apache.commons.math4.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.genetics.TournamentSelection;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java b/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java
index a99cb4a..03409de 100644
--- a/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java
+++ b/src/test/java/org/apache/commons/math4/genetics/UniformCrossoverTest.java
@@ -14,16 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.genetics;
+package org.apache.commons.math4.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
 import org.junit.Assert;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.genetics.BinaryChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ChromosomePair;
+import org.apache.commons.math4.genetics.CrossoverPolicy;
+import org.apache.commons.math4.genetics.UniformCrossover;
 import org.junit.BeforeClass;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
index 437d216..3729574 100644
--- a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser2DTest.java
@@ -14,17 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.enclosing;
+package org.apache.commons.math4.geometry.enclosing;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.twod.DiskGenerator;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well1024a;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.enclosing.WelzlEncloser;
+import org.apache.commons.math4.geometry.euclidean.twod.DiskGenerator;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well1024a;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java
index b4bc2d6..aaa4c43 100644
--- a/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/enclosing/WelzlEncloser3DTest.java
@@ -14,19 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.enclosing;
+package org.apache.commons.math4.geometry.enclosing;
 
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.threed.Euclidean3D;
-import org.apache.commons.math3.geometry.euclidean.threed.SphereGenerator;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.random.Well1024a;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.enclosing.WelzlEncloser;
+import org.apache.commons.math4.geometry.euclidean.threed.Euclidean3D;
+import org.apache.commons.math4.geometry.euclidean.threed.SphereGenerator;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.random.Well1024a;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1DTest.java
index ab6fb97..92a3e7b 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1DTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/FrenchVector1DFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/FrenchVector1DFormatTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/FrenchVector1DFormatTest.java
index 3d836f4..d083c8d 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/FrenchVector1DFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/FrenchVector1DFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
index dd3b461..2ebd847 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.geometry.euclidean.oned.Interval;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
index 0a982ed..a8b00dc 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSetTest.java
@@ -14,17 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Interval;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatAbstractTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatAbstractTest.java
index ab76091..699ff13 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatAbstractTest.java
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1DFormat;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatTest.java
index 305d1a3..9ad0eb1 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
index 500ce6b..0bf6b84 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DTest.java
@@ -15,18 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3DTest.java
index 7456baa..66c494d 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3DTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.threed.Euclidean3D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java
index bcbe91e..1f3af57 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDSTest.java
@@ -15,17 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.euclidean.threed.CardanEulerSingularityException;
+import org.apache.commons.math4.geometry.euclidean.threed.FieldRotation;
+import org.apache.commons.math4.geometry.euclidean.threed.FieldVector3D;
+import org.apache.commons.math4.geometry.euclidean.threed.NotARotationMatrixException;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.RotationOrder;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java
index 5141d3e..c63cf6d 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldRotationDfpTest.java
@@ -15,16 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.dfp.Dfp;
-import org.apache.commons.math3.dfp.DfpField;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpField;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.euclidean.threed.CardanEulerSingularityException;
+import org.apache.commons.math4.geometry.euclidean.threed.FieldRotation;
+import org.apache.commons.math4.geometry.euclidean.threed.FieldVector3D;
+import org.apache.commons.math4.geometry.euclidean.threed.NotARotationMatrixException;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.RotationOrder;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
index 9b9fc3b..48e41e2 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3DTest.java
@@ -15,19 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
 import java.util.Locale;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.geometry.euclidean.threed.FieldVector3D;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FrenchVector3DFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FrenchVector3DFormatTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FrenchVector3DFormatTest.java
index 9d01c5f..42dd7b6 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FrenchVector3DFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/FrenchVector3DFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/LineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/LineTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/LineTest.java
index 1811869..66418bd 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/LineTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/LineTest.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.geometry.euclidean.threed.Line;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.euclidean.threed.Line;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PlaneTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PlaneTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PlaneTest.java
index 081ccb6..0f424e5 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PlaneTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PlaneTest.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.geometry.euclidean.threed.Line;
-import org.apache.commons.math3.geometry.euclidean.threed.Plane;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.euclidean.threed.Line;
+import org.apache.commons.math4.geometry.euclidean.threed.Plane;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
index b23fc5d..dfdd39d 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSetTest.java
@@ -14,24 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math3.geometry.euclidean.twod.SubLine;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.euclidean.threed.Euclidean3D;
+import org.apache.commons.math4.geometry.euclidean.threed.Plane;
+import org.apache.commons.math4.geometry.euclidean.threed.PolyhedronsSet;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.SubPlane;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
+import org.apache.commons.math4.geometry.euclidean.twod.SubLine;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
+import org.apache.commons.math4.geometry.partitioning.BoundaryAttribute;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrderTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrderTest.java
index 6dd2612..68bc5b9 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrderTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrderTest.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.lang.reflect.Field;
 
-import org.apache.commons.math3.geometry.euclidean.threed.RotationOrder;
+import org.apache.commons.math4.geometry.euclidean.threed.RotationOrder;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationTest.java
index d14f77f..0320175 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/RotationTest.java
@@ -15,12 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.euclidean.threed.CardanEulerSingularityException;
+import org.apache.commons.math4.geometry.euclidean.threed.NotARotationMatrixException;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.RotationOrder;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java
index 1950a06..deb0cc3 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGeneratorTest.java
@@ -14,17 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.euclidean.threed.Euclidean3D;
+import org.apache.commons.math4.geometry.euclidean.threed.SphereGenerator;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinatesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinatesTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinatesTest.java
index 9bc9207..b1d4e68 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinatesTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinatesTest.java
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.geometry.euclidean.threed.SphericalCoordinates;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SubLineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SubLineTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SubLineTest.java
index 6996111..a2509fa 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SubLineTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/SubLineTest.java
@@ -14,14 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.threed.Line;
+import org.apache.commons.math4.geometry.euclidean.threed.Segment;
+import org.apache.commons.math4.geometry.euclidean.threed.SubLine;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatAbstractTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
index 4508ab4..a8c13e6 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatAbstractTest.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3DFormat;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3DFormat;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatTest.java
index 1e29e3a..a316d34 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
index 7e2bf49..c3bdf9f 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DTest.java
@@ -15,20 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
 import java.util.Locale;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java
index a7fc16e..f26d467 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGeneratorTest.java
@@ -14,16 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.random.Well1024a;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.euclidean.twod.DiskGenerator;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.random.Well1024a;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2DTest.java
index 18b5cbd..a1c82b9 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2DTest.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/FrenchVector2DFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/FrenchVector2DFormatTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/FrenchVector2DFormatTest.java
index 55c5158..188c815 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/FrenchVector2DFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/FrenchVector2DFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java
index 8ce43fd..f7e3379 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/LineTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Line;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.geometry.euclidean.twod;
+
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Line;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.Transform;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java
index a459484..a444273 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSetTest.java
@@ -14,23 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryProjection;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.euclidean.oned.Interval;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Line;
+import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
+import org.apache.commons.math4.geometry.euclidean.twod.SubLine;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
+import org.apache.commons.math4.geometry.partitioning.BoundaryProjection;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SegmentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SegmentTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SegmentTest.java
index fa1efc8..6c2ea15 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SegmentTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SegmentTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
-import org.apache.commons.math3.geometry.euclidean.twod.Line;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.euclidean.twod.Line;
+import org.apache.commons.math4.geometry.euclidean.twod.Segment;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SubLineTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SubLineTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SubLineTest.java
index 43c15f0..249c5d7 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SubLineTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/SubLineTest.java
@@ -14,13 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.twod.Line;
+import org.apache.commons.math4.geometry.euclidean.twod.Segment;
+import org.apache.commons.math4.geometry.euclidean.twod.SubLine;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatAbstractTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatAbstractTest.java
index b86e739..ef1c765 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatAbstractTest.java
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2DFormat;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatTest.java
index 1231559..fbb5076 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DTest.java
index 32e5325..255324a 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristicTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristicTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristicTest.java
index 860fd83..219e5b2 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristicTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristicTest.java
@@ -14,11 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.AklToussaintHeuristic;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHullGenerator2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.MonotoneChain;
 
 /**
  * Test class for AklToussaintHeuristic.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
index 0c52550..5b3f8ae 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2DAbstractTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -22,16 +22,18 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHull2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHullGenerator2D;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java
index fb85f53..ebc2f6c 100644
--- a/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChainTest.java
@@ -14,13 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHull2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHullGenerator2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.MonotoneChain;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTreeTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTreeTest.java b/src/test/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTreeTest.java
index 49cfef6..2174cd5 100644
--- a/src/test/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTreeTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/partitioning/utilities/AVLTreeTest.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning.utilities;
+package org.apache.commons.math4.geometry.partitioning.utilities;
 
-import org.apache.commons.math3.geometry.partitioning.utilities.AVLTree;
+import org.apache.commons.math4.geometry.partitioning.utilities.AVLTree;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
index b835ea8..0f707bb 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.spherical.oned.Arc;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
index 5b9da17..1eaa73c 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/ArcsSetTest.java
@@ -14,23 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.geometry.spherical.oned.Arc;
+import org.apache.commons.math4.geometry.spherical.oned.ArcsSet;
+import org.apache.commons.math4.geometry.spherical.oned.LimitAngle;
+import org.apache.commons.math4.geometry.spherical.oned.S1Point;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.geometry.spherical.oned.SubLimitAngle;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngleTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngleTest.java
index e049670..eb50bd9 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngleTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/LimitAngleTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.geometry.spherical.oned.LimitAngle;
+import org.apache.commons.math4.geometry.spherical.oned.S1Point;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/oned/S1PointTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/S1PointTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/S1PointTest.java
index 5552a6e..4356f31 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/S1PointTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/S1PointTest.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.geometry.spherical.oned.S1Point;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1Test.java b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1Test.java
index e9e276d..e137f14 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1Test.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/oned/Sphere1Test.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.oned;
+package org.apache.commons.math4.geometry.spherical.oned;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/twod/CircleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/CircleTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/CircleTest.java
index 7546017..ecad646 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/CircleTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/CircleTest.java
@@ -14,21 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
-
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.geometry.spherical.oned.LimitAngle;
-import org.apache.commons.math3.geometry.spherical.oned.S1Point;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.geometry.spherical.oned.SubLimitAngle;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.geometry.spherical.twod;
+
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.Transform;
+import org.apache.commons.math4.geometry.spherical.oned.Arc;
+import org.apache.commons.math4.geometry.spherical.oned.LimitAngle;
+import org.apache.commons.math4.geometry.spherical.oned.S1Point;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.geometry.spherical.oned.SubLimitAngle;
+import org.apache.commons.math4.geometry.spherical.twod.Circle;
+import org.apache.commons.math4.geometry.spherical.twod.S2Point;
+import org.apache.commons.math4.geometry.spherical.twod.Sphere2D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/twod/S2PointTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/S2PointTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/S2PointTest.java
index 1d1b117..2b410bd 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/S2PointTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/S2PointTest.java
@@ -14,12 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.geometry.spherical.twod.S2Point;
+import org.apache.commons.math4.geometry.spherical.twod.Sphere2D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 


[39/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/BracketingNthOrderBrentSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/BracketingNthOrderBrentSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/BracketingNthOrderBrentSolver.java
deleted file mode 100644
index 4981592..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/BracketingNthOrderBrentSolver.java
+++ /dev/null
@@ -1,412 +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.analysis.solvers;
-
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * This class implements a modification of the <a
- * href="http://mathworld.wolfram.com/BrentsMethod.html"> Brent algorithm</a>.
- * <p>
- * The changes with respect to the original Brent algorithm are:
- * <ul>
- *   <li>the returned value is chosen in the current interval according
- *   to user specified {@link AllowedSolution},</li>
- *   <li>the maximal order for the invert polynomial root search is
- *   user-specified instead of being invert quadratic only</li>
- * </ul>
- * </p>
- * The given interval must bracket the root.
- *
- */
-public class BracketingNthOrderBrentSolver
-    extends AbstractUnivariateSolver
-    implements BracketedUnivariateSolver<UnivariateFunction> {
-
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /** Default maximal order. */
-    private static final int DEFAULT_MAXIMAL_ORDER = 5;
-
-    /** Maximal aging triggering an attempt to balance the bracketing interval. */
-    private static final int MAXIMAL_AGING = 2;
-
-    /** Reduction factor for attempts to balance the bracketing interval. */
-    private static final double REDUCTION_FACTOR = 1.0 / 16.0;
-
-    /** Maximal order. */
-    private final int maximalOrder;
-
-    /** The kinds of solutions that the algorithm may accept. */
-    private AllowedSolution allowed;
-
-    /**
-     * Construct a solver with default accuracy and maximal order (1e-6 and 5 respectively)
-     */
-    public BracketingNthOrderBrentSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY, DEFAULT_MAXIMAL_ORDER);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param maximalOrder maximal order.
-     * @exception NumberIsTooSmallException if maximal order is lower than 2
-     */
-    public BracketingNthOrderBrentSolver(final double absoluteAccuracy,
-                                         final int maximalOrder)
-        throws NumberIsTooSmallException {
-        super(absoluteAccuracy);
-        if (maximalOrder < 2) {
-            throw new NumberIsTooSmallException(maximalOrder, 2, true);
-        }
-        this.maximalOrder = maximalOrder;
-        this.allowed = AllowedSolution.ANY_SIDE;
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param maximalOrder maximal order.
-     * @exception NumberIsTooSmallException if maximal order is lower than 2
-     */
-    public BracketingNthOrderBrentSolver(final double relativeAccuracy,
-                                         final double absoluteAccuracy,
-                                         final int maximalOrder)
-        throws NumberIsTooSmallException {
-        super(relativeAccuracy, absoluteAccuracy);
-        if (maximalOrder < 2) {
-            throw new NumberIsTooSmallException(maximalOrder, 2, true);
-        }
-        this.maximalOrder = maximalOrder;
-        this.allowed = AllowedSolution.ANY_SIDE;
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param functionValueAccuracy Function value accuracy.
-     * @param maximalOrder maximal order.
-     * @exception NumberIsTooSmallException if maximal order is lower than 2
-     */
-    public BracketingNthOrderBrentSolver(final double relativeAccuracy,
-                                         final double absoluteAccuracy,
-                                         final double functionValueAccuracy,
-                                         final int maximalOrder)
-        throws NumberIsTooSmallException {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-        if (maximalOrder < 2) {
-            throw new NumberIsTooSmallException(maximalOrder, 2, true);
-        }
-        this.maximalOrder = maximalOrder;
-        this.allowed = AllowedSolution.ANY_SIDE;
-    }
-
-    /** Get the maximal order.
-     * @return maximal order
-     */
-    public int getMaximalOrder() {
-        return maximalOrder;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws TooManyEvaluationsException,
-               NumberIsTooLargeException,
-               NoBracketingException {
-        // prepare arrays with the first points
-        final double[] x = new double[maximalOrder + 1];
-        final double[] y = new double[maximalOrder + 1];
-        x[0] = getMin();
-        x[1] = getStartValue();
-        x[2] = getMax();
-        verifySequence(x[0], x[1], x[2]);
-
-        // evaluate initial guess
-        y[1] = computeObjectiveValue(x[1]);
-        if (Precision.equals(y[1], 0.0, 1)) {
-            // return the initial guess if it is a perfect root.
-            return x[1];
-        }
-
-        // evaluate first  endpoint
-        y[0] = computeObjectiveValue(x[0]);
-        if (Precision.equals(y[0], 0.0, 1)) {
-            // return the first endpoint if it is a perfect root.
-            return x[0];
-        }
-
-        int nbPoints;
-        int signChangeIndex;
-        if (y[0] * y[1] < 0) {
-
-            // reduce interval if it brackets the root
-            nbPoints        = 2;
-            signChangeIndex = 1;
-
-        } else {
-
-            // evaluate second endpoint
-            y[2] = computeObjectiveValue(x[2]);
-            if (Precision.equals(y[2], 0.0, 1)) {
-                // return the second endpoint if it is a perfect root.
-                return x[2];
-            }
-
-            if (y[1] * y[2] < 0) {
-                // use all computed point as a start sampling array for solving
-                nbPoints        = 3;
-                signChangeIndex = 2;
-            } else {
-                throw new NoBracketingException(x[0], x[2], y[0], y[2]);
-            }
-
-        }
-
-        // prepare a work array for inverse polynomial interpolation
-        final double[] tmpX = new double[x.length];
-
-        // current tightest bracketing of the root
-        double xA    = x[signChangeIndex - 1];
-        double yA    = y[signChangeIndex - 1];
-        double absYA = FastMath.abs(yA);
-        int agingA   = 0;
-        double xB    = x[signChangeIndex];
-        double yB    = y[signChangeIndex];
-        double absYB = FastMath.abs(yB);
-        int agingB   = 0;
-
-        // search loop
-        while (true) {
-
-            // check convergence of bracketing interval
-            final double xTol = getAbsoluteAccuracy() +
-                                getRelativeAccuracy() * FastMath.max(FastMath.abs(xA), FastMath.abs(xB));
-            if (((xB - xA) <= xTol) || (FastMath.max(absYA, absYB) < getFunctionValueAccuracy())) {
-                switch (allowed) {
-                case ANY_SIDE :
-                    return absYA < absYB ? xA : xB;
-                case LEFT_SIDE :
-                    return xA;
-                case RIGHT_SIDE :
-                    return xB;
-                case BELOW_SIDE :
-                    return (yA <= 0) ? xA : xB;
-                case ABOVE_SIDE :
-                    return (yA <  0) ? xB : xA;
-                default :
-                    // this should never happen
-                    throw new MathInternalError();
-                }
-            }
-
-            // target for the next evaluation point
-            double targetY;
-            if (agingA >= MAXIMAL_AGING) {
-                // we keep updating the high bracket, try to compensate this
-                final int p = agingA - MAXIMAL_AGING;
-                final double weightA = (1 << p) - 1;
-                final double weightB = p + 1;
-                targetY = (weightA * yA - weightB * REDUCTION_FACTOR * yB) / (weightA + weightB);
-            } else if (agingB >= MAXIMAL_AGING) {
-                // we keep updating the low bracket, try to compensate this
-                final int p = agingB - MAXIMAL_AGING;
-                final double weightA = p + 1;
-                final double weightB = (1 << p) - 1;
-                targetY = (weightB * yB - weightA * REDUCTION_FACTOR * yA) / (weightA + weightB);
-            } else {
-                // bracketing is balanced, try to find the root itself
-                targetY = 0;
-            }
-
-            // make a few attempts to guess a root,
-            double nextX;
-            int start = 0;
-            int end   = nbPoints;
-            do {
-
-                // guess a value for current target, using inverse polynomial interpolation
-                System.arraycopy(x, start, tmpX, start, end - start);
-                nextX = guessX(targetY, tmpX, y, start, end);
-
-                if (!((nextX > xA) && (nextX < xB))) {
-                    // the guessed root is not strictly inside of the tightest bracketing interval
-
-                    // the guessed root is either not strictly inside the interval or it
-                    // is a NaN (which occurs when some sampling points share the same y)
-                    // we try again with a lower interpolation order
-                    if (signChangeIndex - start >= end - signChangeIndex) {
-                        // we have more points before the sign change, drop the lowest point
-                        ++start;
-                    } else {
-                        // we have more points after sign change, drop the highest point
-                        --end;
-                    }
-
-                    // we need to do one more attempt
-                    nextX = Double.NaN;
-
-                }
-
-            } while (Double.isNaN(nextX) && (end - start > 1));
-
-            if (Double.isNaN(nextX)) {
-                // fall back to bisection
-                nextX = xA + 0.5 * (xB - xA);
-                start = signChangeIndex - 1;
-                end   = signChangeIndex;
-            }
-
-            // evaluate the function at the guessed root
-            final double nextY = computeObjectiveValue(nextX);
-            if (Precision.equals(nextY, 0.0, 1)) {
-                // we have found an exact root, since it is not an approximation
-                // we don't need to bother about the allowed solutions setting
-                return nextX;
-            }
-
-            if ((nbPoints > 2) && (end - start != nbPoints)) {
-
-                // we have been forced to ignore some points to keep bracketing,
-                // they are probably too far from the root, drop them from now on
-                nbPoints = end - start;
-                System.arraycopy(x, start, x, 0, nbPoints);
-                System.arraycopy(y, start, y, 0, nbPoints);
-                signChangeIndex -= start;
-
-            } else  if (nbPoints == x.length) {
-
-                // we have to drop one point in order to insert the new one
-                nbPoints--;
-
-                // keep the tightest bracketing interval as centered as possible
-                if (signChangeIndex >= (x.length + 1) / 2) {
-                    // we drop the lowest point, we have to shift the arrays and the index
-                    System.arraycopy(x, 1, x, 0, nbPoints);
-                    System.arraycopy(y, 1, y, 0, nbPoints);
-                    --signChangeIndex;
-                }
-
-            }
-
-            // insert the last computed point
-            //(by construction, we know it lies inside the tightest bracketing interval)
-            System.arraycopy(x, signChangeIndex, x, signChangeIndex + 1, nbPoints - signChangeIndex);
-            x[signChangeIndex] = nextX;
-            System.arraycopy(y, signChangeIndex, y, signChangeIndex + 1, nbPoints - signChangeIndex);
-            y[signChangeIndex] = nextY;
-            ++nbPoints;
-
-            // update the bracketing interval
-            if (nextY * yA <= 0) {
-                // the sign change occurs before the inserted point
-                xB = nextX;
-                yB = nextY;
-                absYB = FastMath.abs(yB);
-                ++agingA;
-                agingB = 0;
-            } else {
-                // the sign change occurs after the inserted point
-                xA = nextX;
-                yA = nextY;
-                absYA = FastMath.abs(yA);
-                agingA = 0;
-                ++agingB;
-
-                // update the sign change index
-                signChangeIndex++;
-
-            }
-
-        }
-
-    }
-
-    /** Guess an x value by n<sup>th</sup> order inverse polynomial interpolation.
-     * <p>
-     * The x value is guessed by evaluating polynomial Q(y) at y = targetY, where Q
-     * is built such that for all considered points (x<sub>i</sub>, y<sub>i</sub>),
-     * Q(y<sub>i</sub>) = x<sub>i</sub>.
-     * </p>
-     * @param targetY target value for y
-     * @param x reference points abscissas for interpolation,
-     * note that this array <em>is</em> modified during computation
-     * @param y reference points ordinates for interpolation
-     * @param start start index of the points to consider (inclusive)
-     * @param end end index of the points to consider (exclusive)
-     * @return guessed root (will be a NaN if two points share the same y)
-     */
-    private double guessX(final double targetY, final double[] x, final double[] y,
-                          final int start, final int end) {
-
-        // compute Q Newton coefficients by divided differences
-        for (int i = start; i < end - 1; ++i) {
-            final int delta = i + 1 - start;
-            for (int j = end - 1; j > i; --j) {
-                x[j] = (x[j] - x[j-1]) / (y[j] - y[j - delta]);
-            }
-        }
-
-        // evaluate Q(targetY)
-        double x0 = 0;
-        for (int j = end - 1; j >= start; --j) {
-            x0 = x[j] + x0 * (targetY - y[j]);
-        }
-
-        return x0;
-
-    }
-
-    /** {@inheritDoc} */
-    public double solve(int maxEval, UnivariateFunction f, double min,
-                        double max, AllowedSolution allowedSolution)
-        throws TooManyEvaluationsException,
-               NumberIsTooLargeException,
-               NoBracketingException {
-        this.allowed = allowedSolution;
-        return super.solve(maxEval, f, min, max);
-    }
-
-    /** {@inheritDoc} */
-    public double solve(int maxEval, UnivariateFunction f, double min,
-                        double max, double startValue,
-                        AllowedSolution allowedSolution)
-        throws TooManyEvaluationsException,
-               NumberIsTooLargeException,
-               NoBracketingException {
-        this.allowed = allowedSolution;
-        return super.solve(maxEval, f, min, max, startValue);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/BrentSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/BrentSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/BrentSolver.java
deleted file mode 100644
index 0cc8750..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/BrentSolver.java
+++ /dev/null
@@ -1,244 +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.analysis.solvers;
-
-
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * This class implements the <a href="http://mathworld.wolfram.com/BrentsMethod.html">
- * Brent algorithm</a> for finding zeros of real univariate functions.
- * The function should be continuous but not necessarily smooth.
- * The {@code solve} method returns a zero {@code x} of the function {@code f}
- * in the given interval {@code [a, b]} to within a tolerance
- * {@code 2 eps abs(x) + t} where {@code eps} is the relative accuracy and
- * {@code t} is the absolute accuracy.
- * The given interval must bracket the root.
- * <p>
- *  The reference implementation is given in chapter 4 of
- *  <blockquote>
- *   <b>Algorithms for Minimization Without Derivatives</b><br>
- *   <em>Richard P. Brent</em><br>
- *   Dover, 2002<br>
- *  </blockquote>
- * </p>
- *
- * @see BaseAbstractUnivariateSolver
- */
-public class BrentSolver extends AbstractUnivariateSolver {
-
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /**
-     * Construct a solver with default absolute accuracy (1e-6).
-     */
-    public BrentSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public BrentSolver(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public BrentSolver(double relativeAccuracy,
-                       double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param functionValueAccuracy Function value accuracy.
-     *
-     * @see BaseAbstractUnivariateSolver#BaseAbstractUnivariateSolver(double,double,double)
-     */
-    public BrentSolver(double relativeAccuracy,
-                       double absoluteAccuracy,
-                       double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws NoBracketingException,
-               TooManyEvaluationsException,
-               NumberIsTooLargeException {
-        double min = getMin();
-        double max = getMax();
-        final double initial = getStartValue();
-        final double functionValueAccuracy = getFunctionValueAccuracy();
-
-        verifySequence(min, initial, max);
-
-        // Return the initial guess if it is good enough.
-        double yInitial = computeObjectiveValue(initial);
-        if (FastMath.abs(yInitial) <= functionValueAccuracy) {
-            return initial;
-        }
-
-        // Return the first endpoint if it is good enough.
-        double yMin = computeObjectiveValue(min);
-        if (FastMath.abs(yMin) <= functionValueAccuracy) {
-            return min;
-        }
-
-        // Reduce interval if min and initial bracket the root.
-        if (yInitial * yMin < 0) {
-            return brent(min, initial, yMin, yInitial);
-        }
-
-        // Return the second endpoint if it is good enough.
-        double yMax = computeObjectiveValue(max);
-        if (FastMath.abs(yMax) <= functionValueAccuracy) {
-            return max;
-        }
-
-        // Reduce interval if initial and max bracket the root.
-        if (yInitial * yMax < 0) {
-            return brent(initial, max, yInitial, yMax);
-        }
-
-        throw new NoBracketingException(min, max, yMin, yMax);
-    }
-
-    /**
-     * Search for a zero inside the provided interval.
-     * This implementation is based on the algorithm described at page 58 of
-     * the book
-     * <blockquote>
-     *  <b>Algorithms for Minimization Without Derivatives</b>
-     *  <it>Richard P. Brent</it>
-     *  Dover 0-486-41998-3
-     * </blockquote>
-     *
-     * @param lo Lower bound of the search interval.
-     * @param hi Higher bound of the search interval.
-     * @param fLo Function value at the lower bound of the search interval.
-     * @param fHi Function value at the higher bound of the search interval.
-     * @return the value where the function is zero.
-     */
-    private double brent(double lo, double hi,
-                         double fLo, double fHi) {
-        double a = lo;
-        double fa = fLo;
-        double b = hi;
-        double fb = fHi;
-        double c = a;
-        double fc = fa;
-        double d = b - a;
-        double e = d;
-
-        final double t = getAbsoluteAccuracy();
-        final double eps = getRelativeAccuracy();
-
-        while (true) {
-            if (FastMath.abs(fc) < FastMath.abs(fb)) {
-                a = b;
-                b = c;
-                c = a;
-                fa = fb;
-                fb = fc;
-                fc = fa;
-            }
-
-            final double tol = 2 * eps * FastMath.abs(b) + t;
-            final double m = 0.5 * (c - b);
-
-            if (FastMath.abs(m) <= tol ||
-                Precision.equals(fb, 0))  {
-                return b;
-            }
-            if (FastMath.abs(e) < tol ||
-                FastMath.abs(fa) <= FastMath.abs(fb)) {
-                // Force bisection.
-                d = m;
-                e = d;
-            } else {
-                double s = fb / fa;
-                double p;
-                double q;
-                // The equality test (a == c) is intentional,
-                // it is part of the original Brent's method and
-                // it should NOT be replaced by proximity test.
-                if (a == c) {
-                    // Linear interpolation.
-                    p = 2 * m * s;
-                    q = 1 - s;
-                } else {
-                    // Inverse quadratic interpolation.
-                    q = fa / fc;
-                    final double r = fb / fc;
-                    p = s * (2 * m * q * (q - r) - (b - a) * (r - 1));
-                    q = (q - 1) * (r - 1) * (s - 1);
-                }
-                if (p > 0) {
-                    q = -q;
-                } else {
-                    p = -p;
-                }
-                s = e;
-                e = d;
-                if (p >= 1.5 * m * q - FastMath.abs(tol * q) ||
-                    p >= FastMath.abs(0.5 * s * q)) {
-                    // Inverse quadratic interpolation gives a value
-                    // in the wrong direction, or progress is slow.
-                    // Fall back to bisection.
-                    d = m;
-                    e = d;
-                } else {
-                    d = p / q;
-                }
-            }
-            a = b;
-            fa = fb;
-
-            if (FastMath.abs(d) > tol) {
-                b += d;
-            } else if (m > 0) {
-                b += tol;
-            } else {
-                b -= tol;
-            }
-            fb = computeObjectiveValue(b);
-            if ((fb > 0 && fc > 0) ||
-                (fb <= 0 && fc <= 0)) {
-                c = a;
-                fc = fa;
-                d = b - a;
-                e = d;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/DifferentiableUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/DifferentiableUnivariateSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/DifferentiableUnivariateSolver.java
deleted file mode 100644
index b9ae158..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/DifferentiableUnivariateSolver.java
+++ /dev/null
@@ -1,30 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-
-
-/**
- * Interface for (univariate real) rootfinding algorithms.
- * Implementations will search for only one zero in the given interval.
- *
- * @deprecated as of 3.1, replaced by {@link UnivariateDifferentiableSolver}
- */
-@Deprecated
-public interface DifferentiableUnivariateSolver
-    extends BaseUnivariateSolver<DifferentiableUnivariateFunction> {}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/IllinoisSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/IllinoisSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/IllinoisSolver.java
deleted file mode 100644
index bd3bc71..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/IllinoisSolver.java
+++ /dev/null
@@ -1,82 +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.analysis.solvers;
-
-
-/**
- * Implements the <em>Illinois</em> method for root-finding (approximating
- * a zero of a univariate real function). It is a modified
- * {@link RegulaFalsiSolver <em>Regula Falsi</em>} method.
- *
- * <p>Like the <em>Regula Falsi</em> method, convergence is guaranteed by
- * maintaining a bracketed solution. The <em>Illinois</em> method however,
- * should converge much faster than the original <em>Regula Falsi</em>
- * method. Furthermore, this implementation of the <em>Illinois</em> method
- * should not suffer from the same implementation issues as the <em>Regula
- * Falsi</em> method, which may fail to convergence in certain cases.</p>
- *
- * <p>The <em>Illinois</em> method assumes that the function is continuous,
- * but not necessarily smooth.</p>
- *
- * <p>Implementation based on the following article: M. Dowell and P. Jarratt,
- * <em>A modified regula falsi method for computing the root of an
- * equation</em>, BIT Numerical Mathematics, volume 11, number 2,
- * pages 168-174, Springer, 1971.</p>
- *
- * @since 3.0
- */
-public class IllinoisSolver extends BaseSecantSolver {
-
-    /** Construct a solver with default accuracy (1e-6). */
-    public IllinoisSolver() {
-        super(DEFAULT_ABSOLUTE_ACCURACY, Method.ILLINOIS);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public IllinoisSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy, Method.ILLINOIS);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public IllinoisSolver(final double relativeAccuracy,
-                          final double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, Method.ILLINOIS);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    public IllinoisSolver(final double relativeAccuracy,
-                          final double absoluteAccuracy,
-                          final double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.PEGASUS);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/LaguerreSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/LaguerreSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/LaguerreSolver.java
deleted file mode 100644
index c127b42..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/LaguerreSolver.java
+++ /dev/null
@@ -1,390 +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.analysis.solvers;
-
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.complex.ComplexUtils;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/LaguerresMethod.html">
- * Laguerre's Method</a> for root finding of real coefficient polynomials.
- * For reference, see
- * <blockquote>
- *  <b>A First Course in Numerical Analysis</b><br>
- *  ISBN 048641454X, chapter 8.<br>
- * </blockquote>
- * Laguerre's method is global in the sense that it can start with any initial
- * approximation and be able to solve all roots from that point.
- * The algorithm requires a bracketing condition.
- *
- * @since 1.2
- */
-public class LaguerreSolver extends AbstractPolynomialSolver {
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-    /** Complex solver. */
-    private final ComplexSolver complexSolver = new ComplexSolver();
-
-    /**
-     * Construct a solver with default accuracy (1e-6).
-     */
-    public LaguerreSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public LaguerreSolver(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public LaguerreSolver(double relativeAccuracy,
-                          double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param functionValueAccuracy Function value accuracy.
-     */
-    public LaguerreSolver(double relativeAccuracy,
-                          double absoluteAccuracy,
-                          double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public double doSolve()
-        throws TooManyEvaluationsException,
-               NumberIsTooLargeException,
-               NoBracketingException {
-        final double min = getMin();
-        final double max = getMax();
-        final double initial = getStartValue();
-        final double functionValueAccuracy = getFunctionValueAccuracy();
-
-        verifySequence(min, initial, max);
-
-        // Return the initial guess if it is good enough.
-        final double yInitial = computeObjectiveValue(initial);
-        if (FastMath.abs(yInitial) <= functionValueAccuracy) {
-            return initial;
-        }
-
-        // Return the first endpoint if it is good enough.
-        final double yMin = computeObjectiveValue(min);
-        if (FastMath.abs(yMin) <= functionValueAccuracy) {
-            return min;
-        }
-
-        // Reduce interval if min and initial bracket the root.
-        if (yInitial * yMin < 0) {
-            return laguerre(min, initial, yMin, yInitial);
-        }
-
-        // Return the second endpoint if it is good enough.
-        final double yMax = computeObjectiveValue(max);
-        if (FastMath.abs(yMax) <= functionValueAccuracy) {
-            return max;
-        }
-
-        // Reduce interval if initial and max bracket the root.
-        if (yInitial * yMax < 0) {
-            return laguerre(initial, max, yInitial, yMax);
-        }
-
-        throw new NoBracketingException(min, max, yMin, yMax);
-    }
-
-    /**
-     * Find a real root in the given interval.
-     *
-     * Despite the bracketing condition, the root returned by
-     * {@link LaguerreSolver.ComplexSolver#solve(Complex[],Complex)} may
-     * not be a real zero inside {@code [min, max]}.
-     * For example, <code>p(x) = x<sup>3</sup> + 1,</code>
-     * with {@code min = -2}, {@code max = 2}, {@code initial = 0}.
-     * When it occurs, this code calls
-     * {@link LaguerreSolver.ComplexSolver#solveAll(Complex[],Complex)}
-     * in order to obtain all roots and picks up one real root.
-     *
-     * @param lo Lower bound of the search interval.
-     * @param hi Higher bound of the search interval.
-     * @param fLo Function value at the lower bound of the search interval.
-     * @param fHi Function value at the higher bound of the search interval.
-     * @return the point at which the function value is zero.
-     * @deprecated This method should not be part of the public API: It will
-     * be made private in version 4.0.
-     */
-    @Deprecated
-    public double laguerre(double lo, double hi,
-                           double fLo, double fHi) {
-        final Complex c[] = ComplexUtils.convertToComplex(getCoefficients());
-
-        final Complex initial = new Complex(0.5 * (lo + hi), 0);
-        final Complex z = complexSolver.solve(c, initial);
-        if (complexSolver.isRoot(lo, hi, z)) {
-            return z.getReal();
-        } else {
-            double r = Double.NaN;
-            // Solve all roots and select the one we are seeking.
-            Complex[] root = complexSolver.solveAll(c, initial);
-            for (int i = 0; i < root.length; i++) {
-                if (complexSolver.isRoot(lo, hi, root[i])) {
-                    r = root[i].getReal();
-                    break;
-                }
-            }
-            return r;
-        }
-    }
-
-    /**
-     * Find all complex roots for the polynomial with the given
-     * coefficients, starting from the given initial value.
-     * <br/>
-     * Note: This method is not part of the API of {@link BaseUnivariateSolver}.
-     *
-     * @param coefficients Polynomial coefficients.
-     * @param initial Start value.
-     * @return the point at which the function value is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-     * if the maximum number of evaluations is exceeded.
-     * @throws NullArgumentException if the {@code coefficients} is
-     * {@code null}.
-     * @throws NoDataException if the {@code coefficients} array is empty.
-     * @since 3.1
-     */
-    public Complex[] solveAllComplex(double[] coefficients,
-                                     double initial)
-        throws NullArgumentException,
-               NoDataException,
-               TooManyEvaluationsException {
-        setup(Integer.MAX_VALUE,
-              new PolynomialFunction(coefficients),
-              Double.NEGATIVE_INFINITY,
-              Double.POSITIVE_INFINITY,
-              initial);
-        return complexSolver.solveAll(ComplexUtils.convertToComplex(coefficients),
-                                      new Complex(initial, 0d));
-    }
-
-    /**
-     * Find a complex root for the polynomial with the given coefficients,
-     * starting from the given initial value.
-     * <br/>
-     * Note: This method is not part of the API of {@link BaseUnivariateSolver}.
-     *
-     * @param coefficients Polynomial coefficients.
-     * @param initial Start value.
-     * @return the point at which the function value is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-     * if the maximum number of evaluations is exceeded.
-     * @throws NullArgumentException if the {@code coefficients} is
-     * {@code null}.
-     * @throws NoDataException if the {@code coefficients} array is empty.
-     * @since 3.1
-     */
-    public Complex solveComplex(double[] coefficients,
-                                double initial)
-        throws NullArgumentException,
-               NoDataException,
-               TooManyEvaluationsException {
-        setup(Integer.MAX_VALUE,
-              new PolynomialFunction(coefficients),
-              Double.NEGATIVE_INFINITY,
-              Double.POSITIVE_INFINITY,
-              initial);
-        return complexSolver.solve(ComplexUtils.convertToComplex(coefficients),
-                                   new Complex(initial, 0d));
-    }
-
-    /**
-     * Class for searching all (complex) roots.
-     */
-    private class ComplexSolver {
-        /**
-         * Check whether the given complex root is actually a real zero
-         * in the given interval, within the solver tolerance level.
-         *
-         * @param min Lower bound for the interval.
-         * @param max Upper bound for the interval.
-         * @param z Complex root.
-         * @return {@code true} if z is a real zero.
-         */
-        public boolean isRoot(double min, double max, Complex z) {
-            if (isSequence(min, z.getReal(), max)) {
-                double tolerance = FastMath.max(getRelativeAccuracy() * z.abs(), getAbsoluteAccuracy());
-                return (FastMath.abs(z.getImaginary()) <= tolerance) ||
-                     (z.abs() <= getFunctionValueAccuracy());
-            }
-            return false;
-        }
-
-        /**
-         * Find all complex roots for the polynomial with the given
-         * coefficients, starting from the given initial value.
-         *
-         * @param coefficients Polynomial coefficients.
-         * @param initial Start value.
-         * @return the point at which the function value is zero.
-         * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-         * if the maximum number of evaluations is exceeded.
-         * @throws NullArgumentException if the {@code coefficients} is
-         * {@code null}.
-         * @throws NoDataException if the {@code coefficients} array is empty.
-         */
-        public Complex[] solveAll(Complex coefficients[], Complex initial)
-            throws NullArgumentException,
-                   NoDataException,
-                   TooManyEvaluationsException {
-            if (coefficients == null) {
-                throw new NullArgumentException();
-            }
-            final int n = coefficients.length - 1;
-            if (n == 0) {
-                throw new NoDataException(LocalizedFormats.POLYNOMIAL);
-            }
-            // Coefficients for deflated polynomial.
-            final Complex c[] = new Complex[n + 1];
-            for (int i = 0; i <= n; i++) {
-                c[i] = coefficients[i];
-            }
-
-            // Solve individual roots successively.
-            final Complex root[] = new Complex[n];
-            for (int i = 0; i < n; i++) {
-                final Complex subarray[] = new Complex[n - i + 1];
-                System.arraycopy(c, 0, subarray, 0, subarray.length);
-                root[i] = solve(subarray, initial);
-                // Polynomial deflation using synthetic division.
-                Complex newc = c[n - i];
-                Complex oldc = null;
-                for (int j = n - i - 1; j >= 0; j--) {
-                    oldc = c[j];
-                    c[j] = newc;
-                    newc = oldc.add(newc.multiply(root[i]));
-                }
-            }
-
-            return root;
-        }
-
-        /**
-         * Find a complex root for the polynomial with the given coefficients,
-         * starting from the given initial value.
-         *
-         * @param coefficients Polynomial coefficients.
-         * @param initial Start value.
-         * @return the point at which the function value is zero.
-         * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-         * if the maximum number of evaluations is exceeded.
-         * @throws NullArgumentException if the {@code coefficients} is
-         * {@code null}.
-         * @throws NoDataException if the {@code coefficients} array is empty.
-         */
-        public Complex solve(Complex coefficients[], Complex initial)
-            throws NullArgumentException,
-                   NoDataException,
-                   TooManyEvaluationsException {
-            if (coefficients == null) {
-                throw new NullArgumentException();
-            }
-
-            final int n = coefficients.length - 1;
-            if (n == 0) {
-                throw new NoDataException(LocalizedFormats.POLYNOMIAL);
-            }
-
-            final double absoluteAccuracy = getAbsoluteAccuracy();
-            final double relativeAccuracy = getRelativeAccuracy();
-            final double functionValueAccuracy = getFunctionValueAccuracy();
-
-            final Complex nC  = new Complex(n, 0);
-            final Complex n1C = new Complex(n - 1, 0);
-
-            Complex z = initial;
-            Complex oldz = new Complex(Double.POSITIVE_INFINITY,
-                                       Double.POSITIVE_INFINITY);
-            while (true) {
-                // Compute pv (polynomial value), dv (derivative value), and
-                // d2v (second derivative value) simultaneously.
-                Complex pv = coefficients[n];
-                Complex dv = Complex.ZERO;
-                Complex d2v = Complex.ZERO;
-                for (int j = n-1; j >= 0; j--) {
-                    d2v = dv.add(z.multiply(d2v));
-                    dv = pv.add(z.multiply(dv));
-                    pv = coefficients[j].add(z.multiply(pv));
-                }
-                d2v = d2v.multiply(new Complex(2.0, 0.0));
-
-                // Check for convergence.
-                final double tolerance = FastMath.max(relativeAccuracy * z.abs(),
-                                                      absoluteAccuracy);
-                if ((z.subtract(oldz)).abs() <= tolerance) {
-                    return z;
-                }
-                if (pv.abs() <= functionValueAccuracy) {
-                    return z;
-                }
-
-                // Now pv != 0, calculate the new approximation.
-                final Complex G = dv.divide(pv);
-                final Complex G2 = G.multiply(G);
-                final Complex H = G2.subtract(d2v.divide(pv));
-                final Complex delta = n1C.multiply((nC.multiply(H)).subtract(G2));
-                // Choose a denominator larger in magnitude.
-                final Complex deltaSqrt = delta.sqrt();
-                final Complex dplus = G.add(deltaSqrt);
-                final Complex dminus = G.subtract(deltaSqrt);
-                final Complex denominator = dplus.abs() > dminus.abs() ? dplus : dminus;
-                // Perturb z if denominator is zero, for instance,
-                // p(x) = x^3 + 1, z = 0.
-                if (denominator.equals(new Complex(0.0, 0.0))) {
-                    z = z.add(new Complex(absoluteAccuracy, absoluteAccuracy));
-                    oldz = new Complex(Double.POSITIVE_INFINITY,
-                                       Double.POSITIVE_INFINITY);
-                } else {
-                    oldz = z;
-                    z = z.subtract(nC.divide(denominator));
-                }
-                incrementEvaluationCount();
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver.java
deleted file mode 100644
index 06a7b6b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver.java
+++ /dev/null
@@ -1,202 +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.analysis.solvers;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * This class implements the <a href="http://mathworld.wolfram.com/MullersMethod.html">
- * Muller's Method</a> for root finding of real univariate functions. For
- * reference, see <b>Elementary Numerical Analysis</b>, ISBN 0070124477,
- * chapter 3.
- * <p>
- * Muller's method applies to both real and complex functions, but here we
- * restrict ourselves to real functions.
- * This class differs from {@link MullerSolver} in the way it avoids complex
- * operations.</p>
- * Muller's original method would have function evaluation at complex point.
- * Since our f(x) is real, we have to find ways to avoid that. Bracketing
- * condition is one way to go: by requiring bracketing in every iteration,
- * the newly computed approximation is guaranteed to be real.</p>
- * <p>
- * Normally Muller's method converges quadratically in the vicinity of a
- * zero, however it may be very slow in regions far away from zeros. For
- * example, f(x) = exp(x) - 1, min = -50, max = 100. In such case we use
- * bisection as a safety backup if it performs very poorly.</p>
- * <p>
- * The formulas here use divided differences directly.</p>
- *
- * @since 1.2
- * @see MullerSolver2
- */
-public class MullerSolver extends AbstractUnivariateSolver {
-
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /**
-     * Construct a solver with default accuracy (1e-6).
-     */
-    public MullerSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public MullerSolver(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public MullerSolver(double relativeAccuracy,
-                        double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws TooManyEvaluationsException,
-               NumberIsTooLargeException,
-               NoBracketingException {
-        final double min = getMin();
-        final double max = getMax();
-        final double initial = getStartValue();
-
-        final double functionValueAccuracy = getFunctionValueAccuracy();
-
-        verifySequence(min, initial, max);
-
-        // check for zeros before verifying bracketing
-        final double fMin = computeObjectiveValue(min);
-        if (FastMath.abs(fMin) < functionValueAccuracy) {
-            return min;
-        }
-        final double fMax = computeObjectiveValue(max);
-        if (FastMath.abs(fMax) < functionValueAccuracy) {
-            return max;
-        }
-        final double fInitial = computeObjectiveValue(initial);
-        if (FastMath.abs(fInitial) <  functionValueAccuracy) {
-            return initial;
-        }
-
-        verifyBracketing(min, max);
-
-        if (isBracketing(min, initial)) {
-            return solve(min, initial, fMin, fInitial);
-        } else {
-            return solve(initial, max, fInitial, fMax);
-        }
-    }
-
-    /**
-     * Find a real root in the given interval.
-     *
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param fMin function value at the lower bound.
-     * @param fMax function value at the upper bound.
-     * @return the point at which the function value is zero.
-     * @throws TooManyEvaluationsException if the allowed number of calls to
-     * the function to be solved has been exhausted.
-     */
-    private double solve(double min, double max,
-                         double fMin, double fMax)
-        throws TooManyEvaluationsException {
-        final double relativeAccuracy = getRelativeAccuracy();
-        final double absoluteAccuracy = getAbsoluteAccuracy();
-        final double functionValueAccuracy = getFunctionValueAccuracy();
-
-        // [x0, x2] is the bracketing interval in each iteration
-        // x1 is the last approximation and an interpolation point in (x0, x2)
-        // x is the new root approximation and new x1 for next round
-        // d01, d12, d012 are divided differences
-
-        double x0 = min;
-        double y0 = fMin;
-        double x2 = max;
-        double y2 = fMax;
-        double x1 = 0.5 * (x0 + x2);
-        double y1 = computeObjectiveValue(x1);
-
-        double oldx = Double.POSITIVE_INFINITY;
-        while (true) {
-            // Muller's method employs quadratic interpolation through
-            // x0, x1, x2 and x is the zero of the interpolating parabola.
-            // Due to bracketing condition, this parabola must have two
-            // real roots and we choose one in [x0, x2] to be x.
-            final double d01 = (y1 - y0) / (x1 - x0);
-            final double d12 = (y2 - y1) / (x2 - x1);
-            final double d012 = (d12 - d01) / (x2 - x0);
-            final double c1 = d01 + (x1 - x0) * d012;
-            final double delta = c1 * c1 - 4 * y1 * d012;
-            final double xplus = x1 + (-2.0 * y1) / (c1 + FastMath.sqrt(delta));
-            final double xminus = x1 + (-2.0 * y1) / (c1 - FastMath.sqrt(delta));
-            // xplus and xminus are two roots of parabola and at least
-            // one of them should lie in (x0, x2)
-            final double x = isSequence(x0, xplus, x2) ? xplus : xminus;
-            final double y = computeObjectiveValue(x);
-
-            // check for convergence
-            final double tolerance = FastMath.max(relativeAccuracy * FastMath.abs(x), absoluteAccuracy);
-            if (FastMath.abs(x - oldx) <= tolerance ||
-                FastMath.abs(y) <= functionValueAccuracy) {
-                return x;
-            }
-
-            // Bisect if convergence is too slow. Bisection would waste
-            // our calculation of x, hopefully it won't happen often.
-            // the real number equality test x == x1 is intentional and
-            // completes the proximity tests above it
-            boolean bisect = (x < x1 && (x1 - x0) > 0.95 * (x2 - x0)) ||
-                             (x > x1 && (x2 - x1) > 0.95 * (x2 - x0)) ||
-                             (x == x1);
-            // prepare the new bracketing interval for next iteration
-            if (!bisect) {
-                x0 = x < x1 ? x0 : x1;
-                y0 = x < x1 ? y0 : y1;
-                x2 = x > x1 ? x2 : x1;
-                y2 = x > x1 ? y2 : y1;
-                x1 = x; y1 = y;
-                oldx = x;
-            } else {
-                double xm = 0.5 * (x0 + x2);
-                double ym = computeObjectiveValue(xm);
-                if (FastMath.signum(y0) + FastMath.signum(ym) == 0.0) {
-                    x2 = xm; y2 = ym;
-                } else {
-                    x0 = xm; y0 = ym;
-                }
-                x1 = 0.5 * (x0 + x2);
-                y1 = computeObjectiveValue(x1);
-                oldx = Double.POSITIVE_INFINITY;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver2.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver2.java b/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver2.java
deleted file mode 100644
index 2a79c11..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/MullerSolver2.java
+++ /dev/null
@@ -1,168 +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.analysis.solvers;
-
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * This class implements the <a href="http://mathworld.wolfram.com/MullersMethod.html">
- * Muller's Method</a> for root finding of real univariate functions. For
- * reference, see <b>Elementary Numerical Analysis</b>, ISBN 0070124477,
- * chapter 3.
- * <p>
- * Muller's method applies to both real and complex functions, but here we
- * restrict ourselves to real functions.
- * This class differs from {@link MullerSolver} in the way it avoids complex
- * operations.</p>
- * Except for the initial [min, max], it does not require bracketing
- * condition, e.g. f(x0), f(x1), f(x2) can have the same sign. If complex
- * number arises in the computation, we simply use its modulus as real
- * approximation.</p>
- * <p>
- * Because the interval may not be bracketing, bisection alternative is
- * not applicable here. However in practice our treatment usually works
- * well, especially near real zeroes where the imaginary part of complex
- * approximation is often negligible.</p>
- * <p>
- * The formulas here do not use divided differences directly.</p>
- *
- * @since 1.2
- * @see MullerSolver
- */
-public class MullerSolver2 extends AbstractUnivariateSolver {
-
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /**
-     * Construct a solver with default accuracy (1e-6).
-     */
-    public MullerSolver2() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public MullerSolver2(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public MullerSolver2(double relativeAccuracy,
-                        double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws TooManyEvaluationsException,
-               NumberIsTooLargeException,
-               NoBracketingException {
-        final double min = getMin();
-        final double max = getMax();
-
-        verifyInterval(min, max);
-
-        final double relativeAccuracy = getRelativeAccuracy();
-        final double absoluteAccuracy = getAbsoluteAccuracy();
-        final double functionValueAccuracy = getFunctionValueAccuracy();
-
-        // x2 is the last root approximation
-        // x is the new approximation and new x2 for next round
-        // x0 < x1 < x2 does not hold here
-
-        double x0 = min;
-        double y0 = computeObjectiveValue(x0);
-        if (FastMath.abs(y0) < functionValueAccuracy) {
-            return x0;
-        }
-        double x1 = max;
-        double y1 = computeObjectiveValue(x1);
-        if (FastMath.abs(y1) < functionValueAccuracy) {
-            return x1;
-        }
-
-        if(y0 * y1 > 0) {
-            throw new NoBracketingException(x0, x1, y0, y1);
-        }
-
-        double x2 = 0.5 * (x0 + x1);
-        double y2 = computeObjectiveValue(x2);
-
-        double oldx = Double.POSITIVE_INFINITY;
-        while (true) {
-            // quadratic interpolation through x0, x1, x2
-            final double q = (x2 - x1) / (x1 - x0);
-            final double a = q * (y2 - (1 + q) * y1 + q * y0);
-            final double b = (2 * q + 1) * y2 - (1 + q) * (1 + q) * y1 + q * q * y0;
-            final double c = (1 + q) * y2;
-            final double delta = b * b - 4 * a * c;
-            double x;
-            final double denominator;
-            if (delta >= 0.0) {
-                // choose a denominator larger in magnitude
-                double dplus = b + FastMath.sqrt(delta);
-                double dminus = b - FastMath.sqrt(delta);
-                denominator = FastMath.abs(dplus) > FastMath.abs(dminus) ? dplus : dminus;
-            } else {
-                // take the modulus of (B +/- FastMath.sqrt(delta))
-                denominator = FastMath.sqrt(b * b - delta);
-            }
-            if (denominator != 0) {
-                x = x2 - 2.0 * c * (x2 - x1) / denominator;
-                // perturb x if it exactly coincides with x1 or x2
-                // the equality tests here are intentional
-                while (x == x1 || x == x2) {
-                    x += absoluteAccuracy;
-                }
-            } else {
-                // extremely rare case, get a random number to skip it
-                x = min + FastMath.random() * (max - min);
-                oldx = Double.POSITIVE_INFINITY;
-            }
-            final double y = computeObjectiveValue(x);
-
-            // check for convergence
-            final double tolerance = FastMath.max(relativeAccuracy * FastMath.abs(x), absoluteAccuracy);
-            if (FastMath.abs(x - oldx) <= tolerance ||
-                FastMath.abs(y) <= functionValueAccuracy) {
-                return x;
-            }
-
-            // prepare the next iteration
-            x0 = x1;
-            y0 = y1;
-            x1 = x2;
-            y1 = y2;
-            x2 = x;
-            y2 = y;
-            oldx = x;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonRaphsonSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonRaphsonSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonRaphsonSolver.java
deleted file mode 100644
index 4cf2688..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonRaphsonSolver.java
+++ /dev/null
@@ -1,92 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Implements <a href="http://mathworld.wolfram.com/NewtonsMethod.html">
- * Newton's Method</a> for finding zeros of real univariate differentiable
- * functions.
- *
- * @since 3.1
- */
-public class NewtonRaphsonSolver extends AbstractUnivariateDifferentiableSolver {
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /**
-     * Construct a solver.
-     */
-    public NewtonRaphsonSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public NewtonRaphsonSolver(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-
-    /**
-     * Find a zero near the midpoint of {@code min} and {@code max}.
-     *
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param maxEval Maximum number of evaluations.
-     * @return the value where the function is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-     * if the maximum evaluation count is exceeded.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
-     * if {@code min >= max}.
-     */
-    @Override
-    public double solve(int maxEval, final UnivariateDifferentiableFunction f,
-                        final double min, final double max)
-        throws TooManyEvaluationsException {
-        return super.solve(maxEval, f, UnivariateSolverUtils.midpoint(min, max));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws TooManyEvaluationsException {
-        final double startValue = getStartValue();
-        final double absoluteAccuracy = getAbsoluteAccuracy();
-
-        double x0 = startValue;
-        double x1;
-        while (true) {
-            final DerivativeStructure y0 = computeObjectiveValueAndDerivative(x0);
-            x1 = x0 - (y0.getValue() / y0.getPartialDerivative(1));
-            if (FastMath.abs(x1 - x0) <= absoluteAccuracy) {
-                return x1;
-            }
-
-            x0 = x1;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonSolver.java
deleted file mode 100644
index 3ba7bf2..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/NewtonSolver.java
+++ /dev/null
@@ -1,92 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Implements <a href="http://mathworld.wolfram.com/NewtonsMethod.html">
- * Newton's Method</a> for finding zeros of real univariate functions.
- * <p>
- * The function should be continuous but not necessarily smooth.</p>
- *
- * @deprecated as of 3.1, replaced by {@link NewtonRaphsonSolver}
- */
-@Deprecated
-public class NewtonSolver extends AbstractDifferentiableUnivariateSolver {
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /**
-     * Construct a solver.
-     */
-    public NewtonSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public NewtonSolver(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-
-    /**
-     * Find a zero near the midpoint of {@code min} and {@code max}.
-     *
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param maxEval Maximum number of evaluations.
-     * @return the value where the function is zero.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-     * if the maximum evaluation count is exceeded.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
-     * if {@code min >= max}.
-     */
-    @Override
-    public double solve(int maxEval, final DifferentiableUnivariateFunction f,
-                        final double min, final double max)
-        throws TooManyEvaluationsException {
-        return super.solve(maxEval, f, UnivariateSolverUtils.midpoint(min, max));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws TooManyEvaluationsException {
-        final double startValue = getStartValue();
-        final double absoluteAccuracy = getAbsoluteAccuracy();
-
-        double x0 = startValue;
-        double x1;
-        while (true) {
-            x1 = x0 - (computeObjectiveValue(x0) / computeDerivativeObjectiveValue(x0));
-            if (FastMath.abs(x1 - x0) <= absoluteAccuracy) {
-                return x1;
-            }
-
-            x0 = x1;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/PegasusSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/PegasusSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/PegasusSolver.java
deleted file mode 100644
index 0d80895..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/PegasusSolver.java
+++ /dev/null
@@ -1,84 +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.analysis.solvers;
-
-/**
- * Implements the <em>Pegasus</em> method for root-finding (approximating
- * a zero of a univariate real function). It is a modified
- * {@link RegulaFalsiSolver <em>Regula Falsi</em>} method.
- *
- * <p>Like the <em>Regula Falsi</em> method, convergence is guaranteed by
- * maintaining a bracketed solution. The <em>Pegasus</em> method however,
- * should converge much faster than the original <em>Regula Falsi</em>
- * method. Furthermore, this implementation of the <em>Pegasus</em> method
- * should not suffer from the same implementation issues as the <em>Regula
- * Falsi</em> method, which may fail to convergence in certain cases. Also,
- * the <em>Pegasus</em> method should converge faster than the
- * {@link IllinoisSolver <em>Illinois</em>} method, another <em>Regula
- * Falsi</em>-based method.</p>
- *
- * <p>The <em>Pegasus</em> method assumes that the function is continuous,
- * but not necessarily smooth.</p>
- *
- * <p>Implementation based on the following article: M. Dowell and P. Jarratt,
- * <em>The "Pegasus" method for computing the root of an equation</em>,
- * BIT Numerical Mathematics, volume 12, number 4, pages 503-508, Springer,
- * 1972.</p>
- *
- * @since 3.0
- */
-public class PegasusSolver extends BaseSecantSolver {
-
-    /** Construct a solver with default accuracy (1e-6). */
-    public PegasusSolver() {
-        super(DEFAULT_ABSOLUTE_ACCURACY, Method.PEGASUS);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public PegasusSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy, Method.PEGASUS);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public PegasusSolver(final double relativeAccuracy,
-                         final double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, Method.PEGASUS);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    public PegasusSolver(final double relativeAccuracy,
-                         final double absoluteAccuracy,
-                         final double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.PEGASUS);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/PolynomialSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/PolynomialSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/PolynomialSolver.java
deleted file mode 100644
index c21f076..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/PolynomialSolver.java
+++ /dev/null
@@ -1,28 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-
-/**
- * Interface for (polynomial) root-finding algorithms.
- * Implementations will search for only one zero in the given interval.
- *
- * @since 3.0
- */
-public interface PolynomialSolver
-    extends BaseUnivariateSolver<PolynomialFunction> {}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/RegulaFalsiSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/RegulaFalsiSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/RegulaFalsiSolver.java
deleted file mode 100644
index cfb7055..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/RegulaFalsiSolver.java
+++ /dev/null
@@ -1,94 +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.analysis.solvers;
-
-/**
- * Implements the <em>Regula Falsi</em> or <em>False position</em> method for
- * root-finding (approximating a zero of a univariate real function). It is a
- * modified {@link SecantSolver <em>Secant</em>} method.
- *
- * <p>The <em>Regula Falsi</em> method is included for completeness, for
- * testing purposes, for educational purposes, for comparison to other
- * algorithms, etc. It is however <strong>not</strong> intended to be used
- * for actual problems, as one of the bounds often remains fixed, resulting
- * in very slow convergence. Instead, one of the well-known modified
- * <em>Regula Falsi</em> algorithms can be used ({@link IllinoisSolver
- * <em>Illinois</em>} or {@link PegasusSolver <em>Pegasus</em>}). These two
- * algorithms solve the fundamental issues of the original <em>Regula
- * Falsi</em> algorithm, and greatly out-performs it for most, if not all,
- * (practical) functions.
- *
- * <p>Unlike the <em>Secant</em> method, the <em>Regula Falsi</em> guarantees
- * convergence, by maintaining a bracketed solution. Note however, that due to
- * the finite/limited precision of Java's {@link Double double} type, which is
- * used in this implementation, the algorithm may get stuck in a situation
- * where it no longer makes any progress. Such cases are detected and result
- * in a {@code ConvergenceException} exception being thrown. In other words,
- * the algorithm theoretically guarantees convergence, but the implementation
- * does not.</p>
- *
- * <p>The <em>Regula Falsi</em> method assumes that the function is continuous,
- * but not necessarily smooth.</p>
- *
- * <p>Implementation based on the following article: M. Dowell and P. Jarratt,
- * <em>A modified regula falsi method for computing the root of an
- * equation</em>, BIT Numerical Mathematics, volume 11, number 2,
- * pages 168-174, Springer, 1971.</p>
- *
- * @since 3.0
- */
-public class RegulaFalsiSolver extends BaseSecantSolver {
-
-    /** Construct a solver with default accuracy (1e-6). */
-    public RegulaFalsiSolver() {
-        super(DEFAULT_ABSOLUTE_ACCURACY, Method.REGULA_FALSI);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public RegulaFalsiSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy, Method.REGULA_FALSI);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public RegulaFalsiSolver(final double relativeAccuracy,
-                             final double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, Method.REGULA_FALSI);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    public RegulaFalsiSolver(final double relativeAccuracy,
-                             final double absoluteAccuracy,
-                             final double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy, Method.REGULA_FALSI);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/RiddersSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/RiddersSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/RiddersSolver.java
deleted file mode 100644
index d83f595..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/RiddersSolver.java
+++ /dev/null
@@ -1,142 +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.analysis.solvers;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/RiddersMethod.html">
- * Ridders' Method</a> for root finding of real univariate functions. For
- * reference, see C. Ridders, <i>A new algorithm for computing a single root
- * of a real continuous function </i>, IEEE Transactions on Circuits and
- * Systems, 26 (1979), 979 - 980.
- * <p>
- * The function should be continuous but not necessarily smooth.</p>
- *
- * @since 1.2
- */
-public class RiddersSolver extends AbstractUnivariateSolver {
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /**
-     * Construct a solver with default accuracy (1e-6).
-     */
-    public RiddersSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public RiddersSolver(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public RiddersSolver(double relativeAccuracy,
-                         double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws TooManyEvaluationsException,
-               NoBracketingException {
-        double min = getMin();
-        double max = getMax();
-        // [x1, x2] is the bracketing interval in each iteration
-        // x3 is the midpoint of [x1, x2]
-        // x is the new root approximation and an endpoint of the new interval
-        double x1 = min;
-        double y1 = computeObjectiveValue(x1);
-        double x2 = max;
-        double y2 = computeObjectiveValue(x2);
-
-        // check for zeros before verifying bracketing
-        if (y1 == 0) {
-            return min;
-        }
-        if (y2 == 0) {
-            return max;
-        }
-        verifyBracketing(min, max);
-
-        final double absoluteAccuracy = getAbsoluteAccuracy();
-        final double functionValueAccuracy = getFunctionValueAccuracy();
-        final double relativeAccuracy = getRelativeAccuracy();
-
-        double oldx = Double.POSITIVE_INFINITY;
-        while (true) {
-            // calculate the new root approximation
-            final double x3 = 0.5 * (x1 + x2);
-            final double y3 = computeObjectiveValue(x3);
-            if (FastMath.abs(y3) <= functionValueAccuracy) {
-                return x3;
-            }
-            final double delta = 1 - (y1 * y2) / (y3 * y3);  // delta > 1 due to bracketing
-            final double correction = (FastMath.signum(y2) * FastMath.signum(y3)) *
-                                      (x3 - x1) / FastMath.sqrt(delta);
-            final double x = x3 - correction;                // correction != 0
-            final double y = computeObjectiveValue(x);
-
-            // check for convergence
-            final double tolerance = FastMath.max(relativeAccuracy * FastMath.abs(x), absoluteAccuracy);
-            if (FastMath.abs(x - oldx) <= tolerance) {
-                return x;
-            }
-            if (FastMath.abs(y) <= functionValueAccuracy) {
-                return x;
-            }
-
-            // prepare the new interval for next iteration
-            // Ridders' method guarantees x1 < x < x2
-            if (correction > 0.0) {             // x1 < x < x3
-                if (FastMath.signum(y1) + FastMath.signum(y) == 0.0) {
-                    x2 = x;
-                    y2 = y;
-                } else {
-                    x1 = x;
-                    x2 = x3;
-                    y1 = y;
-                    y2 = y3;
-                }
-            } else {                            // x3 < x < x2
-                if (FastMath.signum(y2) + FastMath.signum(y) == 0.0) {
-                    x1 = x;
-                    y1 = y;
-                } else {
-                    x1 = x3;
-                    x2 = x;
-                    y1 = y3;
-                    y2 = y;
-                }
-            }
-            oldx = x;
-        }
-    }
-}


[50/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/Field.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/Field.java b/src/main/java/org/apache/commons/math3/Field.java
deleted file mode 100644
index 618536c..0000000
--- a/src/main/java/org/apache/commons/math3/Field.java
+++ /dev/null
@@ -1,58 +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;
-
-/**
- * Interface representing a <a href="http://mathworld.wolfram.com/Field.html">field</a>.
- * <p>
- * Classes implementing this interface will often be singletons.
- * </p>
- * @param <T> the type of the field elements
- * @see FieldElement
- * @since 2.0
- */
-public interface Field<T> {
-
-    /** Get the additive identity of the field.
-     * <p>
-     * The additive identity is the element e<sub>0</sub> of the field such that
-     * for all elements a of the field, the equalities a + e<sub>0</sub> =
-     * e<sub>0</sub> + a = a hold.
-     * </p>
-     * @return additive identity of the field
-     */
-    T getZero();
-
-    /** Get the multiplicative identity of the field.
-     * <p>
-     * The multiplicative identity is the element e<sub>1</sub> of the field such that
-     * for all elements a of the field, the equalities a &times; e<sub>1</sub> =
-     * e<sub>1</sub> &times; a = a hold.
-     * </p>
-     * @return multiplicative identity of the field
-     */
-    T getOne();
-
-    /**
-     * Returns the runtime class of the FieldElement.
-     *
-     * @return The {@code Class} object that represents the runtime
-     *         class of this object.
-     */
-    Class<? extends FieldElement<T>> getRuntimeClass();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/FieldElement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/FieldElement.java b/src/main/java/org/apache/commons/math3/FieldElement.java
deleted file mode 100644
index 8a7533a..0000000
--- a/src/main/java/org/apache/commons/math3/FieldElement.java
+++ /dev/null
@@ -1,87 +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;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NullArgumentException;
-
-
-/**
- * Interface representing <a href="http://mathworld.wolfram.com/Field.html">field</a> elements.
- * @param <T> the type of the field elements
- * @see Field
- * @since 2.0
- */
-public interface FieldElement<T> {
-
-    /** Compute this + a.
-     * @param a element to add
-     * @return a new element representing this + a
-     * @throws NullArgumentException if {@code addend} is {@code null}.
-     */
-    T add(T a) throws NullArgumentException;
-
-    /** Compute this - a.
-     * @param a element to subtract
-     * @return a new element representing this - a
-     * @throws NullArgumentException if {@code a} is {@code null}.
-     */
-    T subtract(T a) throws NullArgumentException;
-
-    /**
-     * Returns the additive inverse of {@code this} element.
-     * @return the opposite of {@code this}.
-     */
-    T negate();
-
-    /** Compute n &times; this. Multiplication by an integer number is defined
-     * as the following sum
-     * <center>
-     * n &times; this = &sum;<sub>i=1</sub><sup>n</sup> this.
-     * </center>
-     * @param n Number of times {@code this} must be added to itself.
-     * @return A new element representing n &times; this.
-     */
-    T multiply(int n);
-
-    /** Compute this &times; a.
-     * @param a element to multiply
-     * @return a new element representing this &times; a
-     * @throws NullArgumentException if {@code a} is {@code null}.
-     */
-    T multiply(T a) throws NullArgumentException;
-
-    /** Compute this &divide; a.
-     * @param a element to add
-     * @return a new element representing this &divide; a
-     * @throws NullArgumentException if {@code a} is {@code null}.
-     * @throws MathArithmeticException if {@code a} is zero
-     */
-    T divide(T a) throws NullArgumentException, MathArithmeticException;
-
-    /**
-     * Returns the multiplicative inverse of {@code this} element.
-     * @return the inverse of {@code this}.
-     * @throws MathArithmeticException if {@code this} is zero
-     */
-    T reciprocal() throws MathArithmeticException;
-
-    /** Get the {@link Field} to which the instance belongs.
-     * @return {@link Field} to which the instance belongs
-     */
-    Field<T> getField();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/RealFieldElement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/RealFieldElement.java b/src/main/java/org/apache/commons/math3/RealFieldElement.java
deleted file mode 100644
index 0e54ba1..0000000
--- a/src/main/java/org/apache/commons/math3/RealFieldElement.java
+++ /dev/null
@@ -1,402 +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;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-
-/**
- * Interface representing a <a href="http://mathworld.wolfram.com/RealNumber.html">real</a>
- * <a href="http://mathworld.wolfram.com/Field.html">field</a>.
- * @param <T> the type of the field elements
- * @see FieldElement
- * @since 3.2
- */
-public interface RealFieldElement<T> extends FieldElement<T> {
-
-    /** Get the real value of the number.
-     * @return real value
-     */
-    double getReal();
-
-    /** '+' operator.
-     * @param a right hand side parameter of the operator
-     * @return this+a
-     */
-    T add(double a);
-
-    /** '-' operator.
-     * @param a right hand side parameter of the operator
-     * @return this-a
-     */
-    T subtract(double a);
-
-    /** '&times;' operator.
-     * @param a right hand side parameter of the operator
-     * @return this&times;a
-     */
-    T multiply(double a);
-
-    /** '&divide;' operator.
-     * @param a right hand side parameter of the operator
-     * @return this&divides;a
-     */
-    T divide(double a);
-
-    /** IEEE remainder operator.
-     * @param a right hand side parameter of the operator
-     * @return this - n &times; a where n is the closest integer to this/a
-     * (the even integer is chosen for n if this/a is halfway between two integers)
-     */
-    T remainder(double a);
-
-    /** IEEE remainder operator.
-     * @param a right hand side parameter of the operator
-     * @return this - n &times; a where n is the closest integer to this/a
-     * (the even integer is chosen for n if this/a is halfway between two integers)
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    T remainder(T a)
-        throws DimensionMismatchException;
-
-    /** absolute value.
-     * @return abs(this)
-     */
-    T abs();
-
-    /** Get the smallest whole number larger than instance.
-     * @return ceil(this)
-     */
-    T ceil();
-
-    /** Get the largest whole number smaller than instance.
-     * @return floor(this)
-     */
-    T floor();
-
-    /** Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.
-     * @return a double number r such that r is an integer r - 0.5 <= this <= r + 0.5
-     */
-    T rint();
-
-    /** Get the closest long to instance value.
-     * @return closest long to {@link #getReal()}
-     */
-    long round();
-
-    /** Compute the signum of the instance.
-     * The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise
-     * @return -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
-     */
-    T signum();
-
-    /**
-     * Returns the instance with the sign of the argument.
-     * A NaN {@code sign} argument is treated as positive.
-     *
-     * @param sign the sign for the returned value
-     * @return the instance with the same sign as the {@code sign} argument
-     */
-    T copySign(T sign);
-
-    /**
-     * Returns the instance with the sign of the argument.
-     * A NaN {@code sign} argument is treated as positive.
-     *
-     * @param sign the sign for the returned value
-     * @return the instance with the same sign as the {@code sign} argument
-     */
-    T copySign(double sign);
-
-    /**
-     * Multiply the instance by a power of 2.
-     * @param n power of 2
-     * @return this &times; 2<sup>n</sup>
-     */
-    T scalb(int n);
-
-    /**
-     * Returns the hypotenuse of a triangle with sides {@code this} and {@code y}
-     * - sqrt(<i>this</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)<br/>
-     * avoiding intermediate overflow or underflow.
-     *
-     * <ul>
-     * <li> If either argument is infinite, then the result is positive infinity.</li>
-     * <li> else, if either argument is NaN then the result is NaN.</li>
-     * </ul>
-     *
-     * @param y a value
-     * @return sqrt(<i>this</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    T hypot(T y)
-        throws DimensionMismatchException;
-
-    /** {@inheritDoc} */
-    T reciprocal();
-
-    /** Square root.
-     * @return square root of the instance
-     */
-    T sqrt();
-
-    /** Cubic root.
-     * @return cubic root of the instance
-     */
-    T cbrt();
-
-    /** N<sup>th</sup> root.
-     * @param n order of the root
-     * @return n<sup>th</sup> root of the instance
-     */
-    T rootN(int n);
-
-    /** Power operation.
-     * @param p power to apply
-     * @return this<sup>p</sup>
-     */
-    T pow(double p);
-
-    /** Integer power operation.
-     * @param n power to apply
-     * @return this<sup>n</sup>
-     */
-    T pow(int n);
-
-    /** Power operation.
-     * @param e exponent
-     * @return this<sup>e</sup>
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    T pow(T e)
-        throws DimensionMismatchException;
-
-    /** Exponential.
-     * @return exponential of the instance
-     */
-    T exp();
-
-    /** Exponential minus 1.
-     * @return exponential minus one of the instance
-     */
-    T expm1();
-
-    /** Natural logarithm.
-     * @return logarithm of the instance
-     */
-    T log();
-
-    /** Shifted natural logarithm.
-     * @return logarithm of one plus the instance
-     */
-    T log1p();
-
-//    TODO: add this method in 4.0, as it is not possible to do it in 3.2
-//          due to incompatibility of the return type in the Dfp class
-//    /** Base 10 logarithm.
-//     * @return base 10 logarithm of the instance
-//     */
-//    T log10();
-
-    /** Cosine operation.
-     * @return cos(this)
-     */
-    T cos();
-
-    /** Sine operation.
-     * @return sin(this)
-     */
-    T sin();
-
-    /** Tangent operation.
-     * @return tan(this)
-     */
-    T tan();
-
-    /** Arc cosine operation.
-     * @return acos(this)
-     */
-    T acos();
-
-    /** Arc sine operation.
-     * @return asin(this)
-     */
-    T asin();
-
-    /** Arc tangent operation.
-     * @return atan(this)
-     */
-    T atan();
-
-    /** Two arguments arc tangent operation.
-     * @param x second argument of the arc tangent
-     * @return atan2(this, x)
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    T atan2(T x)
-        throws DimensionMismatchException;
-
-    /** Hyperbolic cosine operation.
-     * @return cosh(this)
-     */
-    T cosh();
-
-    /** Hyperbolic sine operation.
-     * @return sinh(this)
-     */
-    T sinh();
-
-    /** Hyperbolic tangent operation.
-     * @return tanh(this)
-     */
-    T tanh();
-
-    /** Inverse hyperbolic cosine operation.
-     * @return acosh(this)
-     */
-    T acosh();
-
-    /** Inverse hyperbolic sine operation.
-     * @return asin(this)
-     */
-    T asinh();
-
-    /** Inverse hyperbolic  tangent operation.
-     * @return atanh(this)
-     */
-    T atanh();
-
-    /**
-     * Compute a linear combination.
-     * @param a Factors.
-     * @param b Factors.
-     * @return <code>&Sigma;<sub>i</sub> a<sub>i</sub> b<sub>i</sub></code>.
-     * @throws DimensionMismatchException if arrays dimensions don't match
-     * @since 3.2
-     */
-    T linearCombination(T[] a, T[] b)
-        throws DimensionMismatchException;
-
-    /**
-     * Compute a linear combination.
-     * @param a Factors.
-     * @param b Factors.
-     * @return <code>&Sigma;<sub>i</sub> a<sub>i</sub> b<sub>i</sub></code>.
-     * @throws DimensionMismatchException if arrays dimensions don't match
-     * @since 3.2
-     */
-    T linearCombination(double[] a, T[] b)
-        throws DimensionMismatchException;
-
-    /**
-     * Compute a linear combination.
-     * @param a1 first factor of the first term
-     * @param b1 second factor of the first term
-     * @param a2 first factor of the second term
-     * @param b2 second factor of the second term
-     * @return a<sub>1</sub>&times;b<sub>1</sub> +
-     * a<sub>2</sub>&times;b<sub>2</sub>
-     * @see #linearCombination(Object, Object, Object, Object, Object, Object)
-     * @see #linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
-     * @since 3.2
-     */
-    T linearCombination(T a1, T b1, T a2, T b2);
-
-    /**
-     * Compute a linear combination.
-     * @param a1 first factor of the first term
-     * @param b1 second factor of the first term
-     * @param a2 first factor of the second term
-     * @param b2 second factor of the second term
-     * @return a<sub>1</sub>&times;b<sub>1</sub> +
-     * a<sub>2</sub>&times;b<sub>2</sub>
-     * @see #linearCombination(double, Object, double, Object, double, Object)
-     * @see #linearCombination(double, Object, double, Object, double, Object, double, Object)
-     * @since 3.2
-     */
-    T linearCombination(double a1, T b1, double a2, T b2);
-
-    /**
-     * Compute a linear combination.
-     * @param a1 first factor of the first term
-     * @param b1 second factor of the first term
-     * @param a2 first factor of the second term
-     * @param b2 second factor of the second term
-     * @param a3 first factor of the third term
-     * @param b3 second factor of the third term
-     * @return a<sub>1</sub>&times;b<sub>1</sub> +
-     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub>
-     * @see #linearCombination(Object, Object, Object, Object)
-     * @see #linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)
-     * @since 3.2
-     */
-    T linearCombination(T a1, T b1, T a2, T b2, T a3, T b3);
-
-    /**
-     * Compute a linear combination.
-     * @param a1 first factor of the first term
-     * @param b1 second factor of the first term
-     * @param a2 first factor of the second term
-     * @param b2 second factor of the second term
-     * @param a3 first factor of the third term
-     * @param b3 second factor of the third term
-     * @return a<sub>1</sub>&times;b<sub>1</sub> +
-     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub>
-     * @see #linearCombination(double, Object, double, Object)
-     * @see #linearCombination(double, Object, double, Object, double, Object, double, Object)
-     * @since 3.2
-     */
-    T linearCombination(double a1, T b1,  double a2, T b2, double a3, T b3);
-
-    /**
-     * Compute a linear combination.
-     * @param a1 first factor of the first term
-     * @param b1 second factor of the first term
-     * @param a2 first factor of the second term
-     * @param b2 second factor of the second term
-     * @param a3 first factor of the third term
-     * @param b3 second factor of the third term
-     * @param a4 first factor of the third term
-     * @param b4 second factor of the third term
-     * @return a<sub>1</sub>&times;b<sub>1</sub> +
-     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub> +
-     * a<sub>4</sub>&times;b<sub>4</sub>
-     * @see #linearCombination(Object, Object, Object, Object)
-     * @see #linearCombination(Object, Object, Object, Object, Object, Object)
-     * @since 3.2
-     */
-    T linearCombination(T a1, T b1, T a2, T b2, T a3, T b3, T a4, T b4);
-
-    /**
-     * Compute a linear combination.
-     * @param a1 first factor of the first term
-     * @param b1 second factor of the first term
-     * @param a2 first factor of the second term
-     * @param b2 second factor of the second term
-     * @param a3 first factor of the third term
-     * @param b3 second factor of the third term
-     * @param a4 first factor of the third term
-     * @param b4 second factor of the third term
-     * @return a<sub>1</sub>&times;b<sub>1</sub> +
-     * a<sub>2</sub>&times;b<sub>2</sub> + a<sub>3</sub>&times;b<sub>3</sub> +
-     * a<sub>4</sub>&times;b<sub>4</sub>
-     * @see #linearCombination(double, Object, double, Object)
-     * @see #linearCombination(double, Object, double, Object, double, Object)
-     * @since 3.2
-     */
-    T linearCombination(double a1, T b1, double a2, T b2, double a3, T b3, double a4, T b4);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/BivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/BivariateFunction.java b/src/main/java/org/apache/commons/math3/analysis/BivariateFunction.java
deleted file mode 100644
index d8aaca5..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/BivariateFunction.java
+++ /dev/null
@@ -1,35 +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.analysis;
-
-/**
- * An interface representing a bivariate real function.
- *
- * @since 2.1
- */
-public interface BivariateFunction {
-    /**
-     * Compute the value for the function.
-     *
-     * @param x Abscissa for which the function value should be computed.
-     * @param y Ordinate for which the function value should be computed.
-     * @return the value.
-     */
-    double value(double x, double y);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateFunction.java b/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateFunction.java
deleted file mode 100644
index c7fad48..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateFunction.java
+++ /dev/null
@@ -1,52 +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.analysis;
-
-/**
- * Extension of {@link MultivariateFunction} representing a differentiable
- * multivariate real function.
- * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction}
- */
-@Deprecated
-public interface DifferentiableMultivariateFunction extends MultivariateFunction {
-
-    /**
-     * Returns the partial derivative of the function with respect to a point coordinate.
-     * <p>
-     * The partial derivative is defined with respect to point coordinate
-     * x<sub>k</sub>. If the partial derivatives with respect to all coordinates are
-     * needed, it may be more efficient to use the {@link #gradient()} method which will
-     * compute them all at once.
-     * </p>
-     * @param k index of the coordinate with respect to which the partial
-     * derivative is computed
-     * @return the partial derivative function with respect to k<sup>th</sup> point coordinate
-     */
-    MultivariateFunction partialDerivative(int k);
-
-    /**
-     * Returns the gradient function.
-     * <p>If only one partial derivative with respect to a specific coordinate is
-     * needed, it may be more efficient to use the {@link #partialDerivative(int)} method
-     * which will compute only the specified component.</p>
-     * @return the gradient function
-     */
-    MultivariateVectorFunction gradient();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateVectorFunction.java
deleted file mode 100644
index 5bfa97b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/DifferentiableMultivariateVectorFunction.java
+++ /dev/null
@@ -1,36 +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.analysis;
-
-/**
- * Extension of {@link MultivariateVectorFunction} representing a differentiable
- * multivariate vectorial function.
- * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction}
- */
-@Deprecated
-public interface DifferentiableMultivariateVectorFunction
-    extends MultivariateVectorFunction {
-
-    /**
-     * Returns the jacobian function.
-     * @return the jacobian function
-     */
-    MultivariateMatrixFunction jacobian();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateFunction.java b/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateFunction.java
deleted file mode 100644
index db0314c..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateFunction.java
+++ /dev/null
@@ -1,35 +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.analysis;
-
-/**
- * Extension of {@link UnivariateFunction} representing a differentiable univariate real function.
- *
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction}
- */
-@Deprecated
-public interface DifferentiableUnivariateFunction
-    extends UnivariateFunction {
-
-    /**
-     * Returns the derivative of the function
-     *
-     * @return  the derivative function
-     */
-    UnivariateFunction derivative();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateMatrixFunction.java b/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateMatrixFunction.java
deleted file mode 100644
index 375fcfd..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateMatrixFunction.java
+++ /dev/null
@@ -1,36 +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.analysis;
-
-/**
- * Extension of {@link UnivariateMatrixFunction} representing a differentiable univariate matrix function.
- *
- * @since 2.0
- * @deprecated as of 3.1 replaced by  {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableMatrixFunction}
- */
-@Deprecated
-public interface DifferentiableUnivariateMatrixFunction
-    extends UnivariateMatrixFunction {
-
-    /**
-     * Returns the derivative of the function
-     *
-     * @return  the derivative function
-     */
-    UnivariateMatrixFunction derivative();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateVectorFunction.java
deleted file mode 100644
index b5ab198..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/DifferentiableUnivariateVectorFunction.java
+++ /dev/null
@@ -1,36 +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.analysis;
-
-/**
- * Extension of {@link UnivariateVectorFunction} representing a differentiable univariate vectorial function.
- *
- * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableVectorFunction}
- */
-@Deprecated
-public interface DifferentiableUnivariateVectorFunction
-    extends UnivariateVectorFunction {
-
-    /**
-     * Returns the derivative of the function
-     *
-     * @return  the derivative function
-     */
-    UnivariateVectorFunction derivative();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/FunctionUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/FunctionUtils.java b/src/main/java/org/apache/commons/math3/analysis/FunctionUtils.java
deleted file mode 100644
index 2bc1c48..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/FunctionUtils.java
+++ /dev/null
@@ -1,795 +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.analysis;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.function.Identity;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Utilities for manipulating function objects.
- *
- * @since 3.0
- */
-public class FunctionUtils {
-    /**
-     * Class only contains static methods.
-     */
-    private FunctionUtils() {}
-
-    /**
-     * Composes functions.
-     * <br/>
-     * The functions in the argument list are composed sequentially, in the
-     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).
-     *
-     * @param f List of functions.
-     * @return the composite function.
-     */
-    public static UnivariateFunction compose(final UnivariateFunction ... f) {
-        return new UnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                double r = x;
-                for (int i = f.length - 1; i >= 0; i--) {
-                    r = f[i].value(r);
-                }
-                return r;
-            }
-        };
-    }
-
-    /**
-     * Composes functions.
-     * <br/>
-     * The functions in the argument list are composed sequentially, in the
-     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).
-     *
-     * @param f List of functions.
-     * @return the composite function.
-     * @since 3.1
-     */
-    public static UnivariateDifferentiableFunction compose(final UnivariateDifferentiableFunction ... f) {
-        return new UnivariateDifferentiableFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double t) {
-                double r = t;
-                for (int i = f.length - 1; i >= 0; i--) {
-                    r = f[i].value(r);
-                }
-                return r;
-            }
-
-            /** {@inheritDoc} */
-            public DerivativeStructure value(final DerivativeStructure t) {
-                DerivativeStructure r = t;
-                for (int i = f.length - 1; i >= 0; i--) {
-                    r = f[i].value(r);
-                }
-                return r;
-            }
-
-        };
-    }
-
-    /**
-     * Composes functions.
-     * <br/>
-     * The functions in the argument list are composed sequentially, in the
-     * given order.  For example, compose(f1,f2,f3) acts like f1(f2(f3(x))).
-     *
-     * @param f List of functions.
-     * @return the composite function.
-     * @deprecated as of 3.1 replaced by {@link #compose(UnivariateDifferentiableFunction...)}
-     */
-    @Deprecated
-    public static DifferentiableUnivariateFunction compose(final DifferentiableUnivariateFunction ... f) {
-        return new DifferentiableUnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                double r = x;
-                for (int i = f.length - 1; i >= 0; i--) {
-                    r = f[i].value(r);
-                }
-                return r;
-            }
-
-            /** {@inheritDoc} */
-            public UnivariateFunction derivative() {
-                return new UnivariateFunction() {
-                    /** {@inheritDoc} */
-                    public double value(double x) {
-                        double p = 1;
-                        double r = x;
-                        for (int i = f.length - 1; i >= 0; i--) {
-                            p *= f[i].derivative().value(r);
-                            r = f[i].value(r);
-                        }
-                        return p;
-                    }
-                };
-            }
-        };
-    }
-
-    /**
-     * Adds functions.
-     *
-     * @param f List of functions.
-     * @return a function that computes the sum of the functions.
-     */
-    public static UnivariateFunction add(final UnivariateFunction ... f) {
-        return new UnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                double r = f[0].value(x);
-                for (int i = 1; i < f.length; i++) {
-                    r += f[i].value(x);
-                }
-                return r;
-            }
-        };
-    }
-
-    /**
-     * Adds functions.
-     *
-     * @param f List of functions.
-     * @return a function that computes the sum of the functions.
-     * @since 3.1
-     */
-    public static UnivariateDifferentiableFunction add(final UnivariateDifferentiableFunction ... f) {
-        return new UnivariateDifferentiableFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double t) {
-                double r = f[0].value(t);
-                for (int i = 1; i < f.length; i++) {
-                    r += f[i].value(t);
-                }
-                return r;
-            }
-
-            /** {@inheritDoc}
-             * @throws DimensionMismatchException if functions are not consistent with each other
-             */
-            public DerivativeStructure value(final DerivativeStructure t)
-                throws DimensionMismatchException {
-                DerivativeStructure r = f[0].value(t);
-                for (int i = 1; i < f.length; i++) {
-                    r = r.add(f[i].value(t));
-                }
-                return r;
-            }
-
-        };
-    }
-
-    /**
-     * Adds functions.
-     *
-     * @param f List of functions.
-     * @return a function that computes the sum of the functions.
-     * @deprecated as of 3.1 replaced by {@link #add(UnivariateDifferentiableFunction...)}
-     */
-    @Deprecated
-    public static DifferentiableUnivariateFunction add(final DifferentiableUnivariateFunction ... f) {
-        return new DifferentiableUnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                double r = f[0].value(x);
-                for (int i = 1; i < f.length; i++) {
-                    r += f[i].value(x);
-                }
-                return r;
-            }
-
-            /** {@inheritDoc} */
-            public UnivariateFunction derivative() {
-                return new UnivariateFunction() {
-                    /** {@inheritDoc} */
-                    public double value(double x) {
-                        double r = f[0].derivative().value(x);
-                        for (int i = 1; i < f.length; i++) {
-                            r += f[i].derivative().value(x);
-                        }
-                        return r;
-                    }
-                };
-            }
-        };
-    }
-
-    /**
-     * Multiplies functions.
-     *
-     * @param f List of functions.
-     * @return a function that computes the product of the functions.
-     */
-    public static UnivariateFunction multiply(final UnivariateFunction ... f) {
-        return new UnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                double r = f[0].value(x);
-                for (int i = 1; i < f.length; i++) {
-                    r *= f[i].value(x);
-                }
-                return r;
-            }
-        };
-    }
-
-    /**
-     * Multiplies functions.
-     *
-     * @param f List of functions.
-     * @return a function that computes the product of the functions.
-     * @since 3.1
-     */
-    public static UnivariateDifferentiableFunction multiply(final UnivariateDifferentiableFunction ... f) {
-        return new UnivariateDifferentiableFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double t) {
-                double r = f[0].value(t);
-                for (int i = 1; i < f.length; i++) {
-                    r  *= f[i].value(t);
-                }
-                return r;
-            }
-
-            /** {@inheritDoc} */
-            public DerivativeStructure value(final DerivativeStructure t) {
-                DerivativeStructure r = f[0].value(t);
-                for (int i = 1; i < f.length; i++) {
-                    r = r.multiply(f[i].value(t));
-                }
-                return r;
-            }
-
-        };
-    }
-
-    /**
-     * Multiplies functions.
-     *
-     * @param f List of functions.
-     * @return a function that computes the product of the functions.
-     * @deprecated as of 3.1 replaced by {@link #multiply(UnivariateDifferentiableFunction...)}
-     */
-    @Deprecated
-    public static DifferentiableUnivariateFunction multiply(final DifferentiableUnivariateFunction ... f) {
-        return new DifferentiableUnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                double r = f[0].value(x);
-                for (int i = 1; i < f.length; i++) {
-                    r *= f[i].value(x);
-                }
-                return r;
-            }
-
-            /** {@inheritDoc} */
-            public UnivariateFunction derivative() {
-                return new UnivariateFunction() {
-                    /** {@inheritDoc} */
-                    public double value(double x) {
-                        double sum = 0;
-                        for (int i = 0; i < f.length; i++) {
-                            double prod = f[i].derivative().value(x);
-                            for (int j = 0; j < f.length; j++) {
-                                if (i != j) {
-                                    prod *= f[j].value(x);
-                                }
-                            }
-                            sum += prod;
-                        }
-                        return sum;
-                    }
-                };
-            }
-        };
-    }
-
-    /**
-     * Returns the univariate function <br/>
-     * {@code h(x) = combiner(f(x), g(x))}.
-     *
-     * @param combiner Combiner function.
-     * @param f Function.
-     * @param g Function.
-     * @return the composite function.
-     */
-    public static UnivariateFunction combine(final BivariateFunction combiner,
-                                             final UnivariateFunction f,
-                                             final UnivariateFunction g) {
-        return new UnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                return combiner.value(f.value(x), g.value(x));
-            }
-        };
-    }
-
-    /**
-     * Returns a MultivariateFunction h(x[]) defined by <pre> <code>
-     * h(x[]) = combiner(...combiner(combiner(initialValue,f(x[0])),f(x[1]))...),f(x[x.length-1]))
-     * </code></pre>
-     *
-     * @param combiner Combiner function.
-     * @param f Function.
-     * @param initialValue Initial value.
-     * @return a collector function.
-     */
-    public static MultivariateFunction collector(final BivariateFunction combiner,
-                                                 final UnivariateFunction f,
-                                                 final double initialValue) {
-        return new MultivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double[] point) {
-                double result = combiner.value(initialValue, f.value(point[0]));
-                for (int i = 1; i < point.length; i++) {
-                    result = combiner.value(result, f.value(point[i]));
-                }
-                return result;
-            }
-        };
-    }
-
-    /**
-     * Returns a MultivariateFunction h(x[]) defined by <pre> <code>
-     * h(x[]) = combiner(...combiner(combiner(initialValue,x[0]),x[1])...),x[x.length-1])
-     * </code></pre>
-     *
-     * @param combiner Combiner function.
-     * @param initialValue Initial value.
-     * @return a collector function.
-     */
-    public static MultivariateFunction collector(final BivariateFunction combiner,
-                                                 final double initialValue) {
-        return collector(combiner, new Identity(), initialValue);
-    }
-
-    /**
-     * Creates a unary function by fixing the first argument of a binary function.
-     *
-     * @param f Binary function.
-     * @param fixed Value to which the first argument of {@code f} is set.
-     * @return the unary function h(x) = f(fixed, x)
-     */
-    public static UnivariateFunction fix1stArgument(final BivariateFunction f,
-                                                    final double fixed) {
-        return new UnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                return f.value(fixed, x);
-            }
-        };
-    }
-    /**
-     * Creates a unary function by fixing the second argument of a binary function.
-     *
-     * @param f Binary function.
-     * @param fixed Value to which the second argument of {@code f} is set.
-     * @return the unary function h(x) = f(x, fixed)
-     */
-    public static UnivariateFunction fix2ndArgument(final BivariateFunction f,
-                                                    final double fixed) {
-        return new UnivariateFunction() {
-            /** {@inheritDoc} */
-            public double value(double x) {
-                return f.value(x, fixed);
-            }
-        };
-    }
-
-    /**
-     * Samples the specified univariate real function on the specified interval.
-     * <br/>
-     * The interval is divided equally into {@code n} sections and sample points
-     * are taken from {@code min} to {@code max - (max - min) / n}; therefore
-     * {@code f} is not sampled at the upper bound {@code max}.
-     *
-     * @param f Function to be sampled
-     * @param min Lower bound of the interval (included).
-     * @param max Upper bound of the interval (excluded).
-     * @param n Number of sample points.
-     * @return the array of samples.
-     * @throws NumberIsTooLargeException if the lower bound {@code min} is
-     * greater than, or equal to the upper bound {@code max}.
-     * @throws NotStrictlyPositiveException if the number of sample points
-     * {@code n} is negative.
-     */
-    public static double[] sample(UnivariateFunction f, double min, double max, int n)
-       throws NumberIsTooLargeException, NotStrictlyPositiveException {
-
-        if (n <= 0) {
-            throw new NotStrictlyPositiveException(
-                    LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES,
-                    Integer.valueOf(n));
-        }
-        if (min >= max) {
-            throw new NumberIsTooLargeException(min, max, false);
-        }
-
-        final double[] s = new double[n];
-        final double h = (max - min) / n;
-        for (int i = 0; i < n; i++) {
-            s[i] = f.value(min + i * h);
-        }
-        return s;
-    }
-
-    /** Convert a {@link UnivariateDifferentiableFunction} into a {@link DifferentiableUnivariateFunction}.
-     * @param f function to convert
-     * @return converted function
-     * @deprecated this conversion method is temporary in version 3.1, as the {@link
-     * DifferentiableUnivariateFunction} interface itself is deprecated
-     */
-    @Deprecated
-    public static DifferentiableUnivariateFunction toDifferentiableUnivariateFunction(final UnivariateDifferentiableFunction f) {
-        return new DifferentiableUnivariateFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double x) {
-                return f.value(x);
-            }
-
-            /** {@inheritDoc} */
-            public UnivariateFunction derivative() {
-                return new UnivariateFunction() {
-                    /** {@inheritDoc} */
-                    public double value(final double x) {
-                        return f.value(new DerivativeStructure(1, 1, 0, x)).getPartialDerivative(1);
-                    }
-                };
-            }
-
-        };
-    }
-
-    /** Convert a {@link DifferentiableUnivariateFunction} into a {@link UnivariateDifferentiableFunction}.
-     * <p>
-     * Note that the converted function is able to handle {@link DerivativeStructure} up to order one.
-     * If the function is called with higher order, a {@link NumberIsTooLargeException} will be thrown.
-     * </p>
-     * @param f function to convert
-     * @return converted function
-     * @deprecated this conversion method is temporary in version 3.1, as the {@link
-     * DifferentiableUnivariateFunction} interface itself is deprecated
-     */
-    @Deprecated
-    public static UnivariateDifferentiableFunction toUnivariateDifferential(final DifferentiableUnivariateFunction f) {
-        return new UnivariateDifferentiableFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double x) {
-                return f.value(x);
-            }
-
-            /** {@inheritDoc}
-             * @exception NumberIsTooLargeException if derivation order is greater than 1
-             */
-            public DerivativeStructure value(final DerivativeStructure t)
-                throws NumberIsTooLargeException {
-                switch (t.getOrder()) {
-                    case 0 :
-                        return new DerivativeStructure(t.getFreeParameters(), 0, f.value(t.getValue()));
-                    case 1 : {
-                        final int parameters = t.getFreeParameters();
-                        final double[] derivatives = new double[parameters + 1];
-                        derivatives[0] = f.value(t.getValue());
-                        final double fPrime = f.derivative().value(t.getValue());
-                        int[] orders = new int[parameters];
-                        for (int i = 0; i < parameters; ++i) {
-                            orders[i] = 1;
-                            derivatives[i + 1] = fPrime * t.getPartialDerivative(orders);
-                            orders[i] = 0;
-                        }
-                        return new DerivativeStructure(parameters, 1, derivatives);
-                    }
-                    default :
-                        throw new NumberIsTooLargeException(t.getOrder(), 1, true);
-                }
-            }
-
-        };
-    }
-
-    /** Convert a {@link MultivariateDifferentiableFunction} into a {@link DifferentiableMultivariateFunction}.
-     * @param f function to convert
-     * @return converted function
-     * @deprecated this conversion method is temporary in version 3.1, as the {@link
-     * DifferentiableMultivariateFunction} interface itself is deprecated
-     */
-    @Deprecated
-    public static DifferentiableMultivariateFunction toDifferentiableMultivariateFunction(final MultivariateDifferentiableFunction f) {
-        return new DifferentiableMultivariateFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double[] x) {
-                return f.value(x);
-            }
-
-            /** {@inheritDoc} */
-            public MultivariateFunction partialDerivative(final int k) {
-                return new MultivariateFunction() {
-                    /** {@inheritDoc} */
-                    public double value(final double[] x) {
-
-                        final int n = x.length;
-
-                        // delegate computation to underlying function
-                        final DerivativeStructure[] dsX = new DerivativeStructure[n];
-                        for (int i = 0; i < n; ++i) {
-                            if (i == k) {
-                                dsX[i] = new DerivativeStructure(1, 1, 0, x[i]);
-                            } else {
-                                dsX[i] = new DerivativeStructure(1, 1, x[i]);
-                            }
-                        }
-                        final DerivativeStructure y = f.value(dsX);
-
-                        // extract partial derivative
-                        return y.getPartialDerivative(1);
-
-                    }
-                };
-            }
-
-            public MultivariateVectorFunction gradient() {
-                return new MultivariateVectorFunction() {
-                    /** {@inheritDoc} */
-                    public double[] value(final double[] x) {
-
-                        final int n = x.length;
-
-                        // delegate computation to underlying function
-                        final DerivativeStructure[] dsX = new DerivativeStructure[n];
-                        for (int i = 0; i < n; ++i) {
-                            dsX[i] = new DerivativeStructure(n, 1, i, x[i]);
-                        }
-                        final DerivativeStructure y = f.value(dsX);
-
-                        // extract gradient
-                        final double[] gradient = new double[n];
-                        final int[] orders = new int[n];
-                        for (int i = 0; i < n; ++i) {
-                            orders[i]   = 1;
-                            gradient[i] = y.getPartialDerivative(orders);
-                            orders[i]   = 0;
-                        }
-
-                        return gradient;
-
-                    }
-                };
-            }
-
-        };
-    }
-
-    /** Convert a {@link DifferentiableMultivariateFunction} into a {@link MultivariateDifferentiableFunction}.
-     * <p>
-     * Note that the converted function is able to handle {@link DerivativeStructure} elements
-     * that all have the same number of free parameters and order, and with order at most 1.
-     * If the function is called with inconsistent numbers of free parameters or higher order, a
-     * {@link DimensionMismatchException} or a {@link NumberIsTooLargeException} will be thrown.
-     * </p>
-     * @param f function to convert
-     * @return converted function
-     * @deprecated this conversion method is temporary in version 3.1, as the {@link
-     * DifferentiableMultivariateFunction} interface itself is deprecated
-     */
-    @Deprecated
-    public static MultivariateDifferentiableFunction toMultivariateDifferentiableFunction(final DifferentiableMultivariateFunction f) {
-        return new MultivariateDifferentiableFunction() {
-
-            /** {@inheritDoc} */
-            public double value(final double[] x) {
-                return f.value(x);
-            }
-
-            /** {@inheritDoc}
-             * @exception NumberIsTooLargeException if derivation order is higher than 1
-             * @exception DimensionMismatchException if numbers of free parameters are inconsistent
-             */
-            public DerivativeStructure value(final DerivativeStructure[] t)
-                throws DimensionMismatchException, NumberIsTooLargeException {
-
-                // check parameters and orders limits
-                final int parameters = t[0].getFreeParameters();
-                final int order      = t[0].getOrder();
-                final int n          = t.length;
-                if (order > 1) {
-                    throw new NumberIsTooLargeException(order, 1, true);
-                }
-
-                // check all elements in the array are consistent
-                for (int i = 0; i < n; ++i) {
-                    if (t[i].getFreeParameters() != parameters) {
-                        throw new DimensionMismatchException(t[i].getFreeParameters(), parameters);
-                    }
-
-                    if (t[i].getOrder() != order) {
-                        throw new DimensionMismatchException(t[i].getOrder(), order);
-                    }
-                }
-
-                // delegate computation to underlying function
-                final double[] point = new double[n];
-                for (int i = 0; i < n; ++i) {
-                    point[i] = t[i].getValue();
-                }
-                final double value      = f.value(point);
-                final double[] gradient = f.gradient().value(point);
-
-                // merge value and gradient into one DerivativeStructure
-                final double[] derivatives = new double[parameters + 1];
-                derivatives[0] = value;
-                final int[] orders = new int[parameters];
-                for (int i = 0; i < parameters; ++i) {
-                    orders[i] = 1;
-                    for (int j = 0; j < n; ++j) {
-                        derivatives[i + 1] += gradient[j] * t[j].getPartialDerivative(orders);
-                    }
-                    orders[i] = 0;
-                }
-
-                return new DerivativeStructure(parameters, order, derivatives);
-
-            }
-
-        };
-    }
-
-    /** Convert a {@link MultivariateDifferentiableVectorFunction} into a {@link DifferentiableMultivariateVectorFunction}.
-     * @param f function to convert
-     * @return converted function
-     * @deprecated this conversion method is temporary in version 3.1, as the {@link
-     * DifferentiableMultivariateVectorFunction} interface itself is deprecated
-     */
-    @Deprecated
-    public static DifferentiableMultivariateVectorFunction toDifferentiableMultivariateVectorFunction(final MultivariateDifferentiableVectorFunction f) {
-        return new DifferentiableMultivariateVectorFunction() {
-
-            /** {@inheritDoc} */
-            public double[] value(final double[] x) {
-                return f.value(x);
-            }
-
-            public MultivariateMatrixFunction jacobian() {
-                return new MultivariateMatrixFunction() {
-                    /** {@inheritDoc} */
-                    public double[][] value(final double[] x) {
-
-                        final int n = x.length;
-
-                        // delegate computation to underlying function
-                        final DerivativeStructure[] dsX = new DerivativeStructure[n];
-                        for (int i = 0; i < n; ++i) {
-                            dsX[i] = new DerivativeStructure(n, 1, i, x[i]);
-                        }
-                        final DerivativeStructure[] y = f.value(dsX);
-
-                        // extract Jacobian
-                        final double[][] jacobian = new double[y.length][n];
-                        final int[] orders = new int[n];
-                        for (int i = 0; i < y.length; ++i) {
-                            for (int j = 0; j < n; ++j) {
-                                orders[j]      = 1;
-                                jacobian[i][j] = y[i].getPartialDerivative(orders);
-                                orders[j]      = 0;
-                            }
-                        }
-
-                        return jacobian;
-
-                    }
-                };
-            }
-
-        };
-    }
-
-    /** Convert a {@link DifferentiableMultivariateVectorFunction} into a {@link MultivariateDifferentiableVectorFunction}.
-     * <p>
-     * Note that the converted function is able to handle {@link DerivativeStructure} elements
-     * that all have the same number of free parameters and order, and with order at most 1.
-     * If the function is called with inconsistent numbers of free parameters or higher order, a
-     * {@link DimensionMismatchException} or a {@link NumberIsTooLargeException} will be thrown.
-     * </p>
-     * @param f function to convert
-     * @return converted function
-     * @deprecated this conversion method is temporary in version 3.1, as the {@link
-     * DifferentiableMultivariateFunction} interface itself is deprecated
-     */
-    @Deprecated
-    public static MultivariateDifferentiableVectorFunction toMultivariateDifferentiableVectorFunction(final DifferentiableMultivariateVectorFunction f) {
-        return new MultivariateDifferentiableVectorFunction() {
-
-            /** {@inheritDoc} */
-            public double[] value(final double[] x) {
-                return f.value(x);
-            }
-
-            /** {@inheritDoc}
-             * @exception NumberIsTooLargeException if derivation order is higher than 1
-             * @exception DimensionMismatchException if numbers of free parameters are inconsistent
-             */
-            public DerivativeStructure[] value(final DerivativeStructure[] t)
-                throws DimensionMismatchException, NumberIsTooLargeException {
-
-                // check parameters and orders limits
-                final int parameters = t[0].getFreeParameters();
-                final int order      = t[0].getOrder();
-                final int n          = t.length;
-                if (order > 1) {
-                    throw new NumberIsTooLargeException(order, 1, true);
-                }
-
-                // check all elements in the array are consistent
-                for (int i = 0; i < n; ++i) {
-                    if (t[i].getFreeParameters() != parameters) {
-                        throw new DimensionMismatchException(t[i].getFreeParameters(), parameters);
-                    }
-
-                    if (t[i].getOrder() != order) {
-                        throw new DimensionMismatchException(t[i].getOrder(), order);
-                    }
-                }
-
-                // delegate computation to underlying function
-                final double[] point = new double[n];
-                for (int i = 0; i < n; ++i) {
-                    point[i] = t[i].getValue();
-                }
-                final double[] value      = f.value(point);
-                final double[][] jacobian = f.jacobian().value(point);
-
-                // merge value and Jacobian into a DerivativeStructure array
-                final DerivativeStructure[] merged = new DerivativeStructure[value.length];
-                for (int k = 0; k < merged.length; ++k) {
-                    final double[] derivatives = new double[parameters + 1];
-                    derivatives[0] = value[k];
-                    final int[] orders = new int[parameters];
-                    for (int i = 0; i < parameters; ++i) {
-                        orders[i] = 1;
-                        for (int j = 0; j < n; ++j) {
-                            derivatives[i + 1] += jacobian[k][j] * t[j].getPartialDerivative(orders);
-                        }
-                        orders[i] = 0;
-                    }
-                    merged[k] = new DerivativeStructure(parameters, order, derivatives);
-                }
-
-                return merged;
-
-            }
-
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/MultivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/MultivariateFunction.java b/src/main/java/org/apache/commons/math3/analysis/MultivariateFunction.java
deleted file mode 100644
index f86ba2a..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/MultivariateFunction.java
+++ /dev/null
@@ -1,42 +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.analysis;
-
-/**
- * An interface representing a multivariate real function.
- *
- * @since 2.0
- */
-public interface MultivariateFunction {
-
-    /**
-     * Compute the value for the function at the given point.
-     *
-     * @param point Point at which the function must be evaluated.
-     * @return the function value for the given point.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if the parameter's dimension is wrong for the function being evaluated.
-     * @throws  org.apache.commons.math3.exception.MathIllegalArgumentException
-     * when the activated method itself can ascertain that preconditions,
-     * specified in the API expressed at the level of the activated method,
-     * have been violated.  In the vast majority of cases where Commons Math
-     * throws this exception, it is the result of argument checking of actual
-     * parameters immediately passed to a method.
-     */
-    double value(double[] point);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/MultivariateMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/MultivariateMatrixFunction.java b/src/main/java/org/apache/commons/math3/analysis/MultivariateMatrixFunction.java
deleted file mode 100644
index f064904..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/MultivariateMatrixFunction.java
+++ /dev/null
@@ -1,35 +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.analysis;
-
-/**
- * An interface representing a multivariate matrix function.
- * @since 2.0
- */
-public interface MultivariateMatrixFunction {
-
-    /**
-     * Compute the value for the function at the given point.
-     * @param point point at which the function must be evaluated
-     * @return function value for the given point
-     * @exception IllegalArgumentException if point's dimension is wrong
-     */
-    double[][] value(double[] point)
-        throws IllegalArgumentException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/MultivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/MultivariateVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/MultivariateVectorFunction.java
deleted file mode 100644
index 26a69f2..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/MultivariateVectorFunction.java
+++ /dev/null
@@ -1,35 +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.analysis;
-
-/**
- * An interface representing a multivariate vectorial function.
- * @since 2.0
- */
-public interface MultivariateVectorFunction {
-
-    /**
-     * Compute the value for the function at the given point.
-     * @param point point at which the function must be evaluated
-     * @return function value for the given point
-     * @exception IllegalArgumentException if point's dimension is wrong
-     */
-    double[] value(double[] point)
-        throws IllegalArgumentException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/ParametricUnivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/ParametricUnivariateFunction.java b/src/main/java/org/apache/commons/math3/analysis/ParametricUnivariateFunction.java
deleted file mode 100644
index 616b35d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/ParametricUnivariateFunction.java
+++ /dev/null
@@ -1,44 +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.analysis;
-
-/**
- * An interface representing a real function that depends on one independent
- * variable plus some extra parameters.
- *
- * @since 3.0
- */
-public interface ParametricUnivariateFunction {
-    /**
-     * Compute the value of the function.
-     *
-     * @param x Point for which the function value should be computed.
-     * @param parameters Function parameters.
-     * @return the value.
-     */
-    double value(double x, double ... parameters);
-
-    /**
-     * Compute the gradient of the function with respect to its parameters.
-     *
-     * @param x Point for which the function value should be computed.
-     * @param parameters Function parameters.
-     * @return the value.
-     */
-    double[] gradient(double x, double ... parameters);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/TrivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/TrivariateFunction.java b/src/main/java/org/apache/commons/math3/analysis/TrivariateFunction.java
deleted file mode 100644
index 30ba767..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/TrivariateFunction.java
+++ /dev/null
@@ -1,35 +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.analysis;
-
-/**
- * An interface representing a trivariate real function.
- *
- * @since 2.2
- */
-public interface TrivariateFunction {
-    /**
-     * Compute the value for the function.
-     *
-     * @param x x-coordinate for which the function value should be computed.
-     * @param y y-coordinate for which the function value should be computed.
-     * @param z z-coordinate for which the function value should be computed.
-     * @return the value.
-     */
-    double value(double x, double y, double z);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/UnivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/UnivariateFunction.java b/src/main/java/org/apache/commons/math3/analysis/UnivariateFunction.java
deleted file mode 100644
index e99f1f3..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/UnivariateFunction.java
+++ /dev/null
@@ -1,81 +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.analysis;
-
-/**
- * An interface representing a univariate real function.
- * <br/>
- * When a <em>user-defined</em> function encounters an error during
- * evaluation, the {@link #value(double) value} method should throw a
- * <em>user-defined</em> unchecked exception.
- * <br/>
- * The following code excerpt shows the recommended way to do that using
- * a root solver as an example, but the same construct is applicable to
- * ODE integrators or optimizers.
- *
- * <pre>
- * private static class LocalException extends RuntimeException {
- *     // The x value that caused the problem.
- *     private final double x;
- *
- *     public LocalException(double x) {
- *         this.x = x;
- *     }
- *
- *     public double getX() {
- *         return x;
- *     }
- * }
- *
- * private static class MyFunction implements UnivariateFunction {
- *     public double value(double x) {
- *         double y = hugeFormula(x);
- *         if (somethingBadHappens) {
- *           throw new LocalException(x);
- *         }
- *         return y;
- *     }
- * }
- *
- * public void compute() {
- *     try {
- *         solver.solve(maxEval, new MyFunction(a, b, c), min, max);
- *     } catch (LocalException le) {
- *         // Retrieve the x value.
- *     }
- * }
- * </pre>
- *
- * As shown, the exception is local to the user's code and it is guaranteed
- * that Apache Commons Math will not catch it.
- *
- */
-public interface UnivariateFunction {
-    /**
-     * Compute the value of the function.
-     *
-     * @param x Point at which the function value should be computed.
-     * @return the value of the function.
-     * @throws IllegalArgumentException when the activated method itself can
-     * ascertain that a precondition, specified in the API expressed at the
-     * level of the activated method, has been violated.
-     * When Commons Math throws an {@code IllegalArgumentException}, it is
-     * usually the consequence of checking the actual parameters passed to
-     * the method.
-     */
-    double value(double x);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/UnivariateMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/UnivariateMatrixFunction.java b/src/main/java/org/apache/commons/math3/analysis/UnivariateMatrixFunction.java
deleted file mode 100644
index 0c4b1a9..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/UnivariateMatrixFunction.java
+++ /dev/null
@@ -1,33 +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.analysis;
-
-/**
- * An interface representing a univariate matrix function.
- *
- * @since 2.0
- */
-public interface UnivariateMatrixFunction {
-
-    /**
-     * Compute the value for the function.
-     * @param x the point for which the function value should be computed
-     * @return the value
-     */
-    double[][] value(double x);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/UnivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/UnivariateVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/UnivariateVectorFunction.java
deleted file mode 100644
index 19a9e5d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/UnivariateVectorFunction.java
+++ /dev/null
@@ -1,33 +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.analysis;
-
-/**
- * An interface representing a univariate vectorial function.
- *
- * @since 2.0
- */
-public interface UnivariateVectorFunction {
-
-    /**
-     * Compute the value for the function.
-     * @param x the point for which the function value should be computed
-     * @return the value
-     */
-    double[] value(double x);
-
-}


[17/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java
deleted file mode 100644
index 7945c7c..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Rotation.java
+++ /dev/null
@@ -1,1053 +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.geometry.euclidean.threed;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * This class implements rotations in a three-dimensional space.
- *
- * <p>Rotations can be represented by several different mathematical
- * entities (matrices, axe and angle, Cardan or Euler angles,
- * quaternions). This class presents an higher level abstraction, more
- * user-oriented and hiding this implementation details. Well, for the
- * curious, we use quaternions for the internal representation. The
- * user can build a rotation from any of these representations, and
- * any of these representations can be retrieved from a
- * <code>Rotation</code> instance (see the various constructors and
- * getters). In addition, a rotation can also be built implicitly
- * from a set of vectors and their image.</p>
- * <p>This implies that this class can be used to convert from one
- * representation to another one. For example, converting a rotation
- * matrix into a set of Cardan angles from can be done using the
- * following single line of code:</p>
- * <pre>
- * double[] angles = new Rotation(matrix, 1.0e-10).getAngles(RotationOrder.XYZ);
- * </pre>
- * <p>Focus is oriented on what a rotation <em>do</em> rather than on its
- * underlying representation. Once it has been built, and regardless of its
- * internal representation, a rotation is an <em>operator</em> which basically
- * transforms three dimensional {@link Vector3D vectors} into other three
- * dimensional {@link Vector3D vectors}. Depending on the application, the
- * meaning of these vectors may vary and the semantics of the rotation also.</p>
- * <p>For example in an spacecraft attitude simulation tool, users will often
- * consider the vectors are fixed (say the Earth direction for example) and the
- * frames change. The rotation transforms the coordinates of the vector in inertial
- * frame into the coordinates of the same vector in satellite frame. In this
- * case, the rotation implicitly defines the relation between the two frames.</p>
- * <p>Another example could be a telescope control application, where the rotation
- * would transform the sighting direction at rest into the desired observing
- * direction when the telescope is pointed towards an object of interest. In this
- * case the rotation transforms the direction at rest in a topocentric frame
- * into the sighting direction in the same topocentric frame. This implies in this
- * case the frame is fixed and the vector moves.</p>
- * <p>In many case, both approaches will be combined. In our telescope example,
- * we will probably also need to transform the observing direction in the topocentric
- * frame into the observing direction in inertial frame taking into account the observatory
- * location and the Earth rotation, which would essentially be an application of the
- * first approach.</p>
- *
- * <p>These examples show that a rotation is what the user wants it to be. This
- * class does not push the user towards one specific definition and hence does not
- * provide methods like <code>projectVectorIntoDestinationFrame</code> or
- * <code>computeTransformedDirection</code>. It provides simpler and more generic
- * methods: {@link #applyTo(Vector3D) applyTo(Vector3D)} and {@link
- * #applyInverseTo(Vector3D) applyInverseTo(Vector3D)}.</p>
- *
- * <p>Since a rotation is basically a vectorial operator, several rotations can be
- * composed together and the composite operation <code>r = r<sub>1</sub> o
- * r<sub>2</sub></code> (which means that for each vector <code>u</code>,
- * <code>r(u) = r<sub>1</sub>(r<sub>2</sub>(u))</code>) is also a rotation. Hence
- * we can consider that in addition to vectors, a rotation can be applied to other
- * rotations as well (or to itself). With our previous notations, we would say we
- * can apply <code>r<sub>1</sub></code> to <code>r<sub>2</sub></code> and the result
- * we get is <code>r = r<sub>1</sub> o r<sub>2</sub></code>. For this purpose, the
- * class provides the methods: {@link #applyTo(Rotation) applyTo(Rotation)} and
- * {@link #applyInverseTo(Rotation) applyInverseTo(Rotation)}.</p>
- *
- * <p>Rotations are guaranteed to be immutable objects.</p>
- *
- * @see Vector3D
- * @see RotationOrder
- * @since 1.2
- */
-
-public class Rotation implements Serializable {
-
-  /** Identity rotation. */
-  public static final Rotation IDENTITY = new Rotation(1.0, 0.0, 0.0, 0.0, false);
-
-  /** Serializable version identifier */
-  private static final long serialVersionUID = -2153622329907944313L;
-
-  /** Scalar coordinate of the quaternion. */
-  private final double q0;
-
-  /** First coordinate of the vectorial part of the quaternion. */
-  private final double q1;
-
-  /** Second coordinate of the vectorial part of the quaternion. */
-  private final double q2;
-
-  /** Third coordinate of the vectorial part of the quaternion. */
-  private final double q3;
-
-  /** Build a rotation from the quaternion coordinates.
-   * <p>A rotation can be built from a <em>normalized</em> quaternion,
-   * i.e. a quaternion for which q<sub>0</sub><sup>2</sup> +
-   * q<sub>1</sub><sup>2</sup> + q<sub>2</sub><sup>2</sup> +
-   * q<sub>3</sub><sup>2</sup> = 1. If the quaternion is not normalized,
-   * the constructor can normalize it in a preprocessing step.</p>
-   * <p>Note that some conventions put the scalar part of the quaternion
-   * as the 4<sup>th</sup> component and the vector part as the first three
-   * components. This is <em>not</em> our convention. We put the scalar part
-   * as the first component.</p>
-   * @param q0 scalar part of the quaternion
-   * @param q1 first coordinate of the vectorial part of the quaternion
-   * @param q2 second coordinate of the vectorial part of the quaternion
-   * @param q3 third coordinate of the vectorial part of the quaternion
-   * @param needsNormalization if true, the coordinates are considered
-   * not to be normalized, a normalization preprocessing step is performed
-   * before using them
-   */
-  public Rotation(double q0, double q1, double q2, double q3,
-                  boolean needsNormalization) {
-
-    if (needsNormalization) {
-      // normalization preprocessing
-      double inv = 1.0 / FastMath.sqrt(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3);
-      q0 *= inv;
-      q1 *= inv;
-      q2 *= inv;
-      q3 *= inv;
-    }
-
-    this.q0 = q0;
-    this.q1 = q1;
-    this.q2 = q2;
-    this.q3 = q3;
-
-  }
-
-  /** Build a rotation from an axis and an angle.
-   * <p>We use the convention that angles are oriented according to
-   * the effect of the rotation on vectors around the axis. That means
-   * that if (i, j, k) is a direct frame and if we first provide +k as
-   * the axis and &pi;/2 as the angle to this constructor, and then
-   * {@link #applyTo(Vector3D) apply} the instance to +i, we will get
-   * +j.</p>
-   * <p>Another way to represent our convention is to say that a rotation
-   * of angle &theta; about the unit vector (x, y, z) is the same as the
-   * rotation build from quaternion components { cos(-&theta;/2),
-   * x * sin(-&theta;/2), y * sin(-&theta;/2), z * sin(-&theta;/2) }.
-   * Note the minus sign on the angle!</p>
-   * <p>On the one hand this convention is consistent with a vectorial
-   * perspective (moving vectors in fixed frames), on the other hand it
-   * is different from conventions with a frame perspective (fixed vectors
-   * viewed from different frames) like the ones used for example in spacecraft
-   * attitude community or in the graphics community.</p>
-   * @param axis axis around which to rotate
-   * @param angle rotation angle.
-   * @exception MathIllegalArgumentException if the axis norm is zero
-   */
-  public Rotation(Vector3D axis, double angle) throws MathIllegalArgumentException {
-
-    double norm = axis.getNorm();
-    if (norm == 0) {
-      throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
-    }
-
-    double halfAngle = -0.5 * angle;
-    double coeff = FastMath.sin(halfAngle) / norm;
-
-    q0 = FastMath.cos (halfAngle);
-    q1 = coeff * axis.getX();
-    q2 = coeff * axis.getY();
-    q3 = coeff * axis.getZ();
-
-  }
-
-  /** Build a rotation from a 3X3 matrix.
-
-   * <p>Rotation matrices are orthogonal matrices, i.e. unit matrices
-   * (which are matrices for which m.m<sup>T</sup> = I) with real
-   * coefficients. The module of the determinant of unit matrices is
-   * 1, among the orthogonal 3X3 matrices, only the ones having a
-   * positive determinant (+1) are rotation matrices.</p>
-
-   * <p>When a rotation is defined by a matrix with truncated values
-   * (typically when it is extracted from a technical sheet where only
-   * four to five significant digits are available), the matrix is not
-   * orthogonal anymore. This constructor handles this case
-   * transparently by using a copy of the given matrix and applying a
-   * correction to the copy in order to perfect its orthogonality. If
-   * the Frobenius norm of the correction needed is above the given
-   * threshold, then the matrix is considered to be too far from a
-   * true rotation matrix and an exception is thrown.<p>
-
-   * @param m rotation matrix
-   * @param threshold convergence threshold for the iterative
-   * orthogonality correction (convergence is reached when the
-   * difference between two steps of the Frobenius norm of the
-   * correction is below this threshold)
-
-   * @exception NotARotationMatrixException if the matrix is not a 3X3
-   * matrix, or if it cannot be transformed into an orthogonal matrix
-   * with the given threshold, or if the determinant of the resulting
-   * orthogonal matrix is negative
-
-   */
-  public Rotation(double[][] m, double threshold)
-    throws NotARotationMatrixException {
-
-    // dimension check
-    if ((m.length != 3) || (m[0].length != 3) ||
-        (m[1].length != 3) || (m[2].length != 3)) {
-      throw new NotARotationMatrixException(
-              LocalizedFormats.ROTATION_MATRIX_DIMENSIONS,
-              m.length, m[0].length);
-    }
-
-    // compute a "close" orthogonal matrix
-    double[][] ort = orthogonalizeMatrix(m, threshold);
-
-    // check the sign of the determinant
-    double det = ort[0][0] * (ort[1][1] * ort[2][2] - ort[2][1] * ort[1][2]) -
-                 ort[1][0] * (ort[0][1] * ort[2][2] - ort[2][1] * ort[0][2]) +
-                 ort[2][0] * (ort[0][1] * ort[1][2] - ort[1][1] * ort[0][2]);
-    if (det < 0.0) {
-      throw new NotARotationMatrixException(
-              LocalizedFormats.CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT,
-              det);
-    }
-
-    double[] quat = mat2quat(ort);
-    q0 = quat[0];
-    q1 = quat[1];
-    q2 = quat[2];
-    q3 = quat[3];
-
-  }
-
-  /** Build the rotation that transforms a pair of vector into another pair.
-
-   * <p>Except for possible scale factors, if the instance were applied to
-   * the pair (u<sub>1</sub>, u<sub>2</sub>) it will produce the pair
-   * (v<sub>1</sub>, v<sub>2</sub>).</p>
-
-   * <p>If the angular separation between u<sub>1</sub> and u<sub>2</sub> is
-   * not the same as the angular separation between v<sub>1</sub> and
-   * v<sub>2</sub>, then a corrected v'<sub>2</sub> will be used rather than
-   * v<sub>2</sub>, the corrected vector will be in the (v<sub>1</sub>,
-   * v<sub>2</sub>) plane.</p>
-
-   * @param u1 first vector of the origin pair
-   * @param u2 second vector of the origin pair
-   * @param v1 desired image of u1 by the rotation
-   * @param v2 desired image of u2 by the rotation
-   * @exception MathArithmeticException if the norm of one of the vectors is zero,
-   * or if one of the pair is degenerated (i.e. the vectors of the pair are colinear)
-   */
-  public Rotation(Vector3D u1, Vector3D u2, Vector3D v1, Vector3D v2)
-      throws MathArithmeticException {
-
-      // build orthonormalized base from u1, u2
-      // this fails when vectors are null or colinear, which is forbidden to define a rotation
-      final Vector3D u3 = u1.crossProduct(u2).normalize();
-      u2 = u3.crossProduct(u1).normalize();
-      u1 = u1.normalize();
-
-      // build an orthonormalized base from v1, v2
-      // this fails when vectors are null or colinear, which is forbidden to define a rotation
-      final Vector3D v3 = v1.crossProduct(v2).normalize();
-      v2 = v3.crossProduct(v1).normalize();
-      v1 = v1.normalize();
-
-      // buid a matrix transforming the first base into the second one
-      final double[][] m = new double[][] {
-          {
-              MathArrays.linearCombination(u1.getX(), v1.getX(), u2.getX(), v2.getX(), u3.getX(), v3.getX()),
-              MathArrays.linearCombination(u1.getY(), v1.getX(), u2.getY(), v2.getX(), u3.getY(), v3.getX()),
-              MathArrays.linearCombination(u1.getZ(), v1.getX(), u2.getZ(), v2.getX(), u3.getZ(), v3.getX())
-          },
-          {
-              MathArrays.linearCombination(u1.getX(), v1.getY(), u2.getX(), v2.getY(), u3.getX(), v3.getY()),
-              MathArrays.linearCombination(u1.getY(), v1.getY(), u2.getY(), v2.getY(), u3.getY(), v3.getY()),
-              MathArrays.linearCombination(u1.getZ(), v1.getY(), u2.getZ(), v2.getY(), u3.getZ(), v3.getY())
-          },
-          {
-              MathArrays.linearCombination(u1.getX(), v1.getZ(), u2.getX(), v2.getZ(), u3.getX(), v3.getZ()),
-              MathArrays.linearCombination(u1.getY(), v1.getZ(), u2.getY(), v2.getZ(), u3.getY(), v3.getZ()),
-              MathArrays.linearCombination(u1.getZ(), v1.getZ(), u2.getZ(), v2.getZ(), u3.getZ(), v3.getZ())
-          }
-      };
-
-      double[] quat = mat2quat(m);
-      q0 = quat[0];
-      q1 = quat[1];
-      q2 = quat[2];
-      q3 = quat[3];
-
-  }
-
-  /** Build one of the rotations that transform one vector into another one.
-
-   * <p>Except for a possible scale factor, if the instance were
-   * applied to the vector u it will produce the vector v. There is an
-   * infinite number of such rotations, this constructor choose the
-   * one with the smallest associated angle (i.e. the one whose axis
-   * is orthogonal to the (u, v) plane). If u and v are colinear, an
-   * arbitrary rotation axis is chosen.</p>
-
-   * @param u origin vector
-   * @param v desired image of u by the rotation
-   * @exception MathArithmeticException if the norm of one of the vectors is zero
-   */
-  public Rotation(Vector3D u, Vector3D v) throws MathArithmeticException {
-
-    double normProduct = u.getNorm() * v.getNorm();
-    if (normProduct == 0) {
-        throw new MathArithmeticException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
-    }
-
-    double dot = u.dotProduct(v);
-
-    if (dot < ((2.0e-15 - 1.0) * normProduct)) {
-      // special case u = -v: we select a PI angle rotation around
-      // an arbitrary vector orthogonal to u
-      Vector3D w = u.orthogonal();
-      q0 = 0.0;
-      q1 = -w.getX();
-      q2 = -w.getY();
-      q3 = -w.getZ();
-    } else {
-      // general case: (u, v) defines a plane, we select
-      // the shortest possible rotation: axis orthogonal to this plane
-      q0 = FastMath.sqrt(0.5 * (1.0 + dot / normProduct));
-      double coeff = 1.0 / (2.0 * q0 * normProduct);
-      Vector3D q = v.crossProduct(u);
-      q1 = coeff * q.getX();
-      q2 = coeff * q.getY();
-      q3 = coeff * q.getZ();
-    }
-
-  }
-
-  /** Build a rotation from three Cardan or Euler elementary rotations.
-
-   * <p>Cardan rotations are three successive rotations around the
-   * canonical axes X, Y and Z, each axis being used once. There are
-   * 6 such sets of rotations (XYZ, XZY, YXZ, YZX, ZXY and ZYX). Euler
-   * rotations are three successive rotations around the canonical
-   * axes X, Y and Z, the first and last rotations being around the
-   * same axis. There are 6 such sets of rotations (XYX, XZX, YXY,
-   * YZY, ZXZ and ZYZ), the most popular one being ZXZ.</p>
-   * <p>Beware that many people routinely use the term Euler angles even
-   * for what really are Cardan angles (this confusion is especially
-   * widespread in the aerospace business where Roll, Pitch and Yaw angles
-   * are often wrongly tagged as Euler angles).</p>
-
-   * @param order order of rotations to use
-   * @param alpha1 angle of the first elementary rotation
-   * @param alpha2 angle of the second elementary rotation
-   * @param alpha3 angle of the third elementary rotation
-   */
-  public Rotation(RotationOrder order,
-                  double alpha1, double alpha2, double alpha3) {
-      Rotation r1 = new Rotation(order.getA1(), alpha1);
-      Rotation r2 = new Rotation(order.getA2(), alpha2);
-      Rotation r3 = new Rotation(order.getA3(), alpha3);
-      Rotation composed = r1.applyTo(r2.applyTo(r3));
-      q0 = composed.q0;
-      q1 = composed.q1;
-      q2 = composed.q2;
-      q3 = composed.q3;
-  }
-
-  /** Convert an orthogonal rotation matrix to a quaternion.
-   * @param ort orthogonal rotation matrix
-   * @return quaternion corresponding to the matrix
-   */
-  private static double[] mat2quat(final double[][] ort) {
-
-      final double[] quat = new double[4];
-
-      // There are different ways to compute the quaternions elements
-      // from the matrix. They all involve computing one element from
-      // the diagonal of the matrix, and computing the three other ones
-      // using a formula involving a division by the first element,
-      // which unfortunately can be zero. Since the norm of the
-      // quaternion is 1, we know at least one element has an absolute
-      // value greater or equal to 0.5, so it is always possible to
-      // select the right formula and avoid division by zero and even
-      // numerical inaccuracy. Checking the elements in turn and using
-      // the first one greater than 0.45 is safe (this leads to a simple
-      // test since qi = 0.45 implies 4 qi^2 - 1 = -0.19)
-      double s = ort[0][0] + ort[1][1] + ort[2][2];
-      if (s > -0.19) {
-          // compute q0 and deduce q1, q2 and q3
-          quat[0] = 0.5 * FastMath.sqrt(s + 1.0);
-          double inv = 0.25 / quat[0];
-          quat[1] = inv * (ort[1][2] - ort[2][1]);
-          quat[2] = inv * (ort[2][0] - ort[0][2]);
-          quat[3] = inv * (ort[0][1] - ort[1][0]);
-      } else {
-          s = ort[0][0] - ort[1][1] - ort[2][2];
-          if (s > -0.19) {
-              // compute q1 and deduce q0, q2 and q3
-              quat[1] = 0.5 * FastMath.sqrt(s + 1.0);
-              double inv = 0.25 / quat[1];
-              quat[0] = inv * (ort[1][2] - ort[2][1]);
-              quat[2] = inv * (ort[0][1] + ort[1][0]);
-              quat[3] = inv * (ort[0][2] + ort[2][0]);
-          } else {
-              s = ort[1][1] - ort[0][0] - ort[2][2];
-              if (s > -0.19) {
-                  // compute q2 and deduce q0, q1 and q3
-                  quat[2] = 0.5 * FastMath.sqrt(s + 1.0);
-                  double inv = 0.25 / quat[2];
-                  quat[0] = inv * (ort[2][0] - ort[0][2]);
-                  quat[1] = inv * (ort[0][1] + ort[1][0]);
-                  quat[3] = inv * (ort[2][1] + ort[1][2]);
-              } else {
-                  // compute q3 and deduce q0, q1 and q2
-                  s = ort[2][2] - ort[0][0] - ort[1][1];
-                  quat[3] = 0.5 * FastMath.sqrt(s + 1.0);
-                  double inv = 0.25 / quat[3];
-                  quat[0] = inv * (ort[0][1] - ort[1][0]);
-                  quat[1] = inv * (ort[0][2] + ort[2][0]);
-                  quat[2] = inv * (ort[2][1] + ort[1][2]);
-              }
-          }
-      }
-
-      return quat;
-
-  }
-
-  /** Revert a rotation.
-   * Build a rotation which reverse the effect of another
-   * rotation. This means that if r(u) = v, then r.revert(v) = u. The
-   * instance is not changed.
-   * @return a new rotation whose effect is the reverse of the effect
-   * of the instance
-   */
-  public Rotation revert() {
-    return new Rotation(-q0, q1, q2, q3, false);
-  }
-
-  /** Get the scalar coordinate of the quaternion.
-   * @return scalar coordinate of the quaternion
-   */
-  public double getQ0() {
-    return q0;
-  }
-
-  /** Get the first coordinate of the vectorial part of the quaternion.
-   * @return first coordinate of the vectorial part of the quaternion
-   */
-  public double getQ1() {
-    return q1;
-  }
-
-  /** Get the second coordinate of the vectorial part of the quaternion.
-   * @return second coordinate of the vectorial part of the quaternion
-   */
-  public double getQ2() {
-    return q2;
-  }
-
-  /** Get the third coordinate of the vectorial part of the quaternion.
-   * @return third coordinate of the vectorial part of the quaternion
-   */
-  public double getQ3() {
-    return q3;
-  }
-
-  /** Get the normalized axis of the rotation.
-   * @return normalized axis of the rotation
-   * @see #Rotation(Vector3D, double)
-   */
-  public Vector3D getAxis() {
-    double squaredSine = q1 * q1 + q2 * q2 + q3 * q3;
-    if (squaredSine == 0) {
-      return new Vector3D(1, 0, 0);
-    } else if (q0 < 0) {
-      double inverse = 1 / FastMath.sqrt(squaredSine);
-      return new Vector3D(q1 * inverse, q2 * inverse, q3 * inverse);
-    }
-    double inverse = -1 / FastMath.sqrt(squaredSine);
-    return new Vector3D(q1 * inverse, q2 * inverse, q3 * inverse);
-  }
-
-  /** Get the angle of the rotation.
-   * @return angle of the rotation (between 0 and &pi;)
-   * @see #Rotation(Vector3D, double)
-   */
-  public double getAngle() {
-    if ((q0 < -0.1) || (q0 > 0.1)) {
-      return 2 * FastMath.asin(FastMath.sqrt(q1 * q1 + q2 * q2 + q3 * q3));
-    } else if (q0 < 0) {
-      return 2 * FastMath.acos(-q0);
-    }
-    return 2 * FastMath.acos(q0);
-  }
-
-  /** Get the Cardan or Euler angles corresponding to the instance.
-
-   * <p>The equations show that each rotation can be defined by two
-   * different values of the Cardan or Euler angles set. For example
-   * if Cardan angles are used, the rotation defined by the angles
-   * a<sub>1</sub>, a<sub>2</sub> and a<sub>3</sub> is the same as
-   * the rotation defined by the angles &pi; + a<sub>1</sub>, &pi;
-   * - a<sub>2</sub> and &pi; + a<sub>3</sub>. This method implements
-   * the following arbitrary choices:</p>
-   * <ul>
-   *   <li>for Cardan angles, the chosen set is the one for which the
-   *   second angle is between -&pi;/2 and &pi;/2 (i.e its cosine is
-   *   positive),</li>
-   *   <li>for Euler angles, the chosen set is the one for which the
-   *   second angle is between 0 and &pi; (i.e its sine is positive).</li>
-   * </ul>
-
-   * <p>Cardan and Euler angle have a very disappointing drawback: all
-   * of them have singularities. This means that if the instance is
-   * too close to the singularities corresponding to the given
-   * rotation order, it will be impossible to retrieve the angles. For
-   * Cardan angles, this is often called gimbal lock. There is
-   * <em>nothing</em> to do to prevent this, it is an intrinsic problem
-   * with Cardan and Euler representation (but not a problem with the
-   * rotation itself, which is perfectly well defined). For Cardan
-   * angles, singularities occur when the second angle is close to
-   * -&pi;/2 or +&pi;/2, for Euler angle singularities occur when the
-   * second angle is close to 0 or &pi;, this implies that the identity
-   * rotation is always singular for Euler angles!</p>
-
-   * @param order rotation order to use
-   * @return an array of three angles, in the order specified by the set
-   * @exception CardanEulerSingularityException if the rotation is
-   * singular with respect to the angles set specified
-   */
-  public double[] getAngles(RotationOrder order)
-    throws CardanEulerSingularityException {
-
-    if (order == RotationOrder.XYZ) {
-
-      // r (Vector3D.plusK) coordinates are :
-      //  sin (theta), -cos (theta) sin (phi), cos (theta) cos (phi)
-      // (-r) (Vector3D.plusI) coordinates are :
-      // cos (psi) cos (theta), -sin (psi) cos (theta), sin (theta)
-      // and we can choose to have theta in the interval [-PI/2 ; +PI/2]
-      Vector3D v1 = applyTo(Vector3D.PLUS_K);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);
-      if  ((v2.getZ() < -0.9999999999) || (v2.getZ() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(true);
-      }
-      return new double[] {
-        FastMath.atan2(-(v1.getY()), v1.getZ()),
-        FastMath.asin(v2.getZ()),
-        FastMath.atan2(-(v2.getY()), v2.getX())
-      };
-
-    } else if (order == RotationOrder.XZY) {
-
-      // r (Vector3D.plusJ) coordinates are :
-      // -sin (psi), cos (psi) cos (phi), cos (psi) sin (phi)
-      // (-r) (Vector3D.plusI) coordinates are :
-      // cos (theta) cos (psi), -sin (psi), sin (theta) cos (psi)
-      // and we can choose to have psi in the interval [-PI/2 ; +PI/2]
-      Vector3D v1 = applyTo(Vector3D.PLUS_J);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);
-      if ((v2.getY() < -0.9999999999) || (v2.getY() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(true);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getZ(), v1.getY()),
-       -FastMath.asin(v2.getY()),
-        FastMath.atan2(v2.getZ(), v2.getX())
-      };
-
-    } else if (order == RotationOrder.YXZ) {
-
-      // r (Vector3D.plusK) coordinates are :
-      //  cos (phi) sin (theta), -sin (phi), cos (phi) cos (theta)
-      // (-r) (Vector3D.plusJ) coordinates are :
-      // sin (psi) cos (phi), cos (psi) cos (phi), -sin (phi)
-      // and we can choose to have phi in the interval [-PI/2 ; +PI/2]
-      Vector3D v1 = applyTo(Vector3D.PLUS_K);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);
-      if ((v2.getZ() < -0.9999999999) || (v2.getZ() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(true);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getX(), v1.getZ()),
-       -FastMath.asin(v2.getZ()),
-        FastMath.atan2(v2.getX(), v2.getY())
-      };
-
-    } else if (order == RotationOrder.YZX) {
-
-      // r (Vector3D.plusI) coordinates are :
-      // cos (psi) cos (theta), sin (psi), -cos (psi) sin (theta)
-      // (-r) (Vector3D.plusJ) coordinates are :
-      // sin (psi), cos (phi) cos (psi), -sin (phi) cos (psi)
-      // and we can choose to have psi in the interval [-PI/2 ; +PI/2]
-      Vector3D v1 = applyTo(Vector3D.PLUS_I);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);
-      if ((v2.getX() < -0.9999999999) || (v2.getX() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(true);
-      }
-      return new double[] {
-        FastMath.atan2(-(v1.getZ()), v1.getX()),
-        FastMath.asin(v2.getX()),
-        FastMath.atan2(-(v2.getZ()), v2.getY())
-      };
-
-    } else if (order == RotationOrder.ZXY) {
-
-      // r (Vector3D.plusJ) coordinates are :
-      // -cos (phi) sin (psi), cos (phi) cos (psi), sin (phi)
-      // (-r) (Vector3D.plusK) coordinates are :
-      // -sin (theta) cos (phi), sin (phi), cos (theta) cos (phi)
-      // and we can choose to have phi in the interval [-PI/2 ; +PI/2]
-      Vector3D v1 = applyTo(Vector3D.PLUS_J);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);
-      if ((v2.getY() < -0.9999999999) || (v2.getY() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(true);
-      }
-      return new double[] {
-        FastMath.atan2(-(v1.getX()), v1.getY()),
-        FastMath.asin(v2.getY()),
-        FastMath.atan2(-(v2.getX()), v2.getZ())
-      };
-
-    } else if (order == RotationOrder.ZYX) {
-
-      // r (Vector3D.plusI) coordinates are :
-      //  cos (theta) cos (psi), cos (theta) sin (psi), -sin (theta)
-      // (-r) (Vector3D.plusK) coordinates are :
-      // -sin (theta), sin (phi) cos (theta), cos (phi) cos (theta)
-      // and we can choose to have theta in the interval [-PI/2 ; +PI/2]
-      Vector3D v1 = applyTo(Vector3D.PLUS_I);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);
-      if ((v2.getX() < -0.9999999999) || (v2.getX() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(true);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getY(), v1.getX()),
-       -FastMath.asin(v2.getX()),
-        FastMath.atan2(v2.getY(), v2.getZ())
-      };
-
-    } else if (order == RotationOrder.XYX) {
-
-      // r (Vector3D.plusI) coordinates are :
-      //  cos (theta), sin (phi1) sin (theta), -cos (phi1) sin (theta)
-      // (-r) (Vector3D.plusI) coordinates are :
-      // cos (theta), sin (theta) sin (phi2), sin (theta) cos (phi2)
-      // and we can choose to have theta in the interval [0 ; PI]
-      Vector3D v1 = applyTo(Vector3D.PLUS_I);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);
-      if ((v2.getX() < -0.9999999999) || (v2.getX() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(false);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getY(), -v1.getZ()),
-        FastMath.acos(v2.getX()),
-        FastMath.atan2(v2.getY(), v2.getZ())
-      };
-
-    } else if (order == RotationOrder.XZX) {
-
-      // r (Vector3D.plusI) coordinates are :
-      //  cos (psi), cos (phi1) sin (psi), sin (phi1) sin (psi)
-      // (-r) (Vector3D.plusI) coordinates are :
-      // cos (psi), -sin (psi) cos (phi2), sin (psi) sin (phi2)
-      // and we can choose to have psi in the interval [0 ; PI]
-      Vector3D v1 = applyTo(Vector3D.PLUS_I);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_I);
-      if ((v2.getX() < -0.9999999999) || (v2.getX() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(false);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getZ(), v1.getY()),
-        FastMath.acos(v2.getX()),
-        FastMath.atan2(v2.getZ(), -v2.getY())
-      };
-
-    } else if (order == RotationOrder.YXY) {
-
-      // r (Vector3D.plusJ) coordinates are :
-      //  sin (theta1) sin (phi), cos (phi), cos (theta1) sin (phi)
-      // (-r) (Vector3D.plusJ) coordinates are :
-      // sin (phi) sin (theta2), cos (phi), -sin (phi) cos (theta2)
-      // and we can choose to have phi in the interval [0 ; PI]
-      Vector3D v1 = applyTo(Vector3D.PLUS_J);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);
-      if ((v2.getY() < -0.9999999999) || (v2.getY() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(false);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getX(), v1.getZ()),
-        FastMath.acos(v2.getY()),
-        FastMath.atan2(v2.getX(), -v2.getZ())
-      };
-
-    } else if (order == RotationOrder.YZY) {
-
-      // r (Vector3D.plusJ) coordinates are :
-      //  -cos (theta1) sin (psi), cos (psi), sin (theta1) sin (psi)
-      // (-r) (Vector3D.plusJ) coordinates are :
-      // sin (psi) cos (theta2), cos (psi), sin (psi) sin (theta2)
-      // and we can choose to have psi in the interval [0 ; PI]
-      Vector3D v1 = applyTo(Vector3D.PLUS_J);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_J);
-      if ((v2.getY() < -0.9999999999) || (v2.getY() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(false);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getZ(), -v1.getX()),
-        FastMath.acos(v2.getY()),
-        FastMath.atan2(v2.getZ(), v2.getX())
-      };
-
-    } else if (order == RotationOrder.ZXZ) {
-
-      // r (Vector3D.plusK) coordinates are :
-      //  sin (psi1) sin (phi), -cos (psi1) sin (phi), cos (phi)
-      // (-r) (Vector3D.plusK) coordinates are :
-      // sin (phi) sin (psi2), sin (phi) cos (psi2), cos (phi)
-      // and we can choose to have phi in the interval [0 ; PI]
-      Vector3D v1 = applyTo(Vector3D.PLUS_K);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);
-      if ((v2.getZ() < -0.9999999999) || (v2.getZ() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(false);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getX(), -v1.getY()),
-        FastMath.acos(v2.getZ()),
-        FastMath.atan2(v2.getX(), v2.getY())
-      };
-
-    } else { // last possibility is ZYZ
-
-      // r (Vector3D.plusK) coordinates are :
-      //  cos (psi1) sin (theta), sin (psi1) sin (theta), cos (theta)
-      // (-r) (Vector3D.plusK) coordinates are :
-      // -sin (theta) cos (psi2), sin (theta) sin (psi2), cos (theta)
-      // and we can choose to have theta in the interval [0 ; PI]
-      Vector3D v1 = applyTo(Vector3D.PLUS_K);
-      Vector3D v2 = applyInverseTo(Vector3D.PLUS_K);
-      if ((v2.getZ() < -0.9999999999) || (v2.getZ() > 0.9999999999)) {
-        throw new CardanEulerSingularityException(false);
-      }
-      return new double[] {
-        FastMath.atan2(v1.getY(), v1.getX()),
-        FastMath.acos(v2.getZ()),
-        FastMath.atan2(v2.getY(), -v2.getX())
-      };
-
-    }
-
-  }
-
-  /** Get the 3X3 matrix corresponding to the instance
-   * @return the matrix corresponding to the instance
-   */
-  public double[][] getMatrix() {
-
-    // products
-    double q0q0  = q0 * q0;
-    double q0q1  = q0 * q1;
-    double q0q2  = q0 * q2;
-    double q0q3  = q0 * q3;
-    double q1q1  = q1 * q1;
-    double q1q2  = q1 * q2;
-    double q1q3  = q1 * q3;
-    double q2q2  = q2 * q2;
-    double q2q3  = q2 * q3;
-    double q3q3  = q3 * q3;
-
-    // create the matrix
-    double[][] m = new double[3][];
-    m[0] = new double[3];
-    m[1] = new double[3];
-    m[2] = new double[3];
-
-    m [0][0] = 2.0 * (q0q0 + q1q1) - 1.0;
-    m [1][0] = 2.0 * (q1q2 - q0q3);
-    m [2][0] = 2.0 * (q1q3 + q0q2);
-
-    m [0][1] = 2.0 * (q1q2 + q0q3);
-    m [1][1] = 2.0 * (q0q0 + q2q2) - 1.0;
-    m [2][1] = 2.0 * (q2q3 - q0q1);
-
-    m [0][2] = 2.0 * (q1q3 - q0q2);
-    m [1][2] = 2.0 * (q2q3 + q0q1);
-    m [2][2] = 2.0 * (q0q0 + q3q3) - 1.0;
-
-    return m;
-
-  }
-
-  /** Apply the rotation to a vector.
-   * @param u vector to apply the rotation to
-   * @return a new vector which is the image of u by the rotation
-   */
-  public Vector3D applyTo(Vector3D u) {
-
-    double x = u.getX();
-    double y = u.getY();
-    double z = u.getZ();
-
-    double s = q1 * x + q2 * y + q3 * z;
-
-    return new Vector3D(2 * (q0 * (x * q0 - (q2 * z - q3 * y)) + s * q1) - x,
-                        2 * (q0 * (y * q0 - (q3 * x - q1 * z)) + s * q2) - y,
-                        2 * (q0 * (z * q0 - (q1 * y - q2 * x)) + s * q3) - z);
-
-  }
-
-  /** Apply the rotation to a vector stored in an array.
-   * @param in an array with three items which stores vector to rotate
-   * @param out an array with three items to put result to (it can be the same
-   * array as in)
-   */
-  public void applyTo(final double[] in, final double[] out) {
-
-      final double x = in[0];
-      final double y = in[1];
-      final double z = in[2];
-
-      final double s = q1 * x + q2 * y + q3 * z;
-
-      out[0] = 2 * (q0 * (x * q0 - (q2 * z - q3 * y)) + s * q1) - x;
-      out[1] = 2 * (q0 * (y * q0 - (q3 * x - q1 * z)) + s * q2) - y;
-      out[2] = 2 * (q0 * (z * q0 - (q1 * y - q2 * x)) + s * q3) - z;
-
-  }
-
-  /** Apply the inverse of the rotation to a vector.
-   * @param u vector to apply the inverse of the rotation to
-   * @return a new vector which such that u is its image by the rotation
-   */
-  public Vector3D applyInverseTo(Vector3D u) {
-
-    double x = u.getX();
-    double y = u.getY();
-    double z = u.getZ();
-
-    double s = q1 * x + q2 * y + q3 * z;
-    double m0 = -q0;
-
-    return new Vector3D(2 * (m0 * (x * m0 - (q2 * z - q3 * y)) + s * q1) - x,
-                        2 * (m0 * (y * m0 - (q3 * x - q1 * z)) + s * q2) - y,
-                        2 * (m0 * (z * m0 - (q1 * y - q2 * x)) + s * q3) - z);
-
-  }
-
-  /** Apply the inverse of the rotation to a vector stored in an array.
-   * @param in an array with three items which stores vector to rotate
-   * @param out an array with three items to put result to (it can be the same
-   * array as in)
-   */
-  public void applyInverseTo(final double[] in, final double[] out) {
-
-      final double x = in[0];
-      final double y = in[1];
-      final double z = in[2];
-
-      final double s = q1 * x + q2 * y + q3 * z;
-      final double m0 = -q0;
-
-      out[0] = 2 * (m0 * (x * m0 - (q2 * z - q3 * y)) + s * q1) - x;
-      out[1] = 2 * (m0 * (y * m0 - (q3 * x - q1 * z)) + s * q2) - y;
-      out[2] = 2 * (m0 * (z * m0 - (q1 * y - q2 * x)) + s * q3) - z;
-
-  }
-
-  /** Apply the instance to another rotation.
-   * Applying the instance to a rotation is computing the composition
-   * in an order compliant with the following rule : let u be any
-   * vector and v its image by r (i.e. r.applyTo(u) = v), let w be the image
-   * of v by the instance (i.e. applyTo(v) = w), then w = comp.applyTo(u),
-   * where comp = applyTo(r).
-   * @param r rotation to apply the rotation to
-   * @return a new rotation which is the composition of r by the instance
-   */
-  public Rotation applyTo(Rotation r) {
-    return new Rotation(r.q0 * q0 - (r.q1 * q1 + r.q2 * q2 + r.q3 * q3),
-                        r.q1 * q0 + r.q0 * q1 + (r.q2 * q3 - r.q3 * q2),
-                        r.q2 * q0 + r.q0 * q2 + (r.q3 * q1 - r.q1 * q3),
-                        r.q3 * q0 + r.q0 * q3 + (r.q1 * q2 - r.q2 * q1),
-                        false);
-  }
-
-  /** Apply the inverse of the instance to another rotation.
-   * Applying the inverse of the instance to a rotation is computing
-   * the composition in an order compliant with the following rule :
-   * let u be any vector and v its image by r (i.e. r.applyTo(u) = v),
-   * let w be the inverse image of v by the instance
-   * (i.e. applyInverseTo(v) = w), then w = comp.applyTo(u), where
-   * comp = applyInverseTo(r).
-   * @param r rotation to apply the rotation to
-   * @return a new rotation which is the composition of r by the inverse
-   * of the instance
-   */
-  public Rotation applyInverseTo(Rotation r) {
-    return new Rotation(-r.q0 * q0 - (r.q1 * q1 + r.q2 * q2 + r.q3 * q3),
-                        -r.q1 * q0 + r.q0 * q1 + (r.q2 * q3 - r.q3 * q2),
-                        -r.q2 * q0 + r.q0 * q2 + (r.q3 * q1 - r.q1 * q3),
-                        -r.q3 * q0 + r.q0 * q3 + (r.q1 * q2 - r.q2 * q1),
-                        false);
-  }
-
-  /** Perfect orthogonality on a 3X3 matrix.
-   * @param m initial matrix (not exactly orthogonal)
-   * @param threshold convergence threshold for the iterative
-   * orthogonality correction (convergence is reached when the
-   * difference between two steps of the Frobenius norm of the
-   * correction is below this threshold)
-   * @return an orthogonal matrix close to m
-   * @exception NotARotationMatrixException if the matrix cannot be
-   * orthogonalized with the given threshold after 10 iterations
-   */
-  private double[][] orthogonalizeMatrix(double[][] m, double threshold)
-    throws NotARotationMatrixException {
-    double[] m0 = m[0];
-    double[] m1 = m[1];
-    double[] m2 = m[2];
-    double x00 = m0[0];
-    double x01 = m0[1];
-    double x02 = m0[2];
-    double x10 = m1[0];
-    double x11 = m1[1];
-    double x12 = m1[2];
-    double x20 = m2[0];
-    double x21 = m2[1];
-    double x22 = m2[2];
-    double fn = 0;
-    double fn1;
-
-    double[][] o = new double[3][3];
-    double[] o0 = o[0];
-    double[] o1 = o[1];
-    double[] o2 = o[2];
-
-    // iterative correction: Xn+1 = Xn - 0.5 * (Xn.Mt.Xn - M)
-    int i = 0;
-    while (++i < 11) {
-
-      // Mt.Xn
-      double mx00 = m0[0] * x00 + m1[0] * x10 + m2[0] * x20;
-      double mx10 = m0[1] * x00 + m1[1] * x10 + m2[1] * x20;
-      double mx20 = m0[2] * x00 + m1[2] * x10 + m2[2] * x20;
-      double mx01 = m0[0] * x01 + m1[0] * x11 + m2[0] * x21;
-      double mx11 = m0[1] * x01 + m1[1] * x11 + m2[1] * x21;
-      double mx21 = m0[2] * x01 + m1[2] * x11 + m2[2] * x21;
-      double mx02 = m0[0] * x02 + m1[0] * x12 + m2[0] * x22;
-      double mx12 = m0[1] * x02 + m1[1] * x12 + m2[1] * x22;
-      double mx22 = m0[2] * x02 + m1[2] * x12 + m2[2] * x22;
-
-      // Xn+1
-      o0[0] = x00 - 0.5 * (x00 * mx00 + x01 * mx10 + x02 * mx20 - m0[0]);
-      o0[1] = x01 - 0.5 * (x00 * mx01 + x01 * mx11 + x02 * mx21 - m0[1]);
-      o0[2] = x02 - 0.5 * (x00 * mx02 + x01 * mx12 + x02 * mx22 - m0[2]);
-      o1[0] = x10 - 0.5 * (x10 * mx00 + x11 * mx10 + x12 * mx20 - m1[0]);
-      o1[1] = x11 - 0.5 * (x10 * mx01 + x11 * mx11 + x12 * mx21 - m1[1]);
-      o1[2] = x12 - 0.5 * (x10 * mx02 + x11 * mx12 + x12 * mx22 - m1[2]);
-      o2[0] = x20 - 0.5 * (x20 * mx00 + x21 * mx10 + x22 * mx20 - m2[0]);
-      o2[1] = x21 - 0.5 * (x20 * mx01 + x21 * mx11 + x22 * mx21 - m2[1]);
-      o2[2] = x22 - 0.5 * (x20 * mx02 + x21 * mx12 + x22 * mx22 - m2[2]);
-
-      // correction on each elements
-      double corr00 = o0[0] - m0[0];
-      double corr01 = o0[1] - m0[1];
-      double corr02 = o0[2] - m0[2];
-      double corr10 = o1[0] - m1[0];
-      double corr11 = o1[1] - m1[1];
-      double corr12 = o1[2] - m1[2];
-      double corr20 = o2[0] - m2[0];
-      double corr21 = o2[1] - m2[1];
-      double corr22 = o2[2] - m2[2];
-
-      // Frobenius norm of the correction
-      fn1 = corr00 * corr00 + corr01 * corr01 + corr02 * corr02 +
-            corr10 * corr10 + corr11 * corr11 + corr12 * corr12 +
-            corr20 * corr20 + corr21 * corr21 + corr22 * corr22;
-
-      // convergence test
-      if (FastMath.abs(fn1 - fn) <= threshold) {
-          return o;
-      }
-
-      // prepare next iteration
-      x00 = o0[0];
-      x01 = o0[1];
-      x02 = o0[2];
-      x10 = o1[0];
-      x11 = o1[1];
-      x12 = o1[2];
-      x20 = o2[0];
-      x21 = o2[1];
-      x22 = o2[2];
-      fn  = fn1;
-
-    }
-
-    // the algorithm did not converge after 10 iterations
-    throw new NotARotationMatrixException(
-            LocalizedFormats.UNABLE_TO_ORTHOGONOLIZE_MATRIX,
-            i - 1);
-  }
-
-  /** Compute the <i>distance</i> between two rotations.
-   * <p>The <i>distance</i> is intended here as a way to check if two
-   * rotations are almost similar (i.e. they transform vectors the same way)
-   * or very different. It is mathematically defined as the angle of
-   * the rotation r that prepended to one of the rotations gives the other
-   * one:</p>
-   * <pre>
-   *        r<sub>1</sub>(r) = r<sub>2</sub>
-   * </pre>
-   * <p>This distance is an angle between 0 and &pi;. Its value is the smallest
-   * possible upper bound of the angle in radians between r<sub>1</sub>(v)
-   * and r<sub>2</sub>(v) for all possible vectors v. This upper bound is
-   * reached for some v. The distance is equal to 0 if and only if the two
-   * rotations are identical.</p>
-   * <p>Comparing two rotations should always be done using this value rather
-   * than for example comparing the components of the quaternions. It is much
-   * more stable, and has a geometric meaning. Also comparing quaternions
-   * components is error prone since for example quaternions (0.36, 0.48, -0.48, -0.64)
-   * and (-0.36, -0.48, 0.48, 0.64) represent exactly the same rotation despite
-   * their components are different (they are exact opposites).</p>
-   * @param r1 first rotation
-   * @param r2 second rotation
-   * @return <i>distance</i> between r1 and r2
-   */
-  public static double distance(Rotation r1, Rotation r2) {
-      return r1.applyInverseTo(r2).getAngle();
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationOrder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationOrder.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationOrder.java
deleted file mode 100644
index 03bc1c2..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/RotationOrder.java
+++ /dev/null
@@ -1,174 +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.geometry.euclidean.threed;
-
-/**
- * This class is a utility representing a rotation order specification
- * for Cardan or Euler angles specification.
- *
- * This class cannot be instanciated by the user. He can only use one
- * of the twelve predefined supported orders as an argument to either
- * the {@link Rotation#Rotation(RotationOrder,double,double,double)}
- * constructor or the {@link Rotation#getAngles} method.
- *
- * @since 1.2
- */
-public final class RotationOrder {
-
-    /** Set of Cardan angles.
-     * this ordered set of rotations is around X, then around Y, then
-     * around Z
-     */
-    public static final RotationOrder XYZ =
-      new RotationOrder("XYZ", Vector3D.PLUS_I, Vector3D.PLUS_J, Vector3D.PLUS_K);
-
-    /** Set of Cardan angles.
-     * this ordered set of rotations is around X, then around Z, then
-     * around Y
-     */
-    public static final RotationOrder XZY =
-      new RotationOrder("XZY", Vector3D.PLUS_I, Vector3D.PLUS_K, Vector3D.PLUS_J);
-
-    /** Set of Cardan angles.
-     * this ordered set of rotations is around Y, then around X, then
-     * around Z
-     */
-    public static final RotationOrder YXZ =
-      new RotationOrder("YXZ", Vector3D.PLUS_J, Vector3D.PLUS_I, Vector3D.PLUS_K);
-
-    /** Set of Cardan angles.
-     * this ordered set of rotations is around Y, then around Z, then
-     * around X
-     */
-    public static final RotationOrder YZX =
-      new RotationOrder("YZX", Vector3D.PLUS_J, Vector3D.PLUS_K, Vector3D.PLUS_I);
-
-    /** Set of Cardan angles.
-     * this ordered set of rotations is around Z, then around X, then
-     * around Y
-     */
-    public static final RotationOrder ZXY =
-      new RotationOrder("ZXY", Vector3D.PLUS_K, Vector3D.PLUS_I, Vector3D.PLUS_J);
-
-    /** Set of Cardan angles.
-     * this ordered set of rotations is around Z, then around Y, then
-     * around X
-     */
-    public static final RotationOrder ZYX =
-      new RotationOrder("ZYX", Vector3D.PLUS_K, Vector3D.PLUS_J, Vector3D.PLUS_I);
-
-    /** Set of Euler angles.
-     * this ordered set of rotations is around X, then around Y, then
-     * around X
-     */
-    public static final RotationOrder XYX =
-      new RotationOrder("XYX", Vector3D.PLUS_I, Vector3D.PLUS_J, Vector3D.PLUS_I);
-
-    /** Set of Euler angles.
-     * this ordered set of rotations is around X, then around Z, then
-     * around X
-     */
-    public static final RotationOrder XZX =
-      new RotationOrder("XZX", Vector3D.PLUS_I, Vector3D.PLUS_K, Vector3D.PLUS_I);
-
-    /** Set of Euler angles.
-     * this ordered set of rotations is around Y, then around X, then
-     * around Y
-     */
-    public static final RotationOrder YXY =
-      new RotationOrder("YXY", Vector3D.PLUS_J, Vector3D.PLUS_I, Vector3D.PLUS_J);
-
-    /** Set of Euler angles.
-     * this ordered set of rotations is around Y, then around Z, then
-     * around Y
-     */
-    public static final RotationOrder YZY =
-      new RotationOrder("YZY", Vector3D.PLUS_J, Vector3D.PLUS_K, Vector3D.PLUS_J);
-
-    /** Set of Euler angles.
-     * this ordered set of rotations is around Z, then around X, then
-     * around Z
-     */
-    public static final RotationOrder ZXZ =
-      new RotationOrder("ZXZ", Vector3D.PLUS_K, Vector3D.PLUS_I, Vector3D.PLUS_K);
-
-    /** Set of Euler angles.
-     * this ordered set of rotations is around Z, then around Y, then
-     * around Z
-     */
-    public static final RotationOrder ZYZ =
-      new RotationOrder("ZYZ", Vector3D.PLUS_K, Vector3D.PLUS_J, Vector3D.PLUS_K);
-
-    /** Name of the rotations order. */
-    private final String name;
-
-    /** Axis of the first rotation. */
-    private final Vector3D a1;
-
-    /** Axis of the second rotation. */
-    private final Vector3D a2;
-
-    /** Axis of the third rotation. */
-    private final Vector3D a3;
-
-    /** Private constructor.
-     * This is a utility class that cannot be instantiated by the user,
-     * so its only constructor is private.
-     * @param name name of the rotation order
-     * @param a1 axis of the first rotation
-     * @param a2 axis of the second rotation
-     * @param a3 axis of the third rotation
-     */
-    private RotationOrder(final String name,
-                          final Vector3D a1, final Vector3D a2, final Vector3D a3) {
-        this.name = name;
-        this.a1   = a1;
-        this.a2   = a2;
-        this.a3   = a3;
-    }
-
-    /** Get a string representation of the instance.
-     * @return a string representation of the instance (in fact, its name)
-     */
-    @Override
-    public String toString() {
-        return name;
-    }
-
-    /** Get the axis of the first rotation.
-     * @return axis of the first rotation
-     */
-    public Vector3D getA1() {
-        return a1;
-    }
-
-    /** Get the axis of the second rotation.
-     * @return axis of the second rotation
-     */
-    public Vector3D getA2() {
-        return a2;
-    }
-
-    /** Get the axis of the second rotation.
-     * @return axis of the second rotation
-     */
-    public Vector3D getA3() {
-        return a3;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Segment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Segment.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Segment.java
deleted file mode 100644
index 200b462..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Segment.java
+++ /dev/null
@@ -1,66 +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.geometry.euclidean.threed;
-
-
-/** Simple container for a two-points segment.
- * @since 3.0
- */
-public class Segment {
-
-    /** Start point of the segment. */
-    private final Vector3D start;
-
-    /** End point of the segments. */
-    private final Vector3D end;
-
-    /** Line containing the segment. */
-    private final Line     line;
-
-    /** Build a segment.
-     * @param start start point of the segment
-     * @param end end point of the segment
-     * @param line line containing the segment
-     */
-    public Segment(final Vector3D start, final Vector3D end, final Line line) {
-        this.start  = start;
-        this.end    = end;
-        this.line   = line;
-    }
-
-    /** Get the start point of the segment.
-     * @return start point of the segment
-     */
-    public Vector3D getStart() {
-        return start;
-    }
-
-    /** Get the end point of the segment.
-     * @return end point of the segment
-     */
-    public Vector3D getEnd() {
-        return end;
-    }
-
-    /** Get the line containing the segment.
-     * @return line containing the segment
-     */
-    public Line getLine() {
-        return line;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGenerator.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGenerator.java
deleted file mode 100644
index b553510..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphereGenerator.java
+++ /dev/null
@@ -1,152 +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.geometry.euclidean.threed;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.enclosing.SupportBallGenerator;
-import org.apache.commons.math3.geometry.euclidean.twod.DiskGenerator;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
-
-/** Class generating an enclosing ball from its support points.
- * @since 3.3
- */
-public class SphereGenerator implements SupportBallGenerator<Euclidean3D, Vector3D> {
-
-    /** {@inheritDoc} */
-    public EnclosingBall<Euclidean3D, Vector3D> ballOnSupport(final List<Vector3D> support) {
-
-        if (support.size() < 1) {
-            return new EnclosingBall<Euclidean3D, Vector3D>(Vector3D.ZERO, Double.NEGATIVE_INFINITY);
-        } else {
-            final Vector3D vA = support.get(0);
-            if (support.size() < 2) {
-                return new EnclosingBall<Euclidean3D, Vector3D>(vA, 0, vA);
-            } else {
-                final Vector3D vB = support.get(1);
-                if (support.size() < 3) {
-                    return new EnclosingBall<Euclidean3D, Vector3D>(new Vector3D(0.5, vA, 0.5, vB),
-                                                                    0.5 * vA.distance(vB),
-                                                                    vA, vB);
-                } else {
-                    final Vector3D vC = support.get(2);
-                    if (support.size() < 4) {
-
-                        // delegate to 2D disk generator
-                        final Plane p = new Plane(vA, vB, vC,
-                                                  1.0e-10 * (vA.getNorm1() + vB.getNorm1() + vC.getNorm1()));
-                        final EnclosingBall<Euclidean2D, Vector2D> disk =
-                                new DiskGenerator().ballOnSupport(Arrays.asList(p.toSubSpace(vA),
-                                                                                p.toSubSpace(vB),
-                                                                                p.toSubSpace(vC)));
-
-                        // convert back to 3D
-                        return new EnclosingBall<Euclidean3D, Vector3D>(p.toSpace(disk.getCenter()),
-                                                                        disk.getRadius(), vA, vB, vC);
-
-                    } else {
-                        final Vector3D vD = support.get(3);
-                        // a sphere is 3D can be defined as:
-                        // (1)   (x - x_0)^2 + (y - y_0)^2 + (z - z_0)^2 = r^2
-                        // which can be written:
-                        // (2)   (x^2 + y^2 + z^2) - 2 x_0 x - 2 y_0 y - 2 z_0 z + (x_0^2 + y_0^2 + z_0^2 - r^2) = 0
-                        // or simply:
-                        // (3)   (x^2 + y^2 + z^2) + a x + b y + c z + d = 0
-                        // with sphere center coordinates -a/2, -b/2, -c/2
-                        // If the sphere exists, a b, c and d are a non zero solution to
-                        // [ (x^2  + y^2  + z^2)    x    y   z    1 ]   [ 1 ]   [ 0 ]
-                        // [ (xA^2 + yA^2 + zA^2)   xA   yA  zA   1 ]   [ a ]   [ 0 ]
-                        // [ (xB^2 + yB^2 + zB^2)   xB   yB  zB   1 ] * [ b ] = [ 0 ]
-                        // [ (xC^2 + yC^2 + zC^2)   xC   yC  zC   1 ]   [ c ]   [ 0 ]
-                        // [ (xD^2 + yD^2 + zD^2)   xD   yD  zD   1 ]   [ d ]   [ 0 ]
-                        // So the determinant of the matrix is zero. Computing this determinant
-                        // by expanding it using the minors m_ij of first row leads to
-                        // (4)   m_11 (x^2 + y^2 + z^2) - m_12 x + m_13 y - m_14 z + m_15 = 0
-                        // So by identifying equations (2) and (4) we get the coordinates
-                        // of center as:
-                        //      x_0 = +m_12 / (2 m_11)
-                        //      y_0 = -m_13 / (2 m_11)
-                        //      z_0 = +m_14 / (2 m_11)
-                        // Note that the minors m_11, m_12, m_13 and m_14 all have the last column
-                        // filled with 1.0, hence simplifying the computation
-                        final BigFraction[] c2 = new BigFraction[] {
-                            new BigFraction(vA.getX()), new BigFraction(vB.getX()),
-                            new BigFraction(vC.getX()), new BigFraction(vD.getX())
-                        };
-                        final BigFraction[] c3 = new BigFraction[] {
-                            new BigFraction(vA.getY()), new BigFraction(vB.getY()),
-                            new BigFraction(vC.getY()), new BigFraction(vD.getY())
-                        };
-                        final BigFraction[] c4 = new BigFraction[] {
-                            new BigFraction(vA.getZ()), new BigFraction(vB.getZ()),
-                            new BigFraction(vC.getZ()), new BigFraction(vD.getZ())
-                        };
-                        final BigFraction[] c1 = new BigFraction[] {
-                            c2[0].multiply(c2[0]).add(c3[0].multiply(c3[0])).add(c4[0].multiply(c4[0])),
-                            c2[1].multiply(c2[1]).add(c3[1].multiply(c3[1])).add(c4[1].multiply(c4[1])),
-                            c2[2].multiply(c2[2]).add(c3[2].multiply(c3[2])).add(c4[2].multiply(c4[2])),
-                            c2[3].multiply(c2[3]).add(c3[3].multiply(c3[3])).add(c4[3].multiply(c4[3]))
-                        };
-                        final BigFraction twoM11  = minor(c2, c3, c4).multiply(2);
-                        final BigFraction m12     = minor(c1, c3, c4);
-                        final BigFraction m13     = minor(c1, c2, c4);
-                        final BigFraction m14     = minor(c1, c2, c3);
-                        final BigFraction centerX = m12.divide(twoM11);
-                        final BigFraction centerY = m13.divide(twoM11).negate();
-                        final BigFraction centerZ = m14.divide(twoM11);
-                        final BigFraction dx      = c2[0].subtract(centerX);
-                        final BigFraction dy      = c3[0].subtract(centerY);
-                        final BigFraction dz      = c4[0].subtract(centerZ);
-                        final BigFraction r2      = dx.multiply(dx).add(dy.multiply(dy)).add(dz.multiply(dz));
-                        return new EnclosingBall<Euclidean3D, Vector3D>(new Vector3D(centerX.doubleValue(),
-                                                                                     centerY.doubleValue(),
-                                                                                     centerZ.doubleValue()),
-                                                                        FastMath.sqrt(r2.doubleValue()),
-                                                                        vA, vB, vC, vD);
-                    }
-                }
-            }
-        }
-    }
-
-    /** Compute a dimension 4 minor, when 4<sup>th</sup> column is known to be filled with 1.0.
-     * @param c1 first column
-     * @param c2 second column
-     * @param c3 third column
-     * @return value of the minor computed has an exact fraction
-     */
-    private BigFraction minor(final BigFraction[] c1, final BigFraction[] c2, final BigFraction[] c3) {
-        return      c2[0].multiply(c3[1]).multiply(c1[2].subtract(c1[3])).
-                add(c2[0].multiply(c3[2]).multiply(c1[3].subtract(c1[1]))).
-                add(c2[0].multiply(c3[3]).multiply(c1[1].subtract(c1[2]))).
-                add(c2[1].multiply(c3[0]).multiply(c1[3].subtract(c1[2]))).
-                add(c2[1].multiply(c3[2]).multiply(c1[0].subtract(c1[3]))).
-                add(c2[1].multiply(c3[3]).multiply(c1[2].subtract(c1[0]))).
-                add(c2[2].multiply(c3[0]).multiply(c1[1].subtract(c1[3]))).
-                add(c2[2].multiply(c3[1]).multiply(c1[3].subtract(c1[0]))).
-                add(c2[2].multiply(c3[3]).multiply(c1[0].subtract(c1[1]))).
-                add(c2[3].multiply(c3[0]).multiply(c1[2].subtract(c1[1]))).
-                add(c2[3].multiply(c3[1]).multiply(c1[0].subtract(c1[2]))).
-                add(c2[3].multiply(c3[2]).multiply(c1[1].subtract(c1[0])));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinates.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinates.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinates.java
deleted file mode 100644
index 23d818e..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SphericalCoordinates.java
+++ /dev/null
@@ -1,395 +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.geometry.euclidean.threed;
-
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.util.FastMath;
-
-/** This class provides conversions related to <a
- * href="http://mathworld.wolfram.com/SphericalCoordinates.html">spherical coordinates</a>.
- * <p>
- * The conventions used here are the mathematical ones, i.e. spherical coordinates are
- * related to Cartesian coordinates as follows:
- * </p>
- * <ul>
- *   <li>x = r cos(&theta;) sin(&Phi;)</li>
- *   <li>y = r sin(&theta;) sin(&Phi;)</li>
- *   <li>z = r cos(&Phi;)</li>
- * </ul>
- * <ul>
- *   <li>r       = &radic;(x<sup>2</sup>+y<sup>2</sup>+z<sup>2</sup>)</li>
- *   <li>&theta; = atan2(y, x)</li>
- *   <li>&Phi;   = acos(z/r)</li>
- * </ul>
- * <p>
- * r is the radius, &theta; is the azimuthal angle in the x-y plane and &Phi; is the polar
- * (co-latitude) angle. These conventions are <em>different</em> from the conventions used
- * in physics (and in particular in spherical harmonics) where the meanings of &theta; and
- * &Phi; are reversed.
- * </p>
- * <p>
- * This class provides conversion of coordinates and also of gradient and Hessian
- * between spherical and Cartesian coordinates.
- * </p>
- * @since 3.2
- */
-public class SphericalCoordinates implements Serializable {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20130206L;
-
-    /** Cartesian coordinates. */
-    private final Vector3D v;
-
-    /** Radius. */
-    private final double r;
-
-    /** Azimuthal angle in the x-y plane &theta;. */
-    private final double theta;
-
-    /** Polar angle (co-latitude) &Phi;. */
-    private final double phi;
-
-    /** Jacobian of (r, &theta; &Phi). */
-    private double[][] jacobian;
-
-    /** Hessian of radius. */
-    private double[][] rHessian;
-
-    /** Hessian of azimuthal angle in the x-y plane &theta;. */
-    private double[][] thetaHessian;
-
-    /** Hessian of polar (co-latitude) angle &Phi;. */
-    private double[][] phiHessian;
-
-    /** Build a spherical coordinates transformer from Cartesian coordinates.
-     * @param v Cartesian coordinates
-     */
-    public SphericalCoordinates(final Vector3D v) {
-
-        // Cartesian coordinates
-        this.v = v;
-
-        // remaining spherical coordinates
-        this.r     = v.getNorm();
-        this.theta = v.getAlpha();
-        this.phi   = FastMath.acos(v.getZ() / r);
-
-    }
-
-    /** Build a spherical coordinates transformer from spherical coordinates.
-     * @param r radius
-     * @param theta azimuthal angle in x-y plane
-     * @param phi polar (co-latitude) angle
-     */
-    public SphericalCoordinates(final double r, final double theta, final double phi) {
-
-        final double cosTheta = FastMath.cos(theta);
-        final double sinTheta = FastMath.sin(theta);
-        final double cosPhi   = FastMath.cos(phi);
-        final double sinPhi   = FastMath.sin(phi);
-
-        // spherical coordinates
-        this.r     = r;
-        this.theta = theta;
-        this.phi   = phi;
-
-        // Cartesian coordinates
-        this.v  = new Vector3D(r * cosTheta * sinPhi,
-                               r * sinTheta * sinPhi,
-                               r * cosPhi);
-
-    }
-
-    /** Get the Cartesian coordinates.
-     * @return Cartesian coordinates
-     */
-    public Vector3D getCartesian() {
-        return v;
-    }
-
-    /** Get the radius.
-     * @return radius r
-     * @see #getTheta()
-     * @see #getPhi()
-     */
-    public double getR() {
-        return r;
-    }
-
-    /** Get the azimuthal angle in x-y plane.
-     * @return azimuthal angle in x-y plane &theta;
-     * @see #getR()
-     * @see #getPhi()
-     */
-    public double getTheta() {
-        return theta;
-    }
-
-    /** Get the polar (co-latitude) angle.
-     * @return polar (co-latitude) angle &Phi;
-     * @see #getR()
-     * @see #getTheta()
-     */
-    public double getPhi() {
-        return phi;
-    }
-
-    /** Convert a gradient with respect to spherical coordinates into a gradient
-     * with respect to Cartesian coordinates.
-     * @param sGradient gradient with respect to spherical coordinates
-     * {df/dr, df/d&theta;, df/d&Phi;}
-     * @return gradient with respect to Cartesian coordinates
-     * {df/dx, df/dy, df/dz}
-     */
-    public double[] toCartesianGradient(final double[] sGradient) {
-
-        // lazy evaluation of Jacobian
-        computeJacobian();
-
-        // compose derivatives as gradient^T . J
-        // the expressions have been simplified since we know jacobian[1][2] = dTheta/dZ = 0
-        return new double[] {
-            sGradient[0] * jacobian[0][0] + sGradient[1] * jacobian[1][0] + sGradient[2] * jacobian[2][0],
-            sGradient[0] * jacobian[0][1] + sGradient[1] * jacobian[1][1] + sGradient[2] * jacobian[2][1],
-            sGradient[0] * jacobian[0][2]                                 + sGradient[2] * jacobian[2][2]
-        };
-
-    }
-
-    /** Convert a Hessian with respect to spherical coordinates into a Hessian
-     * with respect to Cartesian coordinates.
-     * <p>
-     * As Hessian are always symmetric, we use only the lower left part of the provided
-     * spherical Hessian, so the upper part may not be initialized. However, we still
-     * do fill up the complete array we create, with guaranteed symmetry.
-     * </p>
-     * @param sHessian Hessian with respect to spherical coordinates
-     * {{d<sup>2</sup>f/dr<sup>2</sup>, d<sup>2</sup>f/drd&theta;, d<sup>2</sup>f/drd&Phi;},
-     *  {d<sup>2</sup>f/drd&theta;, d<sup>2</sup>f/d&theta;<sup>2</sup>, d<sup>2</sup>f/d&theta;d&Phi;},
-     *  {d<sup>2</sup>f/drd&Phi;, d<sup>2</sup>f/d&theta;d&Phi;, d<sup>2</sup>f/d&Phi;<sup>2</sup>}
-     * @param sGradient gradient with respect to spherical coordinates
-     * {df/dr, df/d&theta;, df/d&Phi;}
-     * @return Hessian with respect to Cartesian coordinates
-     * {{d<sup>2</sup>f/dx<sup>2</sup>, d<sup>2</sup>f/dxdy, d<sup>2</sup>f/dxdz},
-     *  {d<sup>2</sup>f/dxdy, d<sup>2</sup>f/dy<sup>2</sup>, d<sup>2</sup>f/dydz},
-     *  {d<sup>2</sup>f/dxdz, d<sup>2</sup>f/dydz, d<sup>2</sup>f/dz<sup>2</sup>}}
-     */
-    public double[][] toCartesianHessian(final double[][] sHessian, final double[] sGradient) {
-
-        computeJacobian();
-        computeHessians();
-
-        // compose derivative as J^T . H_f . J + df/dr H_r + df/dtheta H_theta + df/dphi H_phi
-        // the expressions have been simplified since we know jacobian[1][2] = dTheta/dZ = 0
-        // and H_theta is only a 2x2 matrix as it does not depend on z
-        final double[][] hj = new double[3][3];
-        final double[][] cHessian = new double[3][3];
-
-        // compute H_f . J
-        // beware we use ONLY the lower-left part of sHessian
-        hj[0][0] = sHessian[0][0] * jacobian[0][0] + sHessian[1][0] * jacobian[1][0] + sHessian[2][0] * jacobian[2][0];
-        hj[0][1] = sHessian[0][0] * jacobian[0][1] + sHessian[1][0] * jacobian[1][1] + sHessian[2][0] * jacobian[2][1];
-        hj[0][2] = sHessian[0][0] * jacobian[0][2]                                   + sHessian[2][0] * jacobian[2][2];
-        hj[1][0] = sHessian[1][0] * jacobian[0][0] + sHessian[1][1] * jacobian[1][0] + sHessian[2][1] * jacobian[2][0];
-        hj[1][1] = sHessian[1][0] * jacobian[0][1] + sHessian[1][1] * jacobian[1][1] + sHessian[2][1] * jacobian[2][1];
-        // don't compute hj[1][2] as it is not used below
-        hj[2][0] = sHessian[2][0] * jacobian[0][0] + sHessian[2][1] * jacobian[1][0] + sHessian[2][2] * jacobian[2][0];
-        hj[2][1] = sHessian[2][0] * jacobian[0][1] + sHessian[2][1] * jacobian[1][1] + sHessian[2][2] * jacobian[2][1];
-        hj[2][2] = sHessian[2][0] * jacobian[0][2]                                   + sHessian[2][2] * jacobian[2][2];
-
-        // compute lower-left part of J^T . H_f . J
-        cHessian[0][0] = jacobian[0][0] * hj[0][0] + jacobian[1][0] * hj[1][0] + jacobian[2][0] * hj[2][0];
-        cHessian[1][0] = jacobian[0][1] * hj[0][0] + jacobian[1][1] * hj[1][0] + jacobian[2][1] * hj[2][0];
-        cHessian[2][0] = jacobian[0][2] * hj[0][0]                             + jacobian[2][2] * hj[2][0];
-        cHessian[1][1] = jacobian[0][1] * hj[0][1] + jacobian[1][1] * hj[1][1] + jacobian[2][1] * hj[2][1];
-        cHessian[2][1] = jacobian[0][2] * hj[0][1]                             + jacobian[2][2] * hj[2][1];
-        cHessian[2][2] = jacobian[0][2] * hj[0][2]                             + jacobian[2][2] * hj[2][2];
-
-        // add gradient contribution
-        cHessian[0][0] += sGradient[0] * rHessian[0][0] + sGradient[1] * thetaHessian[0][0] + sGradient[2] * phiHessian[0][0];
-        cHessian[1][0] += sGradient[0] * rHessian[1][0] + sGradient[1] * thetaHessian[1][0] + sGradient[2] * phiHessian[1][0];
-        cHessian[2][0] += sGradient[0] * rHessian[2][0]                                     + sGradient[2] * phiHessian[2][0];
-        cHessian[1][1] += sGradient[0] * rHessian[1][1] + sGradient[1] * thetaHessian[1][1] + sGradient[2] * phiHessian[1][1];
-        cHessian[2][1] += sGradient[0] * rHessian[2][1]                                     + sGradient[2] * phiHessian[2][1];
-        cHessian[2][2] += sGradient[0] * rHessian[2][2]                                     + sGradient[2] * phiHessian[2][2];
-
-        // ensure symmetry
-        cHessian[0][1] = cHessian[1][0];
-        cHessian[0][2] = cHessian[2][0];
-        cHessian[1][2] = cHessian[2][1];
-
-        return cHessian;
-
-    }
-
-    /** Lazy evaluation of (r, &theta;, &phi;) Jacobian.
-     */
-    private void computeJacobian() {
-        if (jacobian == null) {
-
-            // intermediate variables
-            final double x    = v.getX();
-            final double y    = v.getY();
-            final double z    = v.getZ();
-            final double rho2 = x * x + y * y;
-            final double rho  = FastMath.sqrt(rho2);
-            final double r2   = rho2 + z * z;
-
-            jacobian = new double[3][3];
-
-            // row representing the gradient of r
-            jacobian[0][0] = x / r;
-            jacobian[0][1] = y / r;
-            jacobian[0][2] = z / r;
-
-            // row representing the gradient of theta
-            jacobian[1][0] = -y / rho2;
-            jacobian[1][1] =  x / rho2;
-            // jacobian[1][2] is already set to 0 at allocation time
-
-            // row representing the gradient of phi
-            jacobian[2][0] = x * z / (rho * r2);
-            jacobian[2][1] = y * z / (rho * r2);
-            jacobian[2][2] = -rho / r2;
-
-        }
-    }
-
-    /** Lazy evaluation of Hessians.
-     */
-    private void computeHessians() {
-
-        if (rHessian == null) {
-
-            // intermediate variables
-            final double x      = v.getX();
-            final double y      = v.getY();
-            final double z      = v.getZ();
-            final double x2     = x * x;
-            final double y2     = y * y;
-            final double z2     = z * z;
-            final double rho2   = x2 + y2;
-            final double rho    = FastMath.sqrt(rho2);
-            final double r2     = rho2 + z2;
-            final double xOr    = x / r;
-            final double yOr    = y / r;
-            final double zOr    = z / r;
-            final double xOrho2 = x / rho2;
-            final double yOrho2 = y / rho2;
-            final double xOr3   = xOr / r2;
-            final double yOr3   = yOr / r2;
-            final double zOr3   = zOr / r2;
-
-            // lower-left part of Hessian of r
-            rHessian = new double[3][3];
-            rHessian[0][0] = y * yOr3 + z * zOr3;
-            rHessian[1][0] = -x * yOr3;
-            rHessian[2][0] = -z * xOr3;
-            rHessian[1][1] = x * xOr3 + z * zOr3;
-            rHessian[2][1] = -y * zOr3;
-            rHessian[2][2] = x * xOr3 + y * yOr3;
-
-            // upper-right part is symmetric
-            rHessian[0][1] = rHessian[1][0];
-            rHessian[0][2] = rHessian[2][0];
-            rHessian[1][2] = rHessian[2][1];
-
-            // lower-left part of Hessian of azimuthal angle theta
-            thetaHessian = new double[2][2];
-            thetaHessian[0][0] = 2 * xOrho2 * yOrho2;
-            thetaHessian[1][0] = yOrho2 * yOrho2 - xOrho2 * xOrho2;
-            thetaHessian[1][1] = -2 * xOrho2 * yOrho2;
-
-            // upper-right part is symmetric
-            thetaHessian[0][1] = thetaHessian[1][0];
-
-            // lower-left part of Hessian of polar (co-latitude) angle phi
-            final double rhor2       = rho * r2;
-            final double rho2r2      = rho * rhor2;
-            final double rhor4       = rhor2 * r2;
-            final double rho3r4      = rhor4 * rho2;
-            final double r2P2rho2    = 3 * rho2 + z2;
-            phiHessian = new double[3][3];
-            phiHessian[0][0] = z * (rho2r2 - x2 * r2P2rho2) / rho3r4;
-            phiHessian[1][0] = -x * y * z * r2P2rho2 / rho3r4;
-            phiHessian[2][0] = x * (rho2 - z2) / rhor4;
-            phiHessian[1][1] = z * (rho2r2 - y2 * r2P2rho2) / rho3r4;
-            phiHessian[2][1] = y * (rho2 - z2) / rhor4;
-            phiHessian[2][2] = 2 * rho * zOr3 / r;
-
-            // upper-right part is symmetric
-            phiHessian[0][1] = phiHessian[1][0];
-            phiHessian[0][2] = phiHessian[2][0];
-            phiHessian[1][2] = phiHessian[2][1];
-
-        }
-
-    }
-
-    /**
-     * Replace the instance with a data transfer object for serialization.
-     * @return data transfer object that will be serialized
-     */
-    private Object writeReplace() {
-        return new DataTransferObject(v.getX(), v.getY(), v.getZ());
-    }
-
-    /** Internal class used only for serialization. */
-    private static class DataTransferObject implements Serializable {
-
-        /** Serializable UID. */
-        private static final long serialVersionUID = 20130206L;
-
-        /** Abscissa.
-         * @serial
-         */
-        private final double x;
-
-        /** Ordinate.
-         * @serial
-         */
-        private final double y;
-
-        /** Height.
-         * @serial
-         */
-        private final double z;
-
-        /** Simple constructor.
-         * @param x abscissa
-         * @param y ordinate
-         * @param z height
-         */
-        public DataTransferObject(final double x, final double y, final double z) {
-            this.x = x;
-            this.y = y;
-            this.z = z;
-        }
-
-        /** Replace the deserialized data transfer object with a {@link SphericalCoordinates}.
-         * @return replacement {@link SphericalCoordinates}
-         */
-        private Object readResolve() {
-            return new SphericalCoordinates(new Vector3D(x, y, z));
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
deleted file mode 100644
index 2ac917f..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
+++ /dev/null
@@ -1,165 +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.geometry.euclidean.threed;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-
-/** This class represents a subset of a {@link Line}.
- * @since 3.0
- */
-public class SubLine {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Underlying line. */
-    private final Line line;
-
-    /** Remaining region of the hyperplane. */
-    private final IntervalsSet remainingRegion;
-
-    /** Simple constructor.
-     * @param line underlying line
-     * @param remainingRegion remaining region of the line
-     */
-    public SubLine(final Line line, final IntervalsSet remainingRegion) {
-        this.line            = line;
-        this.remainingRegion = remainingRegion;
-    }
-
-    /** Create a sub-line from two endpoints.
-     * @param start start point
-     * @param end end point
-     * @param tolerance tolerance below which points are considered identical
-     * @exception MathIllegalArgumentException if the points are equal
-     * @since 3.3
-     */
-    public SubLine(final Vector3D start, final Vector3D end, final double tolerance)
-        throws MathIllegalArgumentException {
-        this(new Line(start, end, tolerance), buildIntervalSet(start, end, tolerance));
-    }
-
-    /** Create a sub-line from two endpoints.
-     * @param start start point
-     * @param end end point
-     * @exception MathIllegalArgumentException if the points are equal
-     * @deprecated as of 3.3, replaced with {@link #SubLine(Vector3D, Vector3D, double)}
-     */
-    public SubLine(final Vector3D start, final Vector3D end)
-        throws MathIllegalArgumentException {
-        this(start, end, DEFAULT_TOLERANCE);
-    }
-
-    /** Create a sub-line from a segment.
-     * @param segment single segment forming the sub-line
-     * @exception MathIllegalArgumentException if the segment endpoints are equal
-     */
-    public SubLine(final Segment segment) throws MathIllegalArgumentException {
-        this(segment.getLine(),
-             buildIntervalSet(segment.getStart(), segment.getEnd(), segment.getLine().getTolerance()));
-    }
-
-    /** Get the endpoints of the sub-line.
-     * <p>
-     * A subline may be any arbitrary number of disjoints segments, so the endpoints
-     * are provided as a list of endpoint pairs. Each element of the list represents
-     * one segment, and each segment contains a start point at index 0 and an end point
-     * at index 1. If the sub-line is unbounded in the negative infinity direction,
-     * the start point of the first segment will have infinite coordinates. If the
-     * sub-line is unbounded in the positive infinity direction, the end point of the
-     * last segment will have infinite coordinates. So a sub-line covering the whole
-     * line will contain just one row and both elements of this row will have infinite
-     * coordinates. If the sub-line is empty, the returned list will contain 0 segments.
-     * </p>
-     * @return list of segments endpoints
-     */
-    public List<Segment> getSegments() {
-
-        final List<Interval> list = remainingRegion.asList();
-        final List<Segment> segments = new ArrayList<Segment>(list.size());
-
-        for (final Interval interval : list) {
-            final Vector3D start = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getInf()));
-            final Vector3D end   = line.toSpace((Point<Euclidean1D>) new Vector1D(interval.getSup()));
-            segments.add(new Segment(start, end, line));
-        }
-
-        return segments;
-
-    }
-
-    /** Get the intersection of the instance and another sub-line.
-     * <p>
-     * This method is related to the {@link Line#intersection(Line)
-     * intersection} method in the {@link Line Line} class, but in addition
-     * to compute the point along infinite lines, it also checks the point
-     * lies on both sub-line ranges.
-     * </p>
-     * @param subLine other sub-line which may intersect instance
-     * @param includeEndPoints if true, endpoints are considered to belong to
-     * instance (i.e. they are closed sets) and may be returned, otherwise endpoints
-     * are considered to not belong to instance (i.e. they are open sets) and intersection
-     * occurring on endpoints lead to null being returned
-     * @return the intersection point if there is one, null if the sub-lines don't intersect
-     */
-    public Vector3D intersection(final SubLine subLine, final boolean includeEndPoints) {
-
-        // compute the intersection on infinite line
-        Vector3D v1D = line.intersection(subLine.line);
-        if (v1D == null) {
-            return null;
-        }
-
-        // check location of point with respect to first sub-line
-        Location loc1 = remainingRegion.checkPoint((Point<Euclidean1D>) line.toSubSpace((Point<Euclidean3D>) v1D));
-
-        // check location of point with respect to second sub-line
-        Location loc2 = subLine.remainingRegion.checkPoint((Point<Euclidean1D>) subLine.line.toSubSpace((Point<Euclidean3D>) v1D));
-
-        if (includeEndPoints) {
-            return ((loc1 != Location.OUTSIDE) && (loc2 != Location.OUTSIDE)) ? v1D : null;
-        } else {
-            return ((loc1 == Location.INSIDE) && (loc2 == Location.INSIDE)) ? v1D : null;
-        }
-
-    }
-
-    /** Build an interval set from two points.
-     * @param start start point
-     * @param end end point
-     * @return an interval set
-     * @param tolerance tolerance below which points are considered identical
-     * @exception MathIllegalArgumentException if the points are equal
-     */
-    private static IntervalsSet buildIntervalSet(final Vector3D start, final Vector3D end, final double tolerance)
-        throws MathIllegalArgumentException {
-        final Line line = new Line(start, end, tolerance);
-        return new IntervalsSet(line.toSubSpace((Point<Euclidean3D>) start).getX(),
-                                line.toSubSpace((Point<Euclidean3D>) end).getX(),
-                                tolerance);
-    }
-
-}


[24/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/Fraction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/Fraction.java b/src/main/java/org/apache/commons/math3/fraction/Fraction.java
deleted file mode 100644
index 1752043..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/Fraction.java
+++ /dev/null
@@ -1,673 +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.fraction;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Representation of a rational number.
- *
- * implements Serializable since 2.0
- *
- * @since 1.1
- */
-public class Fraction
-    extends Number
-    implements FieldElement<Fraction>, Comparable<Fraction>, Serializable {
-
-    /** A fraction representing "2 / 1". */
-    public static final Fraction TWO = new Fraction(2, 1);
-
-    /** A fraction representing "1". */
-    public static final Fraction ONE = new Fraction(1, 1);
-
-    /** A fraction representing "0". */
-    public static final Fraction ZERO = new Fraction(0, 1);
-
-    /** A fraction representing "4/5". */
-    public static final Fraction FOUR_FIFTHS = new Fraction(4, 5);
-
-    /** A fraction representing "1/5". */
-    public static final Fraction ONE_FIFTH = new Fraction(1, 5);
-
-    /** A fraction representing "1/2". */
-    public static final Fraction ONE_HALF = new Fraction(1, 2);
-
-    /** A fraction representing "1/4". */
-    public static final Fraction ONE_QUARTER = new Fraction(1, 4);
-
-    /** A fraction representing "1/3". */
-    public static final Fraction ONE_THIRD = new Fraction(1, 3);
-
-    /** A fraction representing "3/5". */
-    public static final Fraction THREE_FIFTHS = new Fraction(3, 5);
-
-    /** A fraction representing "3/4". */
-    public static final Fraction THREE_QUARTERS = new Fraction(3, 4);
-
-    /** A fraction representing "2/5". */
-    public static final Fraction TWO_FIFTHS = new Fraction(2, 5);
-
-    /** A fraction representing "2/4". */
-    public static final Fraction TWO_QUARTERS = new Fraction(2, 4);
-
-    /** A fraction representing "2/3". */
-    public static final Fraction TWO_THIRDS = new Fraction(2, 3);
-
-    /** A fraction representing "-1 / 1". */
-    public static final Fraction MINUS_ONE = new Fraction(-1, 1);
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 3698073679419233275L;
-
-    /** The default epsilon used for convergence. */
-    private static final double DEFAULT_EPSILON = 1e-5;
-
-    /** The denominator. */
-    private final int denominator;
-
-    /** The numerator. */
-    private final int numerator;
-
-    /**
-     * Create a fraction given the double value.
-     * @param value the double value to convert to a fraction.
-     * @throws FractionConversionException if the continued fraction failed to
-     *         converge.
-     */
-    public Fraction(double value) throws FractionConversionException {
-        this(value, DEFAULT_EPSILON, 100);
-    }
-
-    /**
-     * Create a fraction given the double value and maximum error allowed.
-     * <p>
-     * References:
-     * <ul>
-     * <li><a href="http://mathworld.wolfram.com/ContinuedFraction.html">
-     * Continued Fraction</a> equations (11) and (22)-(26)</li>
-     * </ul>
-     * </p>
-     * @param value the double value to convert to a fraction.
-     * @param epsilon maximum error allowed.  The resulting fraction is within
-     *        {@code epsilon} of {@code value}, in absolute terms.
-     * @param maxIterations maximum number of convergents
-     * @throws FractionConversionException if the continued fraction failed to
-     *         converge.
-     */
-    public Fraction(double value, double epsilon, int maxIterations)
-        throws FractionConversionException
-    {
-        this(value, epsilon, Integer.MAX_VALUE, maxIterations);
-    }
-
-    /**
-     * Create a fraction given the double value and maximum denominator.
-     * <p>
-     * References:
-     * <ul>
-     * <li><a href="http://mathworld.wolfram.com/ContinuedFraction.html">
-     * Continued Fraction</a> equations (11) and (22)-(26)</li>
-     * </ul>
-     * </p>
-     * @param value the double value to convert to a fraction.
-     * @param maxDenominator The maximum allowed value for denominator
-     * @throws FractionConversionException if the continued fraction failed to
-     *         converge
-     */
-    public Fraction(double value, int maxDenominator)
-        throws FractionConversionException
-    {
-       this(value, 0, maxDenominator, 100);
-    }
-
-    /**
-     * Create a fraction given the double value and either the maximum error
-     * allowed or the maximum number of denominator digits.
-     * <p>
-     *
-     * NOTE: This constructor is called with EITHER
-     *   - a valid epsilon value and the maxDenominator set to Integer.MAX_VALUE
-     *     (that way the maxDenominator has no effect).
-     * OR
-     *   - a valid maxDenominator value and the epsilon value set to zero
-     *     (that way epsilon only has effect if there is an exact match before
-     *     the maxDenominator value is reached).
-     * </p><p>
-     *
-     * It has been done this way so that the same code can be (re)used for both
-     * scenarios. However this could be confusing to users if it were part of
-     * the public API and this constructor should therefore remain PRIVATE.
-     * </p>
-     *
-     * See JIRA issue ticket MATH-181 for more details:
-     *
-     *     https://issues.apache.org/jira/browse/MATH-181
-     *
-     * @param value the double value to convert to a fraction.
-     * @param epsilon maximum error allowed.  The resulting fraction is within
-     *        {@code epsilon} of {@code value}, in absolute terms.
-     * @param maxDenominator maximum denominator value allowed.
-     * @param maxIterations maximum number of convergents
-     * @throws FractionConversionException if the continued fraction failed to
-     *         converge.
-     */
-    private Fraction(double value, double epsilon, int maxDenominator, int maxIterations)
-        throws FractionConversionException
-    {
-        long overflow = Integer.MAX_VALUE;
-        double r0 = value;
-        long a0 = (long)FastMath.floor(r0);
-        if (FastMath.abs(a0) > overflow) {
-            throw new FractionConversionException(value, a0, 1l);
-        }
-
-        // check for (almost) integer arguments, which should not go to iterations.
-        if (FastMath.abs(a0 - value) < epsilon) {
-            this.numerator = (int) a0;
-            this.denominator = 1;
-            return;
-        }
-
-        long p0 = 1;
-        long q0 = 0;
-        long p1 = a0;
-        long q1 = 1;
-
-        long p2 = 0;
-        long q2 = 1;
-
-        int n = 0;
-        boolean stop = false;
-        do {
-            ++n;
-            double r1 = 1.0 / (r0 - a0);
-            long a1 = (long)FastMath.floor(r1);
-            p2 = (a1 * p1) + p0;
-            q2 = (a1 * q1) + q0;
-
-            if ((FastMath.abs(p2) > overflow) || (FastMath.abs(q2) > overflow)) {
-                // in maxDenominator mode, if the last fraction was very close to the actual value
-                // q2 may overflow in the next iteration; in this case return the last one.
-                if (epsilon == 0.0 && FastMath.abs(q1) < maxDenominator) {
-                    break;
-                }
-                throw new FractionConversionException(value, p2, q2);
-            }
-
-            double convergent = (double)p2 / (double)q2;
-            if (n < maxIterations && FastMath.abs(convergent - value) > epsilon && q2 < maxDenominator) {
-                p0 = p1;
-                p1 = p2;
-                q0 = q1;
-                q1 = q2;
-                a0 = a1;
-                r0 = r1;
-            } else {
-                stop = true;
-            }
-        } while (!stop);
-
-        if (n >= maxIterations) {
-            throw new FractionConversionException(value, maxIterations);
-        }
-
-        if (q2 < maxDenominator) {
-            this.numerator = (int) p2;
-            this.denominator = (int) q2;
-        } else {
-            this.numerator = (int) p1;
-            this.denominator = (int) q1;
-        }
-
-    }
-
-    /**
-     * Create a fraction from an int.
-     * The fraction is num / 1.
-     * @param num the numerator.
-     */
-    public Fraction(int num) {
-        this(num, 1);
-    }
-
-    /**
-     * Create a fraction given the numerator and denominator.  The fraction is
-     * reduced to lowest terms.
-     * @param num the numerator.
-     * @param den the denominator.
-     * @throws MathArithmeticException if the denominator is {@code zero}
-     */
-    public Fraction(int num, int den) {
-        if (den == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR_IN_FRACTION,
-                                              num, den);
-        }
-        if (den < 0) {
-            if (num == Integer.MIN_VALUE ||
-                den == Integer.MIN_VALUE) {
-                throw new MathArithmeticException(LocalizedFormats.OVERFLOW_IN_FRACTION,
-                                                  num, den);
-            }
-            num = -num;
-            den = -den;
-        }
-        // reduce numerator and denominator by greatest common denominator.
-        final int d = ArithmeticUtils.gcd(num, den);
-        if (d > 1) {
-            num /= d;
-            den /= d;
-        }
-
-        // move sign to numerator.
-        if (den < 0) {
-            num = -num;
-            den = -den;
-        }
-        this.numerator   = num;
-        this.denominator = den;
-    }
-
-    /**
-     * Returns the absolute value of this fraction.
-     * @return the absolute value.
-     */
-    public Fraction abs() {
-        Fraction ret;
-        if (numerator >= 0) {
-            ret = this;
-        } else {
-            ret = negate();
-        }
-        return ret;
-    }
-
-    /**
-     * Compares this object to another based on size.
-     * @param object the object to compare to
-     * @return -1 if this is less than {@code object}, +1 if this is greater
-     *         than {@code object}, 0 if they are equal.
-     */
-    public int compareTo(Fraction object) {
-        long nOd = ((long) numerator) * object.denominator;
-        long dOn = ((long) denominator) * object.numerator;
-        return (nOd < dOn) ? -1 : ((nOd > dOn) ? +1 : 0);
-    }
-
-    /**
-     * Gets the fraction as a {@code double}. This calculates the fraction as
-     * the numerator divided by denominator.
-     * @return the fraction as a {@code double}
-     */
-    @Override
-    public double doubleValue() {
-        return (double)numerator / (double)denominator;
-    }
-
-    /**
-     * Test for the equality of two fractions.  If the lowest term
-     * numerator and denominators are the same for both fractions, the two
-     * fractions are considered to be equal.
-     * @param other fraction to test for equality to this fraction
-     * @return true if two fractions are equal, false if object is
-     *         {@code null}, not an instance of {@link Fraction}, or not equal
-     *         to this fraction instance.
-     */
-    @Override
-    public boolean equals(Object other) {
-        if (this == other) {
-            return true;
-        }
-        if (other instanceof Fraction) {
-            // since fractions are always in lowest terms, numerators and
-            // denominators can be compared directly for equality.
-            Fraction rhs = (Fraction)other;
-            return (numerator == rhs.numerator) &&
-                (denominator == rhs.denominator);
-        }
-        return false;
-    }
-
-    /**
-     * Gets the fraction as a {@code float}. This calculates the fraction as
-     * the numerator divided by denominator.
-     * @return the fraction as a {@code float}
-     */
-    @Override
-    public float floatValue() {
-        return (float)doubleValue();
-    }
-
-    /**
-     * Access the denominator.
-     * @return the denominator.
-     */
-    public int getDenominator() {
-        return denominator;
-    }
-
-    /**
-     * Access the numerator.
-     * @return the numerator.
-     */
-    public int getNumerator() {
-        return numerator;
-    }
-
-    /**
-     * Gets a hashCode for the fraction.
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        return 37 * (37 * 17 + numerator) + denominator;
-    }
-
-    /**
-     * Gets the fraction as an {@code int}. This returns the whole number part
-     * of the fraction.
-     * @return the whole number fraction part
-     */
-    @Override
-    public int intValue() {
-        return (int)doubleValue();
-    }
-
-    /**
-     * Gets the fraction as a {@code long}. This returns the whole number part
-     * of the fraction.
-     * @return the whole number fraction part
-     */
-    @Override
-    public long longValue() {
-        return (long)doubleValue();
-    }
-
-    /**
-     * Return the additive inverse of this fraction.
-     * @return the negation of this fraction.
-     */
-    public Fraction negate() {
-        if (numerator==Integer.MIN_VALUE) {
-            throw new MathArithmeticException(LocalizedFormats.OVERFLOW_IN_FRACTION, numerator, denominator);
-        }
-        return new Fraction(-numerator, denominator);
-    }
-
-    /**
-     * Return the multiplicative inverse of this fraction.
-     * @return the reciprocal fraction
-     */
-    public Fraction reciprocal() {
-        return new Fraction(denominator, numerator);
-    }
-
-    /**
-     * <p>Adds the value of this fraction to another, returning the result in reduced form.
-     * The algorithm follows Knuth, 4.5.1.</p>
-     *
-     * @param fraction  the fraction to add, must not be {@code null}
-     * @return a {@code Fraction} instance with the resulting values
-     * @throws NullArgumentException if the fraction is {@code null}
-     * @throws MathArithmeticException if the resulting numerator or denominator exceeds
-     *  {@code Integer.MAX_VALUE}
-     */
-    public Fraction add(Fraction fraction) {
-        return addSub(fraction, true /* add */);
-    }
-
-    /**
-     * Add an integer to the fraction.
-     * @param i the {@code integer} to add.
-     * @return this + i
-     */
-    public Fraction add(final int i) {
-        return new Fraction(numerator + i * denominator, denominator);
-    }
-
-    /**
-     * <p>Subtracts the value of another fraction from the value of this one,
-     * returning the result in reduced form.</p>
-     *
-     * @param fraction  the fraction to subtract, must not be {@code null}
-     * @return a {@code Fraction} instance with the resulting values
-     * @throws NullArgumentException if the fraction is {@code null}
-     * @throws MathArithmeticException if the resulting numerator or denominator
-     *   cannot be represented in an {@code int}.
-     */
-    public Fraction subtract(Fraction fraction) {
-        return addSub(fraction, false /* subtract */);
-    }
-
-    /**
-     * Subtract an integer from the fraction.
-     * @param i the {@code integer} to subtract.
-     * @return this - i
-     */
-    public Fraction subtract(final int i) {
-        return new Fraction(numerator - i * denominator, denominator);
-    }
-
-    /**
-     * Implement add and subtract using algorithm described in Knuth 4.5.1.
-     *
-     * @param fraction the fraction to subtract, must not be {@code null}
-     * @param isAdd true to add, false to subtract
-     * @return a {@code Fraction} instance with the resulting values
-     * @throws NullArgumentException if the fraction is {@code null}
-     * @throws MathArithmeticException if the resulting numerator or denominator
-     *   cannot be represented in an {@code int}.
-     */
-    private Fraction addSub(Fraction fraction, boolean isAdd) {
-        if (fraction == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        // zero is identity for addition.
-        if (numerator == 0) {
-            return isAdd ? fraction : fraction.negate();
-        }
-        if (fraction.numerator == 0) {
-            return this;
-        }
-        // if denominators are randomly distributed, d1 will be 1 about 61%
-        // of the time.
-        int d1 = ArithmeticUtils.gcd(denominator, fraction.denominator);
-        if (d1==1) {
-            // result is ( (u*v' +/- u'v) / u'v')
-            int uvp = ArithmeticUtils.mulAndCheck(numerator, fraction.denominator);
-            int upv = ArithmeticUtils.mulAndCheck(fraction.numerator, denominator);
-            return new Fraction
-                (isAdd ? ArithmeticUtils.addAndCheck(uvp, upv) :
-                 ArithmeticUtils.subAndCheck(uvp, upv),
-                 ArithmeticUtils.mulAndCheck(denominator, fraction.denominator));
-        }
-        // the quantity 't' requires 65 bits of precision; see knuth 4.5.1
-        // exercise 7.  we're going to use a BigInteger.
-        // t = u(v'/d1) +/- v(u'/d1)
-        BigInteger uvp = BigInteger.valueOf(numerator)
-        .multiply(BigInteger.valueOf(fraction.denominator/d1));
-        BigInteger upv = BigInteger.valueOf(fraction.numerator)
-        .multiply(BigInteger.valueOf(denominator/d1));
-        BigInteger t = isAdd ? uvp.add(upv) : uvp.subtract(upv);
-        // but d2 doesn't need extra precision because
-        // d2 = gcd(t,d1) = gcd(t mod d1, d1)
-        int tmodd1 = t.mod(BigInteger.valueOf(d1)).intValue();
-        int d2 = (tmodd1==0)?d1:ArithmeticUtils.gcd(tmodd1, d1);
-
-        // result is (t/d2) / (u'/d1)(v'/d2)
-        BigInteger w = t.divide(BigInteger.valueOf(d2));
-        if (w.bitLength() > 31) {
-            throw new MathArithmeticException(LocalizedFormats.NUMERATOR_OVERFLOW_AFTER_MULTIPLY,
-                                              w);
-        }
-        return new Fraction (w.intValue(),
-                ArithmeticUtils.mulAndCheck(denominator/d1,
-                        fraction.denominator/d2));
-    }
-
-    /**
-     * <p>Multiplies the value of this fraction by another, returning the
-     * result in reduced form.</p>
-     *
-     * @param fraction  the fraction to multiply by, must not be {@code null}
-     * @return a {@code Fraction} instance with the resulting values
-     * @throws NullArgumentException if the fraction is {@code null}
-     * @throws MathArithmeticException if the resulting numerator or denominator exceeds
-     *  {@code Integer.MAX_VALUE}
-     */
-    public Fraction multiply(Fraction fraction) {
-        if (fraction == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        if (numerator == 0 || fraction.numerator == 0) {
-            return ZERO;
-        }
-        // knuth 4.5.1
-        // make sure we don't overflow unless the result *must* overflow.
-        int d1 = ArithmeticUtils.gcd(numerator, fraction.denominator);
-        int d2 = ArithmeticUtils.gcd(fraction.numerator, denominator);
-        return getReducedFraction
-        (ArithmeticUtils.mulAndCheck(numerator/d1, fraction.numerator/d2),
-                ArithmeticUtils.mulAndCheck(denominator/d2, fraction.denominator/d1));
-    }
-
-    /**
-     * Multiply the fraction by an integer.
-     * @param i the {@code integer} to multiply by.
-     * @return this * i
-     */
-    public Fraction multiply(final int i) {
-        return new Fraction(numerator * i, denominator);
-    }
-
-    /**
-     * <p>Divide the value of this fraction by another.</p>
-     *
-     * @param fraction  the fraction to divide by, must not be {@code null}
-     * @return a {@code Fraction} instance with the resulting values
-     * @throws IllegalArgumentException if the fraction is {@code null}
-     * @throws MathArithmeticException if the fraction to divide by is zero
-     * @throws MathArithmeticException if the resulting numerator or denominator exceeds
-     *  {@code Integer.MAX_VALUE}
-     */
-    public Fraction divide(Fraction fraction) {
-        if (fraction == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        if (fraction.numerator == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_FRACTION_TO_DIVIDE_BY,
-                                              fraction.numerator, fraction.denominator);
-        }
-        return multiply(fraction.reciprocal());
-    }
-
-    /**
-     * Divide the fraction by an integer.
-     * @param i the {@code integer} to divide by.
-     * @return this * i
-     */
-    public Fraction divide(final int i) {
-        return new Fraction(numerator, denominator * i);
-    }
-
-    /**
-     * <p>
-     * Gets the fraction percentage as a {@code double}. This calculates the
-     * fraction as the numerator divided by denominator multiplied by 100.
-     * </p>
-     *
-     * @return the fraction percentage as a {@code double}.
-     */
-    public double percentageValue() {
-        return 100 * doubleValue();
-    }
-
-    /**
-     * <p>Creates a {@code Fraction} instance with the 2 parts
-     * of a fraction Y/Z.</p>
-     *
-     * <p>Any negative signs are resolved to be on the numerator.</p>
-     *
-     * @param numerator  the numerator, for example the three in 'three sevenths'
-     * @param denominator  the denominator, for example the seven in 'three sevenths'
-     * @return a new fraction instance, with the numerator and denominator reduced
-     * @throws MathArithmeticException if the denominator is {@code zero}
-     */
-    public static Fraction getReducedFraction(int numerator, int denominator) {
-        if (denominator == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR_IN_FRACTION,
-                                              numerator, denominator);
-        }
-        if (numerator==0) {
-            return ZERO; // normalize zero.
-        }
-        // allow 2^k/-2^31 as a valid fraction (where k>0)
-        if (denominator==Integer.MIN_VALUE && (numerator&1)==0) {
-            numerator/=2; denominator/=2;
-        }
-        if (denominator < 0) {
-            if (numerator==Integer.MIN_VALUE ||
-                    denominator==Integer.MIN_VALUE) {
-                throw new MathArithmeticException(LocalizedFormats.OVERFLOW_IN_FRACTION,
-                                                  numerator, denominator);
-            }
-            numerator = -numerator;
-            denominator = -denominator;
-        }
-        // simplify fraction.
-        int gcd = ArithmeticUtils.gcd(numerator, denominator);
-        numerator /= gcd;
-        denominator /= gcd;
-        return new Fraction(numerator, denominator);
-    }
-
-    /**
-     * <p>
-     * Returns the {@code String} representing this fraction, ie
-     * "num / dem" or just "num" if the denominator is one.
-     * </p>
-     *
-     * @return a string representation of the fraction.
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-        String str = null;
-        if (denominator == 1) {
-            str = Integer.toString(numerator);
-        } else if (numerator == 0) {
-            str = "0";
-        } else {
-            str = numerator + " / " + denominator;
-        }
-        return str;
-    }
-
-    /** {@inheritDoc} */
-    public FractionField getField() {
-        return FractionField.getInstance();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/FractionConversionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/FractionConversionException.java b/src/main/java/org/apache/commons/math3/fraction/FractionConversionException.java
deleted file mode 100644
index a16a97a..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/FractionConversionException.java
+++ /dev/null
@@ -1,55 +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.fraction;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Error thrown when a double value cannot be converted to a fraction
- * in the allowed number of iterations.
- *
- * @since 1.2
- */
-public class FractionConversionException extends ConvergenceException {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -4661812640132576263L;
-
-    /**
-     * Constructs an exception with specified formatted detail message.
-     * Message formatting is delegated to {@link java.text.MessageFormat}.
-     * @param value double value to convert
-     * @param maxIterations maximal number of iterations allowed
-     */
-    public FractionConversionException(double value, int maxIterations) {
-        super(LocalizedFormats.FAILED_FRACTION_CONVERSION, value, maxIterations);
-    }
-
-    /**
-     * Constructs an exception with specified formatted detail message.
-     * Message formatting is delegated to {@link java.text.MessageFormat}.
-     * @param value double value to convert
-     * @param p current numerator
-     * @param q current denominator
-     */
-    public FractionConversionException(double value, long p, long q) {
-        super(LocalizedFormats.FRACTION_CONVERSION_OVERFLOW, value, p, q);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/FractionField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/FractionField.java b/src/main/java/org/apache/commons/math3/fraction/FractionField.java
deleted file mode 100644
index 2928509..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/FractionField.java
+++ /dev/null
@@ -1,82 +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.fraction;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-
-/**
- * Representation of the fractional numbers field.
- * <p>
- * This class is a singleton.
- * </p>
- * @see Fraction
- * @since 2.0
- */
-public class FractionField implements Field<Fraction>, Serializable  {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -1257768487499119313L;
-
-    /** Private constructor for the singleton.
-     */
-    private FractionField() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static FractionField getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public Fraction getOne() {
-        return Fraction.ONE;
-    }
-
-    /** {@inheritDoc} */
-    public Fraction getZero() {
-        return Fraction.ZERO;
-    }
-
-    /** {@inheritDoc} */
-    public Class<? extends FieldElement<Fraction>> getRuntimeClass() {
-        return Fraction.class;
-    }
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final FractionField INSTANCE = new FractionField();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/FractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/FractionFormat.java b/src/main/java/org/apache/commons/math3/fraction/FractionFormat.java
deleted file mode 100644
index 06c5a10..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/FractionFormat.java
+++ /dev/null
@@ -1,264 +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.fraction;
-
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Formats a Fraction number in proper format or improper format.  The number
- * format for each of the whole number, numerator and, denominator can be
- * configured.
- *
- * @since 1.1
- */
-public class FractionFormat extends AbstractFormat {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 3008655719530972611L;
-
-    /**
-     * Create an improper formatting instance with the default number format
-     * for the numerator and denominator.
-     */
-    public FractionFormat() {
-    }
-
-    /**
-     * Create an improper formatting instance with a custom number format for
-     * both the numerator and denominator.
-     * @param format the custom format for both the numerator and denominator.
-     */
-    public FractionFormat(final NumberFormat format) {
-        super(format);
-    }
-
-    /**
-     * Create an improper formatting instance with a custom number format for
-     * the numerator and a custom number format for the denominator.
-     * @param numeratorFormat the custom format for the numerator.
-     * @param denominatorFormat the custom format for the denominator.
-     */
-    public FractionFormat(final NumberFormat numeratorFormat,
-                          final NumberFormat denominatorFormat) {
-        super(numeratorFormat, denominatorFormat);
-    }
-
-    /**
-     * Get the set of locales for which complex formats are available.  This
-     * is the same set as the {@link NumberFormat} set.
-     * @return available complex format locales.
-     */
-    public static Locale[] getAvailableLocales() {
-        return NumberFormat.getAvailableLocales();
-    }
-
-    /**
-     * This static method calls formatFraction() on a default instance of
-     * FractionFormat.
-     *
-     * @param f Fraction object to format
-     * @return a formatted fraction in proper form.
-     */
-    public static String formatFraction(Fraction f) {
-        return getImproperInstance().format(f);
-    }
-
-    /**
-     * Returns the default complex format for the current locale.
-     * @return the default complex format.
-     */
-    public static FractionFormat getImproperInstance() {
-        return getImproperInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default complex format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the complex format specific to the given locale.
-     */
-    public static FractionFormat getImproperInstance(final Locale locale) {
-        return new FractionFormat(getDefaultNumberFormat(locale));
-    }
-
-    /**
-     * Returns the default complex format for the current locale.
-     * @return the default complex format.
-     */
-    public static FractionFormat getProperInstance() {
-        return getProperInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default complex format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the complex format specific to the given locale.
-     */
-    public static FractionFormat getProperInstance(final Locale locale) {
-        return new ProperFractionFormat(getDefaultNumberFormat(locale));
-    }
-
-    /**
-     * Create a default number format.  The default number format is based on
-     * {@link NumberFormat#getNumberInstance(java.util.Locale)} with the only
-     * customizing is the maximum number of fraction digits, which is set to 0.
-     * @return the default number format.
-     */
-    protected static NumberFormat getDefaultNumberFormat() {
-        return getDefaultNumberFormat(Locale.getDefault());
-    }
-
-    /**
-     * Formats a {@link Fraction} object to produce a string.  The fraction is
-     * output in improper format.
-     *
-     * @param fraction the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     */
-    public StringBuffer format(final Fraction fraction,
-                               final StringBuffer toAppendTo, final FieldPosition pos) {
-
-        pos.setBeginIndex(0);
-        pos.setEndIndex(0);
-
-        getNumeratorFormat().format(fraction.getNumerator(), toAppendTo, pos);
-        toAppendTo.append(" / ");
-        getDenominatorFormat().format(fraction.getDenominator(), toAppendTo,
-            pos);
-
-        return toAppendTo;
-    }
-
-    /**
-     * Formats an object and appends the result to a StringBuffer. <code>obj</code> must be either a
-     * {@link Fraction} object or a {@link Number} object.  Any other type of
-     * object will result in an {@link IllegalArgumentException} being thrown.
-     *
-     * @param obj the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
-     * @throws FractionConversionException if the number cannot be converted to a fraction
-     * @throws MathIllegalArgumentException if <code>obj</code> is not a valid type.
-     */
-    @Override
-    public StringBuffer format(final Object obj,
-                               final StringBuffer toAppendTo, final FieldPosition pos)
-        throws FractionConversionException, MathIllegalArgumentException {
-        StringBuffer ret = null;
-
-        if (obj instanceof Fraction) {
-            ret = format((Fraction) obj, toAppendTo, pos);
-        } else if (obj instanceof Number) {
-            ret = format(new Fraction(((Number) obj).doubleValue()), toAppendTo, pos);
-        } else {
-            throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_FORMAT_OBJECT_TO_FRACTION);
-        }
-
-        return ret;
-    }
-
-    /**
-     * Parses a string to produce a {@link Fraction} object.
-     * @param source the string to parse
-     * @return the parsed {@link Fraction} object.
-     * @exception MathParseException if the beginning of the specified string
-     *            cannot be parsed.
-     */
-    @Override
-    public Fraction parse(final String source) throws MathParseException {
-        final ParsePosition parsePosition = new ParsePosition(0);
-        final Fraction result = parse(source, parsePosition);
-        if (parsePosition.getIndex() == 0) {
-            throw new MathParseException(source, parsePosition.getErrorIndex(), Fraction.class);
-        }
-        return result;
-    }
-
-    /**
-     * Parses a string to produce a {@link Fraction} object.  This method
-     * expects the string to be formatted as an improper fraction.
-     * @param source the string to parse
-     * @param pos input/output parsing parameter.
-     * @return the parsed {@link Fraction} object.
-     */
-    @Override
-    public Fraction parse(final String source, final ParsePosition pos) {
-        final int initialIndex = pos.getIndex();
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse numerator
-        final Number num = getNumeratorFormat().parse(source, pos);
-        if (num == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse '/'
-        final int startIndex = pos.getIndex();
-        final char c = parseNextCharacter(source, pos);
-        switch (c) {
-        case 0 :
-            // no '/'
-            // return num as a fraction
-            return new Fraction(num.intValue(), 1);
-        case '/' :
-            // found '/', continue parsing denominator
-            break;
-        default :
-            // invalid '/'
-            // set index back to initial, error index should be the last
-            // character examined.
-            pos.setIndex(initialIndex);
-            pos.setErrorIndex(startIndex);
-            return null;
-        }
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse denominator
-        final Number den = getDenominatorFormat().parse(source, pos);
-        if (den == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        return new Fraction(num.intValue(), den.intValue());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/ProperBigFractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/ProperBigFractionFormat.java b/src/main/java/org/apache/commons/math3/fraction/ProperBigFractionFormat.java
deleted file mode 100644
index 4f84acd..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/ProperBigFractionFormat.java
+++ /dev/null
@@ -1,238 +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.fraction;
-
-import java.math.BigInteger;
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NullArgumentException;
-
-/**
- * Formats a BigFraction number in proper format.  The number format for each of
- * the whole number, numerator and, denominator can be configured.
- * <p>
- * Minus signs are only allowed in the whole number part - i.e.,
- * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and
- * will result in a <code>ParseException</code>.</p>
- *
- * @since 1.1
- */
-public class ProperBigFractionFormat extends BigFractionFormat {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -6337346779577272307L;
-
-    /** The format used for the whole number. */
-    private NumberFormat wholeFormat;
-
-    /**
-     * Create a proper formatting instance with the default number format for
-     * the whole, numerator, and denominator.
-     */
-    public ProperBigFractionFormat() {
-        this(getDefaultNumberFormat());
-    }
-
-    /**
-     * Create a proper formatting instance with a custom number format for the
-     * whole, numerator, and denominator.
-     * @param format the custom format for the whole, numerator, and
-     *        denominator.
-     */
-    public ProperBigFractionFormat(final NumberFormat format) {
-        this(format, (NumberFormat)format.clone(), (NumberFormat)format.clone());
-    }
-
-    /**
-     * Create a proper formatting instance with a custom number format for each
-     * of the whole, numerator, and denominator.
-     * @param wholeFormat the custom format for the whole.
-     * @param numeratorFormat the custom format for the numerator.
-     * @param denominatorFormat the custom format for the denominator.
-     */
-    public ProperBigFractionFormat(final NumberFormat wholeFormat,
-                                   final NumberFormat numeratorFormat,
-                                   final NumberFormat denominatorFormat) {
-        super(numeratorFormat, denominatorFormat);
-        setWholeFormat(wholeFormat);
-    }
-
-    /**
-     * Formats a {@link BigFraction} object to produce a string.  The BigFraction
-     * is output in proper format.
-     *
-     * @param fraction the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     */
-    @Override
-    public StringBuffer format(final BigFraction fraction,
-                               final StringBuffer toAppendTo, final FieldPosition pos) {
-
-        pos.setBeginIndex(0);
-        pos.setEndIndex(0);
-
-        BigInteger num = fraction.getNumerator();
-        BigInteger den = fraction.getDenominator();
-        BigInteger whole = num.divide(den);
-        num = num.remainder(den);
-
-        if (!BigInteger.ZERO.equals(whole)) {
-            getWholeFormat().format(whole, toAppendTo, pos);
-            toAppendTo.append(' ');
-            if (num.compareTo(BigInteger.ZERO) < 0) {
-                num = num.negate();
-            }
-        }
-        getNumeratorFormat().format(num, toAppendTo, pos);
-        toAppendTo.append(" / ");
-        getDenominatorFormat().format(den, toAppendTo, pos);
-
-        return toAppendTo;
-    }
-
-    /**
-     * Access the whole format.
-     * @return the whole format.
-     */
-    public NumberFormat getWholeFormat() {
-        return wholeFormat;
-    }
-
-    /**
-     * Parses a string to produce a {@link BigFraction} object.  This method
-     * expects the string to be formatted as a proper BigFraction.
-     * <p>
-     * Minus signs are only allowed in the whole number part - i.e.,
-     * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and
-     * will result in a <code>ParseException</code>.</p>
-     *
-     * @param source the string to parse
-     * @param pos input/ouput parsing parameter.
-     * @return the parsed {@link BigFraction} object.
-     */
-    @Override
-    public BigFraction parse(final String source, final ParsePosition pos) {
-        // try to parse improper BigFraction
-        BigFraction ret = super.parse(source, pos);
-        if (ret != null) {
-            return ret;
-        }
-
-        final int initialIndex = pos.getIndex();
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse whole
-        BigInteger whole = parseNextBigInteger(source, pos);
-        if (whole == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse numerator
-        BigInteger num = parseNextBigInteger(source, pos);
-        if (num == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        if (num.compareTo(BigInteger.ZERO) < 0) {
-            // minus signs should be leading, invalid expression
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse '/'
-        final int startIndex = pos.getIndex();
-        final char c = parseNextCharacter(source, pos);
-        switch (c) {
-        case 0 :
-            // no '/'
-            // return num as a BigFraction
-            return new BigFraction(num);
-        case '/' :
-            // found '/', continue parsing denominator
-            break;
-        default :
-            // invalid '/'
-            // set index back to initial, error index should be the last
-            // character examined.
-            pos.setIndex(initialIndex);
-            pos.setErrorIndex(startIndex);
-            return null;
-        }
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse denominator
-        final BigInteger den = parseNextBigInteger(source, pos);
-        if (den == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        if (den.compareTo(BigInteger.ZERO) < 0) {
-            // minus signs must be leading, invalid
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        boolean wholeIsNeg = whole.compareTo(BigInteger.ZERO) < 0;
-        if (wholeIsNeg) {
-            whole = whole.negate();
-        }
-        num = whole.multiply(den).add(num);
-        if (wholeIsNeg) {
-            num = num.negate();
-        }
-
-        return new BigFraction(num, den);
-
-    }
-
-    /**
-     * Modify the whole format.
-     * @param format The new whole format value.
-     * @throws NullArgumentException if {@code format} is {@code null}.
-     */
-    public void setWholeFormat(final NumberFormat format) {
-        if (format == null) {
-            throw new NullArgumentException(LocalizedFormats.WHOLE_FORMAT);
-        }
-        this.wholeFormat = format;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/ProperFractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/ProperFractionFormat.java b/src/main/java/org/apache/commons/math3/fraction/ProperFractionFormat.java
deleted file mode 100644
index 9dc6778..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/ProperFractionFormat.java
+++ /dev/null
@@ -1,231 +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.fraction;
-
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Formats a Fraction number in proper format.  The number format for each of
- * the whole number, numerator and, denominator can be configured.
- * <p>
- * Minus signs are only allowed in the whole number part - i.e.,
- * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and
- * will result in a <code>ParseException</code>.</p>
- *
- * @since 1.1
- */
-public class ProperFractionFormat extends FractionFormat {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 760934726031766749L;
-
-    /** The format used for the whole number. */
-    private NumberFormat wholeFormat;
-
-    /**
-     * Create a proper formatting instance with the default number format for
-     * the whole, numerator, and denominator.
-     */
-    public ProperFractionFormat() {
-        this(getDefaultNumberFormat());
-    }
-
-    /**
-     * Create a proper formatting instance with a custom number format for the
-     * whole, numerator, and denominator.
-     * @param format the custom format for the whole, numerator, and
-     *        denominator.
-     */
-    public ProperFractionFormat(NumberFormat format) {
-        this(format, (NumberFormat)format.clone(), (NumberFormat)format.clone());
-    }
-
-    /**
-     * Create a proper formatting instance with a custom number format for each
-     * of the whole, numerator, and denominator.
-     * @param wholeFormat the custom format for the whole.
-     * @param numeratorFormat the custom format for the numerator.
-     * @param denominatorFormat the custom format for the denominator.
-     */
-    public ProperFractionFormat(NumberFormat wholeFormat,
-            NumberFormat numeratorFormat,
-            NumberFormat denominatorFormat)
-    {
-        super(numeratorFormat, denominatorFormat);
-        setWholeFormat(wholeFormat);
-    }
-
-    /**
-     * Formats a {@link Fraction} object to produce a string.  The fraction
-     * is output in proper format.
-     *
-     * @param fraction the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     */
-    @Override
-    public StringBuffer format(Fraction fraction, StringBuffer toAppendTo,
-            FieldPosition pos) {
-
-        pos.setBeginIndex(0);
-        pos.setEndIndex(0);
-
-        int num = fraction.getNumerator();
-        int den = fraction.getDenominator();
-        int whole = num / den;
-        num %= den;
-
-        if (whole != 0) {
-            getWholeFormat().format(whole, toAppendTo, pos);
-            toAppendTo.append(' ');
-            num = FastMath.abs(num);
-        }
-        getNumeratorFormat().format(num, toAppendTo, pos);
-        toAppendTo.append(" / ");
-        getDenominatorFormat().format(den, toAppendTo, pos);
-
-        return toAppendTo;
-    }
-
-    /**
-     * Access the whole format.
-     * @return the whole format.
-     */
-    public NumberFormat getWholeFormat() {
-        return wholeFormat;
-    }
-
-    /**
-     * Parses a string to produce a {@link Fraction} object.  This method
-     * expects the string to be formatted as a proper fraction.
-     * <p>
-     * Minus signs are only allowed in the whole number part - i.e.,
-     * "-3 1/2" is legitimate and denotes -7/2, but "-3 -1/2" is invalid and
-     * will result in a <code>ParseException</code>.</p>
-     *
-     * @param source the string to parse
-     * @param pos input/ouput parsing parameter.
-     * @return the parsed {@link Fraction} object.
-     */
-    @Override
-    public Fraction parse(String source, ParsePosition pos) {
-        // try to parse improper fraction
-        Fraction ret = super.parse(source, pos);
-        if (ret != null) {
-            return ret;
-        }
-
-        int initialIndex = pos.getIndex();
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse whole
-        Number whole = getWholeFormat().parse(source, pos);
-        if (whole == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse numerator
-        Number num = getNumeratorFormat().parse(source, pos);
-        if (num == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        if (num.intValue() < 0) {
-            // minus signs should be leading, invalid expression
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse '/'
-        int startIndex = pos.getIndex();
-        char c = parseNextCharacter(source, pos);
-        switch (c) {
-        case 0 :
-            // no '/'
-            // return num as a fraction
-            return new Fraction(num.intValue(), 1);
-        case '/' :
-            // found '/', continue parsing denominator
-            break;
-        default :
-            // invalid '/'
-            // set index back to initial, error index should be the last
-            // character examined.
-            pos.setIndex(initialIndex);
-            pos.setErrorIndex(startIndex);
-            return null;
-        }
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse denominator
-        Number den = getDenominatorFormat().parse(source, pos);
-        if (den == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        if (den.intValue() < 0) {
-            // minus signs must be leading, invalid
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        int w = whole.intValue();
-        int n = num.intValue();
-        int d = den.intValue();
-        return new Fraction(((FastMath.abs(w) * d) + n) * MathUtils.copySign(1, w), d);
-    }
-
-    /**
-     * Modify the whole format.
-     * @param format The new whole format value.
-     * @throws NullArgumentException if {@code format} is {@code null}.
-     */
-    public void setWholeFormat(NumberFormat format) {
-        if (format == null) {
-            throw new NullArgumentException(LocalizedFormats.WHOLE_FORMAT);
-        }
-        this.wholeFormat = format;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/package-info.java b/src/main/java/org/apache/commons/math3/fraction/package-info.java
deleted file mode 100644
index f5425c6..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-/**
- *
- *    Fraction number type and fraction number formatting.
- *
- */
-package org.apache.commons.math3.fraction;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java b/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java
deleted file mode 100644
index 60450ba..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/AbstractListChromosome.java
+++ /dev/null
@@ -1,105 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Chromosome represented by an immutable list of a fixed length.
- *
- * @param <T> type of the representation list
- * @since 2.0
- */
-public abstract class AbstractListChromosome<T> extends Chromosome {
-
-    /** List representing the chromosome */
-    private final List<T> representation;
-
-    /**
-     * Constructor, copying the input representation.
-     * @param representation inner representation of the chromosome
-     * @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
-     */
-    public AbstractListChromosome(final List<T> representation) throws InvalidRepresentationException {
-        this(representation, true);
-    }
-
-    /**
-     * Constructor, copying the input representation.
-     * @param representation inner representation of the chromosome
-     * @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
-     */
-    public AbstractListChromosome(final T[] representation) throws InvalidRepresentationException {
-        this(Arrays.asList(representation));
-    }
-
-    /**
-     * Constructor.
-     * @param representation inner representation of the chromosome
-     * @param copyList if {@code true}, the representation will be copied, otherwise it will be referenced.
-     * @since 3.3
-     */
-    public AbstractListChromosome(final List<T> representation, final boolean copyList) {
-        checkValidity(representation);
-        this.representation =
-                Collections.unmodifiableList(copyList ? new ArrayList<T>(representation) : representation);
-    }
-
-    /**
-     * Asserts that <code>representation</code> can represent a valid chromosome.
-     *
-     * @param chromosomeRepresentation representation of the chromosome
-     * @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
-     */
-    protected abstract void checkValidity(List<T> chromosomeRepresentation) throws InvalidRepresentationException;
-
-    /**
-     * Returns the (immutable) inner representation of the chromosome.
-     * @return the representation of the chromosome
-     */
-    protected List<T> getRepresentation() {
-        return representation;
-    }
-
-    /**
-     * Returns the length of the chromosome.
-     * @return the length of the chromosome
-     */
-    public int getLength() {
-        return getRepresentation().size();
-    }
-
-    /**
-     * Creates a new instance of the same class as <code>this</code> is, with a given <code>arrayRepresentation</code>.
-     * This is needed in crossover and mutation operators, where we need a new instance of the same class, but with
-     * different array representation.
-     * <p>
-     * Usually, this method just calls a constructor of the class.
-     *
-     * @param chromosomeRepresentation the inner array representation of the new chromosome.
-     * @return new instance extended from FixedLengthChromosome with the given arrayRepresentation
-     */
-    public abstract AbstractListChromosome<T> newFixedLengthChromosome(final List<T> chromosomeRepresentation);
-
-    @Override
-    public String toString() {
-        return String.format("(f=%s %s)", getFitness(), getRepresentation());
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java b/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java
deleted file mode 100644
index 47d317c..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/BinaryChromosome.java
+++ /dev/null
@@ -1,96 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-
-/**
- * Chromosome represented by a vector of 0s and 1s.
- *
- * @since 2.0
- */
-public abstract class BinaryChromosome extends AbstractListChromosome<Integer> {
-
-    /**
-     * Constructor.
-     * @param representation list of {0,1} values representing the chromosome
-     * @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
-     */
-    public BinaryChromosome(List<Integer> representation) throws InvalidRepresentationException {
-        super(representation);
-    }
-
-    /**
-     * Constructor.
-     * @param representation array of {0,1} values representing the chromosome
-     * @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
-     */
-    public BinaryChromosome(Integer[] representation) throws InvalidRepresentationException {
-        super(representation);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void checkValidity(List<Integer> chromosomeRepresentation) throws InvalidRepresentationException {
-        for (int i : chromosomeRepresentation) {
-            if (i < 0 || i >1) {
-                throw new InvalidRepresentationException(LocalizedFormats.INVALID_BINARY_DIGIT,
-                                                         i);
-            }
-        }
-    }
-
-    /**
-     * Returns a representation of a random binary array of length <code>length</code>.
-     * @param length length of the array
-     * @return a random binary array of length <code>length</code>
-     */
-    public static List<Integer> randomBinaryRepresentation(int length) {
-        // random binary list
-        List<Integer> rList= new ArrayList<Integer> (length);
-        for (int j=0; j<length; j++) {
-            rList.add(GeneticAlgorithm.getRandomGenerator().nextInt(2));
-        }
-        return rList;
-    }
-
-    @Override
-    protected boolean isSame(Chromosome another) {
-        // type check
-        if (! (another instanceof BinaryChromosome)) {
-            return false;
-        }
-        BinaryChromosome anotherBc = (BinaryChromosome) another;
-        // size check
-        if (getLength() != anotherBc.getLength()) {
-            return false;
-        }
-
-        for (int i=0; i< getRepresentation().size(); i++) {
-            if (!(getRepresentation().get(i).equals(anotherBc.getRepresentation().get(i)))) {
-                return false;
-            }
-        }
-        // all is ok
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java b/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java
deleted file mode 100644
index 0802fc6..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/BinaryMutation.java
+++ /dev/null
@@ -1,56 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Mutation for {@link BinaryChromosome}s. Randomly changes one gene.
- *
- * @since 2.0
- */
-public class BinaryMutation implements MutationPolicy {
-
-    /**
-     * Mutate the given chromosome. Randomly changes one gene.
-     *
-     * @param original the original chromosome.
-     * @return the mutated chromosome.
-     * @throws MathIllegalArgumentException if <code>original</code> is not an instance of {@link BinaryChromosome}.
-     */
-    public Chromosome mutate(Chromosome original) throws MathIllegalArgumentException {
-        if (!(original instanceof BinaryChromosome)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.INVALID_BINARY_CHROMOSOME);
-        }
-
-        BinaryChromosome origChrom = (BinaryChromosome) original;
-        List<Integer> newRepr = new ArrayList<Integer>(origChrom.getRepresentation());
-
-        // randomly select a gene
-        int geneIndex = GeneticAlgorithm.getRandomGenerator().nextInt(origChrom.getLength());
-        // and change it
-        newRepr.set(geneIndex, origChrom.getRepresentation().get(geneIndex) == 0 ? 1 : 0);
-
-        Chromosome newChrom = origChrom.newFixedLengthChromosome(newRepr);
-        return newChrom;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/Chromosome.java b/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
deleted file mode 100644
index 22e4750..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/Chromosome.java
+++ /dev/null
@@ -1,104 +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.genetics;
-
-/**
- * Individual in a population. Chromosomes are compared based on their fitness.
- * <p>
- * The chromosomes are IMMUTABLE, and so their fitness is also immutable and
- * therefore it can be cached.
- *
- * @since 2.0
- */
-public abstract class Chromosome implements Comparable<Chromosome>,Fitness {
-    /** Value assigned when no fitness has been computed yet. */
-    private static final double NO_FITNESS = Double.NEGATIVE_INFINITY;
-
-    /** Cached value of the fitness of this chromosome. */
-    private double fitness = NO_FITNESS;
-
-    /**
-     * Access the fitness of this chromosome. The bigger the fitness, the better the chromosome.
-     * <p>
-     * Computation of fitness is usually very time-consuming task, therefore the fitness is cached.
-     *
-     * @return the fitness
-     */
-    public double getFitness() {
-        if (this.fitness == NO_FITNESS) {
-            // no cache - compute the fitness
-            this.fitness = fitness();
-        }
-        return this.fitness;
-    }
-
-    /**
-     * Compares two chromosomes based on their fitness. The bigger the fitness, the better the chromosome.
-     *
-     * @param another another chromosome to compare
-     * @return
-     * <ul>
-     *   <li>-1 if <code>another</code> is better than <code>this</code></li>
-     *   <li>1 if <code>another</code> is worse than <code>this</code></li>
-     *   <li>0 if the two chromosomes have the same fitness</li>
-     * </ul>
-     */
-    public int compareTo(final Chromosome another) {
-        return Double.compare(getFitness(), another.getFitness());
-    }
-
-    /**
-     * Returns <code>true</code> iff <code>another</code> has the same representation and therefore the same fitness. By
-     * default, it returns false -- override it in your implementation if you need it.
-     *
-     * @param another chromosome to compare
-     * @return true if <code>another</code> is equivalent to this chromosome
-     */
-    protected boolean isSame(final Chromosome another) {
-        return false;
-    }
-
-    /**
-     * Searches the <code>population</code> for another chromosome with the same representation. If such chromosome is
-     * found, it is returned, if no such chromosome exists, returns <code>null</code>.
-     *
-     * @param population Population to search
-     * @return Chromosome with the same representation, or <code>null</code> if no such chromosome exists.
-     */
-    protected Chromosome findSameChromosome(final Population population) {
-        for (Chromosome anotherChr : population) {
-            if (this.isSame(anotherChr)) {
-                return anotherChr;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Searches the population for a chromosome representing the same solution, and if it finds one,
-     * updates the fitness to its value.
-     *
-     * @param population Population to search
-     */
-    public void searchForFitnessUpdate(final Population population) {
-        Chromosome sameChromosome = findSameChromosome(population);
-        if (sameChromosome != null) {
-            fitness = sameChromosome.getFitness();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java b/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java
deleted file mode 100644
index ef8769d..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/ChromosomePair.java
+++ /dev/null
@@ -1,65 +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.genetics;
-
-/**
- * A pair of {@link Chromosome} objects.
- * @since 2.0
- *
- */
-public class ChromosomePair {
-    /** the first chromosome in the pair. */
-    private final Chromosome first;
-
-    /** the second chromosome in the pair. */
-    private final Chromosome second;
-
-    /**
-     * Create a chromosome pair.
-     *
-     * @param c1 the first chromosome.
-     * @param c2 the second chromosome.
-     */
-    public ChromosomePair(final Chromosome c1, final Chromosome c2) {
-        super();
-        first = c1;
-        second = c2;
-    }
-
-    /**
-     * Access the first chromosome.
-     *
-     * @return the first chromosome.
-     */
-    public Chromosome getFirst() {
-        return first;
-    }
-
-    /**
-     * Access the second chromosome.
-     *
-     * @return the second chromosome.
-     */
-    public Chromosome getSecond() {
-        return second;
-    }
-
-    @Override
-    public String toString() {
-        return String.format("(%s,%s)", getFirst(), getSecond());
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java b/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java
deleted file mode 100644
index 9af56f1..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/CrossoverPolicy.java
+++ /dev/null
@@ -1,38 +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.genetics;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-/**
- * Policy used to create a pair of new chromosomes by performing a crossover
- * operation on a source pair of chromosomes.
- *
- * @since 2.0
- */
-public interface CrossoverPolicy {
-
-    /**
-     * Perform a crossover operation on the given chromosomes.
-     *
-     * @param first the first chromosome.
-     * @param second the second chromosome.
-     * @return the pair of new chromosomes that resulted from the crossover.
-     * @throws MathIllegalArgumentException if the given chromosomes are not compatible with this {@link CrossoverPolicy}
-     */
-    ChromosomePair crossover(Chromosome first, Chromosome second) throws MathIllegalArgumentException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/CycleCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/CycleCrossover.java b/src/main/java/org/apache/commons/math3/genetics/CycleCrossover.java
deleted file mode 100644
index 364b16b..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/CycleCrossover.java
+++ /dev/null
@@ -1,182 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Cycle Crossover [CX] builds offspring from <b>ordered</b> chromosomes by identifying cycles
- * between two parent chromosomes. To form the children, the cycles are copied from the
- * respective parents.
- * <p>
- * To form a cycle the following procedure is applied:
- * <ol>
- *   <li>start with the first gene of parent 1</li>
- *   <li>look at the gene at the same position of parent 2</li>
- *   <li>go to the position with the same gene in parent 1</li>
- *   <li>add this gene index to the cycle</li>
- *   <li>repeat the steps 2-5 until we arrive at the starting gene of this cycle</li>
- * </ol>
- * The indices that form a cycle are then used to form the children in alternating order, i.e.
- * in cycle 1, the genes of parent 1 are copied to child 1, while in cycle 2 the genes of parent 1
- * are copied to child 2, and so forth ...
- * </p>
- *
- * Example (zero-start cycle):
- * <pre>
- * p1 = (8 4 7 3 6 2 5 1 9 0)    X   c1 = (8 1 2 3 4 5 6 7 9 0)
- * p2 = (0 1 2 3 4 5 6 7 8 9)    X   c2 = (0 4 7 3 6 2 5 1 8 9)
- *
- * cycle 1: 8 0 9
- * cycle 2: 4 1 7 2 5 6
- * cycle 3: 3
- * </pre>
- *
- * This policy works only on {@link AbstractListChromosome}, and therefore it
- * is parameterized by T. Moreover, the chromosomes must have same lengths.
- *
- * @see <a href="http://www.rubicite.com/Tutorials/GeneticAlgorithms/CrossoverOperators/CycleCrossoverOperator.aspx">
- * Cycle Crossover Operator</a>
- *
- * @param <T> generic type of the {@link AbstractListChromosome}s for crossover
- * @since 3.1
- */
-public class CycleCrossover<T> implements CrossoverPolicy {
-
-    /** If the start index shall be chosen randomly. */
-    private final boolean randomStart;
-
-    /**
-     * Creates a new {@link CycleCrossover} policy.
-     */
-    public CycleCrossover() {
-        this(false);
-    }
-
-    /**
-     * Creates a new {@link CycleCrossover} policy using the given {@code randomStart} behavior.
-     *
-     * @param randomStart whether the start index shall be chosen randomly or be set to 0
-     */
-    public CycleCrossover(final boolean randomStart) {
-        this.randomStart = randomStart;
-    }
-
-    /**
-     * Returns whether the starting index is chosen randomly or set to zero.
-     *
-     * @return {@code true} if the starting index is chosen randomly, {@code false} otherwise
-     */
-    public boolean isRandomStart() {
-        return randomStart;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws MathIllegalArgumentException if the chromosomes are not an instance of {@link AbstractListChromosome}
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    @SuppressWarnings("unchecked")
-    public ChromosomePair crossover(final Chromosome first, final Chromosome second)
-        throws DimensionMismatchException, MathIllegalArgumentException {
-
-        if (!(first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
-        }
-        return mate((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
-    }
-
-    /**
-     * Helper for {@link #crossover(Chromosome, Chromosome)}. Performs the actual crossover.
-     *
-     * @param first the first chromosome
-     * @param second the second chromosome
-     * @return the pair of new chromosomes that resulted from the crossover
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    protected ChromosomePair mate(final AbstractListChromosome<T> first, final AbstractListChromosome<T> second)
-        throws DimensionMismatchException {
-
-        final int length = first.getLength();
-        if (length != second.getLength()) {
-            throw new DimensionMismatchException(second.getLength(), length);
-        }
-
-        // array representations of the parents
-        final List<T> parent1Rep = first.getRepresentation();
-        final List<T> parent2Rep = second.getRepresentation();
-        // and of the children: do a crossover copy to simplify the later processing
-        final List<T> child1Rep = new ArrayList<T>(second.getRepresentation());
-        final List<T> child2Rep = new ArrayList<T>(first.getRepresentation());
-
-        // the set of all visited indices so far
-        final Set<Integer> visitedIndices = new HashSet<Integer>(length);
-        // the indices of the current cycle
-        final List<Integer> indices = new ArrayList<Integer>(length);
-
-        // determine the starting index
-        int idx = randomStart ? GeneticAlgorithm.getRandomGenerator().nextInt(length) : 0;
-        int cycle = 1;
-
-        while (visitedIndices.size() < length) {
-            indices.add(idx);
-
-            T item = parent2Rep.get(idx);
-            idx = parent1Rep.indexOf(item);
-
-            while (idx != indices.get(0)) {
-                // add that index to the cycle indices
-                indices.add(idx);
-                // get the item in the second parent at that index
-                item = parent2Rep.get(idx);
-                // get the index of that item in the first parent
-                idx = parent1Rep.indexOf(item);
-            }
-
-            // for even cycles: swap the child elements on the indices found in this cycle
-            if (cycle++ % 2 != 0) {
-                for (int i : indices) {
-                    T tmp = child1Rep.get(i);
-                    child1Rep.set(i, child2Rep.get(i));
-                    child2Rep.set(i, tmp);
-                }
-            }
-
-            visitedIndices.addAll(indices);
-            // find next starting index: last one + 1 until we find an unvisited index
-            idx = (indices.get(0) + 1) % length;
-            while (visitedIndices.contains(idx) && visitedIndices.size() < length) {
-                idx++;
-                if (idx >= length) {
-                    idx = 0;
-                }
-            }
-            indices.clear();
-        }
-
-        return new ChromosomePair(first.newFixedLengthChromosome(child1Rep),
-                                  second.newFixedLengthChromosome(child2Rep));
-    }
-}


[38/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/SecantSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/SecantSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/SecantSolver.java
deleted file mode 100644
index d866cf8..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/SecantSolver.java
+++ /dev/null
@@ -1,135 +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.analysis.solvers;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Implements the <em>Secant</em> method for root-finding (approximating a
- * zero of a univariate real function). The solution that is maintained is
- * not bracketed, and as such convergence is not guaranteed.
- *
- * <p>Implementation based on the following article: M. Dowell and P. Jarratt,
- * <em>A modified regula falsi method for computing the root of an
- * equation</em>, BIT Numerical Mathematics, volume 11, number 2,
- * pages 168-174, Springer, 1971.</p>
- *
- * <p>Note that since release 3.0 this class implements the actual
- * <em>Secant</em> algorithm, and not a modified one. As such, the 3.0 version
- * is not backwards compatible with previous versions. To use an algorithm
- * similar to the pre-3.0 releases, use the
- * {@link IllinoisSolver <em>Illinois</em>} algorithm or the
- * {@link PegasusSolver <em>Pegasus</em>} algorithm.</p>
- *
- */
-public class SecantSolver extends AbstractUnivariateSolver {
-
-    /** Default absolute accuracy. */
-    protected static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /** Construct a solver with default accuracy (1e-6). */
-    public SecantSolver() {
-        super(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy absolute accuracy
-     */
-    public SecantSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy relative accuracy
-     * @param absoluteAccuracy absolute accuracy
-     */
-    public SecantSolver(final double relativeAccuracy,
-                        final double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected final double doSolve()
-        throws TooManyEvaluationsException,
-               NoBracketingException {
-        // Get initial solution
-        double x0 = getMin();
-        double x1 = getMax();
-        double f0 = computeObjectiveValue(x0);
-        double f1 = computeObjectiveValue(x1);
-
-        // If one of the bounds is the exact root, return it. Since these are
-        // not under-approximations or over-approximations, we can return them
-        // regardless of the allowed solutions.
-        if (f0 == 0.0) {
-            return x0;
-        }
-        if (f1 == 0.0) {
-            return x1;
-        }
-
-        // Verify bracketing of initial solution.
-        verifyBracketing(x0, x1);
-
-        // Get accuracies.
-        final double ftol = getFunctionValueAccuracy();
-        final double atol = getAbsoluteAccuracy();
-        final double rtol = getRelativeAccuracy();
-
-        // Keep finding better approximations.
-        while (true) {
-            // Calculate the next approximation.
-            final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
-            final double fx = computeObjectiveValue(x);
-
-            // If the new approximation is the exact root, return it. Since
-            // this is not an under-approximation or an over-approximation,
-            // we can return it regardless of the allowed solutions.
-            if (fx == 0.0) {
-                return x;
-            }
-
-            // Update the bounds with the new approximation.
-            x0 = x1;
-            f0 = f1;
-            x1 = x;
-            f1 = fx;
-
-            // If the function value of the last approximation is too small,
-            // given the function value accuracy, then we can't get closer to
-            // the root than we already are.
-            if (FastMath.abs(f1) <= ftol) {
-                return x1;
-            }
-
-            // If the current interval is within the given accuracies, we
-            // are satisfied with the current approximation.
-            if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1), atol)) {
-                return x1;
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateDifferentiableSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateDifferentiableSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateDifferentiableSolver.java
deleted file mode 100644
index 82bbead..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateDifferentiableSolver.java
+++ /dev/null
@@ -1,29 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-
-
-/**
- * Interface for (univariate real) rootfinding algorithms.
- * Implementations will search for only one zero in the given interval.
- *
- * @since 3.1
- */
-public interface UnivariateDifferentiableSolver
-    extends BaseUnivariateSolver<UnivariateDifferentiableFunction> {}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolver.java
deleted file mode 100644
index 484e67a..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolver.java
+++ /dev/null
@@ -1,28 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-
-
-/**
- * Interface for (univariate real) root-finding algorithms.
- * Implementations will search for only one zero in the given interval.
- *
- */
-public interface UnivariateSolver
-    extends BaseUnivariateSolver<UnivariateFunction> {}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.java b/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.java
deleted file mode 100644
index 4c2dd90..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/UnivariateSolverUtils.java
+++ /dev/null
@@ -1,465 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Utility routines for {@link UnivariateSolver} objects.
- *
- */
-public class UnivariateSolverUtils {
-    /**
-     * Class contains only static methods.
-     */
-    private UnivariateSolverUtils() {}
-
-    /**
-     * Convenience method to find a zero of a univariate real function.  A default
-     * solver is used.
-     *
-     * @param function Function.
-     * @param x0 Lower bound for the interval.
-     * @param x1 Upper bound for the interval.
-     * @return a value where the function is zero.
-     * @throws NoBracketingException if the function has the same sign at the
-     * endpoints.
-     * @throws NullArgumentException if {@code function} is {@code null}.
-     */
-    public static double solve(UnivariateFunction function, double x0, double x1)
-        throws NullArgumentException,
-               NoBracketingException {
-        if (function == null) {
-            throw new NullArgumentException(LocalizedFormats.FUNCTION);
-        }
-        final UnivariateSolver solver = new BrentSolver();
-        return solver.solve(Integer.MAX_VALUE, function, x0, x1);
-    }
-
-    /**
-     * Convenience method to find a zero of a univariate real function.  A default
-     * solver is used.
-     *
-     * @param function Function.
-     * @param x0 Lower bound for the interval.
-     * @param x1 Upper bound for the interval.
-     * @param absoluteAccuracy Accuracy to be used by the solver.
-     * @return a value where the function is zero.
-     * @throws NoBracketingException if the function has the same sign at the
-     * endpoints.
-     * @throws NullArgumentException if {@code function} is {@code null}.
-     */
-    public static double solve(UnivariateFunction function,
-                               double x0, double x1,
-                               double absoluteAccuracy)
-        throws NullArgumentException,
-               NoBracketingException {
-        if (function == null) {
-            throw new NullArgumentException(LocalizedFormats.FUNCTION);
-        }
-        final UnivariateSolver solver = new BrentSolver(absoluteAccuracy);
-        return solver.solve(Integer.MAX_VALUE, function, x0, x1);
-    }
-
-    /** Force a root found by a non-bracketing solver to lie on a specified side,
-     * as if the solver was a bracketing one.
-     * @param maxEval maximal number of new evaluations of the function
-     * (evaluations already done for finding the root should have already been subtracted
-     * from this number)
-     * @param f function to solve
-     * @param bracketing bracketing solver to use for shifting the root
-     * @param baseRoot original root found by a previous non-bracketing solver
-     * @param min minimal bound of the search interval
-     * @param max maximal bound of the search interval
-     * @param allowedSolution the kind of solutions that the root-finding algorithm may
-     * accept as solutions.
-     * @return a root approximation, on the specified side of the exact root
-     * @throws NoBracketingException if the function has the same sign at the
-     * endpoints.
-     */
-    public static double forceSide(final int maxEval, final UnivariateFunction f,
-                                   final BracketedUnivariateSolver<UnivariateFunction> bracketing,
-                                   final double baseRoot, final double min, final double max,
-                                   final AllowedSolution allowedSolution)
-        throws NoBracketingException {
-
-        if (allowedSolution == AllowedSolution.ANY_SIDE) {
-            // no further bracketing required
-            return baseRoot;
-        }
-
-        // find a very small interval bracketing the root
-        final double step = FastMath.max(bracketing.getAbsoluteAccuracy(),
-                                         FastMath.abs(baseRoot * bracketing.getRelativeAccuracy()));
-        double xLo        = FastMath.max(min, baseRoot - step);
-        double fLo        = f.value(xLo);
-        double xHi        = FastMath.min(max, baseRoot + step);
-        double fHi        = f.value(xHi);
-        int remainingEval = maxEval - 2;
-        while (remainingEval > 0) {
-
-            if ((fLo >= 0 && fHi <= 0) || (fLo <= 0 && fHi >= 0)) {
-                // compute the root on the selected side
-                return bracketing.solve(remainingEval, f, xLo, xHi, baseRoot, allowedSolution);
-            }
-
-            // try increasing the interval
-            boolean changeLo = false;
-            boolean changeHi = false;
-            if (fLo < fHi) {
-                // increasing function
-                if (fLo >= 0) {
-                    changeLo = true;
-                } else {
-                    changeHi = true;
-                }
-            } else if (fLo > fHi) {
-                // decreasing function
-                if (fLo <= 0) {
-                    changeLo = true;
-                } else {
-                    changeHi = true;
-                }
-            } else {
-                // unknown variation
-                changeLo = true;
-                changeHi = true;
-            }
-
-            // update the lower bound
-            if (changeLo) {
-                xLo = FastMath.max(min, xLo - step);
-                fLo  = f.value(xLo);
-                remainingEval--;
-            }
-
-            // update the higher bound
-            if (changeHi) {
-                xHi = FastMath.min(max, xHi + step);
-                fHi  = f.value(xHi);
-                remainingEval--;
-            }
-
-        }
-
-        throw new NoBracketingException(LocalizedFormats.FAILED_BRACKETING,
-                                        xLo, xHi, fLo, fHi,
-                                        maxEval - remainingEval, maxEval, baseRoot,
-                                        min, max);
-
-    }
-
-    /**
-     * This method simply calls {@link #bracket(UnivariateFunction, double, double, double,
-     * double, double, int) bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)}
-     * with {@code q} and {@code r} set to 1.0 and {@code maximumIterations} set to {@code Integer.MAX_VALUE}.
-     * <strong>Note: </strong> this method can take
-     * <code>Integer.MAX_VALUE</code> iterations to throw a
-     * <code>ConvergenceException.</code>  Unless you are confident that there
-     * is a root between <code>lowerBound</code> and <code>upperBound</code>
-     * near <code>initial,</code> it is better to use
-     * {@link #bracket(UnivariateFunction, double, double, double, double,
-     * double, int) bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)},
-     * explicitly specifying the maximum number of iterations.</p>
-     *
-     * @param function Function.
-     * @param initial Initial midpoint of interval being expanded to
-     * bracket a root.
-     * @param lowerBound Lower bound (a is never lower than this value)
-     * @param upperBound Upper bound (b never is greater than this
-     * value).
-     * @return a two-element array holding a and b.
-     * @throws NoBracketingException if a root cannot be bracketted.
-     * @throws NotStrictlyPositiveException if {@code maximumIterations <= 0}.
-     * @throws NullArgumentException if {@code function} is {@code null}.
-     */
-    public static double[] bracket(UnivariateFunction function,
-                                   double initial,
-                                   double lowerBound, double upperBound)
-        throws NullArgumentException,
-               NotStrictlyPositiveException,
-               NoBracketingException {
-        return bracket(function, initial, lowerBound, upperBound, 1.0, 1.0, Integer.MAX_VALUE);
-    }
-
-     /**
-     * This method simply calls {@link #bracket(UnivariateFunction, double, double, double,
-     * double, double, int) bracket(function, initial, lowerBound, upperBound, q, r, maximumIterations)}
-     * with {@code q} and {@code r} set to 1.0.
-     * @param function Function.
-     * @param initial Initial midpoint of interval being expanded to
-     * bracket a root.
-     * @param lowerBound Lower bound (a is never lower than this value).
-     * @param upperBound Upper bound (b never is greater than this
-     * value).
-     * @param maximumIterations Maximum number of iterations to perform
-     * @return a two element array holding a and b.
-     * @throws NoBracketingException if the algorithm fails to find a and b
-     * satisfying the desired conditions.
-     * @throws NotStrictlyPositiveException if {@code maximumIterations <= 0}.
-     * @throws NullArgumentException if {@code function} is {@code null}.
-     */
-    public static double[] bracket(UnivariateFunction function,
-                                   double initial,
-                                   double lowerBound, double upperBound,
-                                   int maximumIterations)
-        throws NullArgumentException,
-               NotStrictlyPositiveException,
-               NoBracketingException {
-        return bracket(function, initial, lowerBound, upperBound, 1.0, 1.0, maximumIterations);
-    }
-
-    /**
-     * This method attempts to find two values a and b satisfying <ul>
-     * <li> {@code lowerBound <= a < initial < b <= upperBound} </li>
-     * <li> {@code f(a) * f(b) <= 0} </li>
-     * </ul>
-     * If {@code f} is continuous on {@code [a,b]}, this means that {@code a}
-     * and {@code b} bracket a root of {@code f}.
-     * <p>
-     * The algorithm checks the sign of \( f(l_k) \) and \( f(u_k) \) for increasing
-     * values of k, where \( l_k = max(lower, initial - \delta_k) \),
-     * \( u_k = min(upper, initial + \delta_k) \), using recurrence
-     * \( \delta_{k+1} = r \delta_k + q, \delta_0 = 0\) and starting search with \( k=1 \).
-     * The algorithm stops when one of the following happens: <ul>
-     * <li> at least one positive and one negative value have been found --  success!</li>
-     * <li> both endpoints have reached their respective limites -- NoBracketingException </li>
-     * <li> {@code maximumIterations} iterations elapse -- NoBracketingException </li></ul></p>
-     * <p>
-     * If different signs are found at first iteration ({@code k=1}), then the returned
-     * interval will be \( [a, b] = [l_1, u_1] \). If different signs are found at a later
-     * iteration ({code k>1}, then the returned interval will be either
-     * \( [a, b] = [l_{k+1}, l_{k}] \) or \( [a, b] = [u_{k}, u_{k+1}] \). A root solver called
-     * with these parameters will therefore start with the smallest bracketing interval known
-     * at this step.
-     * </p>
-     * <p>
-     * Interval expansion rate is tuned by changing the recurrence parameters {@code r} and
-     * {@code q}. When the multiplicative factor {@code r} is set to 1, the sequence is a
-     * simple arithmetic sequence with linear increase. When the multiplicative factor {@code r}
-     * is larger than 1, the sequence has an asymtotically exponential rate. Note than the
-     * additive parameter {@code q} should never be set to zero, otherwise the interval would
-     * degenerate to the single initial point for all values of {@code k}.
-     * </p>
-     * <p>
-     * As a rule of thumb, when the location of the root is expected to be approximately known
-     * within some error margin, {@code r} should be set to 1 and {@code q} should be set to the
-     * order of magnitude of the error margin. When the location of the root is really a wild guess,
-     * then {@code r} should be set to a value larger than 1 (typically 2 to double the interval
-     * length at each iteration) and {@code q} should be set according to half the initial
-     * search interval length.
-     * </p>
-     * <p>
-     * As an example, if we consider the trivial function {@code f(x) = 1 - x} and use
-     * {@code initial = 4}, {@code r = 1}, {@code q = 2}, the algorithm will compute
-     * {@code f(4-2) = f(2) = -1} and {@code f(4+2) = f(6) = -5} for {@code k = 1}, then
-     * {@code f(4-4) = f(0) = +1} and {@code f(4+4) = f(8) = -7} for {@code k = 2}. Then it will
-     * return the interval {@code [0, 2]} as the smallest one known to be bracketing the root.
-     * As shown by this example, the initial value (here {@code 4}) may lie outside of the returned
-     * bracketing interval.
-     * </p>
-     * @param function function to check
-     * @param initial Initial midpoint of interval being expanded to
-     * bracket a root.
-     * @param lowerBound Lower bound (a is never lower than this value).
-     * @param upperBound Upper bound (b never is greater than this
-     * value).
-     * @param q additive offset used to compute bounds sequence (must be strictly positive)
-     * @param r multiplicative factor used to compute bounds sequence
-     * @param maximumIterations Maximum number of iterations to perform
-     * @return a two element array holding the bracketing values.
-     * @exception NoBracketingException if function cannot be bracketed in the search interval
-     */
-    public static double[] bracket(final UnivariateFunction function, final double initial,
-                                   final double lowerBound, final double upperBound,
-                                   final double q, final double r, final int maximumIterations)
-        throws NoBracketingException {
-
-        if (function == null) {
-            throw new NullArgumentException(LocalizedFormats.FUNCTION);
-        }
-        if (q <= 0)  {
-            throw new NotStrictlyPositiveException(q);
-        }
-        if (maximumIterations <= 0)  {
-            throw new NotStrictlyPositiveException(LocalizedFormats.INVALID_MAX_ITERATIONS, maximumIterations);
-        }
-        verifySequence(lowerBound, initial, upperBound);
-
-        // initialize the recurrence
-        double a     = initial;
-        double b     = initial;
-        double fa    = Double.NaN;
-        double fb    = Double.NaN;
-        double delta = 0;
-
-        for (int numIterations = 0;
-             (numIterations < maximumIterations) && (a > lowerBound || b > upperBound);
-             ++numIterations) {
-
-            final double previousA  = a;
-            final double previousFa = fa;
-            final double previousB  = b;
-            final double previousFb = fb;
-
-            delta = r * delta + q;
-            a     = FastMath.max(initial - delta, lowerBound);
-            b     = FastMath.min(initial + delta, upperBound);
-            fa    = function.value(a);
-            fb    = function.value(b);
-
-            if (numIterations == 0) {
-                // at first iteration, we don't have a previous interval
-                // we simply compare both sides of the initial interval
-                if (fa * fb <= 0) {
-                    // the first interval already brackets a root
-                    return new double[] { a, b };
-                }
-            } else {
-                // we have a previous interval with constant sign and expand it,
-                // we expect sign changes to occur at boundaries
-                if (fa * previousFa <= 0) {
-                    // sign change detected at near lower bound
-                    return new double[] { a, previousA };
-                } else if (fb * previousFb <= 0) {
-                    // sign change detected at near upper bound
-                    return new double[] { previousB, b };
-                }
-            }
-
-        }
-
-        // no bracketing found
-        throw new NoBracketingException(a, b, fa, fb);
-
-    }
-
-    /**
-     * Compute the midpoint of two values.
-     *
-     * @param a first value.
-     * @param b second value.
-     * @return the midpoint.
-     */
-    public static double midpoint(double a, double b) {
-        return (a + b) * 0.5;
-    }
-
-    /**
-     * Check whether the interval bounds bracket a root. That is, if the
-     * values at the endpoints are not equal to zero, then the function takes
-     * opposite signs at the endpoints.
-     *
-     * @param function Function.
-     * @param lower Lower endpoint.
-     * @param upper Upper endpoint.
-     * @return {@code true} if the function values have opposite signs at the
-     * given points.
-     * @throws NullArgumentException if {@code function} is {@code null}.
-     */
-    public static boolean isBracketing(UnivariateFunction function,
-                                       final double lower,
-                                       final double upper)
-        throws NullArgumentException {
-        if (function == null) {
-            throw new NullArgumentException(LocalizedFormats.FUNCTION);
-        }
-        final double fLo = function.value(lower);
-        final double fHi = function.value(upper);
-        return (fLo >= 0 && fHi <= 0) || (fLo <= 0 && fHi >= 0);
-    }
-
-    /**
-     * Check whether the arguments form a (strictly) increasing sequence.
-     *
-     * @param start First number.
-     * @param mid Second number.
-     * @param end Third number.
-     * @return {@code true} if the arguments form an increasing sequence.
-     */
-    public static boolean isSequence(final double start,
-                                     final double mid,
-                                     final double end) {
-        return (start < mid) && (mid < end);
-    }
-
-    /**
-     * Check that the endpoints specify an interval.
-     *
-     * @param lower Lower endpoint.
-     * @param upper Upper endpoint.
-     * @throws NumberIsTooLargeException if {@code lower >= upper}.
-     */
-    public static void verifyInterval(final double lower,
-                                      final double upper)
-        throws NumberIsTooLargeException {
-        if (lower >= upper) {
-            throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
-                                                lower, upper, false);
-        }
-    }
-
-    /**
-     * Check that {@code lower < initial < upper}.
-     *
-     * @param lower Lower endpoint.
-     * @param initial Initial value.
-     * @param upper Upper endpoint.
-     * @throws NumberIsTooLargeException if {@code lower >= initial} or
-     * {@code initial >= upper}.
-     */
-    public static void verifySequence(final double lower,
-                                      final double initial,
-                                      final double upper)
-        throws NumberIsTooLargeException {
-        verifyInterval(lower, initial);
-        verifyInterval(initial, upper);
-    }
-
-    /**
-     * Check that the endpoints specify an interval and the end points
-     * bracket a root.
-     *
-     * @param function Function.
-     * @param lower Lower endpoint.
-     * @param upper Upper endpoint.
-     * @throws NoBracketingException if the function has the same sign at the
-     * endpoints.
-     * @throws NullArgumentException if {@code function} is {@code null}.
-     */
-    public static void verifyBracketing(UnivariateFunction function,
-                                        final double lower,
-                                        final double upper)
-        throws NullArgumentException,
-               NoBracketingException {
-        if (function == null) {
-            throw new NullArgumentException(LocalizedFormats.FUNCTION);
-        }
-        verifyInterval(lower, upper);
-        if (!isBracketing(function, lower, upper)) {
-            throw new NoBracketingException(lower, upper,
-                                            function.value(lower),
-                                            function.value(upper));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/package-info.java b/src/main/java/org/apache/commons/math3/analysis/solvers/package-info.java
deleted file mode 100644
index eb15fbc..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-/**
- *
- *     Root finding algorithms, for univariate real functions.
- *
- */
-package org.apache.commons.math3.analysis.solvers;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/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
deleted file mode 100644
index c8bd211..0000000
--- a/src/main/java/org/apache/commons/math3/complex/Complex.java
+++ /dev/null
@@ -1,1318 +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.complex;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * Representation of a Complex number, i.e. a number which has both a
- * real and imaginary part.
- * <br/>
- * 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
- * a {@code NaN} in either real or imaginary part, e.g. the following are
- * considered equal:
- * <ul>
- *  <li>{@code 1 + NaNi}</li>
- *  <li>{@code NaN + i}</li>
- *  <li>{@code NaN + NaNi}</li>
- * </ul>
- * Note that this is in contradiction with 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.
- * <br/>
- * Implements Serializable since 2.0
- *
- */
-public class Complex implements FieldElement<Complex>, Serializable  {
-    /** The square root of -1. A number representing "0.0 + 1.0i" */
-    public static final Complex I = new Complex(0.0, 1.0);
-    // CHECKSTYLE: stop ConstantName
-    /** A complex number representing "NaN + NaNi" */
-    public static final Complex NaN = new Complex(Double.NaN, Double.NaN);
-    // CHECKSTYLE: resume ConstantName
-    /** A complex number representing "+INF + INFi" */
-    public static final Complex INF = new Complex(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
-    /** A complex number representing "1.0 + 0.0i" */
-    public static final Complex ONE = new Complex(1.0, 0.0);
-    /** A complex number representing "0.0 + 0.0i" */
-    public static final Complex ZERO = new Complex(0.0, 0.0);
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -6195664516687396620L;
-
-    /** The imaginary part. */
-    private final double imaginary;
-    /** The real part. */
-    private final double real;
-    /** Record whether this complex number is equal to NaN. */
-    private final transient boolean isNaN;
-    /** Record whether this complex number is infinite. */
-    private final transient boolean isInfinite;
-
-    /**
-     * Create a complex number given only the real part.
-     *
-     * @param real Real part.
-     */
-    public Complex(double real) {
-        this(real, 0.0);
-    }
-
-    /**
-     * Create a complex number given the real and imaginary parts.
-     *
-     * @param real Real part.
-     * @param imaginary Imaginary part.
-     */
-    public Complex(double real, double imaginary) {
-        this.real = real;
-        this.imaginary = imaginary;
-
-        isNaN = Double.isNaN(real) || Double.isNaN(imaginary);
-        isInfinite = !isNaN &&
-            (Double.isInfinite(real) || Double.isInfinite(imaginary));
-    }
-
-    /**
-     * Return the absolute value of this complex number.
-     * Returns {@code NaN} if either real or imaginary part is {@code NaN}
-     * and {@code Double.POSITIVE_INFINITY} if neither part is {@code NaN},
-     * but at least one part is infinite.
-     *
-     * @return the absolute value.
-     */
-    public double abs() {
-        if (isNaN) {
-            return Double.NaN;
-        }
-        if (isInfinite()) {
-            return Double.POSITIVE_INFINITY;
-        }
-        if (FastMath.abs(real) < FastMath.abs(imaginary)) {
-            if (imaginary == 0.0) {
-                return FastMath.abs(real);
-            }
-            double q = real / imaginary;
-            return FastMath.abs(imaginary) * FastMath.sqrt(1 + q * q);
-        } else {
-            if (real == 0.0) {
-                return FastMath.abs(imaginary);
-            }
-            double q = imaginary / real;
-            return FastMath.abs(real) * FastMath.sqrt(1 + q * q);
-        }
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is
-     * {@code (this + addend)}.
-     * Uses the definitional formula
-     * <pre>
-     *  <code>
-     *   (a + bi) + (c + di) = (a+c) + (b+d)i
-     *  </code>
-     * </pre>
-     * <br/>
-     * 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
-     * according to the rules for {@link java.lang.Double} arithmetic.
-     *
-     * @param  addend Value to be added to this {@code Complex}.
-     * @return {@code this + addend}.
-     * @throws NullArgumentException if {@code addend} is {@code null}.
-     */
-    public Complex add(Complex addend) throws NullArgumentException {
-        MathUtils.checkNotNull(addend);
-        if (isNaN || addend.isNaN) {
-            return NaN;
-        }
-
-        return createComplex(real + addend.getReal(),
-                             imaginary + addend.getImaginary());
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is {@code (this + addend)},
-     * with {@code addend} interpreted as a real number.
-     *
-     * @param addend Value to be added to this {@code Complex}.
-     * @return {@code this + addend}.
-     * @see #add(Complex)
-     */
-    public Complex add(double addend) {
-        if (isNaN || Double.isNaN(addend)) {
-            return NaN;
-        }
-
-        return createComplex(real + addend, imaginary);
-    }
-
-     /**
-     * Return the conjugate of this complex number.
-     * The conjugate of {@code a + bi} is {@code a - bi}.
-     * <br/>
-     * {@link #NaN} is returned if either the real or imaginary
-     * part of this Complex number equals {@code Double.NaN}.
-     * <br/>
-     * 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() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return createComplex(real, -imaginary);
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is
-     * {@code (this / divisor)}.
-     * Implements the definitional formula
-     * <pre>
-     *  <code>
-     *    a + bi          ac + bd + (bc - ad)i
-     *    ----------- = -------------------------
-     *    c + di         c<sup>2</sup> + d<sup>2</sup>
-     *  </code>
-     * </pre>
-     * but uses
-     * <a href="http://doi.acm.org/10.1145/1039813.1039814">
-     * prescaling of operands</a> to limit the effects of overflows and
-     * underflows in the computation.
-     * <br/>
-     * {@code Infinite} and {@code NaN} values are handled according to the
-     * following rules, applied in the order presented:
-     * <ul>
-     *  <li>If either {@code this} or {@code divisor} has a {@code NaN} value
-     *   in either part, {@link #NaN} is returned.
-     *  </li>
-     *  <li>If {@code divisor} equals {@link #ZERO}, {@link #NaN} is returned.
-     *  </li>
-     *  <li>If {@code this} and {@code divisor} are both infinite,
-     *   {@link #NaN} is returned.
-     *  </li>
-     *  <li>If {@code this} is finite (i.e., has no {@code Infinite} or
-     *   {@code NaN} parts) and {@code divisor} is infinite (one or both parts
-     *   infinite), {@link #ZERO} is returned.
-     *  </li>
-     *  <li>If {@code this} is infinite and {@code divisor} is finite,
-     *   {@code NaN} values are returned in the parts of the result if the
-     *   {@link java.lang.Double} rules applied to the definitional formula
-     *   force {@code NaN} results.
-     *  </li>
-     * </ul>
-     *
-     * @param divisor Value by which this {@code Complex} is to be divided.
-     * @return {@code this / divisor}.
-     * @throws NullArgumentException if {@code divisor} is {@code null}.
-     */
-    public Complex divide(Complex divisor)
-        throws NullArgumentException {
-        MathUtils.checkNotNull(divisor);
-        if (isNaN || divisor.isNaN) {
-            return NaN;
-        }
-
-        final double c = divisor.getReal();
-        final double d = divisor.getImaginary();
-        if (c == 0.0 && d == 0.0) {
-            return NaN;
-        }
-
-        if (divisor.isInfinite() && !isInfinite()) {
-            return ZERO;
-        }
-
-        if (FastMath.abs(c) < FastMath.abs(d)) {
-            double q = c / d;
-            double denominator = c * q + d;
-            return createComplex((real * q + imaginary) / denominator,
-                (imaginary * q - real) / denominator);
-        } else {
-            double q = d / c;
-            double denominator = d * q + c;
-            return createComplex((imaginary * q + real) / denominator,
-                (imaginary - real * q) / denominator);
-        }
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is {@code (this / divisor)},
-     * with {@code divisor} interpreted as a real number.
-     *
-     * @param  divisor Value by which this {@code Complex} is to be divided.
-     * @return {@code this / divisor}.
-     * @see #divide(Complex)
-     */
-    public Complex divide(double divisor) {
-        if (isNaN || Double.isNaN(divisor)) {
-            return NaN;
-        }
-        if (divisor == 0d) {
-            return NaN;
-        }
-        if (Double.isInfinite(divisor)) {
-            return !isInfinite() ? ZERO : NaN;
-        }
-        return createComplex(real / divisor,
-                             imaginary  / divisor);
-    }
-
-    /** {@inheritDoc} */
-    public Complex reciprocal() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        if (real == 0.0 && imaginary == 0.0) {
-            return INF;
-        }
-
-        if (isInfinite) {
-            return ZERO;
-        }
-
-        if (FastMath.abs(real) < FastMath.abs(imaginary)) {
-            double q = real / imaginary;
-            double scale = 1. / (real * q + imaginary);
-            return createComplex(scale * q, -scale);
-        } else {
-            double q = imaginary / real;
-            double scale = 1. / (imaginary * q + real);
-            return createComplex(scale, -scale * q);
-        }
-    }
-
-    /**
-     * Test for equality with another object.
-     * If both the real and imaginary parts of two complex numbers
-     * are exactly the same, and neither is {@code Double.NaN}, the two
-     * Complex objects are considered to be equal.
-     * The behavior is the same as for JDK's {@link Double#equals(Object)
-     * Double}:
-     * <ul>
-     *  <li>All {@code NaN} values are considered to be equal,
-     *   i.e, if either (or both) real and imaginary parts of the complex
-     *   number are equal to {@code Double.NaN}, the complex number is equal
-     *   to {@code NaN}.
-     *  </li>
-     *  <li>
-     *   Instances constructed with different representations of zero (i.e.
-     *   either "0" or "-0") are <em>not</em> considered to be equal.
-     *  </li>
-     * </ul>
-     *
-     * @param other Object to test for equality with this instance.
-     * @return {@code true} if the objects are equal, {@code false} if object
-     * is {@code null}, not an instance of {@code Complex}, or not equal to
-     * this instance.
-     */
-    @Override
-    public boolean equals(Object other) {
-        if (this == other) {
-            return true;
-        }
-        if (other instanceof Complex){
-            Complex c = (Complex) other;
-            if (c.isNaN) {
-                return isNaN;
-            } else {
-                return MathUtils.equals(real, c.real) &&
-                    MathUtils.equals(imaginary, c.imaginary);
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Test for the floating-point equality between Complex objects.
-     * It returns {@code true} if both arguments are equal or within the
-     * range of allowed error (inclusive).
-     *
-     * @param x First value (cannot be {@code null}).
-     * @param y Second value (cannot be {@code null}).
-     * @param maxUlps {@code (maxUlps - 1)} is the number of floating point
-     * values between the real (resp. imaginary) parts of {@code x} and
-     * {@code y}.
-     * @return {@code true} if there are fewer than {@code maxUlps} floating
-     * point values between the real (resp. imaginary) parts of {@code x}
-     * and {@code y}.
-     *
-     * @see Precision#equals(double,double,int)
-     * @since 3.3
-     */
-    public static boolean equals(Complex x, Complex y, int maxUlps) {
-        return Precision.equals(x.real, y.real, maxUlps) &&
-            Precision.equals(x.imaginary, y.imaginary, maxUlps);
-    }
-
-    /**
-     * Returns {@code true} iff the values are equal as defined by
-     * {@link #equals(Complex,Complex,int) equals(x, y, 1)}.
-     *
-     * @param x First value (cannot be {@code null}).
-     * @param y Second value (cannot be {@code null}).
-     * @return {@code true} if the values are equal.
-     *
-     * @since 3.3
-     */
-    public static boolean equals(Complex x, Complex y) {
-        return equals(x, y, 1);
-    }
-
-    /**
-     * 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).
-     *
-     * @param x First value (cannot be {@code null}).
-     * @param y Second value (cannot be {@code null}).
-     * @param eps Amount of allowed absolute error.
-     * @return {@code true} if the values are two adjacent floating point
-     * numbers or they are within range of each other.
-     *
-     * @see Precision#equals(double,double,double)
-     * @since 3.3
-     */
-    public static boolean equals(Complex x, Complex y, double eps) {
-        return Precision.equals(x.real, y.real, eps) &&
-            Precision.equals(x.imaginary, y.imaginary, eps);
-    }
-
-    /**
-     * 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
-     * relative difference between them is smaller or equal to the given
-     * tolerance.
-     *
-     * @param x First value (cannot be {@code null}).
-     * @param y Second value (cannot be {@code null}).
-     * @param eps Amount of allowed relative error.
-     * @return {@code true} if the values are two adjacent floating point
-     * numbers or they are within range of each other.
-     *
-     * @see Precision#equalsWithRelativeTolerance(double,double,double)
-     * @since 3.3
-     */
-    public static boolean equalsWithRelativeTolerance(Complex x, Complex y,
-                                                      double eps) {
-        return Precision.equalsWithRelativeTolerance(x.real, y.real, eps) &&
-            Precision.equalsWithRelativeTolerance(x.imaginary, y.imaginary, eps);
-    }
-
-    /**
-     * Get a hashCode for the complex number.
-     * Any {@code Double.NaN} value in real or imaginary part produces
-     * the same hash code {@code 7}.
-     *
-     * @return a hash code value for this object.
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN) {
-            return 7;
-        }
-        return 37 * (17 * MathUtils.hash(imaginary) +
-            MathUtils.hash(real));
-    }
-
-    /**
-     * Access the imaginary part.
-     *
-     * @return the imaginary part.
-     */
-    public double getImaginary() {
-        return imaginary;
-    }
-
-    /**
-     * Access the real part.
-     *
-     * @return the real part.
-     */
-    public double getReal() {
-        return real;
-    }
-
-    /**
-     * Checks whether either or both parts of this complex number is
-     * {@code NaN}.
-     *
-     * @return true if either or both parts of this complex number is
-     * {@code NaN}; false otherwise.
-     */
-    public boolean isNaN() {
-        return isNaN;
-    }
-
-    /**
-     * Checks whether either the real or imaginary part of this complex number
-     * takes an infinite value (either {@code Double.POSITIVE_INFINITY} or
-     * {@code Double.NEGATIVE_INFINITY}) and neither part
-     * is {@code NaN}.
-     *
-     * @return true if one or both parts of this complex number are infinite
-     * and neither part is {@code NaN}.
-     */
-    public boolean isInfinite() {
-        return isInfinite;
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is {@code this * factor}.
-     * Implements preliminary checks for {@code NaN} and infinity followed by
-     * the definitional formula:
-     * <pre>
-     *  <code>
-     *   (a + bi)(c + di) = (ac - bd) + (ad + bc)i
-     *  </code>
-     * </pre>
-     * Returns {@link #NaN} if either {@code this} or {@code factor} has one or
-     * more {@code NaN} parts.
-     * <br/>
-     * Returns {@link #INF} if neither {@code this} nor {@code factor} has one
-     * or more {@code NaN} parts and if either {@code this} or {@code factor}
-     * has one or more infinite parts (same result is returned regardless of
-     * the sign of the components).
-     * <br/>
-     * Returns finite values in components of the result per the definitional
-     * formula in all remaining cases.
-     *
-     * @param  factor value to be multiplied by this {@code Complex}.
-     * @return {@code this * factor}.
-     * @throws NullArgumentException if {@code factor} is {@code null}.
-     */
-    public Complex multiply(Complex factor)
-        throws NullArgumentException {
-        MathUtils.checkNotNull(factor);
-        if (isNaN || factor.isNaN) {
-            return NaN;
-        }
-        if (Double.isInfinite(real) ||
-            Double.isInfinite(imaginary) ||
-            Double.isInfinite(factor.real) ||
-            Double.isInfinite(factor.imaginary)) {
-            // we don't use isInfinite() to avoid testing for NaN again
-            return INF;
-        }
-        return createComplex(real * factor.real - imaginary * factor.imaginary,
-                             real * factor.imaginary + imaginary * factor.real);
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is {@code this * factor}, with {@code factor}
-     * interpreted as a integer number.
-     *
-     * @param  factor value to be multiplied by this {@code Complex}.
-     * @return {@code this * factor}.
-     * @see #multiply(Complex)
-     */
-    public Complex multiply(final int factor) {
-        if (isNaN) {
-            return NaN;
-        }
-        if (Double.isInfinite(real) ||
-            Double.isInfinite(imaginary)) {
-            return INF;
-        }
-        return createComplex(real * factor, imaginary * factor);
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is {@code this * factor}, with {@code factor}
-     * interpreted as a real number.
-     *
-     * @param  factor value to be multiplied by this {@code Complex}.
-     * @return {@code this * factor}.
-     * @see #multiply(Complex)
-     */
-    public Complex multiply(double factor) {
-        if (isNaN || Double.isNaN(factor)) {
-            return NaN;
-        }
-        if (Double.isInfinite(real) ||
-            Double.isInfinite(imaginary) ||
-            Double.isInfinite(factor)) {
-            // we don't use isInfinite() to avoid testing for NaN again
-            return INF;
-        }
-        return createComplex(real * factor, imaginary * factor);
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is {@code (-this)}.
-     * Returns {@code NaN} if either real or imaginary
-     * part of this Complex number equals {@code Double.NaN}.
-     *
-     * @return {@code -this}.
-     */
-    public Complex negate() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return createComplex(-real, -imaginary);
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is
-     * {@code (this - subtrahend)}.
-     * Uses the definitional formula
-     * <pre>
-     *  <code>
-     *   (a + bi) - (c + di) = (a-c) + (b-d)i
-     *  </code>
-     * </pre>
-     * If either {@code this} or {@code subtrahend} has a {@code NaN]} value in either part,
-     * {@link #NaN} is returned; otherwise infinite and {@code NaN} values are
-     * returned in the parts of the result according to the rules for
-     * {@link java.lang.Double} arithmetic.
-     *
-     * @param  subtrahend value to be subtracted from this {@code Complex}.
-     * @return {@code this - subtrahend}.
-     * @throws NullArgumentException if {@code subtrahend} is {@code null}.
-     */
-    public Complex subtract(Complex subtrahend)
-        throws NullArgumentException {
-        MathUtils.checkNotNull(subtrahend);
-        if (isNaN || subtrahend.isNaN) {
-            return NaN;
-        }
-
-        return createComplex(real - subtrahend.getReal(),
-                             imaginary - subtrahend.getImaginary());
-    }
-
-    /**
-     * Returns a {@code Complex} whose value is
-     * {@code (this - subtrahend)}.
-     *
-     * @param  subtrahend value to be subtracted from this {@code Complex}.
-     * @return {@code this - subtrahend}.
-     * @see #subtract(Complex)
-     */
-    public Complex subtract(double subtrahend) {
-        if (isNaN || Double.isNaN(subtrahend)) {
-            return NaN;
-        }
-        return createComplex(real - subtrahend, imaginary);
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/InverseCosine.html" TARGET="_top">
-     * inverse cosine</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   acos(z) = -i (log(z + i (sqrt(1 - z<sup>2</sup>))))
-     *  </code>
-     * </pre>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN} or infinite.
-     *
-     * @return the inverse cosine of this complex number.
-     * @since 1.2
-     */
-    public Complex acos() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return this.add(this.sqrt1z().multiply(I)).log().multiply(I.negate());
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/InverseSine.html" TARGET="_top">
-     * inverse sine</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   asin(z) = -i (log(sqrt(1 - z<sup>2</sup>) + iz))
-     *  </code>
-     * </pre>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN} or infinite.
-     *
-     * @return the inverse sine of this complex number.
-     * @since 1.2
-     */
-    public Complex asin() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return sqrt1z().add(this.multiply(I)).log().multiply(I.negate());
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/InverseTangent.html" TARGET="_top">
-     * inverse tangent</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   atan(z) = (i/2) log((i + z)/(i - z))
-     *  </code>
-     * </pre>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN} or infinite.
-     *
-     * @return the inverse tangent of this complex number
-     * @since 1.2
-     */
-    public Complex atan() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return this.add(I).divide(I.subtract(this)).log()
-                .multiply(I.divide(createComplex(2.0, 0.0)));
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/Cosine.html" TARGET="_top">
-     * cosine</a>
-     * of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   cos(a + bi) = cos(a)cosh(b) - sin(a)sinh(b)i
-     *  </code>
-     * </pre>
-     * where the (real) functions on the right-hand side are
-     * {@link FastMath#sin}, {@link FastMath#cos},
-     * {@link FastMath#cosh} and {@link FastMath#sinh}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   cos(1 &plusmn; INFINITY i) = 1 &#x2213; INFINITY i
-     *   cos(&plusmn;INFINITY + i) = NaN + NaN i
-     *   cos(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
-     *  </code>
-     * </pre>
-     *
-     * @return the cosine of this complex number.
-     * @since 1.2
-     */
-    public Complex cos() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return createComplex(FastMath.cos(real) * FastMath.cosh(imaginary),
-                             -FastMath.sin(real) * FastMath.sinh(imaginary));
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/HyperbolicCosine.html" TARGET="_top">
-     * hyperbolic cosine</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   cosh(a + bi) = cosh(a)cos(b) + sinh(a)sin(b)i}
-     *  </code>
-     * </pre>
-     * where the (real) functions on the right-hand side are
-     * {@link FastMath#sin}, {@link FastMath#cos},
-     * {@link FastMath#cosh} and {@link FastMath#sinh}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   cosh(1 &plusmn; INFINITY i) = NaN + NaN i
-     *   cosh(&plusmn;INFINITY + i) = INFINITY &plusmn; INFINITY i
-     *   cosh(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
-     *  </code>
-     * </pre>
-     *
-     * @return the hyperbolic cosine of this complex number.
-     * @since 1.2
-     */
-    public Complex cosh() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return createComplex(FastMath.cosh(real) * FastMath.cos(imaginary),
-                             FastMath.sinh(real) * FastMath.sin(imaginary));
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/ExponentialFunction.html" TARGET="_top">
-     * exponential function</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   exp(a + bi) = exp(a)cos(b) + exp(a)sin(b)i
-     *  </code>
-     * </pre>
-     * where the (real) functions on the right-hand side are
-     * {@link FastMath#exp}, {@link FastMath#cos}, and
-     * {@link FastMath#sin}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   exp(1 &plusmn; INFINITY i) = NaN + NaN i
-     *   exp(INFINITY + i) = INFINITY + INFINITY i
-     *   exp(-INFINITY + i) = 0 + 0i
-     *   exp(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
-     *  </code>
-     * </pre>
-     *
-     * @return <code><i>e</i><sup>this</sup></code>.
-     * @since 1.2
-     */
-    public Complex exp() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        double expReal = FastMath.exp(real);
-        return createComplex(expReal *  FastMath.cos(imaginary),
-                             expReal * FastMath.sin(imaginary));
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/NaturalLogarithm.html" TARGET="_top">
-     * natural logarithm</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   log(a + bi) = ln(|a + bi|) + arg(a + bi)i
-     *  </code>
-     * </pre>
-     * where ln on the right hand side is {@link FastMath#log},
-     * {@code |a + bi|} is the modulus, {@link Complex#abs},  and
-     * {@code arg(a + bi) = }{@link FastMath#atan2}(b, a).
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite (or critical) values in real or imaginary parts of the input may
-     * result in infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   log(1 &plusmn; INFINITY i) = INFINITY &plusmn; (&pi;/2)i
-     *   log(INFINITY + i) = INFINITY + 0i
-     *   log(-INFINITY + i) = INFINITY + &pi;i
-     *   log(INFINITY &plusmn; INFINITY i) = INFINITY &plusmn; (&pi;/4)i
-     *   log(-INFINITY &plusmn; INFINITY i) = INFINITY &plusmn; (3&pi;/4)i
-     *   log(0 + 0i) = -INFINITY + 0i
-     *  </code>
-     * </pre>
-     *
-     * @return the value <code>ln &nbsp; this</code>, the natural logarithm
-     * of {@code this}.
-     * @since 1.2
-     */
-    public Complex log() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return createComplex(FastMath.log(abs()),
-                             FastMath.atan2(imaginary, real));
-    }
-
-    /**
-     * Returns of value of this complex number raised to the power of {@code x}.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   y<sup>x</sup> = exp(x&middot;log(y))
-     *  </code>
-     * </pre>
-     * where {@code exp} and {@code log} are {@link #exp} and
-     * {@link #log}, respectively.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN} or infinite, or if {@code y}
-     * equals {@link Complex#ZERO}.
-     *
-     * @param  x exponent to which this {@code Complex} is to be raised.
-     * @return <code> this<sup>{@code x}</sup></code>.
-     * @throws NullArgumentException if x is {@code null}.
-     * @since 1.2
-     */
-    public Complex pow(Complex x)
-        throws NullArgumentException {
-        MathUtils.checkNotNull(x);
-        return this.log().multiply(x).exp();
-    }
-
-    /**
-     * Returns of value of this complex number raised to the power of {@code x}.
-     *
-     * @param  x exponent to which this {@code Complex} is to be raised.
-     * @return <code>this<sup>x</sup></code>.
-     * @see #pow(Complex)
-     */
-     public Complex pow(double x) {
-        return this.log().multiply(x).exp();
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/Sine.html" TARGET="_top">
-     * sine</a>
-     * of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   sin(a + bi) = sin(a)cosh(b) - cos(a)sinh(b)i
-     *  </code>
-     * </pre>
-     * where the (real) functions on the right-hand side are
-     * {@link FastMath#sin}, {@link FastMath#cos},
-     * {@link FastMath#cosh} and {@link FastMath#sinh}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or {@code NaN} values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   sin(1 &plusmn; INFINITY i) = 1 &plusmn; INFINITY i
-     *   sin(&plusmn;INFINITY + i) = NaN + NaN i
-     *   sin(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
-     *  </code>
-     * </pre>
-     *
-     * @return the sine of this complex number.
-     * @since 1.2
-     */
-    public Complex sin() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return createComplex(FastMath.sin(real) * FastMath.cosh(imaginary),
-                             FastMath.cos(real) * FastMath.sinh(imaginary));
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/HyperbolicSine.html" TARGET="_top">
-     * hyperbolic sine</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   sinh(a + bi) = sinh(a)cos(b)) + cosh(a)sin(b)i
-     *  </code>
-     * </pre>
-     * where the (real) functions on the right-hand side are
-     * {@link FastMath#sin}, {@link FastMath#cos},
-     * {@link FastMath#cosh} and {@link FastMath#sinh}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   sinh(1 &plusmn; INFINITY i) = NaN + NaN i
-     *   sinh(&plusmn;INFINITY + i) = &plusmn; INFINITY + INFINITY i
-     *   sinh(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
-     *  </code>
-     * </pre>
-     *
-     * @return the hyperbolic sine of {@code this}.
-     * @since 1.2
-     */
-    public Complex sinh() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        return createComplex(FastMath.sinh(real) * FastMath.cos(imaginary),
-            FastMath.cosh(real) * FastMath.sin(imaginary));
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top">
-     * square root</a> of this complex number.
-     * Implements the following algorithm to compute {@code sqrt(a + bi)}:
-     * <ol><li>Let {@code t = sqrt((|a| + |a + bi|) / 2)}</li>
-     * <li><pre>if {@code  a &#8805; 0} return {@code t + (b/2t)i}
-     *  else return {@code |b|/2t + sign(b)t i }</pre></li>
-     * </ol>
-     * where <ul>
-     * <li>{@code |a| = }{@link FastMath#abs}(a)</li>
-     * <li>{@code |a + bi| = }{@link Complex#abs}(a + bi)</li>
-     * <li>{@code sign(b) =  }{@link FastMath#copySign(double,double) copySign(1d, b)}
-     * </ul>
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   sqrt(1 &plusmn; INFINITY i) = INFINITY + NaN i
-     *   sqrt(INFINITY + i) = INFINITY + 0i
-     *   sqrt(-INFINITY + i) = 0 + INFINITY i
-     *   sqrt(INFINITY &plusmn; INFINITY i) = INFINITY + NaN i
-     *   sqrt(-INFINITY &plusmn; INFINITY i) = NaN &plusmn; INFINITY i
-     *  </code>
-     * </pre>
-     *
-     * @return the square root of {@code this}.
-     * @since 1.2
-     */
-    public Complex sqrt() {
-        if (isNaN) {
-            return NaN;
-        }
-
-        if (real == 0.0 && imaginary == 0.0) {
-            return createComplex(0.0, 0.0);
-        }
-
-        double t = FastMath.sqrt((FastMath.abs(real) + abs()) / 2.0);
-        if (real >= 0.0) {
-            return createComplex(t, imaginary / (2.0 * t));
-        } else {
-            return createComplex(FastMath.abs(imaginary) / (2.0 * t),
-                                 FastMath.copySign(1d, imaginary) * t);
-        }
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/SquareRoot.html" TARGET="_top">
-     * square root</a> of <code>1 - this<sup>2</sup></code> for this complex
-     * number.
-     * Computes the result directly as
-     * {@code sqrt(ONE.subtract(z.multiply(z)))}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or NaN values returned in parts of the result.
-     *
-     * @return the square root of <code>1 - this<sup>2</sup></code>.
-     * @since 1.2
-     */
-    public Complex sqrt1z() {
-        return createComplex(1.0, 0.0).subtract(this.multiply(this)).sqrt();
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/Tangent.html" TARGET="_top">
-     * tangent</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   tan(a + bi) = sin(2a)/(cos(2a)+cosh(2b)) + [sinh(2b)/(cos(2a)+cosh(2b))]i
-     *  </code>
-     * </pre>
-     * where the (real) functions on the right-hand side are
-     * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and
-     * {@link FastMath#sinh}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite (or critical) values in real or imaginary parts of the input may
-     * result in infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   tan(a &plusmn; INFINITY i) = 0 &plusmn; i
-     *   tan(&plusmn;INFINITY + bi) = NaN + NaN i
-     *   tan(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
-     *   tan(&plusmn;&pi;/2 + 0 i) = &plusmn;INFINITY + NaN i
-     *  </code>
-     * </pre>
-     *
-     * @return the tangent of {@code this}.
-     * @since 1.2
-     */
-    public Complex tan() {
-        if (isNaN || Double.isInfinite(real)) {
-            return NaN;
-        }
-        if (imaginary > 20.0) {
-            return createComplex(0.0, 1.0);
-        }
-        if (imaginary < -20.0) {
-            return createComplex(0.0, -1.0);
-        }
-
-        double real2 = 2.0 * real;
-        double imaginary2 = 2.0 * imaginary;
-        double d = FastMath.cos(real2) + FastMath.cosh(imaginary2);
-
-        return createComplex(FastMath.sin(real2) / d,
-                             FastMath.sinh(imaginary2) / d);
-    }
-
-    /**
-     * Compute the
-     * <a href="http://mathworld.wolfram.com/HyperbolicTangent.html" TARGET="_top">
-     * hyperbolic tangent</a> of this complex number.
-     * Implements the formula:
-     * <pre>
-     *  <code>
-     *   tan(a + bi) = sinh(2a)/(cosh(2a)+cos(2b)) + [sin(2b)/(cosh(2a)+cos(2b))]i
-     *  </code>
-     * </pre>
-     * where the (real) functions on the right-hand side are
-     * {@link FastMath#sin}, {@link FastMath#cos}, {@link FastMath#cosh} and
-     * {@link FastMath#sinh}.
-     * <br/>
-     * Returns {@link Complex#NaN} if either real or imaginary part of the
-     * input argument is {@code NaN}.
-     * <br/>
-     * Infinite values in real or imaginary parts of the input may result in
-     * infinite or NaN values returned in parts of the result.
-     * <pre>
-     *  Examples:
-     *  <code>
-     *   tanh(a &plusmn; INFINITY i) = NaN + NaN i
-     *   tanh(&plusmn;INFINITY + bi) = &plusmn;1 + 0 i
-     *   tanh(&plusmn;INFINITY &plusmn; INFINITY i) = NaN + NaN i
-     *   tanh(0 + (&pi;/2)i) = NaN + INFINITY i
-     *  </code>
-     * </pre>
-     *
-     * @return the hyperbolic tangent of {@code this}.
-     * @since 1.2
-     */
-    public Complex tanh() {
-        if (isNaN || Double.isInfinite(imaginary)) {
-            return NaN;
-        }
-        if (real > 20.0) {
-            return createComplex(1.0, 0.0);
-        }
-        if (real < -20.0) {
-            return createComplex(-1.0, 0.0);
-        }
-        double real2 = 2.0 * real;
-        double imaginary2 = 2.0 * imaginary;
-        double d = FastMath.cosh(real2) + FastMath.cos(imaginary2);
-
-        return createComplex(FastMath.sinh(real2) / d,
-                             FastMath.sin(imaginary2) / d);
-    }
-
-
-
-    /**
-     * Compute the argument of this complex number.
-     * The argument is the angle phi between the positive real axis and
-     * the point representing this number in the complex plane.
-     * The value returned is between -PI (not inclusive)
-     * and PI (inclusive), with negative values returned for numbers with
-     * negative imaginary parts.
-     * <br/>
-     * If either real or imaginary part (or both) is NaN, NaN is returned.
-     * Infinite parts are handled as {@code Math.atan2} handles them,
-     * essentially treating finite parts as zero in the presence of an
-     * infinite coordinate and returning a multiple of pi/4 depending on
-     * the signs of the infinite parts.
-     * See the javadoc for {@code Math.atan2} for full details.
-     *
-     * @return the argument of {@code this}.
-     */
-    public double getArgument() {
-        return FastMath.atan2(getImaginary(), getReal());
-    }
-
-    /**
-     * Computes the n-th roots of this complex number.
-     * The nth roots are defined by the formula:
-     * <pre>
-     *  <code>
-     *   z<sub>k</sub> = abs<sup>1/n</sup> (cos(phi + 2&pi;k/n) + i (sin(phi + 2&pi;k/n))
-     *  </code>
-     * </pre>
-     * for <i>{@code k=0, 1, ..., n-1}</i>, where {@code abs} and {@code phi}
-     * are respectively the {@link #abs() modulus} and
-     * {@link #getArgument() argument} of this complex number.
-     * <br/>
-     * If one or both parts of this complex number is NaN, a list with just
-     * one element, {@link #NaN} is returned.
-     * if neither part is NaN, but at least one part is infinite, the result
-     * is a one-element list containing {@link #INF}.
-     *
-     * @param n Degree of root.
-     * @return a List<Complex> of all {@code n}-th roots of {@code this}.
-     * @throws NotPositiveException if {@code n <= 0}.
-     * @since 2.0
-     */
-    public List<Complex> nthRoot(int n) throws NotPositiveException {
-
-        if (n <= 0) {
-            throw new NotPositiveException(LocalizedFormats.CANNOT_COMPUTE_NTH_ROOT_FOR_NEGATIVE_N,
-                                           n);
-        }
-
-        final List<Complex> result = new ArrayList<Complex>();
-
-        if (isNaN) {
-            result.add(NaN);
-            return result;
-        }
-        if (isInfinite()) {
-            result.add(INF);
-            return result;
-        }
-
-        // nth root of abs -- faster / more accurate to use a solver here?
-        final double nthRootOfAbs = FastMath.pow(abs(), 1.0 / n);
-
-        // Compute nth roots of complex number with k = 0, 1, ... n-1
-        final double nthPhi = getArgument() / n;
-        final double slice = 2 * FastMath.PI / n;
-        double innerPart = nthPhi;
-        for (int k = 0; k < n ; k++) {
-            // inner part
-            final double realPart = nthRootOfAbs *  FastMath.cos(innerPart);
-            final double imaginaryPart = nthRootOfAbs *  FastMath.sin(innerPart);
-            result.add(createComplex(realPart, imaginaryPart));
-            innerPart += slice;
-        }
-
-        return result;
-    }
-
-    /**
-     * Create a complex number given the real and imaginary parts.
-     *
-     * @param realPart Real part.
-     * @param imaginaryPart Imaginary part.
-     * @return a new complex number instance.
-     * @since 1.2
-     * @see #valueOf(double, double)
-     */
-    protected Complex createComplex(double realPart,
-                                    double imaginaryPart) {
-        return new Complex(realPart, imaginaryPart);
-    }
-
-    /**
-     * Create a complex number given the real and imaginary parts.
-     *
-     * @param realPart Real part.
-     * @param imaginaryPart Imaginary part.
-     * @return a Complex instance.
-     */
-    public static Complex valueOf(double realPart,
-                                  double imaginaryPart) {
-        if (Double.isNaN(realPart) ||
-            Double.isNaN(imaginaryPart)) {
-            return NaN;
-        }
-        return new Complex(realPart, imaginaryPart);
-    }
-
-    /**
-     * Create a complex number given only the real part.
-     *
-     * @param realPart Real part.
-     * @return a Complex instance.
-     */
-    public static Complex valueOf(double realPart) {
-        if (Double.isNaN(realPart)) {
-            return NaN;
-        }
-        return new Complex(realPart);
-    }
-
-    /**
-     * Resolve the transient fields in a deserialized Complex Object.
-     * Subclasses will need to override {@link #createComplex} to
-     * deserialize properly.
-     *
-     * @return A Complex instance with all fields resolved.
-     * @since 2.0
-     */
-    protected final Object readResolve() {
-        return createComplex(real, imaginary);
-    }
-
-    /** {@inheritDoc} */
-    public ComplexField getField() {
-        return ComplexField.getInstance();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String toString() {
-        return "(" + real + ", " + imaginary + ")";
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/complex/ComplexField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/complex/ComplexField.java b/src/main/java/org/apache/commons/math3/complex/ComplexField.java
deleted file mode 100644
index 939752d..0000000
--- a/src/main/java/org/apache/commons/math3/complex/ComplexField.java
+++ /dev/null
@@ -1,83 +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.complex;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-
-/**
- * Representation of the complex numbers field.
- * <p>
- * This class is a singleton.
- * </p>
- * @see Complex
- * @since 2.0
- */
-public class ComplexField implements Field<Complex>, Serializable  {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -6130362688700788798L;
-
-    /** Private constructor for the singleton.
-     */
-    private ComplexField() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static ComplexField getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public Complex getOne() {
-        return Complex.ONE;
-    }
-
-    /** {@inheritDoc} */
-    public Complex getZero() {
-        return Complex.ZERO;
-    }
-
-    /** {@inheritDoc} */
-    public Class<? extends FieldElement<Complex>> getRuntimeClass() {
-        return Complex.class;
-    }
-
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final ComplexField INSTANCE = new ComplexField();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-}


[53/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SecondMomentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SecondMomentTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SecondMomentTest.java
index 3e4b722..e42b2a0 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SecondMomentTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SecondMomentTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.SecondMoment;
 
 /**
  * Test cases for the {@link SecondMoment} class.
@@ -28,7 +29,7 @@ public class SecondMomentTest extends StorelessUnivariateStatisticAbstractTest {
     protected SecondMoment stat;
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
      */
     @Override
     public UnivariateStatistic getUnivariateStatistic() {
@@ -36,7 +37,7 @@ public class SecondMomentTest extends StorelessUnivariateStatisticAbstractTest {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
      */
     @Override
     public double expectedValue() {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
index 96f88f3..e9dc85a 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SemiVarianceTest.java
@@ -15,11 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.stat.StatUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.stat.StatUtils;
+import org.apache.commons.math4.stat.descriptive.moment.SemiVariance;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SkewnessTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SkewnessTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SkewnessTest.java
index b082783..099607f 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SkewnessTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/SkewnessTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.Skewness;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviationTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviationTest.java
index 44019d8..f695fc6 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviationTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviationTest.java
@@ -14,11 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.SecondMoment;
+import org.apache.commons.math4.stat.descriptive.moment.StandardDeviation;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMomentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMomentTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMomentTest.java
index 0c1f6f8..098dcfc 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMomentTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMomentTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.ThirdMoment;
 
 /**
  * Test cases for the {@link ThirdMoment} class.
@@ -28,7 +29,7 @@ public class ThirdMomentTest extends StorelessUnivariateStatisticAbstractTest{
     protected ThirdMoment stat;
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
      */
     @Override
     public UnivariateStatistic getUnivariateStatistic() {
@@ -36,7 +37,7 @@ public class ThirdMomentTest extends StorelessUnivariateStatisticAbstractTest{
     }
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
      */
     @Override
     public double expectedValue() {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VarianceTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VarianceTest.java
index c4bf450..c683f83 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VarianceTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VarianceTest.java
@@ -14,11 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.SecondMoment;
+import org.apache.commons.math4.stat.descriptive.moment.StandardDeviation;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.util.MathArrays;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovarianceTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovarianceTest.java
index 68f7e6f..3d2bbb6 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovarianceTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovarianceTest.java
@@ -15,12 +15,12 @@
 //specific language governing permissions and limitations
 //under the License.
 
-package org.apache.commons.math3.stat.descriptive.moment;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.linear.RealMatrix;
+package org.apache.commons.math4.stat.descriptive.moment;
 
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.descriptive.moment.VectorialCovariance;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMeanTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMeanTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMeanTest.java
index 8a3f479..41d43e7 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMeanTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMeanTest.java
@@ -15,11 +15,11 @@
 //specific language governing permissions and limitations
 //under the License.
 
-package org.apache.commons.math3.stat.descriptive.moment;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.TestUtils;
+package org.apache.commons.math4.stat.descriptive.moment;
 
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.stat.descriptive.moment.VectorialMean;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MaxTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MaxTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MaxTest.java
index 83190d7..da80792 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MaxTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MaxTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.rank.Max;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MedianTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MedianTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MedianTest.java
index ef1badf..c4bd114 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MedianTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MedianTest.java
@@ -14,23 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.LEGACY;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_1;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_2;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_3;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_4;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_5;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_6;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_7;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_8;
-import static org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType.R_9;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.LEGACY;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_1;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_2;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_3;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_4;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_5;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_6;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_7;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_8;
+import static org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType.R_9;
 
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.rank.Median;
+import org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -43,7 +44,7 @@ public class MedianTest extends UnivariateStatisticAbstractTest{
     protected Median stat;
 
     /**
-     * {@link  org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType type}
+     * {@link  org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType type}
      *  to be used while calling
      * {@link #getUnivariateStatistic()}
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MinTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MinTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MinTest.java
index f2db645..296248a 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MinTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/MinTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.rank.Min;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
index 8f7295a..78969fb 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentileTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
 import java.io.IOException;
 import java.util.ArrayList;
@@ -24,18 +24,20 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
-import org.apache.commons.math3.distribution.LogNormalDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.rank.PSquarePercentile.PSquareMarkers;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.LogNormalDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.rank.PSquarePercentile;
+import org.apache.commons.math4.stat.descriptive.rank.Percentile;
+import org.apache.commons.math4.stat.descriptive.rank.PSquarePercentile.PSquareMarkers;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
index 5381213..3aa055f 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/rank/PercentileTest.java
@@ -14,28 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotANumberException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
-import org.apache.commons.math3.util.CentralPivotingStrategy;
-import org.apache.commons.math3.util.KthSelector;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MedianOf3PivotingStrategy;
-import org.apache.commons.math3.util.PivotingStrategyInterface;
-import org.apache.commons.math3.util.RandomPivotingStrategy;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.rank.Percentile;
+import org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.util.CentralPivotingStrategy;
+import org.apache.commons.math4.util.KthSelector;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MedianOf3PivotingStrategy;
+import org.apache.commons.math4.util.PivotingStrategyInterface;
+import org.apache.commons.math4.util.RandomPivotingStrategy;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -50,7 +51,7 @@ public class PercentileTest extends UnivariateStatisticAbstractTest{
     private double quantile;
 
     /**
-     * {@link org.apache.commons.math3.stat.descriptive.rank.Percentile.EstimationType type}
+     * {@link org.apache.commons.math4.stat.descriptive.rank.Percentile.EstimationType type}
      * of estimation to be used while calling {@link #getUnivariateStatistic()}
      */
     private Percentile.EstimationType type;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/summary/ProductTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/ProductTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/ProductTest.java
index 7dcaa7c..8bd238c 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/ProductTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/ProductTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.summary.Product;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumLogTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumLogTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumLogTest.java
index ad3576a..d7f6495 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumLogTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumLogTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfLogs;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumSqTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumSqTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumSqTest.java
index b19ca4e..0b722ed 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumSqTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumSqTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumTest.java
index 87a3f5e..fa72645 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/summary/SumTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/BinomialTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/BinomialTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/BinomialTestTest.java
index 4ec371d..365f21d 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/BinomialTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/BinomialTestTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotPositiveException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.stat.inference.AlternativeHypothesis;
+import org.apache.commons.math4.stat.inference.BinomialTest;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/ChiSquareTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/ChiSquareTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/ChiSquareTestTest.java
index daf1882..2f0117d 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/ChiSquareTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/ChiSquareTestTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.stat.inference.ChiSquareTest;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -170,8 +171,8 @@ public class ChiSquareTestTest {
         long[] obs = new long[] {
             2372383, 584222, 257170, 17750155, 7903832, 489265, 209628, 393899
         };
-        org.apache.commons.math3.stat.inference.ChiSquareTest csti =
-            new org.apache.commons.math3.stat.inference.ChiSquareTest();
+        org.apache.commons.math4.stat.inference.ChiSquareTest csti =
+            new org.apache.commons.math4.stat.inference.ChiSquareTest();
         double cst = csti.chiSquareTest(exp, obs);
         Assert.assertEquals("chi-square p-value", 0.0, cst, 1E-3);
         Assert.assertEquals( "chi-square test statistic",

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java
index 228f0ce..f1aba28 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/GTestTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.stat.inference;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.stat.inference.GTest;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
index 9ac5c7c..e44972d 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTestTest.java
@@ -15,12 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java
index e46f8c5..d8c48e2 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/MannWhitneyUTestTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.inference.MannWhitneyUTest;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java b/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java
index ee64981..3442382 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/OneWayAnovaTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.stat.inference.OneWayAnova;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/TTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/TTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/TTestTest.java
index 8bd38de..8f4357d 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/TTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/TTestTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.stat.inference.TTest;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java
index 69bd58a..5fa151f 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/TestUtilsTest.java
@@ -14,20 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.stat.inference.OneWayAnova;
+import org.apache.commons.math4.stat.inference.TestUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -174,8 +176,8 @@ public class TestUtilsTest {
         long[] obs = new long[] {
                 2372383, 584222, 257170, 17750155, 7903832, 489265, 209628, 393899
         };
-        org.apache.commons.math3.stat.inference.ChiSquareTest csti =
-            new org.apache.commons.math3.stat.inference.ChiSquareTest();
+        org.apache.commons.math4.stat.inference.ChiSquareTest csti =
+            new org.apache.commons.math4.stat.inference.ChiSquareTest();
         double cst = csti.chiSquareTest(exp, obs);
         Assert.assertEquals("chi-square p-value", 0.0, cst, 1E-3);
         Assert.assertEquals( "chi-square test statistic",

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java b/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java
index 23ad58b..c435fbd 100644
--- a/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTestTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.stat.inference.WilcoxonSignedRankTest;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/interval/AgrestiCoullIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/interval/AgrestiCoullIntervalTest.java b/src/test/java/org/apache/commons/math4/stat/interval/AgrestiCoullIntervalTest.java
index 2072b0e..ec804d1 100644
--- a/src/test/java/org/apache/commons/math4/stat/interval/AgrestiCoullIntervalTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/interval/AgrestiCoullIntervalTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.stat.interval.AgrestiCoullInterval;
-import org.apache.commons.math3.stat.interval.BinomialConfidenceInterval;
-import org.apache.commons.math3.stat.interval.ConfidenceInterval;
+import org.apache.commons.math4.stat.interval.AgrestiCoullInterval;
+import org.apache.commons.math4.stat.interval.BinomialConfidenceInterval;
+import org.apache.commons.math4.stat.interval.ConfidenceInterval;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/interval/BinomialConfidenceIntervalAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/interval/BinomialConfidenceIntervalAbstractTest.java b/src/test/java/org/apache/commons/math4/stat/interval/BinomialConfidenceIntervalAbstractTest.java
index a346297..621c8ac 100644
--- a/src/test/java/org/apache/commons/math4/stat/interval/BinomialConfidenceIntervalAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/interval/BinomialConfidenceIntervalAbstractTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.stat.interval.BinomialConfidenceInterval;
-import org.apache.commons.math3.stat.interval.ConfidenceInterval;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.stat.interval.BinomialConfidenceInterval;
+import org.apache.commons.math4.stat.interval.ConfidenceInterval;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/interval/ClopperPearsonIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/interval/ClopperPearsonIntervalTest.java b/src/test/java/org/apache/commons/math4/stat/interval/ClopperPearsonIntervalTest.java
index 2dfe1be..e0bcc5b 100644
--- a/src/test/java/org/apache/commons/math4/stat/interval/ClopperPearsonIntervalTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/interval/ClopperPearsonIntervalTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.stat.interval.BinomialConfidenceInterval;
-import org.apache.commons.math3.stat.interval.ClopperPearsonInterval;
-import org.apache.commons.math3.stat.interval.ConfidenceInterval;
+import org.apache.commons.math4.stat.interval.BinomialConfidenceInterval;
+import org.apache.commons.math4.stat.interval.ClopperPearsonInterval;
+import org.apache.commons.math4.stat.interval.ConfidenceInterval;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/interval/IntervalUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/interval/IntervalUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/interval/IntervalUtilsTest.java
index 4f87371..a1715a6 100644
--- a/src/test/java/org/apache/commons/math4/stat/interval/IntervalUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/interval/IntervalUtilsTest.java
@@ -14,8 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
+import org.apache.commons.math4.stat.interval.AgrestiCoullInterval;
+import org.apache.commons.math4.stat.interval.ClopperPearsonInterval;
+import org.apache.commons.math4.stat.interval.ConfidenceInterval;
+import org.apache.commons.math4.stat.interval.IntervalUtils;
+import org.apache.commons.math4.stat.interval.NormalApproximationInterval;
+import org.apache.commons.math4.stat.interval.WilsonScoreInterval;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/interval/NormalApproximationIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/interval/NormalApproximationIntervalTest.java b/src/test/java/org/apache/commons/math4/stat/interval/NormalApproximationIntervalTest.java
index 2b0384a..269b93c 100644
--- a/src/test/java/org/apache/commons/math4/stat/interval/NormalApproximationIntervalTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/interval/NormalApproximationIntervalTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.stat.interval.BinomialConfidenceInterval;
-import org.apache.commons.math3.stat.interval.ConfidenceInterval;
-import org.apache.commons.math3.stat.interval.NormalApproximationInterval;
+import org.apache.commons.math4.stat.interval.BinomialConfidenceInterval;
+import org.apache.commons.math4.stat.interval.ConfidenceInterval;
+import org.apache.commons.math4.stat.interval.NormalApproximationInterval;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/interval/WilsonScoreIntervalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/interval/WilsonScoreIntervalTest.java b/src/test/java/org/apache/commons/math4/stat/interval/WilsonScoreIntervalTest.java
index af64a54..7ed37cb 100644
--- a/src/test/java/org/apache/commons/math4/stat/interval/WilsonScoreIntervalTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/interval/WilsonScoreIntervalTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.stat.interval.BinomialConfidenceInterval;
-import org.apache.commons.math3.stat.interval.ConfidenceInterval;
-import org.apache.commons.math3.stat.interval.WilsonScoreInterval;
+import org.apache.commons.math4.stat.interval.BinomialConfidenceInterval;
+import org.apache.commons.math4.stat.interval.ConfidenceInterval;
+import org.apache.commons.math4.stat.interval.WilsonScoreInterval;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/ranking/NaturalRankingTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/ranking/NaturalRankingTest.java b/src/test/java/org/apache/commons/math4/stat/ranking/NaturalRankingTest.java
index e1ddf06..e713720 100644
--- a/src/test/java/org/apache/commons/math4/stat/ranking/NaturalRankingTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/ranking/NaturalRankingTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.ranking;
+package org.apache.commons.math4.stat.ranking;
 
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.NotANumberException;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.stat.ranking.NaturalRanking;
+import org.apache.commons.math4.stat.ranking.TiesStrategy;
 import org.junit.Test;
 
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java b/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
index 3896487..29dbe07 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegressionTest.java
@@ -14,21 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.random.CorrelatedRandomVectorGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.GaussianRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.stat.correlation.Covariance;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.random.CorrelatedRandomVectorGenerator;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.stat.correlation.Covariance;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.stat.regression.GLSMultipleLinearRegression;
+import org.apache.commons.math4.stat.regression.OLSMultipleLinearRegression;
 
 public class GLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbstractTest {
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegressionTest.java b/src/test/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegressionTest.java
index 2ff023c..0034d75 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegressionTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegressionTest.java
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
-
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.stat.correlation.PearsonsCorrelation;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.stat.regression;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.correlation.PearsonsCorrelation;
+import org.apache.commons.math4.stat.regression.MillerUpdatingRegression;
+import org.apache.commons.math4.stat.regression.OLSMultipleLinearRegression;
+import org.apache.commons.math4.stat.regression.RegressionResults;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java b/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
index ea5fecf..8e05600 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/MultipleLinearRegressionAbstractTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
-
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
+package org.apache.commons.math4.stat.regression;
 
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.stat.regression.AbstractMultipleLinearRegression;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java b/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
index d719c8b..f5025b0 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegressionTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.DefaultRealMatrixChangingVisitor;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.stat.StatUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.stat.StatUtils;
+import org.apache.commons.math4.stat.regression.OLSMultipleLinearRegression;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
@@ -786,7 +787,7 @@ public class OLSMultipleLinearRegressionTest extends MultipleLinearRegressionAbs
     /**
      * Anything requiring beta calculation should advertise SME.
      */
-    @Test(expected=org.apache.commons.math3.linear.SingularMatrixException.class)
+    @Test(expected=org.apache.commons.math4.linear.SingularMatrixException.class)
     public void testSingularCalculateBeta() {
         OLSMultipleLinearRegression model = new OLSMultipleLinearRegression();
         model.newSampleData(new double[] {1,  2,  3, 1, 2, 3, 1, 2, 3}, 3, 2);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/regression/SimpleRegressionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/regression/SimpleRegressionTest.java b/src/test/java/org/apache/commons/math4/stat/regression/SimpleRegressionTest.java
index 544e141..087f5bc 100644
--- a/src/test/java/org/apache/commons/math4/stat/regression/SimpleRegressionTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/regression/SimpleRegressionTest.java
@@ -14,14 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
 import java.util.Random;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.random.ISAACRandom;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.ISAACRandom;
+import org.apache.commons.math4.stat.regression.ModelSpecificationException;
+import org.apache.commons.math4.stat.regression.RegressionResults;
+import org.apache.commons.math4.stat.regression.SimpleRegression;
+import org.apache.commons.math4.stat.regression.UpdatingMultipleLinearRegression;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/transform/FastCosineTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/transform/FastCosineTransformerTest.java b/src/test/java/org/apache/commons/math4/transform/FastCosineTransformerTest.java
index c4c4119..44a351a 100644
--- a/src/test/java/org/apache/commons/math4/transform/FastCosineTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/transform/FastCosineTransformerTest.java
@@ -14,16 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.util.Arrays;
 import java.util.Collection;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Sinc;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.Sinc;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.transform.DctNormalization;
+import org.apache.commons.math4.transform.FastCosineTransformer;
+import org.apache.commons.math4.transform.RealTransformer;
+import org.apache.commons.math4.transform.TransformType;
+import org.apache.commons.math4.transform.TransformUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java b/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java
index af70eed..cb1e682 100644
--- a/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/transform/FastFourierTransformerTest.java
@@ -14,18 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Sinc;
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.Sinc;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.transform.DftNormalization;
+import org.apache.commons.math4.transform.FastFourierTransformer;
+import org.apache.commons.math4.transform.TransformType;
+import org.apache.commons.math4.transform.TransformUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java b/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
index 3d43287..89eeed4 100644
--- a/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/transform/FastHadamardTransformerTest.java
@@ -14,16 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.transform.FastHadamardTransformer;
+import org.apache.commons.math4.transform.TransformType;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 
 
 /**
  * JUnit Test for HadamardTransformerTest
- * @see org.apache.commons.math3.transform.FastHadamardTransformer
+ * @see org.apache.commons.math4.transform.FastHadamardTransformer
  */
 public final class FastHadamardTransformerTest {
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/transform/FastSineTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/transform/FastSineTransformerTest.java b/src/test/java/org/apache/commons/math4/transform/FastSineTransformerTest.java
index f2a23bd..64b8e8d 100644
--- a/src/test/java/org/apache/commons/math4/transform/FastSineTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/transform/FastSineTransformerTest.java
@@ -14,17 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.util.Arrays;
 import java.util.Collection;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Sinc;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.Sinc;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.transform.DstNormalization;
+import org.apache.commons.math4.transform.FastSineTransformer;
+import org.apache.commons.math4.transform.RealTransformer;
+import org.apache.commons.math4.transform.TransformType;
+import org.apache.commons.math4.transform.TransformUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java b/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java
index 552eda1..1e3bf8c 100644
--- a/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/transform/RealTransformerAbstractTest.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.transform.RealTransformer;
+import org.apache.commons.math4.transform.TransformType;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java b/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
index ecf0187..74c8564 100644
--- a/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/util/ArithmeticUtilsTest.java
@@ -14,15 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.math.BigInteger;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.random.RandomDataGenerator;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.random.RandomDataGenerator;
+import org.apache.commons.math4.util.ArithmeticUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/BigRealFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/BigRealFieldTest.java b/src/test/java/org/apache/commons/math4/util/BigRealFieldTest.java
index 0f9af0e..01000e4 100644
--- a/src/test/java/org/apache/commons/math4/util/BigRealFieldTest.java
+++ b/src/test/java/org/apache/commons/math4/util/BigRealFieldTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.util.BigReal;
+import org.apache.commons.math4.util.BigRealField;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/BigRealTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/BigRealTest.java b/src/test/java/org/apache/commons/math4/util/BigRealTest.java
index 0a957f3..b0ac794 100644
--- a/src/test/java/org/apache/commons/math4/util/BigRealTest.java
+++ b/src/test/java/org/apache/commons/math4/util/BigRealTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.MathContext;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.util.BigReal;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/CombinationsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/CombinationsTest.java b/src/test/java/org/apache/commons/math4/util/CombinationsTest.java
index 99b8e60..83baa89 100644
--- a/src/test/java/org/apache/commons/math4/util/CombinationsTest.java
+++ b/src/test/java/org/apache/commons/math4/util/CombinationsTest.java
@@ -14,13 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.Iterator;
 import java.util.Comparator;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.Combinations;
+import org.apache.commons.math4.util.CombinatoricsUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java b/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java
index d5aa34d..0ad8a02 100644
--- a/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/util/CombinatoricsUtilsTest.java
@@ -14,17 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/ContinuedFractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/ContinuedFractionTest.java b/src/test/java/org/apache/commons/math4/util/ContinuedFractionTest.java
index cff2114..686fb51 100644
--- a/src/test/java/org/apache/commons/math4/util/ContinuedFractionTest.java
+++ b/src/test/java/org/apache/commons/math4/util/ContinuedFractionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
+import org.apache.commons.math4.util.ContinuedFraction;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/Decimal64Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/Decimal64Test.java b/src/test/java/org/apache/commons/math4/util/Decimal64Test.java
index bf96c71..45d5fae 100644
--- a/src/test/java/org/apache/commons/math4/util/Decimal64Test.java
+++ b/src/test/java/org/apache/commons/math4/util/Decimal64Test.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.ExtendedFieldElementAbstractTest;
+import org.apache.commons.math4.ExtendedFieldElementAbstractTest;
+import org.apache.commons.math4.util.Decimal64;
 import org.junit.Assert;
-
 import org.junit.Test;
 
 public class Decimal64Test extends ExtendedFieldElementAbstractTest<Decimal64> {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/DefaultTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/DefaultTransformerTest.java b/src/test/java/org/apache/commons/math4/util/DefaultTransformerTest.java
index 1612fbe..826e976 100644
--- a/src/test/java/org/apache/commons/math4/util/DefaultTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/util/DefaultTransformerTest.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.math.BigDecimal;
 
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.DefaultTransformer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/DoubleArrayAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/DoubleArrayAbstractTest.java b/src/test/java/org/apache/commons/math4/util/DoubleArrayAbstractTest.java
index f2e94d2..f3c27e0 100644
--- a/src/test/java/org/apache/commons/math4/util/DoubleArrayAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/util/DoubleArrayAbstractTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.stat.StatUtils;
+import org.apache.commons.math4.stat.StatUtils;
+import org.apache.commons.math4.util.DoubleArray;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java b/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
index 0a4cef5..77a0c7c 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathStrictComparisonTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -24,7 +24,9 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/FastMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathTest.java b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
index f860754..5d36fea 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathTest.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathTest.java
@@ -14,21 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 import java.math.BigInteger;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.dfp.Dfp;
-import org.apache.commons.math3.dfp.DfpField;
-import org.apache.commons.math3.dfp.DfpMath;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well1024a;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpField;
+import org.apache.commons.math4.dfp.DfpMath;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Ignore;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/FastMathTestPerformance.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/FastMathTestPerformance.java b/src/test/java/org/apache/commons/math4/util/FastMathTestPerformance.java
index 849e458..eb09f68 100644
--- a/src/test/java/org/apache/commons/math4/util/FastMathTestPerformance.java
+++ b/src/test/java/org/apache/commons/math4/util/FastMathTestPerformance.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.PerfTestUtils;
+import org.apache.commons.math4.PerfTestUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.Assert;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/IncrementorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/IncrementorTest.java b/src/test/java/org/apache/commons/math4/util/IncrementorTest.java
index 0c7d4fb..72cde88 100644
--- a/src/test/java/org/apache/commons/math4/util/IncrementorTest.java
+++ b/src/test/java/org/apache/commons/math4/util/IncrementorTest.java
@@ -11,10 +11,11 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.Incrementor;
 import org.junit.Assert;
 import org.junit.Test;
 


[64/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/apt/userguide/special.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/userguide/special.apt b/src/site/apt/userguide/special.apt
index b3da56d..420e055 100644
--- a/src/site/apt/userguide/special.apt
+++ b/src/site/apt/userguide/special.apt
@@ -28,7 +28,7 @@
 
 * 5.2 Erf functions
 
-  {{{../apidocs/org/apache/commons/math3/special/Erf.html}Erf}} contains
+  {{{../apidocs/org/apache/commons/math4/special/Erf.html}Erf}} contains
   several useful functions involving the Error Function, Erf.
 
 *----------------+---------+-------------------------------------------------------------------+
@@ -39,7 +39,7 @@
 
 * 5.3 Gamma functions
 
-  Class {{{../apidocs/org/apache/commons/math3/special/Gamma.html}<<<Gamma>>>}}
+  Class {{{../apidocs/org/apache/commons/math4/special/Gamma.html}<<<Gamma>>>}}
   contains several useful functions involving the Gamma Function.
 
 ** Gamma
@@ -97,7 +97,7 @@
 
 * 5.4 Beta functions
 
-  {{{../apidocs/org/apache/commons/math3/special/Beta.html}Beta}} contains
+  {{{../apidocs/org/apache/commons/math4/special/Beta.html}Beta}} contains
   several useful functions involving the Beta Function.
 
 ** Log Beta

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/design/differentiation.puml
----------------------------------------------------------------------
diff --git a/src/site/design/differentiation.puml b/src/site/design/differentiation.puml
index 418610c..ce24df7 100644
--- a/src/site/design/differentiation.puml
+++ b/src/site/design/differentiation.puml
@@ -24,7 +24,7 @@
   skinparam NoteFontColor         #691616
   skinparam ClassFontSize         11
 
-  package org.apache.commons.math3 #ECEBD8
+  package org.apache.commons.math4 #ECEBD8
 
     interface "FieldElement<T>" as FieldElement_T_ {
       T add(T a)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/design/oneD.puml
----------------------------------------------------------------------
diff --git a/src/site/design/oneD.puml b/src/site/design/oneD.puml
index 8e052cd..368e9ab 100644
--- a/src/site/design/oneD.puml
+++ b/src/site/design/oneD.puml
@@ -24,7 +24,7 @@
   skinparam NoteFontColor         #691616
   skinparam ClassFontSize         11
 
-  package org.apache.commons.math3.geometry #ECEBD8
+  package org.apache.commons.math4.geometry #ECEBD8
 
     interface Space {
       +int getDimension()

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/design/partitioning.puml
----------------------------------------------------------------------
diff --git a/src/site/design/partitioning.puml b/src/site/design/partitioning.puml
index e2a356a..dedfe24 100644
--- a/src/site/design/partitioning.puml
+++ b/src/site/design/partitioning.puml
@@ -24,7 +24,7 @@
   skinparam NoteFontColor         #691616
   skinparam ClassFontSize         11
 
-  package org.apache.commons.math3.geometry #ECEBD8
+  package org.apache.commons.math4.geometry #ECEBD8
 
     package partitioning #DDEBD8
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/design/solver.puml
----------------------------------------------------------------------
diff --git a/src/site/design/solver.puml b/src/site/design/solver.puml
index d263a6c..929a46d 100644
--- a/src/site/design/solver.puml
+++ b/src/site/design/solver.puml
@@ -24,7 +24,7 @@
   skinparam NoteFontColor         #691616
   skinparam ClassFontSize         11
 
-  package org.apache.commons.math3.differentiation.solvers #ECEBD8
+  package org.apache.commons.math4.differentiation.solvers #ECEBD8
 
         enum AllowedSolution {
           ANY_SIDE

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/design/threeD.puml
----------------------------------------------------------------------
diff --git a/src/site/design/threeD.puml b/src/site/design/threeD.puml
index 50ac6fe..81daf05 100644
--- a/src/site/design/threeD.puml
+++ b/src/site/design/threeD.puml
@@ -24,7 +24,7 @@
   skinparam NoteFontColor         #691616
   skinparam ClassFontSize         11
 
-  package org.apache.commons.math3.geometry #ECEBD8
+  package org.apache.commons.math4.geometry #ECEBD8
 
     interface Space {
       +int getDimension()

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/design/twoD.puml
----------------------------------------------------------------------
diff --git a/src/site/design/twoD.puml b/src/site/design/twoD.puml
index 35cc6c5..3de2827 100644
--- a/src/site/design/twoD.puml
+++ b/src/site/design/twoD.puml
@@ -24,7 +24,7 @@
   skinparam NoteFontColor         #691616
   skinparam ClassFontSize         11
 
-  package org.apache.commons.math3.geometry #ECEBD8
+  package org.apache.commons.math4.geometry #ECEBD8
 
     interface Space {
       +int getDimension()

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/proposal.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/proposal.xml b/src/site/xdoc/proposal.xml
index c3df6a2..d277c5b 100644
--- a/src/site/xdoc/proposal.xml
+++ b/src/site/xdoc/proposal.xml
@@ -98,7 +98,7 @@ and mathematical algorithms such as the following:
 </p>
 
 <p>The proposed package name for the new component is
-<code>org.apache.commons.math3</code>.</p>
+<code>org.apache.commons.math</code>.</p>
 
     </subsection>
     <subsection name='(3)  Required Jakarta-Commons Resources'>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/analysis.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/analysis.xml b/src/site/xdoc/userguide/analysis.xml
index 90187ac..58a854f 100644
--- a/src/site/xdoc/userguide/analysis.xml
+++ b/src/site/xdoc/userguide/analysis.xml
@@ -89,13 +89,13 @@
       </subsection>
       <subsection name="4.3 Root-finding" href="rootfinding">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/analysis/solvers/UnivariateSolver.html">
-          UnivariateSolver</a>, <a href="../apidocs/org/apache/commons/math3/analysis/solvers/UnivariateDifferentiableSolver.html">
-          UnivariateDifferentiableSolver</a> and <a href="../apidocs/org/apache/commons/math3/analysis/solvers/PolynomialSolver.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/solvers/UnivariateSolver.html">
+          UnivariateSolver</a>, <a href="../apidocs/org/apache/commons/math4/analysis/solvers/UnivariateDifferentiableSolver.html">
+          UnivariateDifferentiableSolver</a> and <a href="../apidocs/org/apache/commons/math4/analysis/solvers/PolynomialSolver.html">
           PolynomialSolver</a> provide means to find roots of
-          <a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a>,
-          <a href="../apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiable.html">differentiable univariate real-valued functions</a>,
-          and <a href="../apidocs/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.html">polynomial functions</a> respectively.
+          <a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a>,
+          <a href="../apidocs/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiable.html">differentiable univariate real-valued functions</a>,
+          and <a href="../apidocs/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.html">polynomial functions</a> respectively.
           A root is the value where the function takes the value 0.  Commons-Math
           includes implementations of the several root-finding algorithms:
         </p>
@@ -103,85 +103,85 @@
             <tr BGCOLOR="#CCCCFF"><td colspan="5"><font size="+1">Root solvers</font></td></tr>
             <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>Function type</td><td>Convergence</td><td>Needs initial bracketing</td><td>Bracket side selection</td></font></tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/BisectionSolver.html">Bisection</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/BisectionSolver.html">Bisection</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>linear, guaranteed</td>
               <td>yes</td>
               <td>yes</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/BrentSolver.html">Brent-Dekker</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/BrentSolver.html">Brent-Dekker</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>super-linear, guaranteed</td>
               <td>yes</td>
               <td>no</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/BracketingNthOrderBrentSolver.html">bracketing n<sup>th</sup> order Brent</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolver.html">bracketing n<sup>th</sup> order Brent</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>variable order, guaranteed</td>
               <td>yes</td>
               <td>yes</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/IllinoisSolver.html">Illinois Method</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/IllinoisSolver.html">Illinois Method</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>super-linear, guaranteed</td>
               <td>yes</td>
               <td>yes</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/LaguerreSolver.html">Laguerre's Method</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.html">polynomial functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/LaguerreSolver.html">Laguerre's Method</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.html">polynomial functions</a></td>
               <td>cubic for simple root, linear for multiple root</td>
               <td>yes</td>
               <td>no</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/MullerSolver.html">Muller's Method</a> using bracketing to deal with real-valued functions</td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/MullerSolver.html">Muller's Method</a> using bracketing to deal with real-valued functions</td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>quadratic close to roots</td>
               <td>yes</td>
               <td>no</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/MullerSolver2.html">Muller's Method</a> using modulus to deal with real-valued functions</td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/MullerSolver2.html">Muller's Method</a> using modulus to deal with real-valued functions</td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>quadratic close to root</td>
               <td>yes</td>
               <td>no</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/NewtonRaphsonSolver.html">Newton-Raphson's Method</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.html">differentiable univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolver.html">Newton-Raphson's Method</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.html">differentiable univariate real-valued functions</a></td>
               <td>quadratic, non-guaranteed</td>
               <td>no</td>
               <td>no</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/PegasusSolver.html">Pegasus Method</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/PegasusSolver.html">Pegasus Method</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>super-linear, guaranteed</td>
               <td>yes</td>
               <td>yes</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/RegulaFalsiSolver.html">Regula Falsi (false position) Method</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolver.html">Regula Falsi (false position) Method</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>linear, guaranteed</td>
               <td>yes</td>
               <td>yes</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/RiddersSolver.html">Ridder's Method</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/RiddersSolver.html">Ridder's Method</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>super-linear</td>
               <td>yes</td>
               <td>no</td>
             </tr>
             <tr>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/solvers/SecantSolver.html">Secant Method</a></td>
-              <td><a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/solvers/SecantSolver.html">Secant Method</a></td>
+              <td><a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">univariate real-valued functions</a></td>
               <td>super-linear, non-guaranteed</td>
               <td>yes</td>
               <td>no</td>
@@ -237,9 +237,9 @@
           ill-conditioned problems is to be solved, this number can be decreased in order
           to avoid wasting time.
           <a
-          href="../apidocs/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.html">Bracketed
+          href="../apidocs/org/apache/commons/math4/analysis/solvers/BracketedUnivariateSolver.html">Bracketed
           solvers</a> also take an <a
-          href="../apidocs/org/apache/commons/math3/analysis/solvers/AllowedSolution.html">allowed solution</a>
+          href="../apidocs/org/apache/commons/math4/analysis/solvers/AllowedSolution.html">allowed solution</a>
           enum parameter to specify which side of the final convergence interval should be
           selected as the root. It can be <code>ANY_SIDE</code>, <code>LEFT_SIDE</code>, <code>RIGHT_SIDE</code>,
           <code>BELOW_SIDE</code> or <code>ABOVE_SIDE</code>. Left and right are used to specify the root along
@@ -373,13 +373,13 @@ double c = UnivariateSolverUtils.forceSide(100, function,
       </subsection>
       <subsection name="4.4 Interpolation" href="interpolation">
         <p>
-          A <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/UnivariateInterpolator.html">
+          A <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/UnivariateInterpolator.html">
           UnivariateInterpolator</a> is used to find a univariate real-valued
           function <code>f</code> which for a given set of ordered pairs 
           (<code>x<sub>i</sub></code>,<code>y<sub>i</sub></code>) yields
           <code>f(x<sub>i</sub>)=y<sub>i</sub></code> to the best accuracy possible. The result
           is provided as an object implementing the <a
-          href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">
+          href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">
           UnivariateFunction</a> interface. It can therefore be evaluated at any point,
           including point not belonging to the original set.
           Currently, only an interpolator for generating natural cubic splines and a polynomial
@@ -436,7 +436,7 @@ System.out println("f(" + interpolationX + ") = " + interpolatedY);</source>
         <p>
           <a href="http://en.wikipedia.org/wiki/Hermite_interpolation">Hermite interpolation</a>
           is an interpolation method that can use derivatives in addition to function values at sample points. The <a
-          href="../apidocs/org/apache/commons/math3/analysis/interpolation/HermiteInterpolator.html">HermiteInterpolator</a>
+          href="../apidocs/org/apache/commons/math4/analysis/interpolation/HermiteInterpolator.html">HermiteInterpolator</a>
           class implements this method for vector-valued functions. The sampling points can have any spacing (there are
           no requirements for a regular grid) and some points may provide derivatives while others don't provide them
           (or provide derivatives to a smaller order). Points are added one at a time, as shown in the following example:
@@ -455,13 +455,13 @@ System.out.println("derivative at x = 0.5: " + interpolator.derivative(0.5)[0]);
 // should print "interpolation polynomial: 1 + 2 x + 4 x^2 - 4 x^3 + x^4"
 System.out.println("interpolation polynomial: " + interpolator.getPolynomials()[0]);</source>
         <p>
-          A <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.html">
+          A <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/BivariateGridInterpolator.html">
           BivariateGridInterpolator</a> is used to find a bivariate real-valued
           function <code>f</code> which for a given set of tuples
           (<code>x<sub>i</sub></code>,<code>y<sub>j</sub></code>,<code>f<sub>ij</sub></code>)
           yields <code>f(x<sub>i</sub>,y<sub>j</sub>)=f<sub>ij</sub></code> to the best accuracy
           possible. The result is provided as an object implementing the
-          <a href="../apidocs/org/apache/commons/math3/analysis/BivariateFunction.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/BivariateFunction.html">
           BivariateFunction</a> interface. It can therefore be evaluated at any point,
           including a point not belonging to the original set.
           The arrays <code>x<sub>i</sub></code> and <code>y<sub>j</sub></code> must be
@@ -473,25 +473,25 @@ System.out.println("interpolation polynomial: " + interpolator.getPolynomials()[
           are computed from the function values sampled on a grid, as well as the values of the
           partial derivatives of the function at those grid points.
           From two-dimensional data sampled on a grid, the
-          <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolator.html">
           BicubicSplineInterpolator</a> computes a
-          <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunction.html">
           bicubic interpolating function</a>.
           Prior to computing an interpolating function, the
-          <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.html">
           SmoothingPolynomialBicubicSplineInterpolator</a> class performs smoothing of
           the data by computing the polynomial that best fits each of the one-dimensional
           curves along each of the coordinate axes.
         </p>
         <p>
-          A <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/TrivariateGridInterpolator.html">
+          A <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/TrivariateGridInterpolator.html">
           TrivariateGridInterpolator</a> is used to find a trivariate real-valued
           function <code>f</code> which for a given set of tuples
           (<code>x<sub>i</sub></code>,<code>y<sub>j</sub></code>,<code>z<sub>k</sub></code>,
           <code>f<sub>ijk</sub></code>)
           yields <code>f(x<sub>i</sub>,y<sub>j</sub>,z<sub>k</sub>)=f<sub>ijk</sub></code>
           to the best accuracy possible. The result is provided as an object implementing the
-          <a href="../apidocs/org/apache/commons/math3/analysis/TrivariateFunction.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/TrivariateFunction.html">
           TrivariateFunction</a> interface. It can therefore be evaluated at any point,
           including a point not belonging to the original set.
           The arrays <code>x<sub>i</sub></code>, <code>y<sub>j</sub></code> and
@@ -504,41 +504,41 @@ System.out.println("interpolation polynomial: " + interpolator.getPolynomials()[
           are computed from the function values sampled on a grid, as well as the values of the
           partial derivatives of the function at those grid points.
           From three-dimensional data sampled on a grid, the
-          <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolator.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolator.html">
           TricubicSplineInterpolator</a> computes a
-          <a href="../apidocs/org/apache/commons/math3/analysis/interpolation/TricubicSplineInterpolatingFunction.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunction.html">
           tricubic interpolating function</a>.
         </p>
       </subsection>
       <subsection name="4.5 Integration" href="integration">
         <p>
-          A <a href="../apidocs/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.html">
+          A <a href="../apidocs/org/apache/commons/math4/analysis/integration/UnivariateIntegrator.html">
           UnivariateIntegrator</a> provides the means to numerically integrate
-          <a href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">
           univariate real-valued functions</a>.
           Commons-Math includes implementations of the following integration algorithms: <ul>
-          <li><a href="../apidocs/org/apache/commons/math3/analysis/integration/RombergIntegrator.html">
+          <li><a href="../apidocs/org/apache/commons/math4/analysis/integration/RombergIntegrator.html">
           Romberg's method</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.html">
+          <li><a href="../apidocs/org/apache/commons/math4/analysis/integration/SimpsonIntegrator.html">
           Simpson's method</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.html">
+          <li><a href="../apidocs/org/apache/commons/math4/analysis/integration/TrapezoidIntegrator.html">
           trapezoid method</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.html">
+          <li><a href="../apidocs/org/apache/commons/math4/analysis/integration/LegendreGaussIntegrator.html">
           Legendre-Gauss method</a></li>
           </ul>      
         </p>
       </subsection>
       <subsection name="4.6 Polynomials" href="polynomials">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/analysis/polynomials/package-summary.html">
-          org.apache.commons.math3.analysis.polynomials</a> package provides real
+          The <a href="../apidocs/org/apache/commons/math4/analysis/polynomials/package-summary.html">
+          org.apache.commons.math4.analysis.polynomials</a> package provides real
           coefficients polynomials.
         </p>
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.html">
+          The <a href="../apidocs/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.html">
           PolynomialFunction</a> class is the most general one, using traditional
           coefficients arrays. The
-          <a href="../apidocs/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/polynomials/PolynomialsUtils.html">
           PolynomialsUtils</a> utility class provides static factory methods to build
           Chebyshev, Hermite, Jacobi, Laguerre and Legendre polynomials. Coefficients are
           computed using exact fractions so these factory methods can build polynomials
@@ -547,21 +547,21 @@ System.out.println("interpolation polynomial: " + interpolator.getPolynomials()[
       </subsection>
       <subsection name="4.7 Differentiation" href="differentiation">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/analysis/differentiation/package-summary.html">
-          org.apache.commons.math3.analysis.differentiation</a> package provides a general-purpose
+          The <a href="../apidocs/org/apache/commons/math4/analysis/differentiation/package-summary.html">
+          org.apache.commons.math4.analysis.differentiation</a> package provides a general-purpose
           differentiation framework.
         </p>
         <p>
-          The core class is <a href="../apidocs/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.html">
+          The core class is <a href="../apidocs/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.html">
           DerivativeStructure</a> which holds the value and the differentials of a function. This class
           handles some arbitrary number of free parameters and arbitrary derivation order. It is used
           both as the input and the output type for the <a
-          href="../apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.html">
+          href="../apidocs/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.html">
           UnivariateDifferentiableFunction</a> interface. Any differentiable function should implement this
           interface.
         </p>
         <p>
-          The main idea behind the <a href="../apidocs/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.html">
+          The main idea behind the <a href="../apidocs/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.html">
           DerivativeStructure</a> class is that it can be used almost as a number (i.e. it can be added,
           multiplied, its square root can be extracted or its cosine computed... However, in addition to
           computed the value itself when doing these computations, the partial derivatives are also computed
@@ -578,7 +578,7 @@ System.out.println("interpolation polynomial: " + interpolator.getPolynomials()[
         <p>
           The workflow of computation of a derivatives of an expression <code>y=f(x)</code> is the following
           one. First we configure an input parameter <code>x</code> of type <a
-          href="../apidocs/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.html">
+          href="../apidocs/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.html">
           DerivativeStructure</a> so it will drive the function to compute all derivatives up to order 3 for
           example. Then we compute <code>y=f(x)</code> normally by passing this parameter to the f function.At
           the end, we extract from <code>y</code> the value and the derivatives we want. As we have specified
@@ -668,28 +668,28 @@ System.out.println("d2g/dxdy = " + g.getPartialDerivative(1, 1);
 System.out.println("d2g/dy2  = " + g.getPartialDerivative(0, 2);</source>
        <p>
           There are several ways a user can create an implementation of the <a
-          href="../apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.html">
+          href="../apidocs/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.html">
           UnivariateDifferentiableFunction</a> interface. The first method is to simply write it directly using
-          the appropriate methods from <a href="../apidocs/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.html">
+          the appropriate methods from <a href="../apidocs/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.html">
           DerivativeStructure</a> to compute addition, subtraction, sine, cosine... This is often quite
           straigthforward and there is no need to remember the rules for differentiation: the user code only
           represent the function itself, the differentials will be computed automatically under the hood. The
           second method is to write a classical <a
-          href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">UnivariateFunction</a> and to
+          href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">UnivariateFunction</a> and to
           pass it to an existing implementation of the <a
-          href="../apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.html">
+          href="../apidocs/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.html">
           UnivariateFunctionDifferentiator</a> interface to retrieve a differentiated version of the same function.
           The first method is more suited to small functions for which user already control all the underlying code.
           The second method is more suited to either large functions that would be cumbersome to write using the
-          <a href="../apidocs/org/apache/commons/math3/analysis/differentiation/DerivativeStructure.html">
+          <a href="../apidocs/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.html">
           DerivativeStructure</a> API, or functions for which user does not have control to the full underlying code
           (for example functions that call external libraries).
         </p>
         <p>
           Apache Commons Math provides one implementation of the <a
-          href="../apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.html">
+          href="../apidocs/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.html">
           UnivariateFunctionDifferentiator</a> interface: <a
-          href="../apidocs/org/apache/commons/math3/analysis/differentiation/FiniteDifferencesDifferentiator.html">
+          href="../apidocs/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiator.html">
           FiniteDifferencesDifferentiator</a>. This class creates a wrapper that will call the user-provided function
           on a grid sample and will use finite differences to compute the derivatives. It takes care of boundaries
           if the variable is not defined on the whole real line. It is possible to use more points than strictly
@@ -700,7 +700,7 @@ System.out.println("d2g/dy2  = " + g.getPartialDerivative(0, 2);</source>
         </p>
         <p>
           Another implementation of the <a
-          href="../apidocs/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.html">
+          href="../apidocs/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.html">
           UnivariateFunctionDifferentiator</a> interface is under development in the related project
           <a href="http://commons.apache.org/sandbox/nabla/">Apache Commons Nabla</a>. This implementation uses
           automatic code analysis and generation at binary level. However, at time of writing

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/complex.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/complex.xml b/src/site/xdoc/userguide/complex.xml
index fa4a95e..f451ab1 100644
--- a/src/site/xdoc/userguide/complex.xml
+++ b/src/site/xdoc/userguide/complex.xml
@@ -33,7 +33,7 @@
       </subsection>
       <subsection name="7.2 Complex Numbers" href="complex">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/complex/Complex.html">
+          <a href="../apidocs/org/apache/commons/math4/complex/Complex.html">
           Complex</a> provides a complex number type that forms the basis for
           the complex functionality found in commons-math.
          </p>  
@@ -44,9 +44,9 @@
            handling infinite and <code>NaN</code> values.  No attempt is made
            to comply with ANSII/IEC C99x Annex G or any other standard for
            Complex arithmetic.  See the class and method javadocs for the 
-           <a href="../apidocs/org/apache/commons/math3/complex/Complex.html">
+           <a href="../apidocs/org/apache/commons/math4/complex/Complex.html">
            Complex</a> and
-           <a href="../apidocs/org/apache/commons/math3/complex/ComplexUtils.html">
+           <a href="../apidocs/org/apache/commons/math4/complex/ComplexUtils.html">
            ComplexUtils</a> classes for details on computing formulas.
         </p>
         <p>
@@ -77,7 +77,7 @@ Complex answer = lhs.add(rhs);       // add two complex numbers
       </subsection>
       <subsection name="7.3 Complex Transcendental Functions" href="function">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/complex/Complex.html">
+          <a href="../apidocs/org/apache/commons/math4/complex/Complex.html">
           Complex</a> also provides implementations of serveral transcendental
           functions involving complex number arguments.
           These operations provide the means to compute the log, sine, tangent,
@@ -93,7 +93,7 @@ Complex answer = first.log();        // natural logarithm.
       <subsection name="7.4 Complex Formatting and Parsing" href="formatting">
         <p>
           <code>Complex</code> instances can be converted to and from strings
-          using the<a href="../apidocs/org/apache/commons/math3/complex/ComplexFormat.html">
+          using the<a href="../apidocs/org/apache/commons/math4/complex/ComplexFormat.html">
           ComplexFormat</a> class.
           <code>ComplexFormat</code> is a <code>java.text.Format</code>
           extension and, as such, is used like other formatting objects (e.g.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/distribution.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/distribution.xml b/src/site/xdoc/userguide/distribution.xml
index 2fc4605..6fa61f8 100644
--- a/src/site/xdoc/userguide/distribution.xml
+++ b/src/site/xdoc/userguide/distribution.xml
@@ -28,14 +28,14 @@
         <p>
           The distributions package provides a framework and implementations for some commonly used
           probability distributions. Continuous univariate distributions are represented by implementations of
-          the <a href="../apidocs/org/apache/commons/math3/distribution/RealDistribution.html">RealDistribution</a>
+          the <a href="../apidocs/org/apache/commons/math4/distribution/RealDistribution.html">RealDistribution</a>
           interface.  Discrete distributions implement
-          <a href="../apidocs/org/apache/commons/math3/distribution/IntegerDistribution.html">IntegerDistribution</a>
+          <a href="../apidocs/org/apache/commons/math4/distribution/IntegerDistribution.html">IntegerDistribution</a>
           (values must be mapped to integers) and there is an
-          <a href="../apidocs/org/apache/commons/math3/distribution/EnumeratedDistribution.html">EnumeratedDistribution</a>
+          <a href="../apidocs/org/apache/commons/math4/distribution/EnumeratedDistribution.html">EnumeratedDistribution</a>
           class representing discrete distributions with a finite, enumerated set of values.  Finally, multivariate
           real-valued distributions can be represented via the 
-          <a href="../apidocs/org/apache/commons/math3/distribution/MultiVariateRealDistribution.html">MultivariateRealDistribution</a>
+          <a href="../apidocs/org/apache/commons/math4/distribution/MultiVariateRealDistribution.html">MultivariateRealDistribution</a>
           interface.
         </p>
         <p>
@@ -74,7 +74,7 @@ double upperTail = 1.0 - t.cumulativeProbability(2.75); // P(T(29) &gt;= 2.75)</
         <p>
           All distributions implement a <code>sample()</code> method to support random sampling from the
           distribution. Implementation classes expose constructors allowing the default 
-          <a href="../apidocs/org/apache/commons/math3/random/RandomGenerator.html">RandomGenerator</a>
+          <a href="../apidocs/org/apache/commons/math4/random/RandomGenerator.html">RandomGenerator</a>
           used by the sampling algorithm to be overridden.  If sampling is not going to be used, providing
           a null <code>RandomGenerator</code> constructor argument will avoid the overhead of initializing
           the default generator.
@@ -98,14 +98,14 @@ double upperTail = 1.0 - t.cumulativeProbability(2.75); // P(T(29) &gt;= 2.75)</
       <subsection name="8.3 User Defined Distributions" href="userdefined">
         <p>
         User-defined distributions can be implemented using
-        <a href="../apidocs/org/apache/commons/math3/distribution/RealDistribution.html">RealDistribution</a>,
-        <a href="../apidocs/org/apache/commons/math3/distribution/IntegerDistribution.html">IntegerDistribution</a> and
-        <a href="../apidocs/org/apache/commons/math3/distribution/MultivariateRealDistribution.html">MultivariateRealDistribution</a>
+        <a href="../apidocs/org/apache/commons/math4/distribution/RealDistribution.html">RealDistribution</a>,
+        <a href="../apidocs/org/apache/commons/math4/distribution/IntegerDistribution.html">IntegerDistribution</a> and
+        <a href="../apidocs/org/apache/commons/math4/distribution/MultivariateRealDistribution.html">MultivariateRealDistribution</a>
         interfaces serve as base types.  These serve as the basis for all the distributions directly supported by
         Apache Commons Math.  To aid in implementing distributions,
-        the <a href="../apidocs/org/apache/commons/math3/distribution/AbstractRealDistribution.html">AbstractRealDistribution</a>,
-        <a href="../apidocs/org/apache/commons/math3/distribution/AbstractIntegerDistribution.html">AbstractIntegerDistribution</a> and 
-        <a href="../apidocs/org/apache/commons/math3/distribution/AbstractMultivariateRealDistribution.html">AbstractMultivariateRealDistribution</a>
+        the <a href="../apidocs/org/apache/commons/math4/distribution/AbstractRealDistribution.html">AbstractRealDistribution</a>,
+        <a href="../apidocs/org/apache/commons/math4/distribution/AbstractIntegerDistribution.html">AbstractIntegerDistribution</a> and 
+        <a href="../apidocs/org/apache/commons/math4/distribution/AbstractMultivariateRealDistribution.html">AbstractMultivariateRealDistribution</a>
         provide implementation building blocks and offer basic distribution functionality.
         By extending these abstract classes directly, much of the repetitive distribution
         implementation is already developed and should save time and effort in developing

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/exceptions.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/exceptions.xml b/src/site/xdoc/userguide/exceptions.xml
index 55dabf0..d16781a 100644
--- a/src/site/xdoc/userguide/exceptions.xml
+++ b/src/site/xdoc/userguide/exceptions.xml
@@ -54,28 +54,28 @@
             <li>
               <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalArgumentException.html">
                 <code>IllegalArgumentException</code></a>:
-              A <a href="../apidocs/org/apache/commons/math3/exception/MathIllegalArgumentException.html">
+              A <a href="../apidocs/org/apache/commons/math4/exception/MathIllegalArgumentException.html">
                 <code>MathIllegalArgumentException</code></a> is thrown when some input
               parameter fails a precondition check.
             </li>
             <li>
               <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/IllegalStateException.html">
                 <code>IllegalStateException</code></a>:
-              A <a href="../apidocs/org/apache/commons/math3/exception/MathIllegalStateException.html">
+              A <a href="../apidocs/org/apache/commons/math4/exception/MathIllegalStateException.html">
                 <code>MathIllegalStateException</code></a> is thrown when some inconsistency
               has been detected.
             </li>
             <li>
               <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/MathArithmeticException.html">
                 <code>ArithmeticException</code></a>:
-              A <a href="../apidocs/org/apache/commons/math3/exception/MathArithmeticException.html">
+              A <a href="../apidocs/org/apache/commons/math4/exception/MathArithmeticException.html">
                 <code>MathArithmeticException</code></a> is thrown when conditions such as
               "division by zero" or "overflow" are encountered.
             </li>
             <li>
               <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/MathUnsupportedOperationException.html">
                 <code>UnsupportedOperationException</code></a>:
-              A <a href="../apidocs/org/apache/commons/math3/exception/MathUnsupportedOperationException.html">
+              A <a href="../apidocs/org/apache/commons/math4/exception/MathUnsupportedOperationException.html">
                 <code>MathUnsupportedOperationException</code></a> indicates that a feature
               is missing or does not make sense in the given context.
             </li>
@@ -102,11 +102,11 @@
           <li>Exception "context"
             <p>
               Every exception generated by Commons Math implements the
-              <a href="../apidocs/org/apache/commons/math3/exception/util/ExceptionContextProvider.html">
+              <a href="../apidocs/org/apache/commons/math4/exception/util/ExceptionContextProvider.html">
                 ExceptionContextProvider</a> interface. A call to the
-              <a href="../apidocs/org/apache/commons/math3/exception/util/ExceptionContextProvider.html#getContext()">
+              <a href="../apidocs/org/apache/commons/math4/exception/util/ExceptionContextProvider.html#getContext()">
                 getContext</a> method will return the
-              <a href="../apidocs/org/apache/commons/math3/exception/util/ExceptionContext.html">
+              <a href="../apidocs/org/apache/commons/math4/exception/util/ExceptionContext.html">
                 ExceptionContext</a> instance stored in the exception, which the
               user can further customize by adding messages and/or any object.
             </p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/filter.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/filter.xml b/src/site/xdoc/userguide/filter.xml
index c1919af..a241bea 100644
--- a/src/site/xdoc/userguide/filter.xml
+++ b/src/site/xdoc/userguide/filter.xml
@@ -31,12 +31,12 @@
       </subsection>
       <subsection name="15.2 Kalman Filter" href="kalman">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/filter/KalmanFilter.html">
+          <a href="../apidocs/org/apache/commons/math4/filter/KalmanFilter.html">
           KalmanFilter</a> provides a discrete-time filter to estimate
           a stochastic linear process.</p>
           
-        <p>A Kalman filter is initialized with a <a href="../apidocs/org/apache/commons/math3/filter/ProcessModel.html">
-          ProcessModel</a> and a <a href="../apidocs/org/apache/commons/math3/filter/MeasurementModel.html">
+        <p>A Kalman filter is initialized with a <a href="../apidocs/org/apache/commons/math4/filter/ProcessModel.html">
+          ProcessModel</a> and a <a href="../apidocs/org/apache/commons/math4/filter/MeasurementModel.html">
           MeasurementModel</a>, which contain the corresponding transformation and noise covariance matrices. 
           The parameter names used in the respective models correspond to the following names commonly used 
           in the mathematical literature:

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/fitting.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/fitting.xml b/src/site/xdoc/userguide/fitting.xml
index 2e38b20..c7c8bb1 100644
--- a/src/site/xdoc/userguide/fitting.xml
+++ b/src/site/xdoc/userguide/fitting.xml
@@ -47,15 +47,15 @@
               appropriate class,
             </li>
             <li>
-              call the <a href="../apidocs/org/apache/commons/math3/fitting/AbstractCurveFitter">fit</a>
-              with a <code>Collection</code> of <a href="../apidocs/org/apache/commons/math3/fitting/WeightedObservedPoint.html">
+              call the <a href="../apidocs/org/apache/commons/math4/fitting/AbstractCurveFitter">fit</a>
+              with a <code>Collection</code> of <a href="../apidocs/org/apache/commons/math4/fitting/WeightedObservedPoint.html">
                 observed data points</a> as argument, which will return an array with the parameters that
               best fit the given data points.
             </li>
           </ul>
 
           The list of observed data points to be passed to <code>fit</code> can be built by incrementally
-          adding instances to an instance of <a href="../apidocs/org/apache/commons/math3/fitting/WeightedObservedPoints.html">WeightedObservedPoints</a>,
+          adding instances to an instance of <a href="../apidocs/org/apache/commons/math4/fitting/WeightedObservedPoints.html">WeightedObservedPoints</a>,
           and then retrieve the list of <code>WeightedObservedPoint</code> by calling the <code>toList</code>
           method on that container.
           A weight can be associated with each observed point; it allows to take into account uncertainty
@@ -82,25 +82,25 @@
           Fitting of specific functions are provided through the following classes:
           <ul>
             <li>
-              <a href="../apidocs/org/apache/commons/math3/fitting/PolynomialCurveFitter.html">
+              <a href="../apidocs/org/apache/commons/math4/fitting/PolynomialCurveFitter.html">
                 PolynomialFitter</a> fits a
-              <a href="../apidocs/org/apache/commons/math3/analysis/polynomials/PolynomialFunction.Parametric.html">
+              <a href="../apidocs/org/apache/commons/math4/analysis/polynomials/PolynomialFunction.Parametric.html">
                 polynomial</a> function.
             </li>
             <li>
-              <a href="../apidocs/org/apache/commons/math3/fitting/HarmonicCurveFitter.html">
+              <a href="../apidocs/org/apache/commons/math4/fitting/HarmonicCurveFitter.html">
                 HarmonicFitter</a> fits a
-              <a href="../apidocs/org/apache/commons/math3/analysis/function/HarmonicOscillator.Parametric.html">
+              <a href="../apidocs/org/apache/commons/math4/analysis/function/HarmonicOscillator.Parametric.html">
                 harmonic</a> function.
-              An instance of the inner class <a href="../apidocs/org/apache/commons/math3/fitting/HarmonicCurveFitter.ParameterGuesser.html">
+              An instance of the inner class <a href="../apidocs/org/apache/commons/math4/fitting/HarmonicCurveFitter.ParameterGuesser.html">
                 ParameterGuesser</a> can be used to retrieve initial values for the fitting procedure.
             </li>
             <li>
-              <a href="../apidocs/org/apache/commons/math3/fitting/GaussianCurveFitter.html">
+              <a href="../apidocs/org/apache/commons/math4/fitting/GaussianCurveFitter.html">
                 GaussianFitter</a> fits a
-              <a href="../apidocs/org/apache/commons/math3/analysis/function/Gaussian.Parametric.html">
+              <a href="../apidocs/org/apache/commons/math4/analysis/function/Gaussian.Parametric.html">
                 Gaussian</a> function.
-              An instance of the inner class <a href="../apidocs/org/apache/commons/math3/fitting/GaussianCurveFitter.ParameterGuesser.html">
+              An instance of the inner class <a href="../apidocs/org/apache/commons/math4/fitting/GaussianCurveFitter.ParameterGuesser.html">
                 ParameterGuesser</a> can be used to retrieve initial values for the fitting procedure.
             </li>
           </ul>
@@ -130,11 +130,11 @@ final double[] coeff = fitter.fit(obs.toList());
 
       <subsection name="17.3 General Case" href="general">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/fitting/AbstractCurveFitter.html">
+          The <a href="../apidocs/org/apache/commons/math4/fitting/AbstractCurveFitter.html">
             AbstractCurveFitter</a> class provides the basic functionality for implementing other
           curve fitting classes.
           Users must provide their own implementation of the curve template as a class that implements
-          the <a href="../apidocs/org/apache/commons/math3/analysis/ParametricUnivariateFunction.html">
+          the <a href="../apidocs/org/apache/commons/math4/analysis/ParametricUnivariateFunction.html">
             ParametricUnivariateFunction</a> interface.
         </p>
       </subsection>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/fraction.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/fraction.xml b/src/site/xdoc/userguide/fraction.xml
index beb96d3..3f8ae51 100644
--- a/src/site/xdoc/userguide/fraction.xml
+++ b/src/site/xdoc/userguide/fraction.xml
@@ -32,8 +32,8 @@
       </subsection>
       <subsection name="9.2 Fraction Numbers" href="fraction">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/fraction/Fraction.html">
-          Fraction</a> and <a href="../apidocs/org/apache/commons/math3/fraction/BigFraction.html">
+          <a href="../apidocs/org/apache/commons/math4/fraction/Fraction.html">
+          Fraction</a> and <a href="../apidocs/org/apache/commons/math4/fraction/BigFraction.html">
           BigFraction</a> provide fraction number type that forms the basis for
           the fraction functionality found in Commons-Math. The former one can be
           used for fractions whose numerators and denominators are small enough
@@ -70,7 +70,7 @@ Fraction answer = lhs.add(rhs);     // add two fractions
       <subsection name="9.3 Fraction Formatting and Parsing" href="formatting">
         <p>
           <code>Fraction</code> instances can be converted to and from strings
-          using the<a href="../apidocs/org/apache/commons/math3/fraction/FractionFormat.html">
+          using the<a href="../apidocs/org/apache/commons/math4/fraction/FractionFormat.html">
           FractionFormat</a> class. <code>FractionFormat</code> is a
           <code>java.text.Format</code> extension and, as such, is used like other
           formatting objects (e.g. <code>java.text.SimpleDateFormat</code>):

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/genetics.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/genetics.xml b/src/site/xdoc/userguide/genetics.xml
index ed29867..49fb749 100644
--- a/src/site/xdoc/userguide/genetics.xml
+++ b/src/site/xdoc/userguide/genetics.xml
@@ -32,15 +32,15 @@
       </subsection>
       <subsection name="14.2 GA Framework">
       <p>
-      <a href="../apidocs/org/apache/commons/math3/genetics/GeneticAlgorithm.html">
+      <a href="../apidocs/org/apache/commons/math4/genetics/GeneticAlgorithm.html">
       GeneticAlgorithm</a> provides an execution framework for Genetic Algorithms (GA).  
-      <a href="../apidocs/org/apache/commons/math3/genetics/Population.html">
-      Populations,</a> consisting of <a href="../apidocs/org/apache/commons/math3/genetics/Chromosome.html">
+      <a href="../apidocs/org/apache/commons/math4/genetics/Population.html">
+      Populations,</a> consisting of <a href="../apidocs/org/apache/commons/math4/genetics/Chromosome.html">
       Chromosomes</a> are evolved by the <code>GeneticAlgorithm</code> until a 
-      <a href="../apidocs/org/apache/commons/math3/genetics/StoppingCondition.html">
-      StoppingCondition</a> is reached. Evolution is determined by <a href="../apidocs/org/apache/commons/math3/genetics/SelectionPolicy.html">
-      SelectionPolicy</a>, <a href="../apidocs/org/apache/commons/math3/genetics/MutationPolicy.html">
-      MutationPolicy</a> and <a href="../apidocs/org/apache/commons/math3/genetics/Fitness.html">
+      <a href="../apidocs/org/apache/commons/math4/genetics/StoppingCondition.html">
+      StoppingCondition</a> is reached. Evolution is determined by <a href="../apidocs/org/apache/commons/math4/genetics/SelectionPolicy.html">
+      SelectionPolicy</a>, <a href="../apidocs/org/apache/commons/math4/genetics/MutationPolicy.html">
+      MutationPolicy</a> and <a href="../apidocs/org/apache/commons/math4/genetics/Fitness.html">
       Fitness</a>.
       </p>
       <p>
@@ -63,10 +63,10 @@
           <ul><li>Apply configured <code>SelectionPolicy</code> to select a pair of parents
                  from <code>current</code></li>
              <li>With probability = 
-                 <a href="../apidocs/org/apache/commons/math3/genetics/GeneticAlgorithm.html#getCrossoverRate()">
+                 <a href="../apidocs/org/apache/commons/math4/genetics/GeneticAlgorithm.html#getCrossoverRate()">
                  getCrossoverRate()</a>, apply configured <code>CrossoverPolicy</code> to parents</li>
              <li>With probability = 
-                 <a href="../apidocs/org/apache/commons/math3/genetics/GeneticAlgorithm.html#getMutationRate()">
+                 <a href="../apidocs/org/apache/commons/math4/genetics/GeneticAlgorithm.html#getMutationRate()">
                  getMutationRate()</a>,
                  apply configured <code>MutationPolicy</code> to each of the offspring</li>
              <li>Add offspring individually to nextGeneration,
@@ -105,27 +105,27 @@ Chromosome bestFinal = finalPopulation.getFittestChromosome();
         <table>
         <tr><th>Parameter</th><th>value in example</th><th>meaning</th></tr>
         <tr><td>crossoverPolicy</td>
-        <td><a href="../apidocs/org/apache/commons/math3/genetics/OnePointCrossover.html">OnePointCrossover</a></td>
+        <td><a href="../apidocs/org/apache/commons/math4/genetics/OnePointCrossover.html">OnePointCrossover</a></td>
         <td>A random crossover point is selected and the first part from each parent is copied to the corresponding
         child, and the second parts are copied crosswise.</td></tr>
         <tr><td>crossoverRate</td>
         <td>1</td>
         <td>Always apply crossover</td></tr>
         <tr><td>mutationPolicy</td>
-        <td><a href="../apidocs/org/apache/commons/math3/genetics/RandomKeyMutation.html">RandomKeyMutation</a></td>
+        <td><a href="../apidocs/org/apache/commons/math4/genetics/RandomKeyMutation.html">RandomKeyMutation</a></td>
         <td>Changes a randomly chosen element of the array representation to a random value uniformly distributed in [0,1].</td></tr>
         <tr><td>mutationRate</td>
         <td>.1</td>
         <td>Apply mutation with probability 0.1 - that is, 10% of the time.</td></tr>
         <tr><td>selectionPolicy</td>
-        <td><a href="../apidocs/org/apache/commons/math3/genetics/TournamentSelection.html">TournamentSelection</a></td>
+        <td><a href="../apidocs/org/apache/commons/math4/genetics/TournamentSelection.html">TournamentSelection</a></td>
         <td>Each of the two selected chromosomes is selected based on an n-ary tournament -- this is done by drawing
         n random chromosomes without replacement from the population, and then selecting the fittest chromosome among them.</td></tr>
         </table><br/>
         The algorithm starts with an <code>initial</code> population of <code>Chromosomes.</code> and executes until 
-        the specified <a href="../apidocs/org/apache/commons/math3/genetics/StoppingCondition.html">StoppingCondition</a>
+        the specified <a href="../apidocs/org/apache/commons/math4/genetics/StoppingCondition.html">StoppingCondition</a>
         is reached.  In the example above, a
-        <a href="../apidocs/org/apache/commons/math3/genetics/FixedGenerationCount.html">FixedGenerationCount</a>
+        <a href="../apidocs/org/apache/commons/math4/genetics/FixedGenerationCount.html">FixedGenerationCount</a>
         stopping condition is used, which means the algorithm proceeds through a fixed number of generations.
       </p>
       </subsection>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/geometry.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/geometry.xml b/src/site/xdoc/userguide/geometry.xml
index c05620e..7f7b6b3 100644
--- a/src/site/xdoc/userguide/geometry.xml
+++ b/src/site/xdoc/userguide/geometry.xml
@@ -42,11 +42,11 @@
           <table border="1" align="center">
           <tr BGCOLOR="#CCCCFF"><td colspan="2"><font size="+1">Regions</font></td></tr>
           <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Space</td><td>Region</td></font></tr>
-          <tr><td>Euclidean 1D</td><td><a href="../apidocs/org/apache/commons/math3/geometry/euclidean/oned/IntervalsSet.html">IntervalsSet</a></td></tr>
-          <tr><td>Euclidean 2D</td><td><a href="../apidocs/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.html">PolygonsSet</a></td></tr>
-          <tr><td>Euclidean 3D</td><td><a href="../apidocs/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.html">PolyhedronsSet</a></td></tr>
-          <tr><td>1-Sphere</td><td><a href="../apidocs/org/apache/commons/math3/geometry/spherical/oned/ArcsSet.html">ArcsSet</a></td></tr>
-          <tr><td>2-Sphere</td><td><a href="../apidocs/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.html">SphericalPolygonsSet</a></td></tr>
+          <tr><td>Euclidean 1D</td><td><a href="../apidocs/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.html">IntervalsSet</a></td></tr>
+          <tr><td>Euclidean 2D</td><td><a href="../apidocs/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.html">PolygonsSet</a></td></tr>
+          <tr><td>Euclidean 3D</td><td><a href="../apidocs/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.html">PolyhedronsSet</a></td></tr>
+          <tr><td>1-Sphere</td><td><a href="../apidocs/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.html">ArcsSet</a></td></tr>
+          <tr><td>2-Sphere</td><td><a href="../apidocs/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.html">SphericalPolygonsSet</a></td></tr>
           </table>
         </p>
         <p>
@@ -75,9 +75,9 @@
 
       <subsection name="11.2 Euclidean spaces" href="euclidean">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/geometry/euclidean/oned/Vector1D.html">
-          Vector1D</a>, <a href="../apidocs/org/apache/commons/math3/geometry/euclidean/twod/Vector2D.html">
-          Vector2D</a> and <a href="../apidocs/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.html">
+          <a href="../apidocs/org/apache/commons/math4/geometry/euclidean/oned/Vector1D.html">
+          Vector1D</a>, <a href="../apidocs/org/apache/commons/math4/geometry/euclidean/twod/Vector2D.html">
+          Vector2D</a> and <a href="../apidocs/org/apache/commons/math4/geometry/euclidean/threed/Vector3D.html">
           Vector3D</a> provide simple vector types. One important feature is
           that instances of these classes are guaranteed
           to be immutable, this greatly simplifies modelling dynamical systems
@@ -99,14 +99,14 @@
           is of course also implemented.
         </p>
         <p>
-          <a href="../apidocs/org/apache/commons/math3/geometry/euclidean/oned/Vector1DFormat.html">
-          Vector1DFormat</a>, <a href="../apidocs/org/apache/commons/math3/geometry/euclidean/twod/Vector2DFormat.html">
-          Vector2DFormat</a> and <a href="../apidocs/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.html">
+          <a href="../apidocs/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormat.html">
+          Vector1DFormat</a>, <a href="../apidocs/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormat.html">
+          Vector2DFormat</a> and <a href="../apidocs/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormat.html">
           Vector3DFormat</a> are specialized classes for formatting output or parsing
           input with text representation of vectors.
         </p>
         <p>
-          <a href="../apidocs/org/apache/commons/math3/geometry/euclidean/threed/Rotation.html">
+          <a href="../apidocs/org/apache/commons/math4/geometry/euclidean/threed/Rotation.html">
           Rotation</a> represents 3D rotations.
           Rotation instances are also immutable objects, as Vector3D instances.
         </p>
@@ -185,13 +185,13 @@
           a two-dimensional disc) and the 2-sphere (i.e. the two dimensional sphere surface
           corresponding to the boundary of a three-dimensional ball). The main classes in
           this package corresopnd to the region explained above, i.e.
-          <a href="../apidocs/org/apache/commons/math3/geometry/spherical/oned/ArcsSet.html">ArcsSet</a>
-          and <a href="../apidocs/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.html">SphericalPolygonsSet</a>.
+          <a href="../apidocs/org/apache/commons/math4/geometry/spherical/oned/ArcsSet.html">ArcsSet</a>
+          and <a href="../apidocs/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSet.html">SphericalPolygonsSet</a>.
         </p>
       </subsection>
       <subsection name="11.4 Binary Space Partitioning" href="partitioning">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/geometry/partitioning/BSPTree.html">
+          <a href="../apidocs/org/apache/commons/math4/geometry/partitioning/BSPTree.html">
           BSP trees</a> are an efficient way to represent space partitions and
           to associate attributes with each cell. Each node in a BSP tree
           represents a convex region which is partitioned in two convex

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/linear.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/linear.xml b/src/site/xdoc/userguide/linear.xml
index acfd4b1..3a061e3 100644
--- a/src/site/xdoc/userguide/linear.xml
+++ b/src/site/xdoc/userguide/linear.xml
@@ -36,7 +36,7 @@
       </subsection>
       <subsection name="3.2 Real matrices" href="real_matrices">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/linear/RealMatrix.html">
+          The <a href="../apidocs/org/apache/commons/math4/linear/RealMatrix.html">
           RealMatrix</a> interface represents a matrix with real numbers as 
           entries.  The following basic matrix operations are supported:
           <ul>
@@ -73,18 +73,18 @@ RealMatrix pInverse = new LUDecomposition(p).getSolver().getInverse();
         </p>
         <p>
         The three main implementations of the interface are <a
-        href="../apidocs/org/apache/commons/math3/linear/Array2DRowRealMatrix.html">
+        href="../apidocs/org/apache/commons/math4/linear/Array2DRowRealMatrix.html">
         Array2DRowRealMatrix</a> and <a
-        href="../apidocs/org/apache/commons/math3/linear/BlockRealMatrix.html">
+        href="../apidocs/org/apache/commons/math4/linear/BlockRealMatrix.html">
         BlockRealMatrix</a> for dense matrices (the second one being more suited to
         dimensions above 50 or 100) and <a
-        href="../apidocs/org/apache/commons/math3/linear/SparseRealMatrix.html">
+        href="../apidocs/org/apache/commons/math4/linear/SparseRealMatrix.html">
         SparseRealMatrix</a> for sparse matrices.
         </p>
       </subsection>
       <subsection name="3.3 Real vectors" href="real_vectors">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/linear/RealVector.html">
+          The <a href="../apidocs/org/apache/commons/math4/linear/RealVector.html">
           RealVector</a> interface represents a vector with real numbers as 
           entries.  The following basic matrix operations are supported:
           <ul>
@@ -97,7 +97,7 @@ RealMatrix pInverse = new LUDecomposition(p).getSolver().getInverse();
           </ul>
         </p>
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/linear/RealVectorFormat.html">
+          The <a href="../apidocs/org/apache/commons/math4/linear/RealVectorFormat.html">
           RealVectorFormat</a> class handles input/output of vectors in a customizable
           textual format.
         </p>
@@ -105,7 +105,7 @@ RealMatrix pInverse = new LUDecomposition(p).getSolver().getInverse();
       <subsection name="3.4 Solving linear systems" href="solve">
         <p>
           The <code>solve()</code> methods of the <a
-          href="../apidocs/org/apache/commons/math3/linear/DecompositionSolver.html">DecompositionSolver</a>
+          href="../apidocs/org/apache/commons/math4/linear/DecompositionSolver.html">DecompositionSolver</a>
           interface support solving linear systems of equations of the form AX=B, either
           in linear sense or in least square sense. A <code>RealMatrix</code> instance is
           used to represent the coefficient matrix of the system. Solving the system is a
@@ -158,11 +158,11 @@ RealVector solution = solver.solve(constants);
           <table border="1" align="center">
           <tr BGCOLOR="#CCCCFF"><td colspan="3"><font size="+1">Decomposition algorithms</font></td></tr>
           <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>coefficients matrix</td><td>problem type</td></font></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/linear/LUDecomposition.html">LU</a></td><td>square</td><td>exact solution only</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/linear/CholeskyDecomposition.html">Cholesky</a></td><td>symmetric positive definite</td><td>exact solution only</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/linear/QRDecomposition.html">QR</a></td><td>any</td><td>least squares solution</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/linear/EigenDecomposition.html">eigen decomposition</a></td><td>square</td><td>exact solution only</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/linear/SingularValueDecomposition.html">SVD</a></td><td>any</td><td>least squares solution</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/linear/LUDecomposition.html">LU</a></td><td>square</td><td>exact solution only</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/linear/CholeskyDecomposition.html">Cholesky</a></td><td>symmetric positive definite</td><td>exact solution only</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/linear/QRDecomposition.html">QR</a></td><td>any</td><td>least squares solution</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/linear/EigenDecomposition.html">eigen decomposition</a></td><td>square</td><td>exact solution only</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/linear/SingularValueDecomposition.html">SVD</a></td><td>any</td><td>least squares solution</td></tr>
           </table>
         </p>
         <p>
@@ -197,13 +197,13 @@ RealVector solution = solver.solve(constants);
       <subsection name="3.6 Non-real fields (complex, fractions ...)" href="field">
         <p>
           In addition to the real field, matrices and vectors using non-real <a
-          href="../apidocs/org/apache/commons/math3/FieldElement.html">field elements</a> can be used.
+          href="../apidocs/org/apache/commons/math4/FieldElement.html">field elements</a> can be used.
           The fields already supported by the library are:
           <ul>
-            <li><a href="../apidocs/org/apache/commons/math3/complex/Complex.html">Complex</a></li>
-            <li><a href="../apidocs/org/apache/commons/math3/fraction/Fraction.html">Fraction</a></li>
-            <li><a href="../apidocs/org/apache/commons/math3/fraction/BigFraction.html">BigFraction</a></li>
-            <li><a href="../apidocs/org/apache/commons/math3/util/BigReal.html">BigReal</a></li>
+            <li><a href="../apidocs/org/apache/commons/math4/complex/Complex.html">Complex</a></li>
+            <li><a href="../apidocs/org/apache/commons/math4/fraction/Fraction.html">Fraction</a></li>
+            <li><a href="../apidocs/org/apache/commons/math4/fraction/BigFraction.html">BigFraction</a></li>
+            <li><a href="../apidocs/org/apache/commons/math4/util/BigReal.html">BigReal</a></li>
           </ul>
         </p>
       </subsection>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/ml.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/ml.xml b/src/site/xdoc/userguide/ml.xml
index 1ba7b65..bc3f2c2 100644
--- a/src/site/xdoc/userguide/ml.xml
+++ b/src/site/xdoc/userguide/ml.xml
@@ -34,30 +34,30 @@
       </subsection>
       <subsection name="16.2 Clustering algorithms and distance measures" href="clustering">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/ml/clustering/Clusterer.html">
+          The <a href="../apidocs/org/apache/commons/math4/ml/clustering/Clusterer.html">
           Clusterer</a> class represents a clustering algorithm.
           The following algorithms are available:
           <ul>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/clustering/KMeansPlusPlusClusterer.html">KMeans++</a>:
+          <li><a href="../apidocs/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.html">KMeans++</a>:
           It is based on the well-known kMeans algorithm, but uses a different method for 
           choosing the initial values (or "seeds") and thus avoids cases where KMeans sometimes 
           results in poor clusterings. KMeans/KMeans++ clustering aims to partition n observations 
           into k clusters in such that each point belongs to the cluster with the nearest center. 
           </li>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/clustering/FuzzyKMeansClusterer.html">Fuzzy-KMeans</a>:
+          <li><a href="../apidocs/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.html">Fuzzy-KMeans</a>:
           A variation of the classical K-Means algorithm, with the major difference that a single
           data point is not uniquely assigned to a single cluster. Instead, each point i has a set
           of weights u<sub>ij</sub> which indicate the degree of membership to the cluster j. The fuzzy
           variant does not require initial values for the cluster centers and is thus more robust, although
           slower than the original kMeans algorithm.
           </li>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/clustering/DBSCANClusterer.html">DBSCAN</a>:
+          <li><a href="../apidocs/org/apache/commons/math4/ml/clustering/DBSCANClusterer.html">DBSCAN</a>:
           Density-based spatial clustering of applications with noise (DBSCAN) finds a number of 
           clusters starting from the estimated density distribution of corresponding nodes. The
           main advantages over KMeans/KMeans++ are that DBSCAN does not require the specification
           of an initial number of clusters and can find arbitrarily shaped clusters.
           </li>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/clustering/MultiKMeansPlusPlusClusterer.html">Multi-KMeans++</a>:
+          <li><a href="../apidocs/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClusterer.html">Multi-KMeans++</a>:
           Multi-KMeans++ is a meta algorithm that basically performs n runs using KMeans++ and then
           chooses the best clustering (i.e., the one with the lowest distance variance over all clusters)
           from those runs.
@@ -75,11 +75,11 @@
           between two points (either data points or cluster centers).
           The following distance measures are available:
           <ul>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/distance/CanberraDistance.html">Canberra distance</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/distance/ChebyshevDistance.html">ChebyshevDistance distance</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/distance/EuclideanDistance.html">EuclideanDistance distance</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/distance/ManhattanDistance.html">ManhattanDistance distance</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/ml/distance/EarthMoversDistance.html">Earth Mover's distance</a></li>
+          <li><a href="../apidocs/org/apache/commons/math4/ml/distance/CanberraDistance.html">Canberra distance</a></li>
+          <li><a href="../apidocs/org/apache/commons/math4/ml/distance/ChebyshevDistance.html">ChebyshevDistance distance</a></li>
+          <li><a href="../apidocs/org/apache/commons/math4/ml/distance/EuclideanDistance.html">EuclideanDistance distance</a></li>
+          <li><a href="../apidocs/org/apache/commons/math4/ml/distance/ManhattanDistance.html">ManhattanDistance distance</a></li>
+          <li><a href="../apidocs/org/apache/commons/math4/ml/distance/EarthMoversDistance.html">Earth Mover's distance</a></li>
           </ul>
         </p>
       </subsection>
@@ -91,7 +91,7 @@
         10 different clusters based on their euclidean distance.
         </p>
         <p>
-        The cluster algorithms expect a list of <a href="../apidocs/org/apache/commons/math3/ml/cluster/Clusterable.html">Clusterable</a>
+        The cluster algorithms expect a list of <a href="../apidocs/org/apache/commons/math4/ml/cluster/Clusterable.html">Clusterable</a>
         as input. Typically, we don't want to pollute our domain objects with interfaces from helper APIs.
         Hence, we first create a wrapper object:
         <source>


[29/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NotStrictlyPositiveException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NotStrictlyPositiveException.java b/src/main/java/org/apache/commons/math3/exception/NotStrictlyPositiveException.java
deleted file mode 100644
index b4f2bf5..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NotStrictlyPositiveException.java
+++ /dev/null
@@ -1,49 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-
-/**
- * Exception to be thrown when the argument is not greater than 0.
- *
- * @since 2.2
- */
-public class NotStrictlyPositiveException extends NumberIsTooSmallException {
-
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -7824848630829852237L;
-
-    /**
-     * Construct the exception.
-     *
-     * @param value Argument.
-     */
-    public NotStrictlyPositiveException(Number value) {
-        super(value, INTEGER_ZERO, false);
-    }
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Specific context where the error occurred.
-     * @param value Argument.
-     */
-    public NotStrictlyPositiveException(Localizable specific,
-                                        Number value) {
-        super(specific, value, INTEGER_ZERO, false);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NullArgumentException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NullArgumentException.java b/src/main/java/org/apache/commons/math3/exception/NullArgumentException.java
deleted file mode 100644
index d56f7e0..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NullArgumentException.java
+++ /dev/null
@@ -1,51 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * All conditions checks that fail due to a {@code null} argument must throw
- * this exception.
- * This class is meant to signal a precondition violation ("null is an illegal
- * argument") and so does not extend the standard {@code NullPointerException}.
- * Propagation of {@code NullPointerException} from within Commons-Math is
- * construed to be a bug.
- *
- * @since 2.2
- */
-public class NullArgumentException extends MathIllegalArgumentException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
-
-    /**
-     * Default constructor.
-     */
-    public NullArgumentException() {
-        this(LocalizedFormats.NULL_NOT_ALLOWED);
-    }
-    /**
-     * @param pattern Message pattern providing the specific context of
-     * the error.
-     * @param arguments Values for replacing the placeholders in {@code pattern}.
-     */
-    public NullArgumentException(Localizable pattern,
-                                 Object ... arguments) {
-        super(pattern, arguments);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NumberIsTooLargeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NumberIsTooLargeException.java b/src/main/java/org/apache/commons/math3/exception/NumberIsTooLargeException.java
deleted file mode 100644
index a65c5e2..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NumberIsTooLargeException.java
+++ /dev/null
@@ -1,85 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when a number is too large.
- *
- * @since 2.2
- */
-public class NumberIsTooLargeException extends MathIllegalNumberException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 4330003017885151975L;
-    /**
-     * Higher bound.
-     */
-    private final Number max;
-    /**
-     * Whether the maximum is included in the allowed range.
-     */
-    private final boolean boundIsAllowed;
-
-    /**
-     * Construct the exception.
-     *
-     * @param wrong Value that is larger than the maximum.
-     * @param max Maximum.
-     * @param boundIsAllowed if true the maximum is included in the allowed range.
-     */
-    public NumberIsTooLargeException(Number wrong,
-                                     Number max,
-                                     boolean boundIsAllowed) {
-        this(boundIsAllowed ?
-             LocalizedFormats.NUMBER_TOO_LARGE :
-             LocalizedFormats.NUMBER_TOO_LARGE_BOUND_EXCLUDED,
-             wrong, max, boundIsAllowed);
-    }
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Specific context pattern.
-     * @param wrong Value that is larger than the maximum.
-     * @param max Maximum.
-     * @param boundIsAllowed if true the maximum is included in the allowed range.
-     */
-    public NumberIsTooLargeException(Localizable specific,
-                                     Number wrong,
-                                     Number max,
-                                     boolean boundIsAllowed) {
-        super(specific, wrong, max);
-
-        this.max = max;
-        this.boundIsAllowed = boundIsAllowed;
-    }
-
-    /**
-     * @return {@code true} if the maximum is included in the allowed range.
-     */
-    public boolean getBoundIsAllowed() {
-        return boundIsAllowed;
-    }
-
-    /**
-     * @return the maximum.
-     */
-    public Number getMax() {
-        return max;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NumberIsTooSmallException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NumberIsTooSmallException.java b/src/main/java/org/apache/commons/math3/exception/NumberIsTooSmallException.java
deleted file mode 100644
index 5073ef8..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NumberIsTooSmallException.java
+++ /dev/null
@@ -1,86 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when a number is too small.
- *
- * @since 2.2
- */
-public class NumberIsTooSmallException extends MathIllegalNumberException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6100997100383932834L;
-    /**
-     * Higher bound.
-     */
-    private final Number min;
-    /**
-     * Whether the maximum is included in the allowed range.
-     */
-    private final boolean boundIsAllowed;
-
-    /**
-     * Construct the exception.
-     *
-     * @param wrong Value that is smaller than the minimum.
-     * @param min Minimum.
-     * @param boundIsAllowed Whether {@code min} is included in the allowed range.
-     */
-    public NumberIsTooSmallException(Number wrong,
-                                     Number min,
-                                     boolean boundIsAllowed) {
-        this(boundIsAllowed ?
-             LocalizedFormats.NUMBER_TOO_SMALL :
-             LocalizedFormats.NUMBER_TOO_SMALL_BOUND_EXCLUDED,
-             wrong, min, boundIsAllowed);
-    }
-
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Specific context pattern.
-     * @param wrong Value that is smaller than the minimum.
-     * @param min Minimum.
-     * @param boundIsAllowed Whether {@code min} is included in the allowed range.
-     */
-    public NumberIsTooSmallException(Localizable specific,
-                                     Number wrong,
-                                     Number min,
-                                     boolean boundIsAllowed) {
-        super(specific, wrong, min);
-
-        this.min = min;
-        this.boundIsAllowed = boundIsAllowed;
-    }
-
-    /**
-     * @return {@code true} if the minimum is included in the allowed range.
-     */
-    public boolean getBoundIsAllowed() {
-        return boundIsAllowed;
-    }
-
-    /**
-     * @return the minimum.
-     */
-    public Number getMin() {
-        return min;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/OutOfRangeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/OutOfRangeException.java b/src/main/java/org/apache/commons/math3/exception/OutOfRangeException.java
deleted file mode 100644
index 99079d7..0000000
--- a/src/main/java/org/apache/commons/math3/exception/OutOfRangeException.java
+++ /dev/null
@@ -1,78 +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.exception;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.Localizable;
-
-/**
- * Exception to be thrown when some argument is out of range.
- *
- * @since 2.2
- */
-public class OutOfRangeException extends MathIllegalNumberException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 111601815794403609L;
-    /** Lower bound. */
-    private final Number lo;
-    /** Higher bound. */
-    private final Number hi;
-
-    /**
-     * Construct an exception from the mismatched dimensions.
-     *
-     * @param wrong Requested value.
-     * @param lo Lower bound.
-     * @param hi Higher bound.
-     */
-    public OutOfRangeException(Number wrong,
-                               Number lo,
-                               Number hi) {
-        this(LocalizedFormats.OUT_OF_RANGE_SIMPLE, wrong, lo, hi);
-    }
-
-    /**
-     * Construct an exception from the mismatched dimensions with a
-     * specific context information.
-     *
-     * @param specific Context information.
-     * @param wrong Requested value.
-     * @param lo Lower bound.
-     * @param hi Higher bound.
-     */
-    public OutOfRangeException(Localizable specific,
-                               Number wrong,
-                               Number lo,
-                               Number hi) {
-        super(specific, wrong, lo, hi);
-        this.lo = lo;
-        this.hi = hi;
-    }
-
-    /**
-     * @return the lower bound.
-     */
-    public Number getLo() {
-        return lo;
-    }
-    /**
-     * @return the higher bound.
-     */
-    public Number getHi() {
-        return hi;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/TooManyEvaluationsException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/TooManyEvaluationsException.java b/src/main/java/org/apache/commons/math3/exception/TooManyEvaluationsException.java
deleted file mode 100644
index 09da0a0..0000000
--- a/src/main/java/org/apache/commons/math3/exception/TooManyEvaluationsException.java
+++ /dev/null
@@ -1,39 +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.exception;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when the maximal number of evaluations is exceeded.
- *
- * @since 3.0
- */
-public class TooManyEvaluationsException extends MaxCountExceededException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 4330003017885151975L;
-
-    /**
-     * Construct the exception.
-     *
-     * @param max Maximum number of evaluations.
-     */
-    public TooManyEvaluationsException(Number max) {
-        super(max);
-        getContext().addMessage(LocalizedFormats.EVALUATIONS);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/TooManyIterationsException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/TooManyIterationsException.java b/src/main/java/org/apache/commons/math3/exception/TooManyIterationsException.java
deleted file mode 100644
index c49f405..0000000
--- a/src/main/java/org/apache/commons/math3/exception/TooManyIterationsException.java
+++ /dev/null
@@ -1,39 +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.exception;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when the maximal number of iterations is exceeded.
- *
- * @since 3.1
- */
-public class TooManyIterationsException extends MaxCountExceededException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 20121211L;
-
-    /**
-     * Construct the exception.
-     *
-     * @param max Maximum number of evaluations.
-     */
-    public TooManyIterationsException(Number max) {
-        super(max);
-        getContext().addMessage(LocalizedFormats.ITERATIONS);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/ZeroException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/ZeroException.java b/src/main/java/org/apache/commons/math3/exception/ZeroException.java
deleted file mode 100644
index 58acf79..0000000
--- a/src/main/java/org/apache/commons/math3/exception/ZeroException.java
+++ /dev/null
@@ -1,48 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when zero is provided where it is not allowed.
- *
- * @since 2.2
- */
-public class ZeroException extends MathIllegalNumberException {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -1960874856936000015L;
-
-    /**
-     * Construct the exception.
-     */
-    public ZeroException() {
-        this(LocalizedFormats.ZERO_NOT_ALLOWED);
-    }
-
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Specific context pattern.
-     * @param arguments Arguments.
-     */
-    public ZeroException(Localizable specific, Object ... arguments) {
-        super(specific, INTEGER_ZERO, arguments);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/package-info.java b/src/main/java/org/apache/commons/math3/exception/package-info.java
deleted file mode 100644
index f6e7319..0000000
--- a/src/main/java/org/apache/commons/math3/exception/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- *
- *     Specialized exceptions for algorithms errors. The exceptions can be localized
- *     using simple java properties.
- *
- */
-package org.apache.commons.math3.exception;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/util/ArgUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/util/ArgUtils.java b/src/main/java/org/apache/commons/math3/exception/util/ArgUtils.java
deleted file mode 100644
index 74214cc..0000000
--- a/src/main/java/org/apache/commons/math3/exception/util/ArgUtils.java
+++ /dev/null
@@ -1,55 +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.exception.util;
-
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Utility class for transforming the list of arguments passed to
- * constructors of exceptions.
- *
- */
-public class ArgUtils {
-    /**
-     * Class contains only static methods.
-     */
-    private ArgUtils() {}
-
-    /**
-     * Transform a multidimensional array into a one-dimensional list.
-     *
-     * @param array Array (possibly multidimensional).
-     * @return a list of all the {@code Object} instances contained in
-     * {@code array}.
-     */
-    public static Object[] flatten(Object[] array) {
-        final List<Object> list = new ArrayList<Object>();
-        if (array != null) {
-            for (Object o : array) {
-                if (o instanceof Object[]) {
-                    for (Object oR : flatten((Object[]) o)) {
-                        list.add(oR);
-                    }
-                } else {
-                    list.add(o);
-                }
-            }
-        }
-        return list.toArray();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/util/DummyLocalizable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/util/DummyLocalizable.java b/src/main/java/org/apache/commons/math3/exception/util/DummyLocalizable.java
deleted file mode 100644
index cd56708..0000000
--- a/src/main/java/org/apache/commons/math3/exception/util/DummyLocalizable.java
+++ /dev/null
@@ -1,57 +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.exception.util;
-
-import java.util.Locale;
-
-/**
- * Dummy implementation of the {@link Localizable} interface, without localization.
- *
- * @since 2.2
- */
-public class DummyLocalizable implements Localizable {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 8843275624471387299L;
-
-    /** Source string. */
-    private final String source;
-
-    /** Simple constructor.
-     * @param source source text
-     */
-    public DummyLocalizable(final String source) {
-        this.source = source;
-    }
-
-    /** {@inheritDoc} */
-    public String getSourceString() {
-        return source;
-    }
-
-    /** {@inheritDoc} */
-    public String getLocalizedString(Locale locale) {
-        return source;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String toString() {
-        return source;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java b/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java
deleted file mode 100644
index a9fd95c..0000000
--- a/src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java
+++ /dev/null
@@ -1,334 +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.exception.util;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Set;
-import java.util.Map;
-import java.io.IOException;
-import java.io.Serializable;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.util.HashMap;
-import java.text.MessageFormat;
-import java.util.Locale;
-
-/**
- * Class that contains the actual implementation of the functionality mandated
- * by the {@link ExceptionContext} interface.
- * All Commons Math exceptions delegate the interface's methods to this class.
- *
- * @since 3.0
- */
-public class ExceptionContext implements Serializable {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
-    /**
-     * The throwable to which this context refers to.
-     */
-    private Throwable throwable;
-    /**
-     * Various informations that enrich the informative message.
-     */
-    private List<Localizable> msgPatterns;
-    /**
-     * Various informations that enrich the informative message.
-     * The arguments will replace the corresponding place-holders in
-     * {@link #msgPatterns}.
-     */
-    private List<Object[]> msgArguments;
-    /**
-     * Arbitrary context information.
-     */
-    private Map<String, Object> context;
-
-    /** Simple constructor.
-     * @param throwable the exception this context refers too
-     */
-    public ExceptionContext(final Throwable throwable) {
-        this.throwable = throwable;
-        msgPatterns    = new ArrayList<Localizable>();
-        msgArguments   = new ArrayList<Object[]>();
-        context        = new HashMap<String, Object>();
-    }
-
-    /** Get a reference to the exception to which the context relates.
-     * @return a reference to the exception to which the context relates
-     */
-    public Throwable getThrowable() {
-        return throwable;
-    }
-
-    /**
-     * Adds a message.
-     *
-     * @param pattern Message pattern.
-     * @param arguments Values for replacing the placeholders in the message
-     * pattern.
-     */
-    public void addMessage(Localizable pattern,
-                           Object ... arguments) {
-        msgPatterns.add(pattern);
-        msgArguments.add(ArgUtils.flatten(arguments));
-    }
-
-    /**
-     * Sets the context (key, value) pair.
-     * Keys are assumed to be unique within an instance. If the same key is
-     * assigned a new value, the previous one will be lost.
-     *
-     * @param key Context key (not null).
-     * @param value Context value.
-     */
-    public void setValue(String key, Object value) {
-        context.put(key, value);
-    }
-
-    /**
-     * Gets the value associated to the given context key.
-     *
-     * @param key Context key.
-     * @return the context value or {@code null} if the key does not exist.
-     */
-    public Object getValue(String key) {
-        return context.get(key);
-    }
-
-    /**
-     * Gets all the keys stored in the exception
-     *
-     * @return the set of keys.
-     */
-    public Set<String> getKeys() {
-        return context.keySet();
-    }
-
-    /**
-     * Gets the default message.
-     *
-     * @return the message.
-     */
-    public String getMessage() {
-        return getMessage(Locale.US);
-    }
-
-    /**
-     * Gets the message in the default locale.
-     *
-     * @return the localized message.
-     */
-    public String getLocalizedMessage() {
-        return getMessage(Locale.getDefault());
-    }
-
-    /**
-     * Gets the message in a specified locale.
-     *
-     * @param locale Locale in which the message should be translated.
-     * @return the localized message.
-     */
-    public String getMessage(final Locale locale) {
-        return buildMessage(locale, ": ");
-    }
-
-    /**
-     * Gets the message in a specified locale.
-     *
-     * @param locale Locale in which the message should be translated.
-     * @param separator Separator inserted between the message parts.
-     * @return the localized message.
-     */
-    public String getMessage(final Locale locale,
-                             final String separator) {
-        return buildMessage(locale, separator);
-    }
-
-    /**
-     * Builds a message string.
-     *
-     * @param locale Locale in which the message should be translated.
-     * @param separator Message separator.
-     * @return a localized message string.
-     */
-    private String buildMessage(Locale locale,
-                                String separator) {
-        final StringBuilder sb = new StringBuilder();
-        int count = 0;
-        final int len = msgPatterns.size();
-        for (int i = 0; i < len; i++) {
-            final Localizable pat = msgPatterns.get(i);
-            final Object[] args = msgArguments.get(i);
-            final MessageFormat fmt = new MessageFormat(pat.getLocalizedString(locale),
-                                                        locale);
-            sb.append(fmt.format(args));
-            if (++count < len) {
-                // Add a separator if there are other messages.
-                sb.append(separator);
-            }
-        }
-
-        return sb.toString();
-    }
-
-    /**
-     * Serialize this object to the given stream.
-     *
-     * @param out Stream.
-     * @throws IOException This should never happen.
-     */
-    private void writeObject(ObjectOutputStream out)
-        throws IOException {
-        out.writeObject(throwable);
-        serializeMessages(out);
-        serializeContext(out);
-    }
-    /**
-     * Deserialize this object from the given stream.
-     *
-     * @param in Stream.
-     * @throws IOException This should never happen.
-     * @throws ClassNotFoundException This should never happen.
-     */
-    private void readObject(ObjectInputStream in)
-        throws IOException,
-               ClassNotFoundException {
-        throwable = (Throwable) in.readObject();
-        deSerializeMessages(in);
-        deSerializeContext(in);
-    }
-
-    /**
-     * Serialize  {@link #msgPatterns} and {@link #msgArguments}.
-     *
-     * @param out Stream.
-     * @throws IOException This should never happen.
-     */
-    private void serializeMessages(ObjectOutputStream out)
-        throws IOException {
-        // Step 1.
-        final int len = msgPatterns.size();
-        out.writeInt(len);
-        // Step 2.
-        for (int i = 0; i < len; i++) {
-            final Localizable pat = msgPatterns.get(i);
-            // Step 3.
-            out.writeObject(pat);
-            final Object[] args = msgArguments.get(i);
-            final int aLen = args.length;
-            // Step 4.
-            out.writeInt(aLen);
-            for (int j = 0; j < aLen; j++) {
-                if (args[j] instanceof Serializable) {
-                    // Step 5a.
-                    out.writeObject(args[j]);
-                } else {
-                    // Step 5b.
-                    out.writeObject(nonSerializableReplacement(args[j]));
-                }
-            }
-        }
-    }
-
-    /**
-     * Deserialize {@link #msgPatterns} and {@link #msgArguments}.
-     *
-     * @param in Stream.
-     * @throws IOException This should never happen.
-     * @throws ClassNotFoundException This should never happen.
-     */
-    private void deSerializeMessages(ObjectInputStream in)
-        throws IOException,
-               ClassNotFoundException {
-        // Step 1.
-        final int len = in.readInt();
-        msgPatterns = new ArrayList<Localizable>(len);
-        msgArguments = new ArrayList<Object[]>(len);
-        // Step 2.
-        for (int i = 0; i < len; i++) {
-            // Step 3.
-            final Localizable pat = (Localizable) in.readObject();
-            msgPatterns.add(pat);
-            // Step 4.
-            final int aLen = in.readInt();
-            final Object[] args = new Object[aLen];
-            for (int j = 0; j < aLen; j++) {
-                // Step 5.
-                args[j] = in.readObject();
-            }
-            msgArguments.add(args);
-        }
-    }
-
-    /**
-     * Serialize {@link #context}.
-     *
-     * @param out Stream.
-     * @throws IOException This should never happen.
-     */
-    private void serializeContext(ObjectOutputStream out)
-        throws IOException {
-        // Step 1.
-        final int len = context.keySet().size();
-        out.writeInt(len);
-        for (String key : context.keySet()) {
-            // Step 2.
-            out.writeObject(key);
-            final Object value = context.get(key);
-            if (value instanceof Serializable) {
-                // Step 3a.
-                out.writeObject(value);
-            } else {
-                // Step 3b.
-                out.writeObject(nonSerializableReplacement(value));
-            }
-        }
-    }
-
-    /**
-     * Deserialize {@link #context}.
-     *
-     * @param in Stream.
-     * @throws IOException This should never happen.
-     * @throws ClassNotFoundException This should never happen.
-     */
-    private void deSerializeContext(ObjectInputStream in)
-        throws IOException,
-               ClassNotFoundException {
-        // Step 1.
-        final int len = in.readInt();
-        context = new HashMap<String, Object>();
-        for (int i = 0; i < len; i++) {
-            // Step 2.
-            final String key = (String) in.readObject();
-            // Step 3.
-            final Object value = in.readObject();
-            context.put(key, value);
-        }
-    }
-
-    /**
-     * Replaces a non-serializable object with an error message string.
-     *
-     * @param obj Object that does not implement the {@code Serializable}
-     * interface.
-     * @return a string that mentions which class could not be serialized.
-     */
-    private String nonSerializableReplacement(Object obj) {
-        return "[Object could not be serialized: " + obj.getClass().getName() + "]";
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/util/ExceptionContextProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/util/ExceptionContextProvider.java b/src/main/java/org/apache/commons/math3/exception/util/ExceptionContextProvider.java
deleted file mode 100644
index 913f66a..0000000
--- a/src/main/java/org/apache/commons/math3/exception/util/ExceptionContextProvider.java
+++ /dev/null
@@ -1,33 +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.exception.util;
-
-/**
- * Interface for accessing the context data structure stored in Commons Math
- * exceptions.
- *
- */
-public interface ExceptionContextProvider {
-    /**
-     * Gets a reference to the "rich context" data structure that allows to
-     * customize error messages and store key, value pairs in exceptions.
-     *
-     * @return a reference to the exception context.
-     */
-    ExceptionContext getContext();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/util/Localizable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/util/Localizable.java b/src/main/java/org/apache/commons/math3/exception/util/Localizable.java
deleted file mode 100644
index 9758bc2..0000000
--- a/src/main/java/org/apache/commons/math3/exception/util/Localizable.java
+++ /dev/null
@@ -1,43 +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.exception.util;
-
-import java.io.Serializable;
-import java.util.Locale;
-
-/**
- * Interface for localizable strings.
- *
- * @since 2.2
- */
-public interface Localizable extends Serializable {
-    /**
-     * Gets the source (non-localized) string.
-     *
-     * @return the source string.
-     */
-    String getSourceString();
-
-    /**
-     * Gets the localized string.
-     *
-     * @param locale locale into which to get the string.
-     * @return the localized string or the source string if no
-     * localized version is available.
-     */
-    String getLocalizedString(Locale locale);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java b/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java
deleted file mode 100644
index 0f3848f..0000000
--- a/src/main/java/org/apache/commons/math3/exception/util/LocalizedFormats.java
+++ /dev/null
@@ -1,408 +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.exception.util;
-
-import java.util.Locale;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Enumeration for localized messages formats used in exceptions messages.
- * <p>
- * The constants in this enumeration represent the available
- * formats as localized strings. These formats are intended to be
- * localized using simple properties files, using the constant
- * name as the key and the property value as the message format.
- * The source English format is provided in the constants themselves
- * to serve both as a reminder for developers to understand the parameters
- * needed by each format, as a basis for translators to create
- * localized properties files, and as a default format if some
- * translation is missing.
- * </p>
- * @since 2.2
- */
-public enum LocalizedFormats implements Localizable {
-
-    // CHECKSTYLE: stop MultipleVariableDeclarations
-    // CHECKSTYLE: stop JavadocVariable
-
-    ARGUMENT_OUTSIDE_DOMAIN("Argument {0} outside domain [{1} ; {2}]"),
-    ARRAY_SIZE_EXCEEDS_MAX_VARIABLES("array size cannot be greater than {0}"),
-    ARRAY_SIZES_SHOULD_HAVE_DIFFERENCE_1("array sizes should have difference 1 ({0} != {1} + 1)"),
-    ARRAY_SUMS_TO_ZERO("array sums to zero"),
-    ASSYMETRIC_EIGEN_NOT_SUPPORTED("eigen decomposition of assymetric matrices not supported yet"),
-    AT_LEAST_ONE_COLUMN("matrix must have at least one column"),
-    AT_LEAST_ONE_ROW("matrix must have at least one row"),
-    BANDWIDTH("bandwidth ({0})"),
-    BESSEL_FUNCTION_BAD_ARGUMENT("Bessel function of order {0} cannot be computed for x = {1}"),
-    BESSEL_FUNCTION_FAILED_CONVERGENCE("Bessel function of order {0} failed to converge for x = {1}"),
-    BINOMIAL_INVALID_PARAMETERS_ORDER("must have n >= k for binomial coefficient (n, k), got k = {0}, n = {1}"),
-    BINOMIAL_NEGATIVE_PARAMETER("must have n >= 0 for binomial coefficient (n, k), got n = {0}"),
-    CANNOT_CLEAR_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS("statistics constructed from external moments cannot be cleared"),
-    CANNOT_COMPUTE_0TH_ROOT_OF_UNITY("cannot compute 0-th root of unity, indefinite result"),
-    CANNOT_COMPUTE_BETA_DENSITY_AT_0_FOR_SOME_ALPHA("cannot compute beta density at 0 when alpha = {0,number}"),
-    CANNOT_COMPUTE_BETA_DENSITY_AT_1_FOR_SOME_BETA("cannot compute beta density at 1 when beta = %.3g"),
-    CANNOT_COMPUTE_NTH_ROOT_FOR_NEGATIVE_N("cannot compute nth root for null or negative n: {0}"),
-    CANNOT_DISCARD_NEGATIVE_NUMBER_OF_ELEMENTS("cannot discard a negative number of elements ({0})"),
-    CANNOT_FORMAT_INSTANCE_AS_3D_VECTOR("cannot format a {0} instance as a 3D vector"),
-    CANNOT_FORMAT_INSTANCE_AS_COMPLEX("cannot format a {0} instance as a complex number"),
-    CANNOT_FORMAT_INSTANCE_AS_REAL_VECTOR("cannot format a {0} instance as a real vector"),
-    CANNOT_FORMAT_OBJECT_TO_FRACTION("cannot format given object as a fraction number"),
-    CANNOT_INCREMENT_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS("statistics constructed from external moments cannot be incremented"),
-    CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR("cannot normalize a zero norm vector"),
-    CANNOT_RETRIEVE_AT_NEGATIVE_INDEX("elements cannot be retrieved from a negative array index {0}"),
-    CANNOT_SET_AT_NEGATIVE_INDEX("cannot set an element at a negative index {0}"),
-    CANNOT_SUBSTITUTE_ELEMENT_FROM_EMPTY_ARRAY("cannot substitute an element from an empty array"),
-    CANNOT_TRANSFORM_TO_DOUBLE("Conversion Exception in Transformation: {0}"),
-    CARDAN_ANGLES_SINGULARITY("Cardan angles singularity"),
-    CLASS_DOESNT_IMPLEMENT_COMPARABLE("class ({0}) does not implement Comparable"),
-    CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT("the closest orthogonal matrix has a negative determinant {0}"),
-    COLUMN_INDEX_OUT_OF_RANGE("column index {0} out of allowed range [{1}, {2}]"),
-    COLUMN_INDEX("column index ({0})"), /* keep */
-    CONSTRAINT("constraint"), /* keep */
-    CONTINUED_FRACTION_INFINITY_DIVERGENCE("Continued fraction convergents diverged to +/- infinity for value {0}"),
-    CONTINUED_FRACTION_NAN_DIVERGENCE("Continued fraction diverged to NaN for value {0}"),
-    CONTRACTION_CRITERIA_SMALLER_THAN_EXPANSION_FACTOR("contraction criteria ({0}) smaller than the expansion factor ({1}).  This would lead to a never ending loop of expansion and contraction as a newly expanded internal storage array would immediately satisfy the criteria for contraction."),
-    CONTRACTION_CRITERIA_SMALLER_THAN_ONE("contraction criteria smaller than one ({0}).  This would lead to a never ending loop of expansion and contraction as an internal storage array length equal to the number of elements would satisfy the contraction criteria."),
-    CONVERGENCE_FAILED("convergence failed"), /* keep */
-    CROSSING_BOUNDARY_LOOPS("some outline boundary loops cross each other"),
-    CROSSOVER_RATE("crossover rate ({0})"),
-    CUMULATIVE_PROBABILITY_RETURNED_NAN("Cumulative probability function returned NaN for argument {0} p = {1}"),
-    DIFFERENT_ROWS_LENGTHS("some rows have length {0} while others have length {1}"),
-    DIFFERENT_ORIG_AND_PERMUTED_DATA("original and permuted data must contain the same elements"),
-    DIGEST_NOT_INITIALIZED("digest not initialized"),
-    DIMENSIONS_MISMATCH_2x2("got {0}x{1} but expected {2}x{3}"), /* keep */
-    DIMENSIONS_MISMATCH_SIMPLE("{0} != {1}"), /* keep */
-    DIMENSIONS_MISMATCH("dimensions mismatch"), /* keep */
-    DISCRETE_CUMULATIVE_PROBABILITY_RETURNED_NAN("Discrete cumulative probability function returned NaN for argument {0}"),
-    DISTRIBUTION_NOT_LOADED("distribution not loaded"),
-    DUPLICATED_ABSCISSA_DIVISION_BY_ZERO("duplicated abscissa {0} causes division by zero"),
-    ELITISM_RATE("elitism rate ({0})"),
-    EMPTY_CLUSTER_IN_K_MEANS("empty cluster in k-means"),
-    EMPTY_INTERPOLATION_SAMPLE("sample for interpolation is empty"),
-    EMPTY_POLYNOMIALS_COEFFICIENTS_ARRAY("empty polynomials coefficients array"), /* keep */
-    EMPTY_SELECTED_COLUMN_INDEX_ARRAY("empty selected column index array"),
-    EMPTY_SELECTED_ROW_INDEX_ARRAY("empty selected row index array"),
-    EMPTY_STRING_FOR_IMAGINARY_CHARACTER("empty string for imaginary character"),
-    ENDPOINTS_NOT_AN_INTERVAL("endpoints do not specify an interval: [{0}, {1}]"),
-    EQUAL_VERTICES_IN_SIMPLEX("equal vertices {0} and {1} in simplex configuration"),
-    EULER_ANGLES_SINGULARITY("Euler angles singularity"),
-    EVALUATION("evaluation"), /* keep */
-    EXPANSION_FACTOR_SMALLER_THAN_ONE("expansion factor smaller than one ({0})"),
-    FACTORIAL_NEGATIVE_PARAMETER("must have n >= 0 for n!, got n = {0}"),
-    FAILED_BRACKETING("number of iterations={4}, maximum iterations={5}, initial={6}, lower bound={7}, upper bound={8}, final a value={0}, final b value={1}, f(a)={2}, f(b)={3}"),
-    FAILED_FRACTION_CONVERSION("Unable to convert {0} to fraction after {1} iterations"),
-    FIRST_COLUMNS_NOT_INITIALIZED_YET("first {0} columns are not initialized yet"),
-    FIRST_ELEMENT_NOT_ZERO("first element is not 0: {0}"),
-    FIRST_ROWS_NOT_INITIALIZED_YET("first {0} rows are not initialized yet"),
-    FRACTION_CONVERSION_OVERFLOW("Overflow trying to convert {0} to fraction ({1}/{2})"),
-    FUNCTION_NOT_DIFFERENTIABLE("function is not differentiable"),
-    FUNCTION_NOT_POLYNOMIAL("function is not polynomial"),
-    GCD_OVERFLOW_32_BITS("overflow: gcd({0}, {1}) is 2^31"),
-    GCD_OVERFLOW_64_BITS("overflow: gcd({0}, {1}) is 2^63"),
-    HOLE_BETWEEN_MODELS_TIME_RANGES("{0} wide hole between models time ranges"),
-    ILL_CONDITIONED_OPERATOR("condition number {1} is too high "),
-    INCONSISTENT_STATE_AT_2_PI_WRAPPING("inconsistent state at 2\u03c0 wrapping"),
-    INDEX_LARGER_THAN_MAX("the index specified: {0} is larger than the current maximal index {1}"),
-    INDEX_NOT_POSITIVE("index ({0}) is not positive"),
-    INDEX_OUT_OF_RANGE("index {0} out of allowed range [{1}, {2}]"),
-    INDEX("index ({0})"), /* keep */
-    NOT_FINITE_NUMBER("{0} is not a finite number"), /* keep */
-    INFINITE_BOUND("interval bounds must be finite"),
-    ARRAY_ELEMENT("value {0} at index {1}"), /* keep */
-    INFINITE_ARRAY_ELEMENT("Array contains an infinite element, {0} at index {1}"),
-    INFINITE_VALUE_CONVERSION("cannot convert infinite value"),
-    INITIAL_CAPACITY_NOT_POSITIVE("initial capacity ({0}) is not positive"),
-    INITIAL_COLUMN_AFTER_FINAL_COLUMN("initial column {1} after final column {0}"),
-    INITIAL_ROW_AFTER_FINAL_ROW("initial row {1} after final row {0}"),
-    @Deprecated
-    INPUT_DATA_FROM_UNSUPPORTED_DATASOURCE("input data comes from unsupported datasource: {0}, supported sources: {1}, {2}"),
-    INSTANCES_NOT_COMPARABLE_TO_EXISTING_VALUES("instance of class {0} not comparable to existing values"),
-    INSUFFICIENT_DATA("insufficient data"),
-    INSUFFICIENT_DATA_FOR_T_STATISTIC("insufficient data for t statistic, needs at least 2, got {0}"),
-    INSUFFICIENT_DIMENSION("insufficient dimension {0}, must be at least {1}"),
-    DIMENSION("dimension ({0})"), /* keep */
-    INSUFFICIENT_OBSERVED_POINTS_IN_SAMPLE("sample contains {0} observed points, at least {1} are required"),
-    INSUFFICIENT_ROWS_AND_COLUMNS("insufficient data: only {0} rows and {1} columns."),
-    INTEGRATION_METHOD_NEEDS_AT_LEAST_TWO_PREVIOUS_POINTS("multistep method needs at least {0} previous steps, got {1}"),
-    INTERNAL_ERROR("internal error, please fill a bug report at {0}"),
-    INVALID_BINARY_DIGIT("invalid binary digit: {0}"),
-    INVALID_BINARY_CHROMOSOME("binary mutation works on BinaryChromosome only"),
-    INVALID_BRACKETING_PARAMETERS("invalid bracketing parameters:  lower bound={0},  initial={1}, upper bound={2}"),
-    INVALID_FIXED_LENGTH_CHROMOSOME("one-point crossover only works with fixed-length chromosomes"),
-    INVALID_IMPLEMENTATION("required functionality is missing in {0}"),
-    INVALID_INTERVAL_INITIAL_VALUE_PARAMETERS("invalid interval, initial value parameters:  lower={0}, initial={1}, upper={2}"),
-    INVALID_ITERATIONS_LIMITS("invalid iteration limits: min={0}, max={1}"),
-    INVALID_MAX_ITERATIONS("bad value for maximum iterations number: {0}"),
-    NOT_ENOUGH_DATA_REGRESSION("the number of observations is not sufficient to conduct regression"),
-    INVALID_REGRESSION_ARRAY("input data array length = {0} does not match the number of observations = {1} and the number of regressors = {2}"),
-    INVALID_REGRESSION_OBSERVATION("length of regressor array = {0} does not match the number of variables = {1} in the model"),
-    INVALID_ROUNDING_METHOD("invalid rounding method {0}, valid methods: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}), {11} ({12}), {13} ({14}), {15} ({16})"),
-    ITERATOR_EXHAUSTED("iterator exhausted"),
-    ITERATIONS("iterations"), /* keep */
-    LCM_OVERFLOW_32_BITS("overflow: lcm({0}, {1}) is 2^31"),
-    LCM_OVERFLOW_64_BITS("overflow: lcm({0}, {1}) is 2^63"),
-    LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE("list of chromosomes bigger than maxPopulationSize"),
-    LOESS_EXPECTS_AT_LEAST_ONE_POINT("Loess expects at least 1 point"),
-    LOWER_BOUND_NOT_BELOW_UPPER_BOUND("lower bound ({0}) must be strictly less than upper bound ({1})"), /* keep */
-    LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT("lower endpoint ({0}) must be less than or equal to upper endpoint ({1})"),
-    MAP_MODIFIED_WHILE_ITERATING("map has been modified while iterating"),
-    EVALUATIONS("evaluations"), /* keep */
-    MAX_COUNT_EXCEEDED("maximal count ({0}) exceeded"), /* keep */
-    MAX_ITERATIONS_EXCEEDED("maximal number of iterations ({0}) exceeded"),
-    MINIMAL_STEPSIZE_REACHED_DURING_INTEGRATION("minimal step size ({1,number,0.00E00}) reached, integration needs {0,number,0.00E00}"),
-    MISMATCHED_LOESS_ABSCISSA_ORDINATE_ARRAYS("Loess expects the abscissa and ordinate arrays to be of the same size, but got {0} abscissae and {1} ordinatae"),
-    MUTATION_RATE("mutation rate ({0})"),
-    NAN_ELEMENT_AT_INDEX("element {0} is NaN"),
-    NAN_VALUE_CONVERSION("cannot convert NaN value"),
-    NEGATIVE_BRIGHTNESS_EXPONENT("brightness exponent should be positive or null, but got {0}"),
-    NEGATIVE_COMPLEX_MODULE("negative complex module {0}"),
-    NEGATIVE_ELEMENT_AT_2D_INDEX("element ({0}, {1}) is negative: {2}"),
-    NEGATIVE_ELEMENT_AT_INDEX("element {0} is negative: {1}"),
-    NEGATIVE_NUMBER_OF_SUCCESSES("number of successes must be non-negative ({0})"),
-    NUMBER_OF_SUCCESSES("number of successes ({0})"), /* keep */
-    NEGATIVE_NUMBER_OF_TRIALS("number of trials must be non-negative ({0})"),
-    NUMBER_OF_INTERPOLATION_POINTS("number of interpolation points ({0})"), /* keep */
-    NUMBER_OF_TRIALS("number of trials ({0})"),
-    NOT_CONVEX("vertices do not form a convex hull in CCW winding"),
-    ROBUSTNESS_ITERATIONS("number of robustness iterations ({0})"),
-    START_POSITION("start position ({0})"), /* keep */
-    NON_CONVERGENT_CONTINUED_FRACTION("Continued fraction convergents failed to converge (in less than {0} iterations) for value {1}"),
-    NON_INVERTIBLE_TRANSFORM("non-invertible affine transform collapses some lines into single points"),
-    NON_POSITIVE_MICROSPHERE_ELEMENTS("number of microsphere elements must be positive, but got {0}"),
-    NON_POSITIVE_POLYNOMIAL_DEGREE("polynomial degree must be positive: degree={0}"),
-    NON_REAL_FINITE_ABSCISSA("all abscissae must be finite real numbers, but {0}-th is {1}"),
-    NON_REAL_FINITE_ORDINATE("all ordinatae must be finite real numbers, but {0}-th is {1}"),
-    NON_REAL_FINITE_WEIGHT("all weights must be finite real numbers, but {0}-th is {1}"),
-    NON_SQUARE_MATRIX("non square ({0}x{1}) matrix"),
-    NORM("Norm ({0})"), /* keep */
-    NORMALIZE_INFINITE("Cannot normalize to an infinite value"),
-    NORMALIZE_NAN("Cannot normalize to NaN"),
-    NOT_ADDITION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not addition compatible"),
-    NOT_DECREASING_NUMBER_OF_POINTS("points {0} and {1} are not decreasing ({2} < {3})"),
-    NOT_DECREASING_SEQUENCE("points {3} and {2} are not decreasing ({1} < {0})"), /* keep */
-    NOT_ENOUGH_DATA_FOR_NUMBER_OF_PREDICTORS("not enough data ({0} rows) for this many predictors ({1} predictors)"),
-    NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION("spline partition must have at least {0} points, got {1}"),
-    NOT_INCREASING_NUMBER_OF_POINTS("points {0} and {1} are not increasing ({2} > {3})"),
-    NOT_INCREASING_SEQUENCE("points {3} and {2} are not increasing ({1} > {0})"), /* keep */
-    NOT_MULTIPLICATION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not multiplication compatible"),
-    NOT_POSITIVE_DEFINITE_MATRIX("not positive definite matrix"), /* keep */
-    NON_POSITIVE_DEFINITE_MATRIX("not positive definite matrix: diagonal element at ({1},{1}) is smaller than {2} ({0})"),
-    NON_POSITIVE_DEFINITE_OPERATOR("non positive definite linear operator"), /* keep */
-    NON_SELF_ADJOINT_OPERATOR("non self-adjoint linear operator"), /* keep */
-    NON_SQUARE_OPERATOR("non square ({0}x{1}) linear operator"), /* keep */
-    DEGREES_OF_FREEDOM("degrees of freedom ({0})"), /* keep */
-    NOT_POSITIVE_DEGREES_OF_FREEDOM("degrees of freedom must be positive ({0})"),
-    NOT_POSITIVE_ELEMENT_AT_INDEX("element {0} is not positive: {1}"),
-    NOT_POSITIVE_EXPONENT("invalid exponent {0} (must be positive)"),
-    NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE("number of elements should be positive ({0})"),
-    BASE("base ({0})"), /* keep */
-    EXPONENT("exponent ({0})"), /* keep */
-    NOT_POSITIVE_LENGTH("length must be positive ({0})"),
-    LENGTH("length ({0})"), /* keep */
-    NOT_POSITIVE_MEAN("mean must be positive ({0})"),
-    MEAN("mean ({0})"), /* keep */
-    NOT_POSITIVE_NUMBER_OF_SAMPLES("number of sample is not positive: {0}"),
-    NUMBER_OF_SAMPLES("number of samples ({0})"), /* keep */
-    NOT_POSITIVE_PERMUTATION("permutation k ({0}) must be positive"),
-    PERMUTATION_SIZE("permutation size ({0}"), /* keep */
-    NOT_POSITIVE_POISSON_MEAN("the Poisson mean must be positive ({0})"),
-    NOT_POSITIVE_POPULATION_SIZE("population size must be positive ({0})"),
-    POPULATION_SIZE("population size ({0})"), /* keep */
-    NOT_POSITIVE_ROW_DIMENSION("invalid row dimension: {0} (must be positive)"),
-    NOT_POSITIVE_SAMPLE_SIZE("sample size must be positive ({0})"),
-    NOT_POSITIVE_SCALE("scale must be positive ({0})"),
-    SCALE("scale ({0})"), /* keep */
-    NOT_POSITIVE_SHAPE("shape must be positive ({0})"),
-    SHAPE("shape ({0})"), /* keep */
-    NOT_POSITIVE_STANDARD_DEVIATION("standard deviation must be positive ({0})"),
-    STANDARD_DEVIATION("standard deviation ({0})"), /* keep */
-    NOT_POSITIVE_UPPER_BOUND("upper bound must be positive ({0})"),
-    NOT_POSITIVE_WINDOW_SIZE("window size must be positive ({0})"),
-    NOT_POWER_OF_TWO("{0} is not a power of 2"),
-    NOT_POWER_OF_TWO_CONSIDER_PADDING("{0} is not a power of 2, consider padding for fix"),
-    NOT_POWER_OF_TWO_PLUS_ONE("{0} is not a power of 2 plus one"),
-    NOT_STRICTLY_DECREASING_NUMBER_OF_POINTS("points {0} and {1} are not strictly decreasing ({2} <= {3})"),
-    NOT_STRICTLY_DECREASING_SEQUENCE("points {3} and {2} are not strictly decreasing ({1} <= {0})"), /* keep */
-    NOT_STRICTLY_INCREASING_KNOT_VALUES("knot values must be strictly increasing"),
-    NOT_STRICTLY_INCREASING_NUMBER_OF_POINTS("points {0} and {1} are not strictly increasing ({2} >= {3})"),
-    NOT_STRICTLY_INCREASING_SEQUENCE("points {3} and {2} are not strictly increasing ({1} >= {0})"), /* keep */
-    NOT_SUBTRACTION_COMPATIBLE_MATRICES("{0}x{1} and {2}x{3} matrices are not subtraction compatible"),
-    NOT_SUPPORTED_IN_DIMENSION_N("method not supported in dimension {0}"),
-    NOT_SYMMETRIC_MATRIX("not symmetric matrix"),
-    NON_SYMMETRIC_MATRIX("non symmetric matrix: the difference between entries at ({0},{1}) and ({1},{0}) is larger than {2}"), /* keep */
-    NO_BIN_SELECTED("no bin selected"),
-    NO_CONVERGENCE_WITH_ANY_START_POINT("none of the {0} start points lead to convergence"), /* keep */
-    NO_DATA("no data"), /* keep */
-    NO_DEGREES_OF_FREEDOM("no degrees of freedom ({0} measurements, {1} parameters)"),
-    NO_DENSITY_FOR_THIS_DISTRIBUTION("This distribution does not have a density function implemented"),
-    NO_FEASIBLE_SOLUTION("no feasible solution"),
-    NO_OPTIMUM_COMPUTED_YET("no optimum computed yet"), /* keep */
-    NO_REGRESSORS("Regression model must include at least one regressor"),
-    NO_RESULT_AVAILABLE("no result available"),
-    NO_SUCH_MATRIX_ENTRY("no entry at indices ({0}, {1}) in a {2}x{3} matrix"),
-    NAN_NOT_ALLOWED("NaN is not allowed"),
-    NULL_NOT_ALLOWED("null is not allowed"), /* keep */
-    ARRAY_ZERO_LENGTH_OR_NULL_NOT_ALLOWED("a null or zero length array not allowed"),
-    COVARIANCE_MATRIX("covariance matrix"), /* keep */
-    DENOMINATOR("denominator"), /* keep */
-    DENOMINATOR_FORMAT("denominator format"), /* keep */
-    FRACTION("fraction"), /* keep */
-    FUNCTION("function"), /* keep */
-    IMAGINARY_FORMAT("imaginary format"), /* keep */
-    INPUT_ARRAY("input array"), /* keep */
-    NUMERATOR("numerator"), /* keep */
-    NUMERATOR_FORMAT("numerator format"), /* keep */
-    OBJECT_TRANSFORMATION("conversion exception in transformation"), /* keep */
-    REAL_FORMAT("real format"), /* keep */
-    WHOLE_FORMAT("whole format"), /* keep */
-    NUMBER_TOO_LARGE("{0} is larger than the maximum ({1})"), /* keep */
-    NUMBER_TOO_SMALL("{0} is smaller than the minimum ({1})"), /* keep */
-    NUMBER_TOO_LARGE_BOUND_EXCLUDED("{0} is larger than, or equal to, the maximum ({1})"), /* keep */
-    NUMBER_TOO_SMALL_BOUND_EXCLUDED("{0} is smaller than, or equal to, the minimum ({1})"), /* keep */
-    NUMBER_OF_SUCCESS_LARGER_THAN_POPULATION_SIZE("number of successes ({0}) must be less than or equal to population size ({1})"),
-    NUMERATOR_OVERFLOW_AFTER_MULTIPLY("overflow, numerator too large after multiply: {0}"),
-    N_POINTS_GAUSS_LEGENDRE_INTEGRATOR_NOT_SUPPORTED("{0} points Legendre-Gauss integrator not supported, number of points must be in the {1}-{2} range"),
-    OBSERVED_COUNTS_ALL_ZERO("observed counts are all 0 in observed array {0}"),
-    OBSERVED_COUNTS_BOTTH_ZERO_FOR_ENTRY("observed counts are both zero for entry {0}"),
-    BOBYQA_BOUND_DIFFERENCE_CONDITION("the difference between the upper and lower bound must be larger than twice the initial trust region radius ({0})"),
-    OUT_OF_BOUNDS_QUANTILE_VALUE("out of bounds quantile value: {0}, must be in (0, 100]"),
-    OUT_OF_BOUNDS_CONFIDENCE_LEVEL("out of bounds confidence level {0}, must be between {1} and {2}"),
-    OUT_OF_BOUND_SIGNIFICANCE_LEVEL("out of bounds significance level {0}, must be between {1} and {2}"),
-    SIGNIFICANCE_LEVEL("significance level ({0})"), /* keep */
-    OUT_OF_ORDER_ABSCISSA_ARRAY("the abscissae array must be sorted in a strictly increasing order, but the {0}-th element is {1} whereas {2}-th is {3}"),
-    OUT_OF_RANGE_ROOT_OF_UNITY_INDEX("out of range root of unity index {0} (must be in [{1};{2}])"),
-    OUT_OF_RANGE("out of range"), /* keep */
-    OUT_OF_RANGE_SIMPLE("{0} out of [{1}, {2}] range"), /* keep */
-    OUT_OF_RANGE_LEFT("{0} out of ({1}, {2}] range"),
-    OUT_OF_RANGE_RIGHT("{0} out of [{1}, {2}) range"),
-    OUTLINE_BOUNDARY_LOOP_OPEN("an outline boundary loop is open"),
-    OVERFLOW("overflow"), /* keep */
-    OVERFLOW_IN_FRACTION("overflow in fraction {0}/{1}, cannot negate"),
-    OVERFLOW_IN_ADDITION("overflow in addition: {0} + {1}"),
-    OVERFLOW_IN_SUBTRACTION("overflow in subtraction: {0} - {1}"),
-    OVERFLOW_IN_MULTIPLICATION("overflow in multiplication: {0} * {1}"),
-    PERCENTILE_IMPLEMENTATION_CANNOT_ACCESS_METHOD("cannot access {0} method in percentile implementation {1}"),
-    PERCENTILE_IMPLEMENTATION_UNSUPPORTED_METHOD("percentile implementation {0} does not support {1}"),
-    PERMUTATION_EXCEEDS_N("permutation size ({0}) exceeds permuation domain ({1})"), /* keep */
-    POLYNOMIAL("polynomial"), /* keep */
-    POLYNOMIAL_INTERPOLANTS_MISMATCH_SEGMENTS("number of polynomial interpolants must match the number of segments ({0} != {1} - 1)"),
-    POPULATION_LIMIT_NOT_POSITIVE("population limit has to be positive"),
-    POWER_NEGATIVE_PARAMETERS("cannot raise an integral value to a negative power ({0}^{1})"),
-    PROPAGATION_DIRECTION_MISMATCH("propagation direction mismatch"),
-    RANDOMKEY_MUTATION_WRONG_CLASS("RandomKeyMutation works only with RandomKeys, not {0}"),
-    ROOTS_OF_UNITY_NOT_COMPUTED_YET("roots of unity have not been computed yet"),
-    ROTATION_MATRIX_DIMENSIONS("a {0}x{1} matrix cannot be a rotation matrix"),
-    ROW_INDEX_OUT_OF_RANGE("row index {0} out of allowed range [{1}, {2}]"),
-    ROW_INDEX("row index ({0})"), /* keep */
-    SAME_SIGN_AT_ENDPOINTS("function values at endpoints do not have different signs, endpoints: [{0}, {1}], values: [{2}, {3}]"),
-    SAMPLE_SIZE_EXCEEDS_COLLECTION_SIZE("sample size ({0}) exceeds collection size ({1})"), /* keep */
-    SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE("sample size ({0}) must be less than or equal to population size ({1})"),
-    SIMPLEX_NEED_ONE_POINT("simplex must contain at least one point"),
-    SIMPLE_MESSAGE("{0}"),
-    SINGULAR_MATRIX("matrix is singular"), /* keep */
-    SINGULAR_OPERATOR("operator is singular"),
-    SUBARRAY_ENDS_AFTER_ARRAY_END("subarray ends after array end"),
-    TOO_LARGE_CUTOFF_SINGULAR_VALUE("cutoff singular value is {0}, should be at most {1}"),
-    TOO_LARGE_TOURNAMENT_ARITY("tournament arity ({0}) cannot be bigger than population size ({1})"),
-    TOO_MANY_ELEMENTS_TO_DISCARD_FROM_ARRAY("cannot discard {0} elements from a {1} elements array"),
-    TOO_MANY_REGRESSORS("too many regressors ({0}) specified, only {1} in the model"),
-    TOO_SMALL_COST_RELATIVE_TOLERANCE("cost relative tolerance is too small ({0}), no further reduction in the sum of squares is possible"),
-    TOO_SMALL_INTEGRATION_INTERVAL("too small integration interval: length = {0}"),
-    TOO_SMALL_ORTHOGONALITY_TOLERANCE("orthogonality tolerance is too small ({0}), solution is orthogonal to the jacobian"),
-    TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE("parameters relative tolerance is too small ({0}), no further improvement in the approximate solution is possible"),
-    TRUST_REGION_STEP_FAILED("trust region step has failed to reduce Q"),
-    TWO_OR_MORE_CATEGORIES_REQUIRED("two or more categories required, got {0}"),
-    TWO_OR_MORE_VALUES_IN_CATEGORY_REQUIRED("two or more values required in each category, one has {0}"),
-    UNABLE_TO_BRACKET_OPTIMUM_IN_LINE_SEARCH("unable to bracket optimum in line search"),
-    UNABLE_TO_COMPUTE_COVARIANCE_SINGULAR_PROBLEM("unable to compute covariances: singular problem"),
-    UNABLE_TO_FIRST_GUESS_HARMONIC_COEFFICIENTS("unable to first guess the harmonic coefficients"),
-    UNABLE_TO_ORTHOGONOLIZE_MATRIX("unable to orthogonalize matrix in {0} iterations"),
-    UNABLE_TO_PERFORM_QR_DECOMPOSITION_ON_JACOBIAN("unable to perform Q.R decomposition on the {0}x{1} jacobian matrix"),
-    UNABLE_TO_SOLVE_SINGULAR_PROBLEM("unable to solve: singular problem"),
-    UNBOUNDED_SOLUTION("unbounded solution"),
-    UNKNOWN_MODE("unknown mode {0}, known modes: {1} ({2}), {3} ({4}), {5} ({6}), {7} ({8}), {9} ({10}) and {11} ({12})"),
-    UNKNOWN_PARAMETER("unknown parameter {0}"),
-    UNMATCHED_ODE_IN_EXPANDED_SET("ode does not match the main ode set in the extended set"),
-    CANNOT_PARSE_AS_TYPE("string \"{0}\" unparseable (from position {1}) as an object of type {2}"), /* keep */
-    CANNOT_PARSE("string \"{0}\" unparseable (from position {1})"), /* keep */
-    UNPARSEABLE_3D_VECTOR("unparseable 3D vector: \"{0}\""),
-    UNPARSEABLE_COMPLEX_NUMBER("unparseable complex number: \"{0}\""),
-    UNPARSEABLE_REAL_VECTOR("unparseable real vector: \"{0}\""),
-    UNSUPPORTED_EXPANSION_MODE("unsupported expansion mode {0}, supported modes are {1} ({2}) and {3} ({4})"),
-    UNSUPPORTED_OPERATION("unsupported operation"), /* keep */
-    ARITHMETIC_EXCEPTION("arithmetic exception"), /* keep */
-    ILLEGAL_STATE("illegal state"), /* keep */
-    USER_EXCEPTION("exception generated in user code"), /* keep */
-    URL_CONTAINS_NO_DATA("URL {0} contains no data"),
-    VALUES_ADDED_BEFORE_CONFIGURING_STATISTIC("{0} values have been added before statistic is configured"),
-    VECTOR_LENGTH_MISMATCH("vector length mismatch: got {0} but expected {1}"),
-    VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT("vector must have at least one element"),
-    WEIGHT_AT_LEAST_ONE_NON_ZERO("weigth array must contain at least one non-zero value"),
-    WRONG_BLOCK_LENGTH("wrong array shape (block length = {0}, expected {1})"),
-    WRONG_NUMBER_OF_POINTS("{0} points are required, got only {1}"),
-    NUMBER_OF_POINTS("number of points ({0})"), /* keep */
-    ZERO_DENOMINATOR("denominator must be different from 0"), /* keep */
-    ZERO_DENOMINATOR_IN_FRACTION("zero denominator in fraction {0}/{1}"),
-    ZERO_FRACTION_TO_DIVIDE_BY("the fraction to divide by must not be zero: {0}/{1}"),
-    ZERO_NORM("zero norm"),
-    ZERO_NORM_FOR_ROTATION_AXIS("zero norm for rotation axis"),
-    ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR("zero norm for rotation defining vector"),
-    ZERO_NOT_ALLOWED("zero not allowed here");
-
-    // CHECKSTYLE: resume JavadocVariable
-    // CHECKSTYLE: resume MultipleVariableDeclarations
-
-
-    /** Source English format. */
-    private final String sourceFormat;
-
-    /** Simple constructor.
-     * @param sourceFormat source English format to use when no
-     * localized version is available
-     */
-    private LocalizedFormats(final String sourceFormat) {
-        this.sourceFormat = sourceFormat;
-    }
-
-    /** {@inheritDoc} */
-    public String getSourceString() {
-        return sourceFormat;
-    }
-
-    /** {@inheritDoc} */
-    public String getLocalizedString(final Locale locale) {
-        try {
-            final String path = LocalizedFormats.class.getName().replaceAll("\\.", "/");
-            ResourceBundle bundle =
-                    ResourceBundle.getBundle("assets/" + path, locale);
-            if (bundle.getLocale().getLanguage().equals(locale.getLanguage())) {
-                // the value of the resource is the translated format
-                return bundle.getString(toString());
-            }
-
-        } catch (MissingResourceException mre) { // NOPMD
-            // do nothing here
-        }
-
-        // either the locale is not supported or the resource is unknown
-        // don't translate and fall back to using the source format
-        return sourceFormat;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/util/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/util/package-info.java b/src/main/java/org/apache/commons/math3/exception/util/package-info.java
deleted file mode 100644
index 6439a8d..0000000
--- a/src/main/java/org/apache/commons/math3/exception/util/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-/**
- *
- *    Classes supporting exception localization.
- *
- */
-package org.apache.commons.math3.exception.util;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/filter/DefaultMeasurementModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/filter/DefaultMeasurementModel.java b/src/main/java/org/apache/commons/math3/filter/DefaultMeasurementModel.java
deleted file mode 100644
index 10c6f2b..0000000
--- a/src/main/java/org/apache/commons/math3/filter/DefaultMeasurementModel.java
+++ /dev/null
@@ -1,84 +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.filter;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-
-/**
- * Default implementation of a {@link MeasurementModel} for the use with a {@link KalmanFilter}.
- *
- * @since 3.0
- */
-public class DefaultMeasurementModel implements MeasurementModel {
-
-    /**
-     * The measurement matrix, used to associate the measurement vector to the
-     * internal state estimation vector.
-     */
-    private RealMatrix measurementMatrix;
-
-    /**
-     * The measurement noise covariance matrix.
-     */
-    private RealMatrix measurementNoise;
-
-    /**
-     * Create a new {@link MeasurementModel}, taking double arrays as input parameters for the
-     * respective measurement matrix and noise.
-     *
-     * @param measMatrix
-     *            the measurement matrix
-     * @param measNoise
-     *            the measurement noise matrix
-     * @throws NullArgumentException
-     *             if any of the input matrices is {@code null}
-     * @throws NoDataException
-     *             if any row / column dimension of the input matrices is zero
-     * @throws DimensionMismatchException
-     *             if any of the input matrices is non-rectangular
-     */
-    public DefaultMeasurementModel(final double[][] measMatrix, final double[][] measNoise)
-            throws NullArgumentException, NoDataException, DimensionMismatchException {
-        this(new Array2DRowRealMatrix(measMatrix), new Array2DRowRealMatrix(measNoise));
-    }
-
-    /**
-     * Create a new {@link MeasurementModel}, taking {@link RealMatrix} objects
-     * as input parameters for the respective measurement matrix and noise.
-     *
-     * @param measMatrix the measurement matrix
-     * @param measNoise the measurement noise matrix
-     */
-    public DefaultMeasurementModel(final RealMatrix measMatrix, final RealMatrix measNoise) {
-        this.measurementMatrix = measMatrix;
-        this.measurementNoise = measNoise;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getMeasurementMatrix() {
-        return measurementMatrix;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getMeasurementNoise() {
-        return measurementNoise;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/filter/DefaultProcessModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/filter/DefaultProcessModel.java b/src/main/java/org/apache/commons/math3/filter/DefaultProcessModel.java
deleted file mode 100644
index 732e2c1..0000000
--- a/src/main/java/org/apache/commons/math3/filter/DefaultProcessModel.java
+++ /dev/null
@@ -1,165 +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.filter;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-
-/**
- * Default implementation of a {@link ProcessModel} for the use with a {@link KalmanFilter}.
- *
- * @since 3.0
- */
-public class DefaultProcessModel implements ProcessModel {
-    /**
-     * The state transition matrix, used to advance the internal state estimation each time-step.
-     */
-    private RealMatrix stateTransitionMatrix;
-
-    /**
-     * The control matrix, used to integrate a control input into the state estimation.
-     */
-    private RealMatrix controlMatrix;
-
-    /** The process noise covariance matrix. */
-    private RealMatrix processNoiseCovMatrix;
-
-    /** The initial state estimation of the observed process. */
-    private RealVector initialStateEstimateVector;
-
-    /** The initial error covariance matrix of the observed process. */
-    private RealMatrix initialErrorCovMatrix;
-
-    /**
-     * Create a new {@link ProcessModel}, taking double arrays as input parameters.
-     *
-     * @param stateTransition
-     *            the state transition matrix
-     * @param control
-     *            the control matrix
-     * @param processNoise
-     *            the process noise matrix
-     * @param initialStateEstimate
-     *            the initial state estimate vector
-     * @param initialErrorCovariance
-     *            the initial error covariance matrix
-     * @throws NullArgumentException
-     *             if any of the input arrays is {@code null}
-     * @throws NoDataException
-     *             if any row / column dimension of the input matrices is zero
-     * @throws DimensionMismatchException
-     *             if any of the input matrices is non-rectangular
-     */
-    public DefaultProcessModel(final double[][] stateTransition,
-                               final double[][] control,
-                               final double[][] processNoise,
-                               final double[] initialStateEstimate,
-                               final double[][] initialErrorCovariance)
-            throws NullArgumentException, NoDataException, DimensionMismatchException {
-
-        this(new Array2DRowRealMatrix(stateTransition),
-                new Array2DRowRealMatrix(control),
-                new Array2DRowRealMatrix(processNoise),
-                new ArrayRealVector(initialStateEstimate),
-                new Array2DRowRealMatrix(initialErrorCovariance));
-    }
-
-    /**
-     * Create a new {@link ProcessModel}, taking double arrays as input parameters.
-     * <p>
-     * The initial state estimate and error covariance are omitted and will be initialized by the
-     * {@link KalmanFilter} to default values.
-     *
-     * @param stateTransition
-     *            the state transition matrix
-     * @param control
-     *            the control matrix
-     * @param processNoise
-     *            the process noise matrix
-     * @throws NullArgumentException
-     *             if any of the input arrays is {@code null}
-     * @throws NoDataException
-     *             if any row / column dimension of the input matrices is zero
-     * @throws DimensionMismatchException
-     *             if any of the input matrices is non-rectangular
-     */
-    public DefaultProcessModel(final double[][] stateTransition,
-                               final double[][] control,
-                               final double[][] processNoise)
-            throws NullArgumentException, NoDataException, DimensionMismatchException {
-
-        this(new Array2DRowRealMatrix(stateTransition),
-                new Array2DRowRealMatrix(control),
-                new Array2DRowRealMatrix(processNoise), null, null);
-    }
-
-    /**
-     * Create a new {@link ProcessModel}, taking double arrays as input parameters.
-     *
-     * @param stateTransition
-     *            the state transition matrix
-     * @param control
-     *            the control matrix
-     * @param processNoise
-     *            the process noise matrix
-     * @param initialStateEstimate
-     *            the initial state estimate vector
-     * @param initialErrorCovariance
-     *            the initial error covariance matrix
-     */
-    public DefaultProcessModel(final RealMatrix stateTransition,
-                               final RealMatrix control,
-                               final RealMatrix processNoise,
-                               final RealVector initialStateEstimate,
-                               final RealMatrix initialErrorCovariance) {
-        this.stateTransitionMatrix = stateTransition;
-        this.controlMatrix = control;
-        this.processNoiseCovMatrix = processNoise;
-        this.initialStateEstimateVector = initialStateEstimate;
-        this.initialErrorCovMatrix = initialErrorCovariance;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getStateTransitionMatrix() {
-        return stateTransitionMatrix;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getControlMatrix() {
-        return controlMatrix;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getProcessNoise() {
-        return processNoiseCovMatrix;
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getInitialStateEstimate() {
-        return initialStateEstimateVector;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getInitialErrorCovariance() {
-        return initialErrorCovMatrix;
-    }
-}


[10/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/EdgesBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/EdgesBuilder.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/EdgesBuilder.java
deleted file mode 100644
index 4aa712c..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/EdgesBuilder.java
+++ /dev/null
@@ -1,169 +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.geometry.spherical.twod;
-
-import java.util.ArrayList;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.S1Point;
-
-/** Visitor building edges.
- * @since 3.3
- */
-class EdgesBuilder implements BSPTreeVisitor<Sphere2D> {
-
-    /** Root of the tree. */
-    private final BSPTree<Sphere2D> root;
-
-    /** Tolerance below which points are consider to be identical. */
-    private final double tolerance;
-
-    /** Built edges and their associated nodes. */
-    private final Map<Edge, BSPTree<Sphere2D>> edgeToNode;
-
-    /** Reversed map. */
-    private final Map<BSPTree<Sphere2D>, List<Edge>> nodeToEdgesList;
-
-    /** Simple constructor.
-     * @param root tree root
-     * @param tolerance below which points are consider to be identical
-     */
-    public EdgesBuilder(final BSPTree<Sphere2D> root, final double tolerance) {
-        this.root            = root;
-        this.tolerance       = tolerance;
-        this.edgeToNode      = new IdentityHashMap<Edge, BSPTree<Sphere2D>>();
-        this.nodeToEdgesList = new IdentityHashMap<BSPTree<Sphere2D>, List<Edge>>();
-    }
-
-    /** {@inheritDoc} */
-    public Order visitOrder(final BSPTree<Sphere2D> node) {
-        return Order.MINUS_SUB_PLUS;
-    }
-
-    /** {@inheritDoc} */
-    public void visitInternalNode(final BSPTree<Sphere2D> node) {
-        nodeToEdgesList.put(node, new ArrayList<Edge>());
-        @SuppressWarnings("unchecked")
-        final BoundaryAttribute<Sphere2D> attribute = (BoundaryAttribute<Sphere2D>) node.getAttribute();
-        if (attribute.getPlusOutside() != null) {
-            addContribution((SubCircle) attribute.getPlusOutside(), false, node);
-        }
-        if (attribute.getPlusInside() != null) {
-            addContribution((SubCircle) attribute.getPlusInside(), true, node);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void visitLeafNode(final BSPTree<Sphere2D> node) {
-    }
-
-    /** Add the contribution of a boundary edge.
-     * @param sub boundary facet
-     * @param reversed if true, the facet has the inside on its plus side
-     * @param node node to which the edge belongs
-     */
-    private void addContribution(final SubCircle sub, final boolean reversed,
-                                 final BSPTree<Sphere2D> node) {
-        final Circle circle  = (Circle) sub.getHyperplane();
-        final List<Arc> arcs = ((ArcsSet) sub.getRemainingRegion()).asList();
-        for (final Arc a : arcs) {
-            final Vertex start = new Vertex((S2Point) circle.toSpace(new S1Point(a.getInf())));
-            final Vertex end   = new Vertex((S2Point) circle.toSpace(new S1Point(a.getSup())));
-            start.bindWith(circle);
-            end.bindWith(circle);
-            final Edge edge;
-            if (reversed) {
-                edge = new Edge(end, start, a.getSize(), circle.getReverse());
-            } else {
-                edge = new Edge(start, end, a.getSize(), circle);
-            }
-            edgeToNode.put(edge, node);
-            nodeToEdgesList.get(node).add(edge);
-        }
-    }
-
-    /** Get the edge that should naturally follow another one.
-     * @param previous edge to be continued
-     * @return other edge, starting where the previous one ends (they
-     * have not been connected yet)
-     * @exception MathIllegalStateException if there is not a single other edge
-     */
-    private Edge getFollowingEdge(final Edge previous)
-        throws MathIllegalStateException {
-
-        // get the candidate nodes
-        final S2Point point = previous.getEnd().getLocation();
-        final List<BSPTree<Sphere2D>> candidates = root.getCloseCuts(point, tolerance);
-
-        // the following edge we are looking for must start from one of the candidates nodes
-        double closest = tolerance;
-        Edge following = null;
-        for (final BSPTree<Sphere2D> node : candidates) {
-            for (final Edge edge : nodeToEdgesList.get(node)) {
-                if (edge != previous && edge.getStart().getIncoming() == null) {
-                    final Vector3D edgeStart = edge.getStart().getLocation().getVector();
-                    final double gap         = Vector3D.angle(point.getVector(), edgeStart);
-                    if (gap <= closest) {
-                        closest   = gap;
-                        following = edge;
-                    }
-                }
-            }
-        }
-
-        if (following == null) {
-            final Vector3D previousStart = previous.getStart().getLocation().getVector();
-            if (Vector3D.angle(point.getVector(), previousStart) <= tolerance) {
-                // the edge connects back to itself
-                return previous;
-            }
-
-            // this should never happen
-            throw new MathIllegalStateException(LocalizedFormats.OUTLINE_BOUNDARY_LOOP_OPEN);
-
-        }
-
-        return following;
-
-    }
-
-    /** Get the boundary edges.
-     * @return boundary edges
-     * @exception MathIllegalStateException if there is not a single other edge
-     */
-    public List<Edge> getEdges() throws MathIllegalStateException {
-
-        // connect the edges
-        for (final Edge previous : edgeToNode.keySet()) {
-            previous.setNextEdge(getFollowingEdge(previous));
-        }
-
-        return new ArrayList<Edge>(edgeToNode.keySet());
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/PropertiesComputer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/PropertiesComputer.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/PropertiesComputer.java
deleted file mode 100644
index 9d15b11..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/PropertiesComputer.java
+++ /dev/null
@@ -1,173 +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.geometry.spherical.twod;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/** Visitor computing geometrical properties.
- * @since 3.3
- */
-class PropertiesComputer implements BSPTreeVisitor<Sphere2D> {
-
-    /** Tolerance below which points are consider to be identical. */
-    private final double tolerance;
-
-    /** Summed area. */
-    private double summedArea;
-
-    /** Summed barycenter. */
-    private Vector3D summedBarycenter;
-
-    /** List of points strictly inside convex cells. */
-    private final List<Vector3D> convexCellsInsidePoints;
-
-    /** Simple constructor.
- * @param tolerance below which points are consider to be identical
-     */
-    public PropertiesComputer(final double tolerance) {
-        this.tolerance              = tolerance;
-        this.summedArea             = 0;
-        this.summedBarycenter       = Vector3D.ZERO;
-        this.convexCellsInsidePoints = new ArrayList<Vector3D>();
-    }
-
-    /** {@inheritDoc} */
-    public Order visitOrder(final BSPTree<Sphere2D> node) {
-        return Order.MINUS_SUB_PLUS;
-    }
-
-    /** {@inheritDoc} */
-    public void visitInternalNode(final BSPTree<Sphere2D> node) {
-        // nothing to do here
-    }
-
-    /** {@inheritDoc} */
-    public void visitLeafNode(final BSPTree<Sphere2D> node) {
-        if ((Boolean) node.getAttribute()) {
-
-            // transform this inside leaf cell into a simple convex polygon
-            final SphericalPolygonsSet convex =
-                    new SphericalPolygonsSet(node.pruneAroundConvexCell(Boolean.TRUE,
-                                                                        Boolean.FALSE,
-                                                                        null),
-                                             tolerance);
-
-            // extract the start of the single loop boundary of the convex cell
-            final List<Vertex> boundary = convex.getBoundaryLoops();
-            if (boundary.size() != 1) {
-                // this should never happen
-                throw new MathInternalError();
-            }
-
-            // compute the geometrical properties of the convex cell
-            final double area  = convexCellArea(boundary.get(0));
-            final Vector3D barycenter = convexCellBarycenter(boundary.get(0));
-            convexCellsInsidePoints.add(barycenter);
-
-            // add the cell contribution to the global properties
-            summedArea      += area;
-            summedBarycenter = new Vector3D(1, summedBarycenter, area, barycenter);
-
-        }
-    }
-
-    /** Compute convex cell area.
-     * @param start start vertex of the convex cell boundary
-     * @return area
-     */
-    private double convexCellArea(final Vertex start) {
-
-        int n = 0;
-        double sum = 0;
-
-        // loop around the cell
-        for (Edge e = start.getOutgoing(); n == 0 || e.getStart() != start; e = e.getEnd().getOutgoing()) {
-
-            // find path interior angle at vertex
-            final Vector3D previousPole = e.getCircle().getPole();
-            final Vector3D nextPole     = e.getEnd().getOutgoing().getCircle().getPole();
-            final Vector3D point        = e.getEnd().getLocation().getVector();
-            double alpha = FastMath.atan2(Vector3D.dotProduct(nextPole, Vector3D.crossProduct(point, previousPole)),
-                                          -Vector3D.dotProduct(nextPole, previousPole));
-            if (alpha < 0) {
-                alpha += MathUtils.TWO_PI;
-            }
-            sum += alpha;
-            n++;
-        }
-
-        // compute area using extended Girard theorem
-        // see Spherical Trigonometry: For the Use of Colleges and Schools by I. Todhunter
-        // article 99 in chapter VIII Area Of a Spherical Triangle. Spherical Excess.
-        // book available from project Gutenberg at http://www.gutenberg.org/ebooks/19770
-        return sum - (n - 2) * FastMath.PI;
-
-    }
-
-    /** Compute convex cell barycenter.
-     * @param start start vertex of the convex cell boundary
-     * @return barycenter
-     */
-    private Vector3D convexCellBarycenter(final Vertex start) {
-
-        int n = 0;
-        Vector3D sumB = Vector3D.ZERO;
-
-        // loop around the cell
-        for (Edge e = start.getOutgoing(); n == 0 || e.getStart() != start; e = e.getEnd().getOutgoing()) {
-            sumB = new Vector3D(1, sumB, e.getLength(), e.getCircle().getPole());
-            n++;
-        }
-
-        return sumB.normalize();
-
-    }
-
-    /** Get the area.
-     * @return area
-     */
-    public double getArea() {
-        return summedArea;
-    }
-
-    /** Get the barycenter.
-     * @return barycenter
-     */
-    public S2Point getBarycenter() {
-        if (summedBarycenter.getNormSq() == 0) {
-            return S2Point.NaN;
-        } else {
-            return new S2Point(summedBarycenter);
-        }
-    }
-
-    /** Get the points strictly inside convex cells.
-     * @return points strictly inside convex cells
-     */
-    public List<Vector3D> getConvexCellsInsidePoints() {
-        return convexCellsInsidePoints;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/S2Point.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/S2Point.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/S2Point.java
deleted file mode 100644
index 677e830..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/S2Point.java
+++ /dev/null
@@ -1,237 +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.geometry.spherical.twod;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/** This class represents a point on the 2-sphere.
- * <p>
- * We use the mathematical convention to use the azimuthal angle \( \theta \)
- * in the x-y plane as the first coordinate, and the polar angle \( \varphi \)
- * as the second coordinate (see <a
- * href="http://mathworld.wolfram.com/SphericalCoordinates.html">Spherical
- * Coordinates</a> in MathWorld).
- * </p>
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.3
- */
-public class S2Point implements Point<Sphere2D> {
-
-    /** +I (coordinates: \( \theta = 0, \varphi = \pi/2 \)). */
-    public static final S2Point PLUS_I = new S2Point(0, 0.5 * FastMath.PI, Vector3D.PLUS_I);
-
-    /** +J (coordinates: \( \theta = \pi/2, \varphi = \pi/2 \))). */
-    public static final S2Point PLUS_J = new S2Point(0.5 * FastMath.PI, 0.5 * FastMath.PI, Vector3D.PLUS_J);
-
-    /** +K (coordinates: \( \theta = any angle, \varphi = 0 \)). */
-    public static final S2Point PLUS_K = new S2Point(0, 0, Vector3D.PLUS_K);
-
-    /** -I (coordinates: \( \theta = \pi, \varphi = \pi/2 \)). */
-    public static final S2Point MINUS_I = new S2Point(FastMath.PI, 0.5 * FastMath.PI, Vector3D.MINUS_I);
-
-    /** -J (coordinates: \( \theta = 3\pi/2, \varphi = \pi/2 \)). */
-    public static final S2Point MINUS_J = new S2Point(1.5 * FastMath.PI, 0.5 * FastMath.PI, Vector3D.MINUS_J);
-
-    /** -K (coordinates: \( \theta = any angle, \varphi = \pi \)). */
-    public static final S2Point MINUS_K = new S2Point(0, FastMath.PI, Vector3D.MINUS_K);
-
-    // CHECKSTYLE: stop ConstantName
-    /** A vector with all coordinates set to NaN. */
-    public static final S2Point NaN = new S2Point(Double.NaN, Double.NaN, Vector3D.NaN);
-    // CHECKSTYLE: resume ConstantName
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20131218L;
-
-    /** Azimuthal angle \( \theta \) in the x-y plane. */
-    private final double theta;
-
-    /** Polar angle \( \varphi \). */
-    private final double phi;
-
-    /** Corresponding 3D normalized vector. */
-    private final Vector3D vector;
-
-    /** Simple constructor.
-     * Build a vector from its spherical coordinates
-     * @param theta azimuthal angle \( \theta \) in the x-y plane
-     * @param phi polar angle \( \varphi \)
-     * @see #getTheta()
-     * @see #getPhi()
-     * @exception OutOfRangeException if \( \varphi \) is not in the [\( 0; \pi \)] range
-     */
-    public S2Point(final double theta, final double phi)
-        throws OutOfRangeException {
-        this(theta, phi, vector(theta, phi));
-    }
-
-    /** Simple constructor.
-     * Build a vector from its underlying 3D vector
-     * @param vector 3D vector
-     * @exception MathArithmeticException if vector norm is zero
-     */
-    public S2Point(final Vector3D vector) throws MathArithmeticException {
-        this(FastMath.atan2(vector.getY(), vector.getX()), Vector3D.angle(Vector3D.PLUS_K, vector),
-             vector.normalize());
-    }
-
-    /** Build a point from its internal components.
-     * @param theta azimuthal angle \( \theta \) in the x-y plane
-     * @param phi polar angle \( \varphi \)
-     * @param vector corresponding vector
-     */
-    private S2Point(final double theta, final double phi, final Vector3D vector) {
-        this.theta  = theta;
-        this.phi    = phi;
-        this.vector = vector;
-    }
-
-    /** Build the normalized vector corresponding to spherical coordinates.
-     * @param theta azimuthal angle \( \theta \) in the x-y plane
-     * @param phi polar angle \( \varphi \)
-     * @return normalized vector
-     * @exception OutOfRangeException if \( \varphi \) is not in the [\( 0; \pi \)] range
-     */
-    private static Vector3D vector(final double theta, final double phi)
-       throws OutOfRangeException {
-
-        if (phi < 0 || phi > FastMath.PI) {
-            throw new OutOfRangeException(phi, 0, FastMath.PI);
-        }
-
-        final double cosTheta = FastMath.cos(theta);
-        final double sinTheta = FastMath.sin(theta);
-        final double cosPhi   = FastMath.cos(phi);
-        final double sinPhi   = FastMath.sin(phi);
-
-        return new Vector3D(cosTheta * sinPhi, sinTheta * sinPhi, cosPhi);
-
-    }
-
-    /** Get the azimuthal angle \( \theta \) in the x-y plane.
-     * @return azimuthal angle \( \theta \) in the x-y plane
-     * @see #S2Point(double, double)
-     */
-    public double getTheta() {
-        return theta;
-    }
-
-    /** Get the polar angle \( \varphi \).
-     * @return polar angle \( \varphi \)
-     * @see #S2Point(double, double)
-     */
-    public double getPhi() {
-        return phi;
-    }
-
-    /** Get the corresponding normalized vector in the 3D euclidean space.
-     * @return normalized vector
-     */
-    public Vector3D getVector() {
-        return vector;
-    }
-
-    /** {@inheritDoc} */
-    public Space getSpace() {
-        return Sphere2D.getInstance();
-    }
-
-    /** {@inheritDoc} */
-    public boolean isNaN() {
-        return Double.isNaN(theta) || Double.isNaN(phi);
-    }
-
-    /** Get the opposite of the instance.
-     * @return a new vector which is opposite to the instance
-     */
-    public S2Point negate() {
-        return new S2Point(-theta, FastMath.PI - phi, vector.negate());
-    }
-
-    /** {@inheritDoc} */
-    public double distance(final Point<Sphere2D> point) {
-        return distance(this, (S2Point) point);
-    }
-
-    /** Compute the distance (angular separation) between two points.
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the angular separation between p1 and p2
-     */
-    public static double distance(S2Point p1, S2Point p2) {
-        return Vector3D.angle(p1.vector, p2.vector);
-    }
-
-    /**
-     * Test for the equality of two points on the 2-sphere.
-     * <p>
-     * If all coordinates of two points are exactly the same, and none are
-     * <code>Double.NaN</code>, the two points are considered to be equal.
-     * </p>
-     * <p>
-     * <code>NaN</code> coordinates are considered to affect globally the vector
-     * and be equals to each other - i.e, if either (or all) coordinates of the
-     * 2D vector are equal to <code>Double.NaN</code>, the 2D vector is equal to
-     * {@link #NaN}.
-     * </p>
-     *
-     * @param other Object to test for equality to this
-     * @return true if two points on the 2-sphere objects are equal, false if
-     *         object is null, not an instance of S2Point, or
-     *         not equal to this S2Point instance
-     *
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof S2Point) {
-            final S2Point rhs = (S2Point) other;
-            if (rhs.isNaN()) {
-                return this.isNaN();
-            }
-
-            return (theta == rhs.theta) && (phi == rhs.phi);
-        }
-        return false;
-    }
-
-    /**
-     * Get a hashCode for the 2D vector.
-     * <p>
-     * All NaN values have the same hash code.</p>
-     *
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN()) {
-            return 542;
-        }
-        return 134 * (37 * MathUtils.hash(theta) +  MathUtils.hash(phi));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Sphere2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Sphere2D.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Sphere2D.java
deleted file mode 100644
index 93ff04e..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Sphere2D.java
+++ /dev/null
@@ -1,80 +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.geometry.spherical.twod;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-
-/**
- * This class implements a two-dimensional sphere (i.e. the regular sphere).
- * <p>
- * We use here the topologists definition of the 2-sphere (see
- * <a href="http://mathworld.wolfram.com/Sphere.html">Sphere</a> on
- * MathWorld), i.e. the 2-sphere is the two-dimensional surface
- * defined in 3D as x<sup>2</sup>+y<sup>2</sup>+z<sup>2</sup>=1.
- * </p>
- * @since 3.3
- */
-public class Sphere2D implements Serializable, Space {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20131218L;
-
-    /** Private constructor for the singleton.
-     */
-    private Sphere2D() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static Sphere2D getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public int getDimension() {
-        return 2;
-    }
-
-    /** {@inheritDoc} */
-    public Sphere1D getSubSpace() {
-        return Sphere1D.getInstance();
-    }
-
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final Sphere2D INSTANCE = new Sphere2D();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java
deleted file mode 100644
index 5fdb1c3..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SphericalPolygonsSet.java
+++ /dev/null
@@ -1,563 +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.geometry.spherical.twod;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.enclosing.WelzlEncloser;
-import org.apache.commons.math3.geometry.euclidean.threed.Euclidean3D;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.SphereGenerator;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BoundaryProjection;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/** This class represents a region on the 2-sphere: a set of spherical polygons.
- * @since 3.3
- */
-public class SphericalPolygonsSet extends AbstractRegion<Sphere2D, Sphere1D> {
-
-    /** Boundary defined as an array of closed loops start vertices. */
-    private List<Vertex> loops;
-
-    /** Build a polygons set representing the whole real 2-sphere.
-     * @param tolerance below which points are consider to be identical
-     */
-    public SphericalPolygonsSet(final double tolerance) {
-        super(tolerance);
-    }
-
-    /** Build a polygons set representing a hemisphere.
-     * @param pole pole of the hemisphere (the pole is in the inside half)
-     * @param tolerance below which points are consider to be identical
-     */
-    public SphericalPolygonsSet(final Vector3D pole, final double tolerance) {
-        super(new BSPTree<Sphere2D>(new Circle(pole, tolerance).wholeHyperplane(),
-                                    new BSPTree<Sphere2D>(Boolean.FALSE),
-                                    new BSPTree<Sphere2D>(Boolean.TRUE),
-                                    null),
-              tolerance);
-    }
-
-    /** Build a polygons set representing a regular polygon.
-     * @param center center of the polygon (the center is in the inside half)
-     * @param meridian point defining the reference meridian for first polygon vertex
-     * @param outsideRadius distance of the vertices to the center
-     * @param n number of sides of the polygon
-     * @param tolerance below which points are consider to be identical
-     */
-    public SphericalPolygonsSet(final Vector3D center, final Vector3D meridian,
-                                final double outsideRadius, final int n,
-                                final double tolerance) {
-        this(tolerance, createRegularPolygonVertices(center, meridian, outsideRadius, n));
-    }
-
-    /** Build a polygons set from a BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * @param tree inside/outside BSP tree representing the region
-     * @param tolerance below which points are consider to be identical
-     */
-    public SphericalPolygonsSet(final BSPTree<Sphere2D> tree, final double tolerance) {
-        super(tree, tolerance);
-    }
-
-    /** Build a polygons set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polygons with holes
-     * or a set of disjoint polygons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
-     * checkPoint} method will not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements, as a
-     * collection of {@link SubHyperplane SubHyperplane} objects
-     * @param tolerance below which points are consider to be identical
-     */
-    public SphericalPolygonsSet(final Collection<SubHyperplane<Sphere2D>> boundary, final double tolerance) {
-        super(boundary, tolerance);
-    }
-
-    /** Build a polygon from a simple list of vertices.
-     * <p>The boundary is provided as a list of points considering to
-     * represent the vertices of a simple loop. The interior part of the
-     * region is on the left side of this path and the exterior is on its
-     * right side.</p>
-     * <p>This constructor does not handle polygons with a boundary
-     * forming several disconnected paths (such as polygons with holes).</p>
-     * <p>For cases where this simple constructor applies, it is expected to
-     * be numerically more robust than the {@link #SphericalPolygonsSet(Collection,
-     * double) general constructor} using {@link SubHyperplane subhyperplanes}.</p>
-     * <p>If the list is empty, the region will represent the whole
-     * space.</p>
-     * <p>
-     * Polygons with thin pikes or dents are inherently difficult to handle because
-     * they involve circles with almost opposite directions at some vertices. Polygons
-     * whose vertices come from some physical measurement with noise are also
-     * difficult because an edge that should be straight may be broken in lots of
-     * different pieces with almost equal directions. In both cases, computing the
-     * circles intersections is not numerically robust due to the almost 0 or almost
-     * &pi; angle. Such cases need to carefully adjust the {@code hyperplaneThickness}
-     * parameter. A too small value would often lead to completely wrong polygons
-     * with large area wrongly identified as inside or outside. Large values are
-     * often much safer. As a rule of thumb, a value slightly below the size of the
-     * most accurate detail needed is a good value for the {@code hyperplaneThickness}
-     * parameter.
-     * </p>
-     * @param hyperplaneThickness tolerance below which points are considered to
-     * belong to the hyperplane (which is therefore more a slab)
-     * @param vertices vertices of the simple loop boundary
-     */
-    public SphericalPolygonsSet(final double hyperplaneThickness, final S2Point ... vertices) {
-        super(verticesToTree(hyperplaneThickness, vertices), hyperplaneThickness);
-    }
-
-    /** Build the vertices representing a regular polygon.
-     * @param center center of the polygon (the center is in the inside half)
-     * @param meridian point defining the reference meridian for first polygon vertex
-     * @param outsideRadius distance of the vertices to the center
-     * @param n number of sides of the polygon
-     * @return vertices array
-     */
-    private static S2Point[] createRegularPolygonVertices(final Vector3D center, final Vector3D meridian,
-                                                          final double outsideRadius, final int n) {
-        final S2Point[] array = new S2Point[n];
-        final Rotation r0 = new Rotation(Vector3D.crossProduct(center, meridian), outsideRadius);
-        array[0] = new S2Point(r0.applyTo(center));
-
-        final Rotation r = new Rotation(center, MathUtils.TWO_PI / n);
-        for (int i = 1; i < n; ++i) {
-            array[i] = new S2Point(r.applyTo(array[i - 1].getVector()));
-        }
-
-        return array;
-    }
-
-    /** Build the BSP tree of a polygons set from a simple list of vertices.
-     * <p>The boundary is provided as a list of points considering to
-     * represent the vertices of a simple loop. The interior part of the
-     * region is on the left side of this path and the exterior is on its
-     * right side.</p>
-     * <p>This constructor does not handle polygons with a boundary
-     * forming several disconnected paths (such as polygons with holes).</p>
-     * <p>This constructor handles only polygons with edges strictly shorter
-     * than \( \pi \). If longer edges are needed, they need to be broken up
-     * in smaller sub-edges so this constraint holds.</p>
-     * <p>For cases where this simple constructor applies, it is expected to
-     * be numerically more robust than the {@link #PolygonsSet(Collection) general
-     * constructor} using {@link SubHyperplane subhyperplanes}.</p>
-     * @param hyperplaneThickness tolerance below which points are consider to
-     * belong to the hyperplane (which is therefore more a slab)
-     * @param vertices vertices of the simple loop boundary
-     * @return the BSP tree of the input vertices
-     */
-    private static BSPTree<Sphere2D> verticesToTree(final double hyperplaneThickness,
-                                                    final S2Point ... vertices) {
-
-        final int n = vertices.length;
-        if (n == 0) {
-            // the tree represents the whole space
-            return new BSPTree<Sphere2D>(Boolean.TRUE);
-        }
-
-        // build the vertices
-        final Vertex[] vArray = new Vertex[n];
-        for (int i = 0; i < n; ++i) {
-            vArray[i] = new Vertex(vertices[i]);
-        }
-
-        // build the edges
-        List<Edge> edges = new ArrayList<Edge>(n);
-        Vertex end = vArray[n - 1];
-        for (int i = 0; i < n; ++i) {
-
-            // get the endpoints of the edge
-            final Vertex start = end;
-            end = vArray[i];
-
-            // get the circle supporting the edge, taking care not to recreate it
-            // if it was already created earlier due to another edge being aligned
-            // with the current one
-            Circle circle = start.sharedCircleWith(end);
-            if (circle == null) {
-                circle = new Circle(start.getLocation(), end.getLocation(), hyperplaneThickness);
-            }
-
-            // create the edge and store it
-            edges.add(new Edge(start, end,
-                               Vector3D.angle(start.getLocation().getVector(),
-                                              end.getLocation().getVector()),
-                               circle));
-
-            // check if another vertex also happens to be on this circle
-            for (final Vertex vertex : vArray) {
-                if (vertex != start && vertex != end &&
-                    FastMath.abs(circle.getOffset(vertex.getLocation())) <= hyperplaneThickness) {
-                    vertex.bindWith(circle);
-                }
-            }
-
-        }
-
-        // build the tree top-down
-        final BSPTree<Sphere2D> tree = new BSPTree<Sphere2D>();
-        insertEdges(hyperplaneThickness, tree, edges);
-
-        return tree;
-
-    }
-
-    /** Recursively build a tree by inserting cut sub-hyperplanes.
-     * @param hyperplaneThickness tolerance below which points are considered to
-     * belong to the hyperplane (which is therefore more a slab)
-     * @param node current tree node (it is a leaf node at the beginning
-     * of the call)
-     * @param edges list of edges to insert in the cell defined by this node
-     * (excluding edges not belonging to the cell defined by this node)
-     */
-    private static void insertEdges(final double hyperplaneThickness,
-                                    final BSPTree<Sphere2D> node,
-                                    final List<Edge> edges) {
-
-        // find an edge with an hyperplane that can be inserted in the node
-        int index = 0;
-        Edge inserted = null;
-        while (inserted == null && index < edges.size()) {
-            inserted = edges.get(index++);
-            if (!node.insertCut(inserted.getCircle())) {
-                inserted = null;
-            }
-        }
-
-        if (inserted == null) {
-            // no suitable edge was found, the node remains a leaf node
-            // we need to set its inside/outside boolean indicator
-            final BSPTree<Sphere2D> parent = node.getParent();
-            if (parent == null || node == parent.getMinus()) {
-                node.setAttribute(Boolean.TRUE);
-            } else {
-                node.setAttribute(Boolean.FALSE);
-            }
-            return;
-        }
-
-        // we have split the node by inserting an edge as a cut sub-hyperplane
-        // distribute the remaining edges in the two sub-trees
-        final List<Edge> outsideList = new ArrayList<Edge>();
-        final List<Edge> insideList  = new ArrayList<Edge>();
-        for (final Edge edge : edges) {
-            if (edge != inserted) {
-                edge.split(inserted.getCircle(), outsideList, insideList);
-            }
-        }
-
-        // recurse through lower levels
-        if (!outsideList.isEmpty()) {
-            insertEdges(hyperplaneThickness, node.getPlus(), outsideList);
-        } else {
-            node.getPlus().setAttribute(Boolean.FALSE);
-        }
-        if (!insideList.isEmpty()) {
-            insertEdges(hyperplaneThickness, node.getMinus(),  insideList);
-        } else {
-            node.getMinus().setAttribute(Boolean.TRUE);
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public SphericalPolygonsSet buildNew(final BSPTree<Sphere2D> tree) {
-        return new SphericalPolygonsSet(tree, getTolerance());
-    }
-
-    /** {@inheritDoc}
-     * @exception MathIllegalStateException if the tolerance setting does not allow to build
-     * a clean non-ambiguous boundary
-     */
-    @Override
-    protected void computeGeometricalProperties() throws MathIllegalStateException {
-
-        final BSPTree<Sphere2D> tree = getTree(true);
-
-        if (tree.getCut() == null) {
-
-            // the instance has a single cell without any boundaries
-
-            if (tree.getCut() == null && (Boolean) tree.getAttribute()) {
-                // the instance covers the whole space
-                setSize(4 * FastMath.PI);
-                setBarycenter(new S2Point(0, 0));
-            } else {
-                setSize(0);
-                setBarycenter(S2Point.NaN);
-            }
-
-        } else {
-
-            // the instance has a boundary
-            final PropertiesComputer pc = new PropertiesComputer(getTolerance());
-            tree.visit(pc);
-            setSize(pc.getArea());
-            setBarycenter(pc.getBarycenter());
-
-        }
-
-    }
-
-    /** Get the boundary loops of the polygon.
-     * <p>The polygon boundary can be represented as a list of closed loops,
-     * each loop being given by exactly one of its vertices. From each loop
-     * start vertex, one can follow the loop by finding the outgoing edge,
-     * then the end vertex, then the next outgoing edge ... until the start
-     * vertex of the loop (exactly the same instance) is found again once
-     * the full loop has been visited.</p>
-     * <p>If the polygon has no boundary at all, a zero length loop
-     * array will be returned.</p>
-     * <p>If the polygon is a simple one-piece polygon, then the returned
-     * array will contain a single vertex.
-     * </p>
-     * <p>All edges in the various loops have the inside of the region on
-     * their left side (i.e. toward their pole) and the outside on their
-     * right side (i.e. away from their pole) when moving in the underlying
-     * circle direction. This means that the closed loops obey the direct
-     * trigonometric orientation.</p>
-     * @return boundary of the polygon, organized as an unmodifiable list of loops start vertices.
-     * @exception MathIllegalStateException if the tolerance setting does not allow to build
-     * a clean non-ambiguous boundary
-     * @see Vertex
-     * @see Edge
-     */
-    public List<Vertex> getBoundaryLoops() throws MathIllegalStateException {
-
-        if (loops == null) {
-            if (getTree(false).getCut() == null) {
-                loops = Collections.emptyList();
-            } else {
-
-                // sort the arcs according to their start point
-                final BSPTree<Sphere2D> root = getTree(true);
-                final EdgesBuilder visitor = new EdgesBuilder(root, getTolerance());
-                root.visit(visitor);
-                final List<Edge> edges = visitor.getEdges();
-
-
-                // convert the list of all edges into a list of start vertices
-                loops = new ArrayList<Vertex>();
-                while (!edges.isEmpty()) {
-
-                    // this is an edge belonging to a new loop, store it
-                    Edge edge = edges.get(0);
-                    final Vertex startVertex = edge.getStart();
-                    loops.add(startVertex);
-
-                    // remove all remaining edges in the same loop
-                    do {
-
-                        // remove one edge
-                        for (final Iterator<Edge> iterator = edges.iterator(); iterator.hasNext();) {
-                            if (iterator.next() == edge) {
-                                iterator.remove();
-                                break;
-                            }
-                        }
-
-                        // go to next edge following the boundary loop
-                        edge = edge.getEnd().getOutgoing();
-
-                    } while (edge.getStart() != startVertex);
-
-                }
-
-            }
-        }
-
-        return Collections.unmodifiableList(loops);
-
-    }
-
-    /** Get a spherical cap enclosing the polygon.
-     * <p>
-     * This method is intended as a first test to quickly identify points
-     * that are guaranteed to be outside of the region, hence performing a full
-     * {@link #checkPoint(org.apache.commons.math3.geometry.Vector) checkPoint}
-     * only if the point status remains undecided after the quick check. It is
-     * is therefore mostly useful to speed up computation for small polygons with
-     * complex shapes (say a country boundary on Earth), as the spherical cap will
-     * be small and hence will reliably identify a large part of the sphere as outside,
-     * whereas the full check can be more computing intensive. A typical use case is
-     * therefore:
-     * </p>
-     * <pre>
-     *   // compute region, plus an enclosing spherical cap
-     *   SphericalPolygonsSet complexShape = ...;
-     *   EnclosingBall<Sphere2D, S2Point> cap = complexShape.getEnclosingCap();
-     *
-     *   // check lots of points
-     *   for (Vector3D p : points) {
-     *
-     *     final Location l;
-     *     if (cap.contains(p)) {
-     *       // we cannot be sure where the point is
-     *       // we need to perform the full computation
-     *       l = complexShape.checkPoint(v);
-     *     } else {
-     *       // no need to do further computation,
-     *       // we already know the point is outside
-     *       l = Location.OUTSIDE;
-     *     }
-     *
-     *     // use l ...
-     *
-     *   }
-     * </pre>
-     * <p>
-     * In the special cases of empty or whole sphere polygons, special
-     * spherical caps are returned, with angular radius set to negative
-     * or positive infinity so the {@link
-     * EnclosingBall#contains(org.apache.commons.math3.geometry.Point) ball.contains(point)}
-     * method return always false or true.
-     * </p>
-     * <p>
-     * This method is <em>not</em> guaranteed to return the smallest enclosing cap.
-     * </p>
-     * @return a spherical cap enclosing the polygon
-     */
-    public EnclosingBall<Sphere2D, S2Point> getEnclosingCap() {
-
-        // handle special cases first
-        if (isEmpty()) {
-            return new EnclosingBall<Sphere2D, S2Point>(S2Point.PLUS_K, Double.NEGATIVE_INFINITY);
-        }
-        if (isFull()) {
-            return new EnclosingBall<Sphere2D, S2Point>(S2Point.PLUS_K, Double.POSITIVE_INFINITY);
-        }
-
-        // as the polygons is neither empty nor full, it has some boundaries and cut hyperplanes
-        final BSPTree<Sphere2D> root = getTree(false);
-        if (isEmpty(root.getMinus()) && isFull(root.getPlus())) {
-            // the polygon covers an hemisphere, and its boundary is one 2Ï€ long edge
-            final Circle circle = (Circle) root.getCut().getHyperplane();
-            return new EnclosingBall<Sphere2D, S2Point>(new S2Point(circle.getPole()).negate(),
-                                                        0.5 * FastMath.PI);
-        }
-        if (isFull(root.getMinus()) && isEmpty(root.getPlus())) {
-            // the polygon covers an hemisphere, and its boundary is one 2Ï€ long edge
-            final Circle circle = (Circle) root.getCut().getHyperplane();
-            return new EnclosingBall<Sphere2D, S2Point>(new S2Point(circle.getPole()),
-                                                        0.5 * FastMath.PI);
-        }
-
-        // gather some inside points, to be used by the encloser
-        final List<Vector3D> points = getInsidePoints();
-
-        // extract points from the boundary loops, to be used by the encloser as well
-        final List<Vertex> boundary = getBoundaryLoops();
-        for (final Vertex loopStart : boundary) {
-            int count = 0;
-            for (Vertex v = loopStart; count == 0 || v != loopStart; v = v.getOutgoing().getEnd()) {
-                ++count;
-                points.add(v.getLocation().getVector());
-            }
-        }
-
-        // find the smallest enclosing 3D sphere
-        final SphereGenerator generator = new SphereGenerator();
-        final WelzlEncloser<Euclidean3D, Vector3D> encloser =
-                new WelzlEncloser<Euclidean3D, Vector3D>(getTolerance(), generator);
-        EnclosingBall<Euclidean3D, Vector3D> enclosing3D = encloser.enclose(points);
-        final Vector3D[] support3D = enclosing3D.getSupport();
-
-        // convert to 3D sphere to spherical cap
-        final double r = enclosing3D.getRadius();
-        final double h = enclosing3D.getCenter().getNorm();
-        if (h < getTolerance()) {
-            // the 3D sphere is centered on the unit sphere and covers it
-            // fall back to a crude approximation, based only on outside convex cells
-            EnclosingBall<Sphere2D, S2Point> enclosingS2 =
-                    new EnclosingBall<Sphere2D, S2Point>(S2Point.PLUS_K, Double.POSITIVE_INFINITY);
-            for (Vector3D outsidePoint : getOutsidePoints()) {
-                final S2Point outsideS2 = new S2Point(outsidePoint);
-                final BoundaryProjection<Sphere2D> projection = projectToBoundary(outsideS2);
-                if (FastMath.PI - projection.getOffset() < enclosingS2.getRadius()) {
-                    enclosingS2 = new EnclosingBall<Sphere2D, S2Point>(outsideS2.negate(),
-                                                                       FastMath.PI - projection.getOffset(),
-                                                                       (S2Point) projection.getProjected());
-                }
-            }
-            return enclosingS2;
-        }
-        final S2Point[] support = new S2Point[support3D.length];
-        for (int i = 0; i < support3D.length; ++i) {
-            support[i] = new S2Point(support3D[i]);
-        }
-
-        final EnclosingBall<Sphere2D, S2Point> enclosingS2 =
-                new EnclosingBall<Sphere2D, S2Point>(new S2Point(enclosing3D.getCenter()),
-                                                     FastMath.acos((1 + h * h - r * r) / (2 * h)),
-                                                     support);
-
-        return enclosingS2;
-
-    }
-
-    /** Gather some inside points.
-     * @return list of points known to be strictly in all inside convex cells
-     */
-    private List<Vector3D> getInsidePoints() {
-        final PropertiesComputer pc = new PropertiesComputer(getTolerance());
-        getTree(true).visit(pc);
-        return pc.getConvexCellsInsidePoints();
-    }
-
-    /** Gather some outside points.
-     * @return list of points known to be strictly in all outside convex cells
-     */
-    private List<Vector3D> getOutsidePoints() {
-        final SphericalPolygonsSet complement =
-                (SphericalPolygonsSet) new RegionFactory<Sphere2D>().getComplement(this);
-        final PropertiesComputer pc = new PropertiesComputer(getTolerance());
-        complement.getTree(true).visit(pc);
-        return pc.getConvexCellsInsidePoints();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SubCircle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SubCircle.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SubCircle.java
deleted file mode 100644
index fa7fd9c..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/SubCircle.java
+++ /dev/null
@@ -1,94 +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.geometry.spherical.twod;
-
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.FastMath;
-
-/** This class represents a sub-hyperplane for {@link Circle}.
- * @since 3.3
- */
-public class SubCircle extends AbstractSubHyperplane<Sphere2D, Sphere1D> {
-
-    /** Simple constructor.
-     * @param hyperplane underlying hyperplane
-     * @param remainingRegion remaining region of the hyperplane
-     */
-    public SubCircle(final Hyperplane<Sphere2D> hyperplane,
-                     final Region<Sphere1D> remainingRegion) {
-        super(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected AbstractSubHyperplane<Sphere2D, Sphere1D> buildNew(final Hyperplane<Sphere2D> hyperplane,
-                                                                 final Region<Sphere1D> remainingRegion) {
-        return new SubCircle(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Side side(final Hyperplane<Sphere2D> hyperplane) {
-
-        final Circle thisCircle  = (Circle) getHyperplane();
-        final Circle otherCircle = (Circle) hyperplane;
-        final double angle = Vector3D.angle(thisCircle.getPole(), otherCircle.getPole());
-
-        if (angle < thisCircle.getTolerance() || angle > FastMath.PI - thisCircle.getTolerance()) {
-            // the two circles are aligned or opposite
-            return Side.HYPER;
-        } else {
-            // the two circles intersect each other
-            return ((ArcsSet) getRemainingRegion()).side(thisCircle.getInsideArc(otherCircle));
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public SplitSubHyperplane<Sphere2D> split(final Hyperplane<Sphere2D> hyperplane) {
-
-        final Circle thisCircle   = (Circle) getHyperplane();
-        final Circle otherCircle  = (Circle) hyperplane;
-        final double angle = Vector3D.angle(thisCircle.getPole(), otherCircle.getPole());
-
-        if (angle < thisCircle.getTolerance()) {
-            // the two circles are aligned
-            return new SplitSubHyperplane<Sphere2D>(null, this);
-        } else if (angle > FastMath.PI - thisCircle.getTolerance()) {
-            // the two circles are opposite
-            return new SplitSubHyperplane<Sphere2D>(this, null);
-        } else {
-            // the two circles intersect each other
-            final Arc    arc          = thisCircle.getInsideArc(otherCircle);
-            final ArcsSet.Split split = ((ArcsSet) getRemainingRegion()).split(arc);
-            final ArcsSet plus        = split.getPlus();
-            final ArcsSet minus       = split.getMinus();
-            return new SplitSubHyperplane<Sphere2D>(plus  == null ? null : new SubCircle(thisCircle.copySelf(), plus),
-                                                    minus == null ? null : new SubCircle(thisCircle.copySelf(), minus));
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Vertex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Vertex.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Vertex.java
deleted file mode 100644
index 3003da8..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Vertex.java
+++ /dev/null
@@ -1,124 +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.geometry.spherical.twod;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/** Spherical polygons boundary vertex.
- * @see SphericalPolygonsSet#getBoundaryLoops()
- * @see Edge
- * @since 3.3
- */
-public class Vertex {
-
-    /** Vertex location. */
-    private final S2Point location;
-
-    /** Incoming edge. */
-    private Edge incoming;
-
-    /** Outgoing edge. */
-    private Edge outgoing;
-
-    /** Circles bound with this vertex. */
-    private final List<Circle> circles;
-
-    /** Build a non-processed vertex not owned by any node yet.
-     * @param location vertex location
-     */
-    Vertex(final S2Point location) {
-        this.location = location;
-        this.incoming = null;
-        this.outgoing = null;
-        this.circles  = new ArrayList<Circle>();
-    }
-
-    /** Get Vertex location.
-     * @return vertex location
-     */
-    public S2Point getLocation() {
-        return location;
-    }
-
-    /** Bind a circle considered to contain this vertex.
-     * @param circle circle to bind with this vertex
-     */
-    void bindWith(final Circle circle) {
-        circles.add(circle);
-    }
-
-    /** Get the common circle bound with both the instance and another vertex, if any.
-     * <p>
-     * When two vertices are both bound to the same circle, this means they are
-     * already handled by node associated with this circle, so there is no need
-     * to create a cut hyperplane for them.
-     * </p>
-     * @param vertex other vertex to check instance against
-     * @return circle bound with both the instance and another vertex, or null if the
-     * two vertices do not share a circle yet
-     */
-    Circle sharedCircleWith(final Vertex vertex) {
-        for (final Circle circle1 : circles) {
-            for (final Circle circle2 : vertex.circles) {
-                if (circle1 == circle2) {
-                    return circle1;
-                }
-            }
-        }
-        return null;
-    }
-
-    /** Set incoming edge.
-     * <p>
-     * The circle supporting the incoming edge is automatically bound
-     * with the instance.
-     * </p>
-     * @param incoming incoming edge
-     */
-    void setIncoming(final Edge incoming) {
-        this.incoming = incoming;
-        bindWith(incoming.getCircle());
-    }
-
-    /** Get incoming edge.
-     * @return incoming edge
-     */
-    public Edge getIncoming() {
-        return incoming;
-    }
-
-    /** Set outgoing edge.
-     * <p>
-     * The circle supporting the outgoing edge is automatically bound
-     * with the instance.
-     * </p>
-     * @param outgoing outgoing edge
-     */
-    void setOutgoing(final Edge outgoing) {
-        this.outgoing = outgoing;
-        bindWith(outgoing.getCircle());
-    }
-
-    /** Get outgoing edge.
-     * @return outgoing edge
-     */
-    public Edge getOutgoing() {
-        return outgoing;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/package-info.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/package-info.java
deleted file mode 100644
index 3f3c5b0..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/package-info.java
+++ /dev/null
@@ -1,30 +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.
- */
-/**
- *
- * <p>
- * This package provides basic geometry components on the 2-sphere.
- * </p>
- * <p>
- * We use here the topologists definition of the 2-sphere (see
- * <a href="http://mathworld.wolfram.com/Sphere.html">Sphere</a> on
- * MathWorld), i.e. the 2-sphere is the two-dimensional surface
- * defined in 3D as x<sup>2</sup>+y<sup>2</sup>+z<sup>2</sup>=1.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.spherical.twod;


[16/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubPlane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubPlane.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubPlane.java
deleted file mode 100644
index 64fe1ed..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubPlane.java
+++ /dev/null
@@ -1,144 +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.geometry.euclidean.threed;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-
-/** This class represents a sub-hyperplane for {@link Plane}.
- * @since 3.0
- */
-public class SubPlane extends AbstractSubHyperplane<Euclidean3D, Euclidean2D> {
-
-    /** Simple constructor.
-     * @param hyperplane underlying hyperplane
-     * @param remainingRegion remaining region of the hyperplane
-     */
-    public SubPlane(final Hyperplane<Euclidean3D> hyperplane,
-                    final Region<Euclidean2D> remainingRegion) {
-        super(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected AbstractSubHyperplane<Euclidean3D, Euclidean2D> buildNew(final Hyperplane<Euclidean3D> hyperplane,
-                                                                       final Region<Euclidean2D> remainingRegion) {
-        return new SubPlane(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Side side(Hyperplane<Euclidean3D> hyperplane) {
-
-        final Plane otherPlane = (Plane) hyperplane;
-        final Plane thisPlane  = (Plane) getHyperplane();
-        final Line  inter      = otherPlane.intersection(thisPlane);
-        final double tolerance = thisPlane.getTolerance();
-
-        if (inter == null) {
-            // the hyperplanes are parallel,
-            // any point can be used to check their relative position
-            final double global = otherPlane.getOffset(thisPlane);
-            return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
-        }
-
-        // create a 2D line in the otherPlane canonical 2D frame such that:
-        //   - the line is the crossing line of the two planes in 3D
-        //   - the line splits the otherPlane in two half planes with an
-        //     orientation consistent with the orientation of the instance
-        //     (i.e. the 3D half space on the plus side (resp. minus side)
-        //      of the instance contains the 2D half plane on the plus side
-        //      (resp. minus side) of the 2D line
-        Vector2D p = thisPlane.toSubSpace((Point<Euclidean3D>) inter.toSpace((Point<Euclidean1D>) Vector1D.ZERO));
-        Vector2D q = thisPlane.toSubSpace((Point<Euclidean3D>) inter.toSpace((Point<Euclidean1D>) Vector1D.ONE));
-        Vector3D crossP = Vector3D.crossProduct(inter.getDirection(), thisPlane.getNormal());
-        if (crossP.dotProduct(otherPlane.getNormal()) < 0) {
-            final Vector2D tmp = p;
-            p           = q;
-            q           = tmp;
-        }
-        final org.apache.commons.math3.geometry.euclidean.twod.Line line2D =
-            new org.apache.commons.math3.geometry.euclidean.twod.Line(p, q, tolerance);
-
-        // check the side on the 2D plane
-        return getRemainingRegion().side(line2D);
-
-    }
-
-    /** Split the instance in two parts by an hyperplane.
-     * @param hyperplane splitting hyperplane
-     * @return an object containing both the part of the instance
-     * on the plus side of the instance and the part of the
-     * instance on the minus side of the instance
-     */
-    @Override
-    public SplitSubHyperplane<Euclidean3D> split(Hyperplane<Euclidean3D> hyperplane) {
-
-        final Plane otherPlane = (Plane) hyperplane;
-        final Plane thisPlane  = (Plane) getHyperplane();
-        final Line  inter      = otherPlane.intersection(thisPlane);
-        final double tolerance = thisPlane.getTolerance();
-
-        if (inter == null) {
-            // the hyperplanes are parallel
-            final double global = otherPlane.getOffset(thisPlane);
-            return (global < -1.0e-10) ?
-                   new SplitSubHyperplane<Euclidean3D>(null, this) :
-                   new SplitSubHyperplane<Euclidean3D>(this, null);
-        }
-
-        // the hyperplanes do intersect
-        Vector2D p = thisPlane.toSubSpace((Point<Euclidean3D>) inter.toSpace((Point<Euclidean1D>) Vector1D.ZERO));
-        Vector2D q = thisPlane.toSubSpace((Point<Euclidean3D>) inter.toSpace((Point<Euclidean1D>) Vector1D.ONE));
-        Vector3D crossP = Vector3D.crossProduct(inter.getDirection(), thisPlane.getNormal());
-        if (crossP.dotProduct(otherPlane.getNormal()) < 0) {
-            final Vector2D tmp = p;
-            p           = q;
-            q           = tmp;
-        }
-        final SubHyperplane<Euclidean2D> l2DMinus =
-            new org.apache.commons.math3.geometry.euclidean.twod.Line(p, q, tolerance).wholeHyperplane();
-        final SubHyperplane<Euclidean2D> l2DPlus =
-            new org.apache.commons.math3.geometry.euclidean.twod.Line(q, p, tolerance).wholeHyperplane();
-
-        final BSPTree<Euclidean2D> splitTree = getRemainingRegion().getTree(false).split(l2DMinus);
-        final BSPTree<Euclidean2D> plusTree  = getRemainingRegion().isEmpty(splitTree.getPlus()) ?
-                                               new BSPTree<Euclidean2D>(Boolean.FALSE) :
-                                               new BSPTree<Euclidean2D>(l2DPlus, new BSPTree<Euclidean2D>(Boolean.FALSE),
-                                                                        splitTree.getPlus(), null);
-
-        final BSPTree<Euclidean2D> minusTree = getRemainingRegion().isEmpty(splitTree.getMinus()) ?
-                                               new BSPTree<Euclidean2D>(Boolean.FALSE) :
-                                                   new BSPTree<Euclidean2D>(l2DMinus, new BSPTree<Euclidean2D>(Boolean.FALSE),
-                                                                            splitTree.getMinus(), null);
-
-        return new SplitSubHyperplane<Euclidean3D>(new SubPlane(thisPlane.copySelf(), new PolygonsSet(plusTree, tolerance)),
-                                                   new SubPlane(thisPlane.copySelf(), new PolygonsSet(minusTree, tolerance)));
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java
deleted file mode 100644
index 3eaea3a..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3D.java
+++ /dev/null
@@ -1,588 +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.geometry.euclidean.threed;
-
-import java.io.Serializable;
-import java.text.NumberFormat;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * This class implements vectors in a three-dimensional space.
- * <p>Instance of this class are guaranteed to be immutable.</p>
- * @since 1.2
- */
-public class Vector3D implements Serializable, Vector<Euclidean3D> {
-
-    /** Null vector (coordinates: 0, 0, 0). */
-    public static final Vector3D ZERO   = new Vector3D(0, 0, 0);
-
-    /** First canonical vector (coordinates: 1, 0, 0). */
-    public static final Vector3D PLUS_I = new Vector3D(1, 0, 0);
-
-    /** Opposite of the first canonical vector (coordinates: -1, 0, 0). */
-    public static final Vector3D MINUS_I = new Vector3D(-1, 0, 0);
-
-    /** Second canonical vector (coordinates: 0, 1, 0). */
-    public static final Vector3D PLUS_J = new Vector3D(0, 1, 0);
-
-    /** Opposite of the second canonical vector (coordinates: 0, -1, 0). */
-    public static final Vector3D MINUS_J = new Vector3D(0, -1, 0);
-
-    /** Third canonical vector (coordinates: 0, 0, 1). */
-    public static final Vector3D PLUS_K = new Vector3D(0, 0, 1);
-
-    /** Opposite of the third canonical vector (coordinates: 0, 0, -1).  */
-    public static final Vector3D MINUS_K = new Vector3D(0, 0, -1);
-
-    // CHECKSTYLE: stop ConstantName
-    /** A vector with all coordinates set to NaN. */
-    public static final Vector3D NaN = new Vector3D(Double.NaN, Double.NaN, Double.NaN);
-    // CHECKSTYLE: resume ConstantName
-
-    /** A vector with all coordinates set to positive infinity. */
-    public static final Vector3D POSITIVE_INFINITY =
-        new Vector3D(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
-
-    /** A vector with all coordinates set to negative infinity. */
-    public static final Vector3D NEGATIVE_INFINITY =
-        new Vector3D(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY);
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 1313493323784566947L;
-
-    /** Abscissa. */
-    private final double x;
-
-    /** Ordinate. */
-    private final double y;
-
-    /** Height. */
-    private final double z;
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param x abscissa
-     * @param y ordinate
-     * @param z height
-     * @see #getX()
-     * @see #getY()
-     * @see #getZ()
-     */
-    public Vector3D(double x, double y, double z) {
-        this.x = x;
-        this.y = y;
-        this.z = z;
-    }
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param v coordinates array
-     * @exception DimensionMismatchException if array does not have 3 elements
-     * @see #toArray()
-     */
-    public Vector3D(double[] v) throws DimensionMismatchException {
-        if (v.length != 3) {
-            throw new DimensionMismatchException(v.length, 3);
-        }
-        this.x = v[0];
-        this.y = v[1];
-        this.z = v[2];
-    }
-
-    /** Simple constructor.
-     * Build a vector from its azimuthal coordinates
-     * @param alpha azimuth (&alpha;) around Z
-     *              (0 is +X, &pi;/2 is +Y, &pi; is -X and 3&pi;/2 is -Y)
-     * @param delta elevation (&delta;) above (XY) plane, from -&pi;/2 to +&pi;/2
-     * @see #getAlpha()
-     * @see #getDelta()
-     */
-    public Vector3D(double alpha, double delta) {
-        double cosDelta = FastMath.cos(delta);
-        this.x = FastMath.cos(alpha) * cosDelta;
-        this.y = FastMath.sin(alpha) * cosDelta;
-        this.z = FastMath.sin(delta);
-    }
-
-    /** Multiplicative constructor
-     * Build a vector from another one and a scale factor.
-     * The vector built will be a * u
-     * @param a scale factor
-     * @param u base (unscaled) vector
-     */
-    public Vector3D(double a, Vector3D u) {
-        this.x = a * u.x;
-        this.y = a * u.y;
-        this.z = a * u.z;
-    }
-
-    /** Linear constructor
-     * Build a vector from two other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     */
-    public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2) {
-        this.x = MathArrays.linearCombination(a1, u1.x, a2, u2.x);
-        this.y = MathArrays.linearCombination(a1, u1.y, a2, u2.y);
-        this.z = MathArrays.linearCombination(a1, u1.z, a2, u2.z);
-    }
-
-    /** Linear constructor
-     * Build a vector from three other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     */
-    public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2,
-                    double a3, Vector3D u3) {
-        this.x = MathArrays.linearCombination(a1, u1.x, a2, u2.x, a3, u3.x);
-        this.y = MathArrays.linearCombination(a1, u1.y, a2, u2.y, a3, u3.y);
-        this.z = MathArrays.linearCombination(a1, u1.z, a2, u2.z, a3, u3.z);
-    }
-
-    /** Linear constructor
-     * Build a vector from four other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     * @param a4 fourth scale factor
-     * @param u4 fourth base (unscaled) vector
-     */
-    public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2,
-                    double a3, Vector3D u3, double a4, Vector3D u4) {
-        this.x = MathArrays.linearCombination(a1, u1.x, a2, u2.x, a3, u3.x, a4, u4.x);
-        this.y = MathArrays.linearCombination(a1, u1.y, a2, u2.y, a3, u3.y, a4, u4.y);
-        this.z = MathArrays.linearCombination(a1, u1.z, a2, u2.z, a3, u3.z, a4, u4.z);
-    }
-
-    /** Get the abscissa of the vector.
-     * @return abscissa of the vector
-     * @see #Vector3D(double, double, double)
-     */
-    public double getX() {
-        return x;
-    }
-
-    /** Get the ordinate of the vector.
-     * @return ordinate of the vector
-     * @see #Vector3D(double, double, double)
-     */
-    public double getY() {
-        return y;
-    }
-
-    /** Get the height of the vector.
-     * @return height of the vector
-     * @see #Vector3D(double, double, double)
-     */
-    public double getZ() {
-        return z;
-    }
-
-    /** Get the vector coordinates as a dimension 3 array.
-     * @return vector coordinates
-     * @see #Vector3D(double[])
-     */
-    public double[] toArray() {
-        return new double[] { x, y, z };
-    }
-
-    /** {@inheritDoc} */
-    public Space getSpace() {
-        return Euclidean3D.getInstance();
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D getZero() {
-        return ZERO;
-    }
-
-    /** {@inheritDoc} */
-    public double getNorm1() {
-        return FastMath.abs(x) + FastMath.abs(y) + FastMath.abs(z);
-    }
-
-    /** {@inheritDoc} */
-    public double getNorm() {
-        // there are no cancellation problems here, so we use the straightforward formula
-        return FastMath.sqrt (x * x + y * y + z * z);
-    }
-
-    /** {@inheritDoc} */
-    public double getNormSq() {
-        // there are no cancellation problems here, so we use the straightforward formula
-        return x * x + y * y + z * z;
-    }
-
-    /** {@inheritDoc} */
-    public double getNormInf() {
-        return FastMath.max(FastMath.max(FastMath.abs(x), FastMath.abs(y)), FastMath.abs(z));
-    }
-
-    /** Get the azimuth of the vector.
-     * @return azimuth (&alpha;) of the vector, between -&pi; and +&pi;
-     * @see #Vector3D(double, double)
-     */
-    public double getAlpha() {
-        return FastMath.atan2(y, x);
-    }
-
-    /** Get the elevation of the vector.
-     * @return elevation (&delta;) of the vector, between -&pi;/2 and +&pi;/2
-     * @see #Vector3D(double, double)
-     */
-    public double getDelta() {
-        return FastMath.asin(z / getNorm());
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D add(final Vector<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        return new Vector3D(x + v3.x, y + v3.y, z + v3.z);
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D add(double factor, final Vector<Euclidean3D> v) {
-        return new Vector3D(1, this, factor, (Vector3D) v);
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D subtract(final Vector<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        return new Vector3D(x - v3.x, y - v3.y, z - v3.z);
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D subtract(final double factor, final Vector<Euclidean3D> v) {
-        return new Vector3D(1, this, -factor, (Vector3D) v);
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D normalize() throws MathArithmeticException {
-        double s = getNorm();
-        if (s == 0) {
-            throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
-        }
-        return scalarMultiply(1 / s);
-    }
-
-    /** Get a vector orthogonal to the instance.
-     * <p>There are an infinite number of normalized vectors orthogonal
-     * to the instance. This method picks up one of them almost
-     * arbitrarily. It is useful when one needs to compute a reference
-     * frame with one of the axes in a predefined direction. The
-     * following example shows how to build a frame having the k axis
-     * aligned with the known vector u :
-     * <pre><code>
-     *   Vector3D k = u.normalize();
-     *   Vector3D i = k.orthogonal();
-     *   Vector3D j = Vector3D.crossProduct(k, i);
-     * </code></pre></p>
-     * @return a new normalized vector orthogonal to the instance
-     * @exception MathArithmeticException if the norm of the instance is null
-     */
-    public Vector3D orthogonal() throws MathArithmeticException {
-
-        double threshold = 0.6 * getNorm();
-        if (threshold == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-
-        if (FastMath.abs(x) <= threshold) {
-            double inverse  = 1 / FastMath.sqrt(y * y + z * z);
-            return new Vector3D(0, inverse * z, -inverse * y);
-        } else if (FastMath.abs(y) <= threshold) {
-            double inverse  = 1 / FastMath.sqrt(x * x + z * z);
-            return new Vector3D(-inverse * z, 0, inverse * x);
-        }
-        double inverse  = 1 / FastMath.sqrt(x * x + y * y);
-        return new Vector3D(inverse * y, -inverse * x, 0);
-
-    }
-
-    /** Compute the angular separation between two vectors.
-     * <p>This method computes the angular separation between two
-     * vectors using the dot product for well separated vectors and the
-     * cross product for almost aligned vectors. This allows to have a
-     * good accuracy in all cases, even for vectors very close to each
-     * other.</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return angular separation between v1 and v2
-     * @exception MathArithmeticException if either vector has a null norm
-     */
-    public static double angle(Vector3D v1, Vector3D v2) throws MathArithmeticException {
-
-        double normProduct = v1.getNorm() * v2.getNorm();
-        if (normProduct == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-
-        double dot = v1.dotProduct(v2);
-        double threshold = normProduct * 0.9999;
-        if ((dot < -threshold) || (dot > threshold)) {
-            // the vectors are almost aligned, compute using the sine
-            Vector3D v3 = crossProduct(v1, v2);
-            if (dot >= 0) {
-                return FastMath.asin(v3.getNorm() / normProduct);
-            }
-            return FastMath.PI - FastMath.asin(v3.getNorm() / normProduct);
-        }
-
-        // the vectors are sufficiently separated to use the cosine
-        return FastMath.acos(dot / normProduct);
-
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D negate() {
-        return new Vector3D(-x, -y, -z);
-    }
-
-    /** {@inheritDoc} */
-    public Vector3D scalarMultiply(double a) {
-        return new Vector3D(a * x, a * y, a * z);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isNaN() {
-        return Double.isNaN(x) || Double.isNaN(y) || Double.isNaN(z);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isInfinite() {
-        return !isNaN() && (Double.isInfinite(x) || Double.isInfinite(y) || Double.isInfinite(z));
-    }
-
-    /**
-     * Test for the equality of two 3D vectors.
-     * <p>
-     * If all coordinates of two 3D vectors are exactly the same, and none are
-     * <code>Double.NaN</code>, the two 3D vectors are considered to be equal.
-     * </p>
-     * <p>
-     * <code>NaN</code> coordinates are considered to affect globally the vector
-     * and be equals to each other - i.e, if either (or all) coordinates of the
-     * 3D vector are equal to <code>Double.NaN</code>, the 3D vector is equal to
-     * {@link #NaN}.
-     * </p>
-     *
-     * @param other Object to test for equality to this
-     * @return true if two 3D vector objects are equal, false if
-     *         object is null, not an instance of Vector3D, or
-     *         not equal to this Vector3D instance
-     *
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof Vector3D) {
-            final Vector3D rhs = (Vector3D)other;
-            if (rhs.isNaN()) {
-                return this.isNaN();
-            }
-
-            return (x == rhs.x) && (y == rhs.y) && (z == rhs.z);
-        }
-        return false;
-    }
-
-    /**
-     * Get a hashCode for the 3D vector.
-     * <p>
-     * All NaN values have the same hash code.</p>
-     *
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN()) {
-            return 642;
-        }
-        return 643 * (164 * MathUtils.hash(x) +  3 * MathUtils.hash(y) +  MathUtils.hash(z));
-    }
-
-    /** {@inheritDoc}
-     * <p>
-     * The implementation uses specific multiplication and addition
-     * algorithms to preserve accuracy and reduce cancellation effects.
-     * It should be very accurate even for nearly orthogonal vectors.
-     * </p>
-     * @see MathArrays#linearCombination(double, double, double, double, double, double)
-     */
-    public double dotProduct(final Vector<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        return MathArrays.linearCombination(x, v3.x, y, v3.y, z, v3.z);
-    }
-
-    /** Compute the cross-product of the instance with another vector.
-     * @param v other vector
-     * @return the cross product this ^ v as a new Vector3D
-     */
-    public Vector3D crossProduct(final Vector<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        return new Vector3D(MathArrays.linearCombination(y, v3.z, -z, v3.y),
-                            MathArrays.linearCombination(z, v3.x, -x, v3.z),
-                            MathArrays.linearCombination(x, v3.y, -y, v3.x));
-    }
-
-    /** {@inheritDoc} */
-    public double distance1(Vector<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        final double dx = FastMath.abs(v3.x - x);
-        final double dy = FastMath.abs(v3.y - y);
-        final double dz = FastMath.abs(v3.z - z);
-        return dx + dy + dz;
-    }
-
-    /** {@inheritDoc} */
-    public double distance(Vector<Euclidean3D> v) {
-        return distance((Point<Euclidean3D>) v);
-    }
-
-    /** {@inheritDoc} */
-    public double distance(Point<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        final double dx = v3.x - x;
-        final double dy = v3.y - y;
-        final double dz = v3.z - z;
-        return FastMath.sqrt(dx * dx + dy * dy + dz * dz);
-    }
-
-    /** {@inheritDoc} */
-    public double distanceInf(Vector<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        final double dx = FastMath.abs(v3.x - x);
-        final double dy = FastMath.abs(v3.y - y);
-        final double dz = FastMath.abs(v3.z - z);
-        return FastMath.max(FastMath.max(dx, dy), dz);
-    }
-
-    /** {@inheritDoc} */
-    public double distanceSq(Vector<Euclidean3D> v) {
-        final Vector3D v3 = (Vector3D) v;
-        final double dx = v3.x - x;
-        final double dy = v3.y - y;
-        final double dz = v3.z - z;
-        return dx * dx + dy * dy + dz * dz;
-    }
-
-    /** Compute the dot-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return the dot product v1.v2
-     */
-    public static double dotProduct(Vector3D v1, Vector3D v2) {
-        return v1.dotProduct(v2);
-    }
-
-    /** Compute the cross-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return the cross product v1 ^ v2 as a new Vector
-     */
-    public static Vector3D crossProduct(final Vector3D v1, final Vector3D v2) {
-        return v1.crossProduct(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>1</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm1()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return the distance between v1 and v2 according to the L<sub>1</sub> norm
-     */
-    public static double distance1(Vector3D v1, Vector3D v2) {
-        return v1.distance1(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return the distance between v1 and v2 according to the L<sub>2</sub> norm
-     */
-    public static double distance(Vector3D v1, Vector3D v2) {
-        return v1.distance(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return the distance between v1 and v2 according to the L<sub>&infin;</sub> norm
-     */
-    public static double distanceInf(Vector3D v1, Vector3D v2) {
-        return v1.distanceInf(v2);
-    }
-
-    /** Compute the square of the distance between two vectors.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @return the square of the distance between v1 and v2
-     */
-    public static double distanceSq(Vector3D v1, Vector3D v2) {
-        return v1.distanceSq(v2);
-    }
-
-    /** Get a string representation of this vector.
-     * @return a string representation of this vector
-     */
-    @Override
-    public String toString() {
-        return Vector3DFormat.getInstance().format(this);
-    }
-
-    /** {@inheritDoc} */
-    public String toString(final NumberFormat format) {
-        return new Vector3DFormat(format).format(this);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java
deleted file mode 100644
index da3f71e..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Vector3DFormat.java
+++ /dev/null
@@ -1,155 +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.geometry.euclidean.threed;
-
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.VectorFormat;
-import org.apache.commons.math3.util.CompositeFormat;
-
-/**
- * Formats a 3D vector in components list format "{x; y; z}".
- * <p>The prefix and suffix "{" and "}" and the separator "; " can be replaced by
- * any user-defined strings. The number format for components can be configured.</p>
- * <p>White space is ignored at parse time, even if it is in the prefix, suffix
- * or separator specifications. So even if the default separator does include a space
- * character that is used at format time, both input string "{1;1;1}" and
- * " { 1 ; 1 ; 1 } " will be parsed without error and the same vector will be
- * returned. In the second case, however, the parse position after parsing will be
- * just after the closing curly brace, i.e. just before the trailing space.</p>
- * <p><b>Note:</b> using "," as a separator may interfere with the grouping separator
- * of the default {@link NumberFormat} for the current locale. Thus it is advised
- * to use a {@link NumberFormat} instance with disabled grouping in such a case.</p>
- *
- */
-public class Vector3DFormat extends VectorFormat<Euclidean3D> {
-
-    /**
-     * Create an instance with default settings.
-     * <p>The instance uses the default prefix, suffix and separator:
-     * "{", "}", and "; " and the default number format for components.</p>
-     */
-    public Vector3DFormat() {
-        super(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR,
-              CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with a custom number format for components.
-     * @param format the custom format for components.
-     */
-    public Vector3DFormat(final NumberFormat format) {
-        super(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, format);
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix and separator.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     * @param separator separator to use instead of the default "; "
-     */
-    public Vector3DFormat(final String prefix, final String suffix,
-                         final String separator) {
-        super(prefix, suffix, separator, CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix, separator and format
-     * for components.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     * @param separator separator to use instead of the default "; "
-     * @param format the custom format for components.
-     */
-    public Vector3DFormat(final String prefix, final String suffix,
-                         final String separator, final NumberFormat format) {
-        super(prefix, suffix, separator, format);
-    }
-
-    /**
-     * Returns the default 3D vector format for the current locale.
-     * @return the default 3D vector format.
-     */
-    public static Vector3DFormat getInstance() {
-        return getInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default 3D vector format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the 3D vector format specific to the given locale.
-     */
-    public static Vector3DFormat getInstance(final Locale locale) {
-        return new Vector3DFormat(CompositeFormat.getDefaultNumberFormat(locale));
-    }
-
-    /**
-     * Formats a {@link Vector3D} object to produce a string.
-     * @param vector the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     */
-    @Override
-    public StringBuffer format(final Vector<Euclidean3D> vector, final StringBuffer toAppendTo,
-                               final FieldPosition pos) {
-        final Vector3D v3 = (Vector3D) vector;
-        return format(toAppendTo, pos, v3.getX(), v3.getY(), v3.getZ());
-    }
-
-    /**
-     * Parses a string to produce a {@link Vector3D} object.
-     * @param source the string to parse
-     * @return the parsed {@link Vector3D} object.
-     * @throws MathParseException if the beginning of the specified string
-     * cannot be parsed.
-     */
-    @Override
-    public Vector3D parse(final String source) throws MathParseException {
-        ParsePosition parsePosition = new ParsePosition(0);
-        Vector3D result = parse(source, parsePosition);
-        if (parsePosition.getIndex() == 0) {
-            throw new MathParseException(source,
-                                         parsePosition.getErrorIndex(),
-                                         Vector3D.class);
-        }
-        return result;
-    }
-
-    /**
-     * Parses a string to produce a {@link Vector3D} object.
-     * @param source the string to parse
-     * @param pos input/ouput parsing parameter.
-     * @return the parsed {@link Vector3D} object.
-     */
-    @Override
-    public Vector3D parse(final String source, final ParsePosition pos) {
-        final double[] coordinates = parseCoordinates(3, source, pos);
-        if (coordinates == null) {
-            return null;
-        }
-        return new Vector3D(coordinates[0], coordinates[1], coordinates[2]);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/package-info.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/package-info.java
deleted file mode 100644
index eaa3c6a..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- *
- * <p>
- * This package provides basic 3D geometry components.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.euclidean.threed;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGenerator.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGenerator.java
deleted file mode 100644
index 332b1b7..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/DiskGenerator.java
+++ /dev/null
@@ -1,108 +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.geometry.euclidean.twod;
-
-import java.util.List;
-
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.enclosing.SupportBallGenerator;
-import org.apache.commons.math3.util.FastMath;
-
-/** Class generating an enclosing ball from its support points.
- * @since 3.3
- */
-public class DiskGenerator implements SupportBallGenerator<Euclidean2D, Vector2D> {
-
-    /** {@inheritDoc} */
-    public EnclosingBall<Euclidean2D, Vector2D> ballOnSupport(final List<Vector2D> support) {
-
-        if (support.size() < 1) {
-            return new EnclosingBall<Euclidean2D, Vector2D>(Vector2D.ZERO, Double.NEGATIVE_INFINITY);
-        } else {
-            final Vector2D vA = support.get(0);
-            if (support.size() < 2) {
-                return new EnclosingBall<Euclidean2D, Vector2D>(vA, 0, vA);
-            } else {
-                final Vector2D vB = support.get(1);
-                if (support.size() < 3) {
-                    return new EnclosingBall<Euclidean2D, Vector2D>(new Vector2D(0.5, vA, 0.5, vB),
-                                                                    0.5 * vA.distance(vB),
-                                                                    vA, vB);
-                } else {
-                    final Vector2D vC = support.get(2);
-                    // a disk is 2D can be defined as:
-                    // (1)   (x - x_0)^2 + (y - y_0)^2 = r^2
-                    // which can be written:
-                    // (2)   (x^2 + y^2) - 2 x_0 x - 2 y_0 y + (x_0^2 + y_0^2 - r^2) = 0
-                    // or simply:
-                    // (3)   (x^2 + y^2) + a x + b y + c = 0
-                    // with disk center coordinates -a/2, -b/2
-                    // If the disk exists, a, b and c are a non-zero solution to
-                    // [ (x^2  + y^2 )   x    y   1 ]   [ 1 ]   [ 0 ]
-                    // [ (xA^2 + yA^2)   xA   yA  1 ]   [ a ]   [ 0 ]
-                    // [ (xB^2 + yB^2)   xB   yB  1 ] * [ b ] = [ 0 ]
-                    // [ (xC^2 + yC^2)   xC   yC  1 ]   [ c ]   [ 0 ]
-                    // So the determinant of the matrix is zero. Computing this determinant
-                    // by expanding it using the minors m_ij of first row leads to
-                    // (4)   m_11 (x^2 + y^2) - m_12 x + m_13 y - m_14 = 0
-                    // So by identifying equations (2) and (4) we get the coordinates
-                    // of center as:
-                    //      x_0 = +m_12 / (2 m_11)
-                    //      y_0 = -m_13 / (2 m_11)
-                    // Note that the minors m_11, m_12 and m_13 all have the last column
-                    // filled with 1.0, hence simplifying the computation
-                    final BigFraction[] c2 = new BigFraction[] {
-                        new BigFraction(vA.getX()), new BigFraction(vB.getX()), new BigFraction(vC.getX())
-                    };
-                    final BigFraction[] c3 = new BigFraction[] {
-                        new BigFraction(vA.getY()), new BigFraction(vB.getY()), new BigFraction(vC.getY())
-                    };
-                    final BigFraction[] c1 = new BigFraction[] {
-                        c2[0].multiply(c2[0]).add(c3[0].multiply(c3[0])),
-                        c2[1].multiply(c2[1]).add(c3[1].multiply(c3[1])),
-                        c2[2].multiply(c2[2]).add(c3[2].multiply(c3[2]))
-                    };
-                    final BigFraction twoM11  = minor(c2, c3).multiply(2);
-                    final BigFraction m12     = minor(c1, c3);
-                    final BigFraction m13     = minor(c1, c2);
-                    final BigFraction centerX = m12.divide(twoM11);
-                    final BigFraction centerY = m13.divide(twoM11).negate();
-                    final BigFraction dx      = c2[0].subtract(centerX);
-                    final BigFraction dy      = c3[0].subtract(centerY);
-                    final BigFraction r2      = dx.multiply(dx).add(dy.multiply(dy));
-                    return new EnclosingBall<Euclidean2D, Vector2D>(new Vector2D(centerX.doubleValue(),
-                                                                                 centerY.doubleValue()),
-                                                                    FastMath.sqrt(r2.doubleValue()),
-                                                                    vA, vB, vC);
-                }
-            }
-        }
-    }
-
-    /** Compute a dimension 3 minor, when 3<sup>d</sup> column is known to be filled with 1.0.
-     * @param c1 first column
-     * @param c2 second column
-     * @return value of the minor computed has an exact fraction
-     */
-    private BigFraction minor(final BigFraction[] c1, final BigFraction[] c2) {
-        return      c2[0].multiply(c1[2].subtract(c1[1])).
-                add(c2[1].multiply(c1[0].subtract(c1[2]))).
-                add(c2[2].multiply(c1[1].subtract(c1[0])));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Euclidean2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Euclidean2D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Euclidean2D.java
deleted file mode 100644
index af7630d..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Euclidean2D.java
+++ /dev/null
@@ -1,74 +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.geometry.euclidean.twod;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-
-/**
- * This class implements a two-dimensional space.
- * @since 3.0
- */
-public class Euclidean2D implements Serializable, Space {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 4793432849757649566L;
-
-    /** Private constructor for the singleton.
-     */
-    private Euclidean2D() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static Euclidean2D getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public int getDimension() {
-        return 2;
-    }
-
-    /** {@inheritDoc} */
-    public Euclidean1D getSubSpace() {
-        return Euclidean1D.getInstance();
-    }
-
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final Euclidean2D INSTANCE = new Euclidean2D();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Line.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Line.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Line.java
deleted file mode 100644
index d6fd487..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/Line.java
+++ /dev/null
@@ -1,540 +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.geometry.euclidean.twod;
-
-import java.awt.geom.AffineTransform;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.OrientedPoint;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/** This class represents an oriented line in the 2D plane.
-
- * <p>An oriented line can be defined either by prolongating a line
- * segment between two points past these points, or by one point and
- * an angular direction (in trigonometric orientation).</p>
-
- * <p>Since it is oriented the two half planes at its two sides are
- * unambiguously identified as a left half plane and a right half
- * plane. This can be used to identify the interior and the exterior
- * in a simple way by local properties only when part of a line is
- * used to define part of a polygon boundary.</p>
-
- * <p>A line can also be used to completely define a reference frame
- * in the plane. It is sufficient to select one specific point in the
- * line (the orthogonal projection of the original reference frame on
- * the line) and to use the unit vector in the line direction and the
- * orthogonal vector oriented from left half plane to right half
- * plane. We define two coordinates by the process, the
- * <em>abscissa</em> along the line, and the <em>offset</em> across
- * the line. All points of the plane are uniquely identified by these
- * two coordinates. The line is the set of points at zero offset, the
- * left half plane is the set of points with negative offsets and the
- * right half plane is the set of points with positive offsets.</p>
-
- * @since 3.0
- */
-public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euclidean1D> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Angle with respect to the abscissa axis. */
-    private double angle;
-
-    /** Cosine of the line angle. */
-    private double cos;
-
-    /** Sine of the line angle. */
-    private double sin;
-
-    /** Offset of the frame origin. */
-    private double originOffset;
-
-    /** Tolerance below which points are considered identical. */
-    private final double tolerance;
-
-    /** Reverse line. */
-    private Line reverse;
-
-    /** Build a line from two points.
-     * <p>The line is oriented from p1 to p2</p>
-     * @param p1 first point
-     * @param p2 second point
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public Line(final Vector2D p1, final Vector2D p2, final double tolerance) {
-        reset(p1, p2);
-        this.tolerance = tolerance;
-    }
-
-    /** Build a line from a point and an angle.
-     * @param p point belonging to the line
-     * @param angle angle of the line with respect to abscissa axis
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public Line(final Vector2D p, final double angle, final double tolerance) {
-        reset(p, angle);
-        this.tolerance = tolerance;
-    }
-
-    /** Build a line from its internal characteristics.
-     * @param angle angle of the line with respect to abscissa axis
-     * @param cos cosine of the angle
-     * @param sin sine of the angle
-     * @param originOffset offset of the origin
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    private Line(final double angle, final double cos, final double sin,
-                 final double originOffset, final double tolerance) {
-        this.angle        = angle;
-        this.cos          = cos;
-        this.sin          = sin;
-        this.originOffset = originOffset;
-        this.tolerance    = tolerance;
-        this.reverse      = null;
-    }
-
-    /** Build a line from two points.
-     * <p>The line is oriented from p1 to p2</p>
-     * @param p1 first point
-     * @param p2 second point
-     * @deprecated as of 3.3, replaced with {@link #Line(Vector2D, Vector2D, double)}
-     */
-    @Deprecated
-    public Line(final Vector2D p1, final Vector2D p2) {
-        this(p1, p2, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a line from a point and an angle.
-     * @param p point belonging to the line
-     * @param angle angle of the line with respect to abscissa axis
-     * @deprecated as of 3.3, replaced with {@link #Line(Vector2D, double, double)}
-     */
-    @Deprecated
-    public Line(final Vector2D p, final double angle) {
-        this(p, angle, DEFAULT_TOLERANCE);
-    }
-
-    /** Copy constructor.
-     * <p>The created instance is completely independent from the
-     * original instance, it is a deep copy.</p>
-     * @param line line to copy
-     */
-    public Line(final Line line) {
-        angle        = MathUtils.normalizeAngle(line.angle, FastMath.PI);
-        cos          = line.cos;
-        sin          = line.sin;
-        originOffset = line.originOffset;
-        tolerance    = line.tolerance;
-        reverse      = null;
-    }
-
-    /** {@inheritDoc} */
-    public Line copySelf() {
-        return new Line(this);
-    }
-
-    /** Reset the instance as if built from two points.
-     * <p>The line is oriented from p1 to p2</p>
-     * @param p1 first point
-     * @param p2 second point
-     */
-    public void reset(final Vector2D p1, final Vector2D p2) {
-        unlinkReverse();
-        final double dx = p2.getX() - p1.getX();
-        final double dy = p2.getY() - p1.getY();
-        final double d = FastMath.hypot(dx, dy);
-        if (d == 0.0) {
-            angle        = 0.0;
-            cos          = 1.0;
-            sin          = 0.0;
-            originOffset = p1.getY();
-        } else {
-            angle        = FastMath.PI + FastMath.atan2(-dy, -dx);
-            cos          = dx / d;
-            sin          = dy / d;
-            originOffset = MathArrays.linearCombination(p2.getX(), p1.getY(), -p1.getX(), p2.getY()) / d;
-        }
-    }
-
-    /** Reset the instance as if built from a line and an angle.
-     * @param p point belonging to the line
-     * @param alpha angle of the line with respect to abscissa axis
-     */
-    public void reset(final Vector2D p, final double alpha) {
-        unlinkReverse();
-        this.angle   = MathUtils.normalizeAngle(alpha, FastMath.PI);
-        cos          = FastMath.cos(this.angle);
-        sin          = FastMath.sin(this.angle);
-        originOffset = MathArrays.linearCombination(cos, p.getY(), -sin, p.getX());
-    }
-
-    /** Revert the instance.
-     */
-    public void revertSelf() {
-        unlinkReverse();
-        if (angle < FastMath.PI) {
-            angle += FastMath.PI;
-        } else {
-            angle -= FastMath.PI;
-        }
-        cos          = -cos;
-        sin          = -sin;
-        originOffset = -originOffset;
-    }
-
-    /** Unset the link between an instance and its reverse.
-     */
-    private void unlinkReverse() {
-        if (reverse != null) {
-            reverse.reverse = null;
-        }
-        reverse = null;
-    }
-
-    /** Get the reverse of the instance.
-     * <p>Get a line with reversed orientation with respect to the
-     * instance.</p>
-     * <p>
-     * As long as neither the instance nor its reverse are modified
-     * (i.e. as long as none of the {@link #reset(Vector2D, Vector2D)},
-     * {@link #reset(Vector2D, double)}, {@link #revertSelf()},
-     * {@link #setAngle(double)} or {@link #setOriginOffset(double)}
-     * methods are called), then the line and its reverse remain linked
-     * together so that {@code line.getReverse().getReverse() == line}.
-     * When one of the line is modified, the link is deleted as both
-     * instance becomes independent.
-     * </p>
-     * @return a new line, with orientation opposite to the instance orientation
-     */
-    public Line getReverse() {
-        if (reverse == null) {
-            reverse = new Line((angle < FastMath.PI) ? (angle + FastMath.PI) : (angle - FastMath.PI),
-                               -cos, -sin, -originOffset, tolerance);
-            reverse.reverse = this;
-        }
-        return reverse;
-    }
-
-    /** Transform a space point into a sub-space point.
-     * @param vector n-dimension point of the space
-     * @return (n-1)-dimension point of the sub-space corresponding to
-     * the specified space point
-     */
-    public Vector1D toSubSpace(Vector<Euclidean2D> vector) {
-        return toSubSpace((Point<Euclidean2D>) vector);
-    }
-
-    /** Transform a sub-space point into a space point.
-     * @param vector (n-1)-dimension point of the sub-space
-     * @return n-dimension point of the space corresponding to the
-     * specified sub-space point
-     */
-    public Vector2D toSpace(Vector<Euclidean1D> vector) {
-        return toSpace((Point<Euclidean1D>) vector);
-    }
-
-    /** {@inheritDoc} */
-    public Vector1D toSubSpace(final Point<Euclidean2D> point) {
-        Vector2D p2 = (Vector2D) point;
-        return new Vector1D(MathArrays.linearCombination(cos, p2.getX(), sin, p2.getY()));
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D toSpace(final Point<Euclidean1D> point) {
-        final double abscissa = ((Vector1D) point).getX();
-        return new Vector2D(MathArrays.linearCombination(abscissa, cos, -originOffset, sin),
-                            MathArrays.linearCombination(abscissa, sin,  originOffset, cos));
-    }
-
-    /** Get the intersection point of the instance and another line.
-     * @param other other line
-     * @return intersection point of the instance and the other line
-     * or null if there are no intersection points
-     */
-    public Vector2D intersection(final Line other) {
-        final double d = MathArrays.linearCombination(sin, other.cos, -other.sin, cos);
-        if (FastMath.abs(d) < tolerance) {
-            return null;
-        }
-        return new Vector2D(MathArrays.linearCombination(cos, other.originOffset, -other.cos, originOffset) / d,
-                            MathArrays.linearCombination(sin, other.originOffset, -other.sin, originOffset) / d);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    public Point<Euclidean2D> project(Point<Euclidean2D> point) {
-        return toSpace(toSubSpace(point));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /** {@inheritDoc} */
-    public SubLine wholeHyperplane() {
-        return new SubLine(this, new IntervalsSet(tolerance));
-    }
-
-    /** Build a region covering the whole space.
-     * @return a region containing the instance (really a {@link
-     * PolygonsSet PolygonsSet} instance)
-     */
-    public PolygonsSet wholeSpace() {
-        return new PolygonsSet(tolerance);
-    }
-
-    /** Get the offset (oriented distance) of a parallel line.
-     * <p>This method should be called only for parallel lines otherwise
-     * the result is not meaningful.</p>
-     * <p>The offset is 0 if both lines are the same, it is
-     * positive if the line is on the right side of the instance and
-     * negative if it is on the left side, according to its natural
-     * orientation.</p>
-     * @param line line to check
-     * @return offset of the line
-     */
-    public double getOffset(final Line line) {
-        return originOffset +
-               (MathArrays.linearCombination(cos, line.cos, sin, line.sin) > 0 ? -line.originOffset : line.originOffset);
-    }
-
-    /** Get the offset (oriented distance) of a vector.
-     * @param vector vector to check
-     * @return offset of the vector
-     */
-    public double getOffset(Vector<Euclidean2D> vector) {
-        return getOffset((Point<Euclidean2D>) vector);
-    }
-
-    /** {@inheritDoc} */
-    public double getOffset(final Point<Euclidean2D> point) {
-        Vector2D p2 = (Vector2D) point;
-        return MathArrays.linearCombination(sin, p2.getX(), -cos, p2.getY(), 1.0, originOffset);
-    }
-
-    /** {@inheritDoc} */
-    public boolean sameOrientationAs(final Hyperplane<Euclidean2D> other) {
-        final Line otherL = (Line) other;
-        return MathArrays.linearCombination(sin, otherL.sin, cos, otherL.cos) >= 0.0;
-    }
-
-    /** Get one point from the plane.
-     * @param abscissa desired abscissa for the point
-     * @param offset desired offset for the point
-     * @return one point in the plane, with given abscissa and offset
-     * relative to the line
-     */
-    public Vector2D getPointAt(final Vector1D abscissa, final double offset) {
-        final double x       = abscissa.getX();
-        final double dOffset = offset - originOffset;
-        return new Vector2D(MathArrays.linearCombination(x, cos,  dOffset, sin),
-                            MathArrays.linearCombination(x, sin, -dOffset, cos));
-    }
-
-    /** Check if the line contains a point.
-     * @param p point to check
-     * @return true if p belongs to the line
-     */
-    public boolean contains(final Vector2D p) {
-        return FastMath.abs(getOffset(p)) < tolerance;
-    }
-
-    /** Compute the distance between the instance and a point.
-     * <p>This is a shortcut for invoking FastMath.abs(getOffset(p)),
-     * and provides consistency with what is in the
-     * org.apache.commons.math3.geometry.euclidean.threed.Line class.</p>
-     *
-     * @param p to check
-     * @return distance between the instance and the point
-     * @since 3.1
-     */
-    public double distance(final Vector2D p) {
-        return FastMath.abs(getOffset(p));
-    }
-
-    /** Check the instance is parallel to another line.
-     * @param line other line to check
-     * @return true if the instance is parallel to the other line
-     * (they can have either the same or opposite orientations)
-     */
-    public boolean isParallelTo(final Line line) {
-        return FastMath.abs(MathArrays.linearCombination(sin, line.cos, -cos, line.sin)) < tolerance;
-    }
-
-    /** Translate the line to force it passing by a point.
-     * @param p point by which the line should pass
-     */
-    public void translateToPoint(final Vector2D p) {
-        originOffset = MathArrays.linearCombination(cos, p.getY(), -sin, p.getX());
-    }
-
-    /** Get the angle of the line.
-     * @return the angle of the line with respect to the abscissa axis
-     */
-    public double getAngle() {
-        return MathUtils.normalizeAngle(angle, FastMath.PI);
-    }
-
-    /** Set the angle of the line.
-     * @param angle new angle of the line with respect to the abscissa axis
-     */
-    public void setAngle(final double angle) {
-        unlinkReverse();
-        this.angle = MathUtils.normalizeAngle(angle, FastMath.PI);
-        cos        = FastMath.cos(this.angle);
-        sin        = FastMath.sin(this.angle);
-    }
-
-    /** Get the offset of the origin.
-     * @return the offset of the origin
-     */
-    public double getOriginOffset() {
-        return originOffset;
-    }
-
-    /** Set the offset of the origin.
-     * @param offset offset of the origin
-     */
-    public void setOriginOffset(final double offset) {
-        unlinkReverse();
-        originOffset = offset;
-    }
-
-    /** Get a {@link org.apache.commons.math3.geometry.partitioning.Transform
-     * Transform} embedding an affine transform.
-     * @param transform affine transform to embed (must be inversible
-     * otherwise the {@link
-     * org.apache.commons.math3.geometry.partitioning.Transform#apply(Hyperplane)
-     * apply(Hyperplane)} method would work only for some lines, and
-     * fail for other ones)
-     * @return a new transform that can be applied to either {@link
-     * Vector2D Vector2D}, {@link Line Line} or {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
-     * SubHyperplane} instances
-     * @exception MathIllegalArgumentException if the transform is non invertible
-     */
-    public static Transform<Euclidean2D, Euclidean1D> getTransform(final AffineTransform transform)
-        throws MathIllegalArgumentException {
-        return new LineTransform(transform);
-    }
-
-    /** Class embedding an affine transform.
-     * <p>This class is used in order to apply an affine transform to a
-     * line. Using a specific object allow to perform some computations
-     * on the transform only once even if the same transform is to be
-     * applied to a large number of lines (for example to a large
-     * polygon)./<p>
-     */
-    private static class LineTransform implements Transform<Euclidean2D, Euclidean1D> {
-
-        // CHECKSTYLE: stop JavadocVariable check
-        private double cXX;
-        private double cXY;
-        private double cX1;
-        private double cYX;
-        private double cYY;
-        private double cY1;
-
-        private double c1Y;
-        private double c1X;
-        private double c11;
-        // CHECKSTYLE: resume JavadocVariable check
-
-        /** Build an affine line transform from a n {@code AffineTransform}.
-         * @param transform transform to use (must be invertible otherwise
-         * the {@link LineTransform#apply(Hyperplane)} method would work
-         * only for some lines, and fail for other ones)
-         * @exception MathIllegalArgumentException if the transform is non invertible
-         */
-        public LineTransform(final AffineTransform transform) throws MathIllegalArgumentException {
-
-            final double[] m = new double[6];
-            transform.getMatrix(m);
-            cXX = m[0];
-            cXY = m[2];
-            cX1 = m[4];
-            cYX = m[1];
-            cYY = m[3];
-            cY1 = m[5];
-
-            c1Y = MathArrays.linearCombination(cXY, cY1, -cYY, cX1);
-            c1X = MathArrays.linearCombination(cXX, cY1, -cYX, cX1);
-            c11 = MathArrays.linearCombination(cXX, cYY, -cYX, cXY);
-
-            if (FastMath.abs(c11) < 1.0e-20) {
-                throw new MathIllegalArgumentException(LocalizedFormats.NON_INVERTIBLE_TRANSFORM);
-            }
-
-        }
-
-        /** {@inheritDoc} */
-        public Vector2D apply(final Point<Euclidean2D> point) {
-            final Vector2D p2D = (Vector2D) point;
-            final double  x   = p2D.getX();
-            final double  y   = p2D.getY();
-            return new Vector2D(MathArrays.linearCombination(cXX, x, cXY, y, cX1, 1),
-                                MathArrays.linearCombination(cYX, x, cYY, y, cY1, 1));
-        }
-
-        /** {@inheritDoc} */
-        public Line apply(final Hyperplane<Euclidean2D> hyperplane) {
-            final Line   line    = (Line) hyperplane;
-            final double rOffset = MathArrays.linearCombination(c1X, line.cos, c1Y, line.sin, c11, line.originOffset);
-            final double rCos    = MathArrays.linearCombination(cXX, line.cos, cXY, line.sin);
-            final double rSin    = MathArrays.linearCombination(cYX, line.cos, cYY, line.sin);
-            final double inv     = 1.0 / FastMath.sqrt(rSin * rSin + rCos * rCos);
-            return new Line(FastMath.PI + FastMath.atan2(-rSin, -rCos),
-                            inv * rCos, inv * rSin,
-                            inv * rOffset, line.tolerance);
-        }
-
-        /** {@inheritDoc} */
-        public SubHyperplane<Euclidean1D> apply(final SubHyperplane<Euclidean1D> sub,
-                                                final Hyperplane<Euclidean2D> original,
-                                                final Hyperplane<Euclidean2D> transformed) {
-            final OrientedPoint op     = (OrientedPoint) sub.getHyperplane();
-            final Line originalLine    = (Line) original;
-            final Line transformedLine = (Line) transformed;
-            final Vector1D newLoc =
-                transformedLine.toSubSpace(apply(originalLine.toSpace(op.getLocation())));
-            return new OrientedPoint(newLoc, op.isDirect(), originalLine.tolerance).wholeHyperplane();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/NestedLoops.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/NestedLoops.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/NestedLoops.java
deleted file mode 100644
index a58caf1..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/NestedLoops.java
+++ /dev/null
@@ -1,200 +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.geometry.euclidean.twod;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-
-/** This class represent a tree of nested 2D boundary loops.
-
- * <p>This class is used for piecewise polygons construction.
- * Polygons are built using the outline edges as
- * representative of boundaries, the orientation of these lines are
- * meaningful. However, we want to allow the user to specify its
- * outline loops without having to take care of this orientation. This
- * class is devoted to correct mis-oriented loops.<p>
-
- * <p>Orientation is computed assuming the piecewise polygon is finite,
- * i.e. the outermost loops have their exterior side facing points at
- * infinity, and hence are oriented counter-clockwise. The orientation of
- * internal loops is computed as the reverse of the orientation of
- * their immediate surrounding loop.</p>
-
- * @since 3.0
- */
-class NestedLoops {
-
-    /** Boundary loop. */
-    private Vector2D[] loop;
-
-    /** Surrounded loops. */
-    private ArrayList<NestedLoops> surrounded;
-
-    /** Polygon enclosing a finite region. */
-    private Region<Euclidean2D> polygon;
-
-    /** Indicator for original loop orientation. */
-    private boolean originalIsClockwise;
-
-    /** Tolerance below which points are considered identical. */
-    private final double tolerance;
-
-    /** Simple Constructor.
-     * <p>Build an empty tree of nested loops. This instance will become
-     * the root node of a complete tree, it is not associated with any
-     * loop by itself, the outermost loops are in the root tree child
-     * nodes.</p>
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public NestedLoops(final double tolerance) {
-        this.surrounded = new ArrayList<NestedLoops>();
-        this.tolerance  = tolerance;
-    }
-
-    /** Constructor.
-     * <p>Build a tree node with neither parent nor children</p>
-     * @param loop boundary loop (will be reversed in place if needed)
-     * @param tolerance tolerance below which points are considered identical
-     * @exception MathIllegalArgumentException if an outline has an open boundary loop
-     * @since 3.3
-     */
-    private NestedLoops(final Vector2D[] loop, final double tolerance)
-        throws MathIllegalArgumentException {
-
-        if (loop[0] == null) {
-            throw new MathIllegalArgumentException(LocalizedFormats.OUTLINE_BOUNDARY_LOOP_OPEN);
-        }
-
-        this.loop       = loop;
-        this.surrounded = new ArrayList<NestedLoops>();
-        this.tolerance  = tolerance;
-
-        // build the polygon defined by the loop
-        final ArrayList<SubHyperplane<Euclidean2D>> edges = new ArrayList<SubHyperplane<Euclidean2D>>();
-        Vector2D current = loop[loop.length - 1];
-        for (int i = 0; i < loop.length; ++i) {
-            final Vector2D previous = current;
-            current = loop[i];
-            final Line   line   = new Line(previous, current, tolerance);
-            final IntervalsSet region =
-                new IntervalsSet(line.toSubSpace((Point<Euclidean2D>) previous).getX(),
-                                 line.toSubSpace((Point<Euclidean2D>) current).getX(),
-                                 tolerance);
-            edges.add(new SubLine(line, region));
-        }
-        polygon = new PolygonsSet(edges, tolerance);
-
-        // ensure the polygon encloses a finite region of the plane
-        if (Double.isInfinite(polygon.getSize())) {
-            polygon = new RegionFactory<Euclidean2D>().getComplement(polygon);
-            originalIsClockwise = false;
-        } else {
-            originalIsClockwise = true;
-        }
-
-    }
-
-    /** Add a loop in a tree.
-     * @param bLoop boundary loop (will be reversed in place if needed)
-     * @exception MathIllegalArgumentException if an outline has crossing
-     * boundary loops or open boundary loops
-     */
-    public void add(final Vector2D[] bLoop) throws MathIllegalArgumentException {
-        add(new NestedLoops(bLoop, tolerance));
-    }
-
-    /** Add a loop in a tree.
-     * @param node boundary loop (will be reversed in place if needed)
-     * @exception MathIllegalArgumentException if an outline has boundary
-     * loops that cross each other
-     */
-    private void add(final NestedLoops node) throws MathIllegalArgumentException {
-
-        // check if we can go deeper in the tree
-        for (final NestedLoops child : surrounded) {
-            if (child.polygon.contains(node.polygon)) {
-                child.add(node);
-                return;
-            }
-        }
-
-        // check if we can absorb some of the instance children
-        for (final Iterator<NestedLoops> iterator = surrounded.iterator(); iterator.hasNext();) {
-            final NestedLoops child = iterator.next();
-            if (node.polygon.contains(child.polygon)) {
-                node.surrounded.add(child);
-                iterator.remove();
-            }
-        }
-
-        // we should be separate from the remaining children
-        RegionFactory<Euclidean2D> factory = new RegionFactory<Euclidean2D>();
-        for (final NestedLoops child : surrounded) {
-            if (!factory.intersection(node.polygon, child.polygon).isEmpty()) {
-                throw new MathIllegalArgumentException(LocalizedFormats.CROSSING_BOUNDARY_LOOPS);
-            }
-        }
-
-        surrounded.add(node);
-
-    }
-
-    /** Correct the orientation of the loops contained in the tree.
-     * <p>This is this method that really inverts the loops that where
-     * provided through the {@link #add(Vector2D[]) add} method if
-     * they are mis-oriented</p>
-     */
-    public void correctOrientation() {
-        for (NestedLoops child : surrounded) {
-            child.setClockWise(true);
-        }
-    }
-
-    /** Set the loop orientation.
-     * @param clockwise if true, the loop should be set to clockwise
-     * orientation
-     */
-    private void setClockWise(final boolean clockwise) {
-
-        if (originalIsClockwise ^ clockwise) {
-            // we need to inverse the original loop
-            int min = -1;
-            int max = loop.length;
-            while (++min < --max) {
-                final Vector2D tmp = loop[min];
-                loop[min] = loop[max];
-                loop[max] = tmp;
-            }
-        }
-
-        // go deeper in the tree
-        for (final NestedLoops child : surrounded) {
-            child.setClockWise(!clockwise);
-        }
-
-    }
-
-}


[36/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/dfp/Dfp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/dfp/Dfp.java b/src/main/java/org/apache/commons/math3/dfp/Dfp.java
deleted file mode 100644
index 19d79a8..0000000
--- a/src/main/java/org/apache/commons/math3/dfp/Dfp.java
+++ /dev/null
@@ -1,2882 +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.dfp;
-
-import java.util.Arrays;
-
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- *  Decimal floating point library for Java
- *
- *  <p>Another floating point class.  This one is built using radix 10000
- *  which is 10<sup>4</sup>, so its almost decimal.</p>
- *
- *  <p>The design goals here are:
- *  <ol>
- *    <li>Decimal math, or close to it</li>
- *    <li>Settable precision (but no mix between numbers using different settings)</li>
- *    <li>Portability.  Code should be kept as portable as possible.</li>
- *    <li>Performance</li>
- *    <li>Accuracy  - Results should always be +/- 1 ULP for basic
- *         algebraic operation</li>
- *    <li>Comply with IEEE 854-1987 as much as possible.
- *         (See IEEE 854-1987 notes below)</li>
- *  </ol></p>
- *
- *  <p>Trade offs:
- *  <ol>
- *    <li>Memory foot print.  I'm using more memory than necessary to
- *         represent numbers to get better performance.</li>
- *    <li>Digits are bigger, so rounding is a greater loss.  So, if you
- *         really need 12 decimal digits, better use 4 base 10000 digits
- *         there can be one partially filled.</li>
- *  </ol></p>
- *
- *  <p>Numbers are represented  in the following form:
- *  <pre>
- *  n  =  sign &times; mant &times; (radix)<sup>exp</sup>;</p>
- *  </pre>
- *  where sign is &plusmn;1, mantissa represents a fractional number between
- *  zero and one.  mant[0] is the least significant digit.
- *  exp is in the range of -32767 to 32768</p>
- *
- *  <p>IEEE 854-1987  Notes and differences</p>
- *
- *  <p>IEEE 854 requires the radix to be either 2 or 10.  The radix here is
- *  10000, so that requirement is not met, but  it is possible that a
- *  subclassed can be made to make it behave as a radix 10
- *  number.  It is my opinion that if it looks and behaves as a radix
- *  10 number then it is one and that requirement would be met.</p>
- *
- *  <p>The radix of 10000 was chosen because it should be faster to operate
- *  on 4 decimal digits at once instead of one at a time.  Radix 10 behavior
- *  can be realized by adding an additional rounding step to ensure that
- *  the number of decimal digits represented is constant.</p>
- *
- *  <p>The IEEE standard specifically leaves out internal data encoding,
- *  so it is reasonable to conclude that such a subclass of this radix
- *  10000 system is merely an encoding of a radix 10 system.</p>
- *
- *  <p>IEEE 854 also specifies the existence of "sub-normal" numbers.  This
- *  class does not contain any such entities.  The most significant radix
- *  10000 digit is always non-zero.  Instead, we support "gradual underflow"
- *  by raising the underflow flag for numbers less with exponent less than
- *  expMin, but don't flush to zero until the exponent reaches MIN_EXP-digits.
- *  Thus the smallest number we can represent would be:
- *  1E(-(MIN_EXP-digits-1)*4),  eg, for digits=5, MIN_EXP=-32767, that would
- *  be 1e-131092.</p>
- *
- *  <p>IEEE 854 defines that the implied radix point lies just to the right
- *  of the most significant digit and to the left of the remaining digits.
- *  This implementation puts the implied radix point to the left of all
- *  digits including the most significant one.  The most significant digit
- *  here is the one just to the right of the radix point.  This is a fine
- *  detail and is really only a matter of definition.  Any side effects of
- *  this can be rendered invisible by a subclass.</p>
- * @see DfpField
- * @since 2.2
- */
-public class Dfp implements RealFieldElement<Dfp> {
-
-    /** The radix, or base of this system.  Set to 10000 */
-    public static final int RADIX = 10000;
-
-    /** The minimum exponent before underflow is signaled.  Flush to zero
-     *  occurs at minExp-DIGITS */
-    public static final int MIN_EXP = -32767;
-
-    /** The maximum exponent before overflow is signaled and results flushed
-     *  to infinity */
-    public static final int MAX_EXP =  32768;
-
-    /** The amount under/overflows are scaled by before going to trap handler */
-    public static final int ERR_SCALE = 32760;
-
-    /** Indicator value for normal finite numbers. */
-    public static final byte FINITE = 0;
-
-    /** Indicator value for Infinity. */
-    public static final byte INFINITE = 1;
-
-    /** Indicator value for signaling NaN. */
-    public static final byte SNAN = 2;
-
-    /** Indicator value for quiet NaN. */
-    public static final byte QNAN = 3;
-
-    /** String for NaN representation. */
-    private static final String NAN_STRING = "NaN";
-
-    /** String for positive infinity representation. */
-    private static final String POS_INFINITY_STRING = "Infinity";
-
-    /** String for negative infinity representation. */
-    private static final String NEG_INFINITY_STRING = "-Infinity";
-
-    /** Name for traps triggered by addition. */
-    private static final String ADD_TRAP = "add";
-
-    /** Name for traps triggered by multiplication. */
-    private static final String MULTIPLY_TRAP = "multiply";
-
-    /** Name for traps triggered by division. */
-    private static final String DIVIDE_TRAP = "divide";
-
-    /** Name for traps triggered by square root. */
-    private static final String SQRT_TRAP = "sqrt";
-
-    /** Name for traps triggered by alignment. */
-    private static final String ALIGN_TRAP = "align";
-
-    /** Name for traps triggered by truncation. */
-    private static final String TRUNC_TRAP = "trunc";
-
-    /** Name for traps triggered by nextAfter. */
-    private static final String NEXT_AFTER_TRAP = "nextAfter";
-
-    /** Name for traps triggered by lessThan. */
-    private static final String LESS_THAN_TRAP = "lessThan";
-
-    /** Name for traps triggered by greaterThan. */
-    private static final String GREATER_THAN_TRAP = "greaterThan";
-
-    /** Name for traps triggered by newInstance. */
-    private static final String NEW_INSTANCE_TRAP = "newInstance";
-
-    /** Mantissa. */
-    protected int[] mant;
-
-    /** Sign bit: 1 for positive, -1 for negative. */
-    protected byte sign;
-
-    /** Exponent. */
-    protected int exp;
-
-    /** Indicator for non-finite / non-number values. */
-    protected byte nans;
-
-    /** Factory building similar Dfp's. */
-    private final DfpField field;
-
-    /** Makes an instance with a value of zero.
-     * @param field field to which this instance belongs
-     */
-    protected Dfp(final DfpField field) {
-        mant = new int[field.getRadixDigits()];
-        sign = 1;
-        exp = 0;
-        nans = FINITE;
-        this.field = field;
-    }
-
-    /** Create an instance from a byte value.
-     * @param field field to which this instance belongs
-     * @param x value to convert to an instance
-     */
-    protected Dfp(final DfpField field, byte x) {
-        this(field, (long) x);
-    }
-
-    /** Create an instance from an int value.
-     * @param field field to which this instance belongs
-     * @param x value to convert to an instance
-     */
-    protected Dfp(final DfpField field, int x) {
-        this(field, (long) x);
-    }
-
-    /** Create an instance from a long value.
-     * @param field field to which this instance belongs
-     * @param x value to convert to an instance
-     */
-    protected Dfp(final DfpField field, long x) {
-
-        // initialize as if 0
-        mant = new int[field.getRadixDigits()];
-        nans = FINITE;
-        this.field = field;
-
-        boolean isLongMin = false;
-        if (x == Long.MIN_VALUE) {
-            // special case for Long.MIN_VALUE (-9223372036854775808)
-            // we must shift it before taking its absolute value
-            isLongMin = true;
-            ++x;
-        }
-
-        // set the sign
-        if (x < 0) {
-            sign = -1;
-            x = -x;
-        } else {
-            sign = 1;
-        }
-
-        exp = 0;
-        while (x != 0) {
-            System.arraycopy(mant, mant.length - exp, mant, mant.length - 1 - exp, exp);
-            mant[mant.length - 1] = (int) (x % RADIX);
-            x /= RADIX;
-            exp++;
-        }
-
-        if (isLongMin) {
-            // remove the shift added for Long.MIN_VALUE
-            // we know in this case that fixing the last digit is sufficient
-            for (int i = 0; i < mant.length - 1; i++) {
-                if (mant[i] != 0) {
-                    mant[i]++;
-                    break;
-                }
-            }
-        }
-    }
-
-    /** Create an instance from a double value.
-     * @param field field to which this instance belongs
-     * @param x value to convert to an instance
-     */
-    protected Dfp(final DfpField field, double x) {
-
-        // initialize as if 0
-        mant = new int[field.getRadixDigits()];
-        sign = 1;
-        exp = 0;
-        nans = FINITE;
-        this.field = field;
-
-        long bits = Double.doubleToLongBits(x);
-        long mantissa = bits & 0x000fffffffffffffL;
-        int exponent = (int) ((bits & 0x7ff0000000000000L) >> 52) - 1023;
-
-        if (exponent == -1023) {
-            // Zero or sub-normal
-            if (x == 0) {
-                // make sure 0 has the right sign
-                if ((bits & 0x8000000000000000L) != 0) {
-                    sign = -1;
-                }
-                return;
-            }
-
-            exponent++;
-
-            // Normalize the subnormal number
-            while ( (mantissa & 0x0010000000000000L) == 0) {
-                exponent--;
-                mantissa <<= 1;
-            }
-            mantissa &= 0x000fffffffffffffL;
-        }
-
-        if (exponent == 1024) {
-            // infinity or NAN
-            if (x != x) {
-                sign = (byte) 1;
-                nans = QNAN;
-            } else if (x < 0) {
-                sign = (byte) -1;
-                nans = INFINITE;
-            } else {
-                sign = (byte) 1;
-                nans = INFINITE;
-            }
-            return;
-        }
-
-        Dfp xdfp = new Dfp(field, mantissa);
-        xdfp = xdfp.divide(new Dfp(field, 4503599627370496l)).add(field.getOne());  // Divide by 2^52, then add one
-        xdfp = xdfp.multiply(DfpMath.pow(field.getTwo(), exponent));
-
-        if ((bits & 0x8000000000000000L) != 0) {
-            xdfp = xdfp.negate();
-        }
-
-        System.arraycopy(xdfp.mant, 0, mant, 0, mant.length);
-        sign = xdfp.sign;
-        exp  = xdfp.exp;
-        nans = xdfp.nans;
-
-    }
-
-    /** Copy constructor.
-     * @param d instance to copy
-     */
-    public Dfp(final Dfp d) {
-        mant  = d.mant.clone();
-        sign  = d.sign;
-        exp   = d.exp;
-        nans  = d.nans;
-        field = d.field;
-    }
-
-    /** Create an instance from a String representation.
-     * @param field field to which this instance belongs
-     * @param s string representation of the instance
-     */
-    protected Dfp(final DfpField field, final String s) {
-
-        // initialize as if 0
-        mant = new int[field.getRadixDigits()];
-        sign = 1;
-        exp = 0;
-        nans = FINITE;
-        this.field = field;
-
-        boolean decimalFound = false;
-        final int rsize = 4;   // size of radix in decimal digits
-        final int offset = 4;  // Starting offset into Striped
-        final char[] striped = new char[getRadixDigits() * rsize + offset * 2];
-
-        // Check some special cases
-        if (s.equals(POS_INFINITY_STRING)) {
-            sign = (byte) 1;
-            nans = INFINITE;
-            return;
-        }
-
-        if (s.equals(NEG_INFINITY_STRING)) {
-            sign = (byte) -1;
-            nans = INFINITE;
-            return;
-        }
-
-        if (s.equals(NAN_STRING)) {
-            sign = (byte) 1;
-            nans = QNAN;
-            return;
-        }
-
-        // Check for scientific notation
-        int p = s.indexOf("e");
-        if (p == -1) { // try upper case?
-            p = s.indexOf("E");
-        }
-
-        final String fpdecimal;
-        int sciexp = 0;
-        if (p != -1) {
-            // scientific notation
-            fpdecimal = s.substring(0, p);
-            String fpexp = s.substring(p+1);
-            boolean negative = false;
-
-            for (int i=0; i<fpexp.length(); i++)
-            {
-                if (fpexp.charAt(i) == '-')
-                {
-                    negative = true;
-                    continue;
-                }
-                if (fpexp.charAt(i) >= '0' && fpexp.charAt(i) <= '9') {
-                    sciexp = sciexp * 10 + fpexp.charAt(i) - '0';
-                }
-            }
-
-            if (negative) {
-                sciexp = -sciexp;
-            }
-        } else {
-            // normal case
-            fpdecimal = s;
-        }
-
-        // If there is a minus sign in the number then it is negative
-        if (fpdecimal.indexOf("-") !=  -1) {
-            sign = -1;
-        }
-
-        // First off, find all of the leading zeros, trailing zeros, and significant digits
-        p = 0;
-
-        // Move p to first significant digit
-        int decimalPos = 0;
-        for (;;) {
-            if (fpdecimal.charAt(p) >= '1' && fpdecimal.charAt(p) <= '9') {
-                break;
-            }
-
-            if (decimalFound && fpdecimal.charAt(p) == '0') {
-                decimalPos--;
-            }
-
-            if (fpdecimal.charAt(p) == '.') {
-                decimalFound = true;
-            }
-
-            p++;
-
-            if (p == fpdecimal.length()) {
-                break;
-            }
-        }
-
-        // Copy the string onto Stripped
-        int q = offset;
-        striped[0] = '0';
-        striped[1] = '0';
-        striped[2] = '0';
-        striped[3] = '0';
-        int significantDigits=0;
-        for(;;) {
-            if (p == (fpdecimal.length())) {
-                break;
-            }
-
-            // Don't want to run pass the end of the array
-            if (q == mant.length*rsize+offset+1) {
-                break;
-            }
-
-            if (fpdecimal.charAt(p) == '.') {
-                decimalFound = true;
-                decimalPos = significantDigits;
-                p++;
-                continue;
-            }
-
-            if (fpdecimal.charAt(p) < '0' || fpdecimal.charAt(p) > '9') {
-                p++;
-                continue;
-            }
-
-            striped[q] = fpdecimal.charAt(p);
-            q++;
-            p++;
-            significantDigits++;
-        }
-
-
-        // If the decimal point has been found then get rid of trailing zeros.
-        if (decimalFound && q != offset) {
-            for (;;) {
-                q--;
-                if (q == offset) {
-                    break;
-                }
-                if (striped[q] == '0') {
-                    significantDigits--;
-                } else {
-                    break;
-                }
-            }
-        }
-
-        // special case of numbers like "0.00000"
-        if (decimalFound && significantDigits == 0) {
-            decimalPos = 0;
-        }
-
-        // Implicit decimal point at end of number if not present
-        if (!decimalFound) {
-            decimalPos = q-offset;
-        }
-
-        // Find the number of significant trailing zeros
-        q = offset;  // set q to point to first sig digit
-        p = significantDigits-1+offset;
-
-        while (p > q) {
-            if (striped[p] != '0') {
-                break;
-            }
-            p--;
-        }
-
-        // Make sure the decimal is on a mod 10000 boundary
-        int i = ((rsize * 100) - decimalPos - sciexp % rsize) % rsize;
-        q -= i;
-        decimalPos += i;
-
-        // Make the mantissa length right by adding zeros at the end if necessary
-        while ((p - q) < (mant.length * rsize)) {
-            for (i = 0; i < rsize; i++) {
-                striped[++p] = '0';
-            }
-        }
-
-        // Ok, now we know how many trailing zeros there are,
-        // and where the least significant digit is
-        for (i = mant.length - 1; i >= 0; i--) {
-            mant[i] = (striped[q]   - '0') * 1000 +
-                      (striped[q+1] - '0') * 100  +
-                      (striped[q+2] - '0') * 10   +
-                      (striped[q+3] - '0');
-            q += 4;
-        }
-
-
-        exp = (decimalPos+sciexp) / rsize;
-
-        if (q < striped.length) {
-            // Is there possible another digit?
-            round((striped[q] - '0')*1000);
-        }
-
-    }
-
-    /** Creates an instance with a non-finite value.
-     * @param field field to which this instance belongs
-     * @param sign sign of the Dfp to create
-     * @param nans code of the value, must be one of {@link #INFINITE},
-     * {@link #SNAN},  {@link #QNAN}
-     */
-    protected Dfp(final DfpField field, final byte sign, final byte nans) {
-        this.field = field;
-        this.mant    = new int[field.getRadixDigits()];
-        this.sign    = sign;
-        this.exp     = 0;
-        this.nans    = nans;
-    }
-
-    /** Create an instance with a value of 0.
-     * Use this internally in preference to constructors to facilitate subclasses
-     * @return a new instance with a value of 0
-     */
-    public Dfp newInstance() {
-        return new Dfp(getField());
-    }
-
-    /** Create an instance from a byte value.
-     * @param x value to convert to an instance
-     * @return a new instance with value x
-     */
-    public Dfp newInstance(final byte x) {
-        return new Dfp(getField(), x);
-    }
-
-    /** Create an instance from an int value.
-     * @param x value to convert to an instance
-     * @return a new instance with value x
-     */
-    public Dfp newInstance(final int x) {
-        return new Dfp(getField(), x);
-    }
-
-    /** Create an instance from a long value.
-     * @param x value to convert to an instance
-     * @return a new instance with value x
-     */
-    public Dfp newInstance(final long x) {
-        return new Dfp(getField(), x);
-    }
-
-    /** Create an instance from a double value.
-     * @param x value to convert to an instance
-     * @return a new instance with value x
-     */
-    public Dfp newInstance(final double x) {
-        return new Dfp(getField(), x);
-    }
-
-    /** Create an instance by copying an existing one.
-     * Use this internally in preference to constructors to facilitate subclasses.
-     * @param d instance to copy
-     * @return a new instance with the same value as d
-     */
-    public Dfp newInstance(final Dfp d) {
-
-        // make sure we don't mix number with different precision
-        if (field.getRadixDigits() != d.field.getRadixDigits()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            return dotrap(DfpField.FLAG_INVALID, NEW_INSTANCE_TRAP, d, result);
-        }
-
-        return new Dfp(d);
-
-    }
-
-    /** Create an instance from a String representation.
-     * Use this internally in preference to constructors to facilitate subclasses.
-     * @param s string representation of the instance
-     * @return a new instance parsed from specified string
-     */
-    public Dfp newInstance(final String s) {
-        return new Dfp(field, s);
-    }
-
-    /** Creates an instance with a non-finite value.
-     * @param sig sign of the Dfp to create
-     * @param code code of the value, must be one of {@link #INFINITE},
-     * {@link #SNAN},  {@link #QNAN}
-     * @return a new instance with a non-finite value
-     */
-    public Dfp newInstance(final byte sig, final byte code) {
-        return field.newDfp(sig, code);
-    }
-
-    /** Get the {@link org.apache.commons.math3.Field Field} (really a {@link DfpField}) to which the instance belongs.
-     * <p>
-     * The field is linked to the number of digits and acts as a factory
-     * for {@link Dfp} instances.
-     * </p>
-     * @return {@link org.apache.commons.math3.Field Field} (really a {@link DfpField}) to which the instance belongs
-     */
-    public DfpField getField() {
-        return field;
-    }
-
-    /** Get the number of radix digits of the instance.
-     * @return number of radix digits
-     */
-    public int getRadixDigits() {
-        return field.getRadixDigits();
-    }
-
-    /** Get the constant 0.
-     * @return a Dfp with value zero
-     */
-    public Dfp getZero() {
-        return field.getZero();
-    }
-
-    /** Get the constant 1.
-     * @return a Dfp with value one
-     */
-    public Dfp getOne() {
-        return field.getOne();
-    }
-
-    /** Get the constant 2.
-     * @return a Dfp with value two
-     */
-    public Dfp getTwo() {
-        return field.getTwo();
-    }
-
-    /** Shift the mantissa left, and adjust the exponent to compensate.
-     */
-    protected void shiftLeft() {
-        for (int i = mant.length - 1; i > 0; i--) {
-            mant[i] = mant[i-1];
-        }
-        mant[0] = 0;
-        exp--;
-    }
-
-    /* Note that shiftRight() does not call round() as that round() itself
-     uses shiftRight() */
-    /** Shift the mantissa right, and adjust the exponent to compensate.
-     */
-    protected void shiftRight() {
-        for (int i = 0; i < mant.length - 1; i++) {
-            mant[i] = mant[i+1];
-        }
-        mant[mant.length - 1] = 0;
-        exp++;
-    }
-
-    /** Make our exp equal to the supplied one, this may cause rounding.
-     *  Also causes de-normalized numbers.  These numbers are generally
-     *  dangerous because most routines assume normalized numbers.
-     *  Align doesn't round, so it will return the last digit destroyed
-     *  by shifting right.
-     *  @param e desired exponent
-     *  @return last digit destroyed by shifting right
-     */
-    protected int align(int e) {
-        int lostdigit = 0;
-        boolean inexact = false;
-
-        int diff = exp - e;
-
-        int adiff = diff;
-        if (adiff < 0) {
-            adiff = -adiff;
-        }
-
-        if (diff == 0) {
-            return 0;
-        }
-
-        if (adiff > (mant.length + 1)) {
-            // Special case
-            Arrays.fill(mant, 0);
-            exp = e;
-
-            field.setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            dotrap(DfpField.FLAG_INEXACT, ALIGN_TRAP, this, this);
-
-            return 0;
-        }
-
-        for (int i = 0; i < adiff; i++) {
-            if (diff < 0) {
-                /* Keep track of loss -- only signal inexact after losing 2 digits.
-                 * the first lost digit is returned to add() and may be incorporated
-                 * into the result.
-                 */
-                if (lostdigit != 0) {
-                    inexact = true;
-                }
-
-                lostdigit = mant[0];
-
-                shiftRight();
-            } else {
-                shiftLeft();
-            }
-        }
-
-        if (inexact) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            dotrap(DfpField.FLAG_INEXACT, ALIGN_TRAP, this, this);
-        }
-
-        return lostdigit;
-
-    }
-
-    /** Check if instance is less than x.
-     * @param x number to check instance against
-     * @return true if instance is less than x and neither are NaN, false otherwise
-     */
-    public boolean lessThan(final Dfp x) {
-
-        // make sure we don't mix number with different precision
-        if (field.getRadixDigits() != x.field.getRadixDigits()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            dotrap(DfpField.FLAG_INVALID, LESS_THAN_TRAP, x, result);
-            return false;
-        }
-
-        /* if a nan is involved, signal invalid and return false */
-        if (isNaN() || x.isNaN()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            dotrap(DfpField.FLAG_INVALID, LESS_THAN_TRAP, x, newInstance(getZero()));
-            return false;
-        }
-
-        return compare(this, x) < 0;
-    }
-
-    /** Check if instance is greater than x.
-     * @param x number to check instance against
-     * @return true if instance is greater than x and neither are NaN, false otherwise
-     */
-    public boolean greaterThan(final Dfp x) {
-
-        // make sure we don't mix number with different precision
-        if (field.getRadixDigits() != x.field.getRadixDigits()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            dotrap(DfpField.FLAG_INVALID, GREATER_THAN_TRAP, x, result);
-            return false;
-        }
-
-        /* if a nan is involved, signal invalid and return false */
-        if (isNaN() || x.isNaN()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            dotrap(DfpField.FLAG_INVALID, GREATER_THAN_TRAP, x, newInstance(getZero()));
-            return false;
-        }
-
-        return compare(this, x) > 0;
-    }
-
-    /** Check if instance is less than or equal to 0.
-     * @return true if instance is not NaN and less than or equal to 0, false otherwise
-     */
-    public boolean negativeOrNull() {
-
-        if (isNaN()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            dotrap(DfpField.FLAG_INVALID, LESS_THAN_TRAP, this, newInstance(getZero()));
-            return false;
-        }
-
-        return (sign < 0) || ((mant[mant.length - 1] == 0) && !isInfinite());
-
-    }
-
-    /** Check if instance is strictly less than 0.
-     * @return true if instance is not NaN and less than or equal to 0, false otherwise
-     */
-    public boolean strictlyNegative() {
-
-        if (isNaN()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            dotrap(DfpField.FLAG_INVALID, LESS_THAN_TRAP, this, newInstance(getZero()));
-            return false;
-        }
-
-        return (sign < 0) && ((mant[mant.length - 1] != 0) || isInfinite());
-
-    }
-
-    /** Check if instance is greater than or equal to 0.
-     * @return true if instance is not NaN and greater than or equal to 0, false otherwise
-     */
-    public boolean positiveOrNull() {
-
-        if (isNaN()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            dotrap(DfpField.FLAG_INVALID, LESS_THAN_TRAP, this, newInstance(getZero()));
-            return false;
-        }
-
-        return (sign > 0) || ((mant[mant.length - 1] == 0) && !isInfinite());
-
-    }
-
-    /** Check if instance is strictly greater than 0.
-     * @return true if instance is not NaN and greater than or equal to 0, false otherwise
-     */
-    public boolean strictlyPositive() {
-
-        if (isNaN()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            dotrap(DfpField.FLAG_INVALID, LESS_THAN_TRAP, this, newInstance(getZero()));
-            return false;
-        }
-
-        return (sign > 0) && ((mant[mant.length - 1] != 0) || isInfinite());
-
-    }
-
-    /** Get the absolute value of instance.
-     * @return absolute value of instance
-     * @since 3.2
-     */
-    public Dfp abs() {
-        Dfp result = newInstance(this);
-        result.sign = 1;
-        return result;
-    }
-
-    /** Check if instance is infinite.
-     * @return true if instance is infinite
-     */
-    public boolean isInfinite() {
-        return nans == INFINITE;
-    }
-
-    /** Check if instance is not a number.
-     * @return true if instance is not a number
-     */
-    public boolean isNaN() {
-        return (nans == QNAN) || (nans == SNAN);
-    }
-
-    /** Check if instance is equal to zero.
-     * @return true if instance is equal to zero
-     */
-    public boolean isZero() {
-
-        if (isNaN()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            dotrap(DfpField.FLAG_INVALID, LESS_THAN_TRAP, this, newInstance(getZero()));
-            return false;
-        }
-
-        return (mant[mant.length - 1] == 0) && !isInfinite();
-
-    }
-
-    /** Check if instance is equal to x.
-     * @param other object to check instance against
-     * @return true if instance is equal to x and neither are NaN, false otherwise
-     */
-    @Override
-    public boolean equals(final Object other) {
-
-        if (other instanceof Dfp) {
-            final Dfp x = (Dfp) other;
-            if (isNaN() || x.isNaN() || field.getRadixDigits() != x.field.getRadixDigits()) {
-                return false;
-            }
-
-            return compare(this, x) == 0;
-        }
-
-        return false;
-
-    }
-
-    /**
-     * Gets a hashCode for the instance.
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        return 17 + (sign << 8) + (nans << 16) + exp + Arrays.hashCode(mant);
-    }
-
-    /** Check if instance is not equal to x.
-     * @param x number to check instance against
-     * @return true if instance is not equal to x and neither are NaN, false otherwise
-     */
-    public boolean unequal(final Dfp x) {
-        if (isNaN() || x.isNaN() || field.getRadixDigits() != x.field.getRadixDigits()) {
-            return false;
-        }
-
-        return greaterThan(x) || lessThan(x);
-    }
-
-    /** Compare two instances.
-     * @param a first instance in comparison
-     * @param b second instance in comparison
-     * @return -1 if a<b, 1 if a>b and 0 if a==b
-     *  Note this method does not properly handle NaNs or numbers with different precision.
-     */
-    private static int compare(final Dfp a, final Dfp b) {
-        // Ignore the sign of zero
-        if (a.mant[a.mant.length - 1] == 0 && b.mant[b.mant.length - 1] == 0 &&
-            a.nans == FINITE && b.nans == FINITE) {
-            return 0;
-        }
-
-        if (a.sign != b.sign) {
-            if (a.sign == -1) {
-                return -1;
-            } else {
-                return 1;
-            }
-        }
-
-        // deal with the infinities
-        if (a.nans == INFINITE && b.nans == FINITE) {
-            return a.sign;
-        }
-
-        if (a.nans == FINITE && b.nans == INFINITE) {
-            return -b.sign;
-        }
-
-        if (a.nans == INFINITE && b.nans == INFINITE) {
-            return 0;
-        }
-
-        // Handle special case when a or b is zero, by ignoring the exponents
-        if (b.mant[b.mant.length-1] != 0 && a.mant[b.mant.length-1] != 0) {
-            if (a.exp < b.exp) {
-                return -a.sign;
-            }
-
-            if (a.exp > b.exp) {
-                return a.sign;
-            }
-        }
-
-        // compare the mantissas
-        for (int i = a.mant.length - 1; i >= 0; i--) {
-            if (a.mant[i] > b.mant[i]) {
-                return a.sign;
-            }
-
-            if (a.mant[i] < b.mant[i]) {
-                return -a.sign;
-            }
-        }
-
-        return 0;
-
-    }
-
-    /** Round to nearest integer using the round-half-even method.
-     *  That is round to nearest integer unless both are equidistant.
-     *  In which case round to the even one.
-     *  @return rounded value
-     * @since 3.2
-     */
-    public Dfp rint() {
-        return trunc(DfpField.RoundingMode.ROUND_HALF_EVEN);
-    }
-
-    /** Round to an integer using the round floor mode.
-     * That is, round toward -Infinity
-     *  @return rounded value
-     * @since 3.2
-     */
-    public Dfp floor() {
-        return trunc(DfpField.RoundingMode.ROUND_FLOOR);
-    }
-
-    /** Round to an integer using the round ceil mode.
-     * That is, round toward +Infinity
-     *  @return rounded value
-     * @since 3.2
-     */
-    public Dfp ceil() {
-        return trunc(DfpField.RoundingMode.ROUND_CEIL);
-    }
-
-    /** Returns the IEEE remainder.
-     * @param d divisor
-     * @return this less n &times; d, where n is the integer closest to this/d
-     * @since 3.2
-     */
-    public Dfp remainder(final Dfp d) {
-
-        final Dfp result = this.subtract(this.divide(d).rint().multiply(d));
-
-        // IEEE 854-1987 says that if the result is zero, then it carries the sign of this
-        if (result.mant[mant.length-1] == 0) {
-            result.sign = sign;
-        }
-
-        return result;
-
-    }
-
-    /** Does the integer conversions with the specified rounding.
-     * @param rmode rounding mode to use
-     * @return truncated value
-     */
-    protected Dfp trunc(final DfpField.RoundingMode rmode) {
-        boolean changed = false;
-
-        if (isNaN()) {
-            return newInstance(this);
-        }
-
-        if (nans == INFINITE) {
-            return newInstance(this);
-        }
-
-        if (mant[mant.length-1] == 0) {
-            // a is zero
-            return newInstance(this);
-        }
-
-        /* If the exponent is less than zero then we can certainly
-         * return zero */
-        if (exp < 0) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            Dfp result = newInstance(getZero());
-            result = dotrap(DfpField.FLAG_INEXACT, TRUNC_TRAP, this, result);
-            return result;
-        }
-
-        /* If the exponent is greater than or equal to digits, then it
-         * must already be an integer since there is no precision left
-         * for any fractional part */
-
-        if (exp >= mant.length) {
-            return newInstance(this);
-        }
-
-        /* General case:  create another dfp, result, that contains the
-         * a with the fractional part lopped off.  */
-
-        Dfp result = newInstance(this);
-        for (int i = 0; i < mant.length-result.exp; i++) {
-            changed |= result.mant[i] != 0;
-            result.mant[i] = 0;
-        }
-
-        if (changed) {
-            switch (rmode) {
-                case ROUND_FLOOR:
-                    if (result.sign == -1) {
-                        // then we must increment the mantissa by one
-                        result = result.add(newInstance(-1));
-                    }
-                    break;
-
-                case ROUND_CEIL:
-                    if (result.sign == 1) {
-                        // then we must increment the mantissa by one
-                        result = result.add(getOne());
-                    }
-                    break;
-
-                case ROUND_HALF_EVEN:
-                default:
-                    final Dfp half = newInstance("0.5");
-                    Dfp a = subtract(result);  // difference between this and result
-                    a.sign = 1;            // force positive (take abs)
-                    if (a.greaterThan(half)) {
-                        a = newInstance(getOne());
-                        a.sign = sign;
-                        result = result.add(a);
-                    }
-
-                    /** If exactly equal to 1/2 and odd then increment */
-                    if (a.equals(half) && result.exp > 0 && (result.mant[mant.length-result.exp]&1) != 0) {
-                        a = newInstance(getOne());
-                        a.sign = sign;
-                        result = result.add(a);
-                    }
-                    break;
-            }
-
-            field.setIEEEFlagsBits(DfpField.FLAG_INEXACT);  // signal inexact
-            result = dotrap(DfpField.FLAG_INEXACT, TRUNC_TRAP, this, result);
-            return result;
-        }
-
-        return result;
-    }
-
-    /** Convert this to an integer.
-     * If greater than 2147483647, it returns 2147483647. If less than -2147483648 it returns -2147483648.
-     * @return converted number
-     */
-    public int intValue() {
-        Dfp rounded;
-        int result = 0;
-
-        rounded = rint();
-
-        if (rounded.greaterThan(newInstance(2147483647))) {
-            return 2147483647;
-        }
-
-        if (rounded.lessThan(newInstance(-2147483648))) {
-            return -2147483648;
-        }
-
-        for (int i = mant.length - 1; i >= mant.length - rounded.exp; i--) {
-            result = result * RADIX + rounded.mant[i];
-        }
-
-        if (rounded.sign == -1) {
-            result = -result;
-        }
-
-        return result;
-    }
-
-    /** Get the exponent of the greatest power of 10000 that is
-     *  less than or equal to the absolute value of this.  I.E.  if
-     *  this is 10<sup>6</sup> then log10K would return 1.
-     *  @return integer base 10000 logarithm
-     */
-    public int log10K() {
-        return exp - 1;
-    }
-
-    /** Get the specified  power of 10000.
-     * @param e desired power
-     * @return 10000<sup>e</sup>
-     */
-    public Dfp power10K(final int e) {
-        Dfp d = newInstance(getOne());
-        d.exp = e + 1;
-        return d;
-    }
-
-    /** Get the exponent of the greatest power of 10 that is less than or equal to abs(this).
-     *  @return integer base 10 logarithm
-     * @since 3.2
-     */
-    public int intLog10()  {
-        if (mant[mant.length-1] > 1000) {
-            return exp * 4 - 1;
-        }
-        if (mant[mant.length-1] > 100) {
-            return exp * 4 - 2;
-        }
-        if (mant[mant.length-1] > 10) {
-            return exp * 4 - 3;
-        }
-        return exp * 4 - 4;
-    }
-
-    /** Return the specified  power of 10.
-     * @param e desired power
-     * @return 10<sup>e</sup>
-     */
-    public Dfp power10(final int e) {
-        Dfp d = newInstance(getOne());
-
-        if (e >= 0) {
-            d.exp = e / 4 + 1;
-        } else {
-            d.exp = (e + 1) / 4;
-        }
-
-        switch ((e % 4 + 4) % 4) {
-            case 0:
-                break;
-            case 1:
-                d = d.multiply(10);
-                break;
-            case 2:
-                d = d.multiply(100);
-                break;
-            default:
-                d = d.multiply(1000);
-        }
-
-        return d;
-    }
-
-    /** Negate the mantissa of this by computing the complement.
-     *  Leaves the sign bit unchanged, used internally by add.
-     *  Denormalized numbers are handled properly here.
-     *  @param extra ???
-     *  @return ???
-     */
-    protected int complement(int extra) {
-
-        extra = RADIX-extra;
-        for (int i = 0; i < mant.length; i++) {
-            mant[i] = RADIX-mant[i]-1;
-        }
-
-        int rh = extra / RADIX;
-        extra -= rh * RADIX;
-        for (int i = 0; i < mant.length; i++) {
-            final int r = mant[i] + rh;
-            rh = r / RADIX;
-            mant[i] = r - rh * RADIX;
-        }
-
-        return extra;
-    }
-
-    /** Add x to this.
-     * @param x number to add
-     * @return sum of this and x
-     */
-    public Dfp add(final Dfp x) {
-
-        // make sure we don't mix number with different precision
-        if (field.getRadixDigits() != x.field.getRadixDigits()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            return dotrap(DfpField.FLAG_INVALID, ADD_TRAP, x, result);
-        }
-
-        /* handle special cases */
-        if (nans != FINITE || x.nans != FINITE) {
-            if (isNaN()) {
-                return this;
-            }
-
-            if (x.isNaN()) {
-                return x;
-            }
-
-            if (nans == INFINITE && x.nans == FINITE) {
-                return this;
-            }
-
-            if (x.nans == INFINITE && nans == FINITE) {
-                return x;
-            }
-
-            if (x.nans == INFINITE && nans == INFINITE && sign == x.sign) {
-                return x;
-            }
-
-            if (x.nans == INFINITE && nans == INFINITE && sign != x.sign) {
-                field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-                Dfp result = newInstance(getZero());
-                result.nans = QNAN;
-                result = dotrap(DfpField.FLAG_INVALID, ADD_TRAP, x, result);
-                return result;
-            }
-        }
-
-        /* copy this and the arg */
-        Dfp a = newInstance(this);
-        Dfp b = newInstance(x);
-
-        /* initialize the result object */
-        Dfp result = newInstance(getZero());
-
-        /* Make all numbers positive, but remember their sign */
-        final byte asign = a.sign;
-        final byte bsign = b.sign;
-
-        a.sign = 1;
-        b.sign = 1;
-
-        /* The result will be signed like the arg with greatest magnitude */
-        byte rsign = bsign;
-        if (compare(a, b) > 0) {
-            rsign = asign;
-        }
-
-        /* Handle special case when a or b is zero, by setting the exponent
-       of the zero number equal to the other one.  This avoids an alignment
-       which would cause catastropic loss of precision */
-        if (b.mant[mant.length-1] == 0) {
-            b.exp = a.exp;
-        }
-
-        if (a.mant[mant.length-1] == 0) {
-            a.exp = b.exp;
-        }
-
-        /* align number with the smaller exponent */
-        int aextradigit = 0;
-        int bextradigit = 0;
-        if (a.exp < b.exp) {
-            aextradigit = a.align(b.exp);
-        } else {
-            bextradigit = b.align(a.exp);
-        }
-
-        /* complement the smaller of the two if the signs are different */
-        if (asign != bsign) {
-            if (asign == rsign) {
-                bextradigit = b.complement(bextradigit);
-            } else {
-                aextradigit = a.complement(aextradigit);
-            }
-        }
-
-        /* add the mantissas */
-        int rh = 0; /* acts as a carry */
-        for (int i = 0; i < mant.length; i++) {
-            final int r = a.mant[i]+b.mant[i]+rh;
-            rh = r / RADIX;
-            result.mant[i] = r - rh * RADIX;
-        }
-        result.exp = a.exp;
-        result.sign = rsign;
-
-        /* handle overflow -- note, when asign!=bsign an overflow is
-         * normal and should be ignored.  */
-
-        if (rh != 0 && (asign == bsign)) {
-            final int lostdigit = result.mant[0];
-            result.shiftRight();
-            result.mant[mant.length-1] = rh;
-            final int excp = result.round(lostdigit);
-            if (excp != 0) {
-                result = dotrap(excp, ADD_TRAP, x, result);
-            }
-        }
-
-        /* normalize the result */
-        for (int i = 0; i < mant.length; i++) {
-            if (result.mant[mant.length-1] != 0) {
-                break;
-            }
-            result.shiftLeft();
-            if (i == 0) {
-                result.mant[0] = aextradigit+bextradigit;
-                aextradigit = 0;
-                bextradigit = 0;
-            }
-        }
-
-        /* result is zero if after normalization the most sig. digit is zero */
-        if (result.mant[mant.length-1] == 0) {
-            result.exp = 0;
-
-            if (asign != bsign) {
-                // Unless adding 2 negative zeros, sign is positive
-                result.sign = 1;  // Per IEEE 854-1987 Section 6.3
-            }
-        }
-
-        /* Call round to test for over/under flows */
-        final int excp = result.round(aextradigit + bextradigit);
-        if (excp != 0) {
-            result = dotrap(excp, ADD_TRAP, x, result);
-        }
-
-        return result;
-    }
-
-    /** Returns a number that is this number with the sign bit reversed.
-     * @return the opposite of this
-     */
-    public Dfp negate() {
-        Dfp result = newInstance(this);
-        result.sign = (byte) - result.sign;
-        return result;
-    }
-
-    /** Subtract x from this.
-     * @param x number to subtract
-     * @return difference of this and a
-     */
-    public Dfp subtract(final Dfp x) {
-        return add(x.negate());
-    }
-
-    /** Round this given the next digit n using the current rounding mode.
-     * @param n ???
-     * @return the IEEE flag if an exception occurred
-     */
-    protected int round(int n) {
-        boolean inc = false;
-        switch (field.getRoundingMode()) {
-            case ROUND_DOWN:
-                inc = false;
-                break;
-
-            case ROUND_UP:
-                inc = n != 0;       // round up if n!=0
-                break;
-
-            case ROUND_HALF_UP:
-                inc = n >= 5000;  // round half up
-                break;
-
-            case ROUND_HALF_DOWN:
-                inc = n > 5000;  // round half down
-                break;
-
-            case ROUND_HALF_EVEN:
-                inc = n > 5000 || (n == 5000 && (mant[0] & 1) == 1);  // round half-even
-                break;
-
-            case ROUND_HALF_ODD:
-                inc = n > 5000 || (n == 5000 && (mant[0] & 1) == 0);  // round half-odd
-                break;
-
-            case ROUND_CEIL:
-                inc = sign == 1 && n != 0;  // round ceil
-                break;
-
-            case ROUND_FLOOR:
-            default:
-                inc = sign == -1 && n != 0;  // round floor
-                break;
-        }
-
-        if (inc) {
-            // increment if necessary
-            int rh = 1;
-            for (int i = 0; i < mant.length; i++) {
-                final int r = mant[i] + rh;
-                rh = r / RADIX;
-                mant[i] = r - rh * RADIX;
-            }
-
-            if (rh != 0) {
-                shiftRight();
-                mant[mant.length-1] = rh;
-            }
-        }
-
-        // check for exceptional cases and raise signals if necessary
-        if (exp < MIN_EXP) {
-            // Gradual Underflow
-            field.setIEEEFlagsBits(DfpField.FLAG_UNDERFLOW);
-            return DfpField.FLAG_UNDERFLOW;
-        }
-
-        if (exp > MAX_EXP) {
-            // Overflow
-            field.setIEEEFlagsBits(DfpField.FLAG_OVERFLOW);
-            return DfpField.FLAG_OVERFLOW;
-        }
-
-        if (n != 0) {
-            // Inexact
-            field.setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            return DfpField.FLAG_INEXACT;
-        }
-
-        return 0;
-
-    }
-
-    /** Multiply this by x.
-     * @param x multiplicand
-     * @return product of this and x
-     */
-    public Dfp multiply(final Dfp x) {
-
-        // make sure we don't mix number with different precision
-        if (field.getRadixDigits() != x.field.getRadixDigits()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            return dotrap(DfpField.FLAG_INVALID, MULTIPLY_TRAP, x, result);
-        }
-
-        Dfp result = newInstance(getZero());
-
-        /* handle special cases */
-        if (nans != FINITE || x.nans != FINITE) {
-            if (isNaN()) {
-                return this;
-            }
-
-            if (x.isNaN()) {
-                return x;
-            }
-
-            if (nans == INFINITE && x.nans == FINITE && x.mant[mant.length-1] != 0) {
-                result = newInstance(this);
-                result.sign = (byte) (sign * x.sign);
-                return result;
-            }
-
-            if (x.nans == INFINITE && nans == FINITE && mant[mant.length-1] != 0) {
-                result = newInstance(x);
-                result.sign = (byte) (sign * x.sign);
-                return result;
-            }
-
-            if (x.nans == INFINITE && nans == INFINITE) {
-                result = newInstance(this);
-                result.sign = (byte) (sign * x.sign);
-                return result;
-            }
-
-            if ( (x.nans == INFINITE && nans == FINITE && mant[mant.length-1] == 0) ||
-                    (nans == INFINITE && x.nans == FINITE && x.mant[mant.length-1] == 0) ) {
-                field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-                result = newInstance(getZero());
-                result.nans = QNAN;
-                result = dotrap(DfpField.FLAG_INVALID, MULTIPLY_TRAP, x, result);
-                return result;
-            }
-        }
-
-        int[] product = new int[mant.length*2];  // Big enough to hold even the largest result
-
-        for (int i = 0; i < mant.length; i++) {
-            int rh = 0;  // acts as a carry
-            for (int j=0; j<mant.length; j++) {
-                int r = mant[i] * x.mant[j];    // multiply the 2 digits
-                r += product[i+j] + rh;  // add to the product digit with carry in
-
-                rh = r / RADIX;
-                product[i+j] = r - rh * RADIX;
-            }
-            product[i+mant.length] = rh;
-        }
-
-        // Find the most sig digit
-        int md = mant.length * 2 - 1;  // default, in case result is zero
-        for (int i = mant.length * 2 - 1; i >= 0; i--) {
-            if (product[i] != 0) {
-                md = i;
-                break;
-            }
-        }
-
-        // Copy the digits into the result
-        for (int i = 0; i < mant.length; i++) {
-            result.mant[mant.length - i - 1] = product[md - i];
-        }
-
-        // Fixup the exponent.
-        result.exp = exp + x.exp + md - 2 * mant.length + 1;
-        result.sign = (byte)((sign == x.sign)?1:-1);
-
-        if (result.mant[mant.length-1] == 0) {
-            // if result is zero, set exp to zero
-            result.exp = 0;
-        }
-
-        final int excp;
-        if (md > (mant.length-1)) {
-            excp = result.round(product[md-mant.length]);
-        } else {
-            excp = result.round(0); // has no effect except to check status
-        }
-
-        if (excp != 0) {
-            result = dotrap(excp, MULTIPLY_TRAP, x, result);
-        }
-
-        return result;
-
-    }
-
-    /** Multiply this by a single digit x.
-     * @param x multiplicand
-     * @return product of this and x
-     */
-    public Dfp multiply(final int x) {
-        if (x >= 0 && x < RADIX) {
-            return multiplyFast(x);
-        } else {
-            return multiply(newInstance(x));
-        }
-    }
-
-    /** Multiply this by a single digit 0&lt;=x&lt;radix.
-     * There are speed advantages in this special case.
-     * @param x multiplicand
-     * @return product of this and x
-     */
-    private Dfp multiplyFast(final int x) {
-        Dfp result = newInstance(this);
-
-        /* handle special cases */
-        if (nans != FINITE) {
-            if (isNaN()) {
-                return this;
-            }
-
-            if (nans == INFINITE && x != 0) {
-                result = newInstance(this);
-                return result;
-            }
-
-            if (nans == INFINITE && x == 0) {
-                field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-                result = newInstance(getZero());
-                result.nans = QNAN;
-                result = dotrap(DfpField.FLAG_INVALID, MULTIPLY_TRAP, newInstance(getZero()), result);
-                return result;
-            }
-        }
-
-        /* range check x */
-        if (x < 0 || x >= RADIX) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            result = newInstance(getZero());
-            result.nans = QNAN;
-            result = dotrap(DfpField.FLAG_INVALID, MULTIPLY_TRAP, result, result);
-            return result;
-        }
-
-        int rh = 0;
-        for (int i = 0; i < mant.length; i++) {
-            final int r = mant[i] * x + rh;
-            rh = r / RADIX;
-            result.mant[i] = r - rh * RADIX;
-        }
-
-        int lostdigit = 0;
-        if (rh != 0) {
-            lostdigit = result.mant[0];
-            result.shiftRight();
-            result.mant[mant.length-1] = rh;
-        }
-
-        if (result.mant[mant.length-1] == 0) { // if result is zero, set exp to zero
-            result.exp = 0;
-        }
-
-        final int excp = result.round(lostdigit);
-        if (excp != 0) {
-            result = dotrap(excp, MULTIPLY_TRAP, result, result);
-        }
-
-        return result;
-    }
-
-    /** Divide this by divisor.
-     * @param divisor divisor
-     * @return quotient of this by divisor
-     */
-    public Dfp divide(Dfp divisor) {
-        int dividend[]; // current status of the dividend
-        int quotient[]; // quotient
-        int remainder[];// remainder
-        int qd;         // current quotient digit we're working with
-        int nsqd;       // number of significant quotient digits we have
-        int trial=0;    // trial quotient digit
-        int minadj;     // minimum adjustment
-        boolean trialgood; // Flag to indicate a good trail digit
-        int md=0;       // most sig digit in result
-        int excp;       // exceptions
-
-        // make sure we don't mix number with different precision
-        if (field.getRadixDigits() != divisor.field.getRadixDigits()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            return dotrap(DfpField.FLAG_INVALID, DIVIDE_TRAP, divisor, result);
-        }
-
-        Dfp result = newInstance(getZero());
-
-        /* handle special cases */
-        if (nans != FINITE || divisor.nans != FINITE) {
-            if (isNaN()) {
-                return this;
-            }
-
-            if (divisor.isNaN()) {
-                return divisor;
-            }
-
-            if (nans == INFINITE && divisor.nans == FINITE) {
-                result = newInstance(this);
-                result.sign = (byte) (sign * divisor.sign);
-                return result;
-            }
-
-            if (divisor.nans == INFINITE && nans == FINITE) {
-                result = newInstance(getZero());
-                result.sign = (byte) (sign * divisor.sign);
-                return result;
-            }
-
-            if (divisor.nans == INFINITE && nans == INFINITE) {
-                field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-                result = newInstance(getZero());
-                result.nans = QNAN;
-                result = dotrap(DfpField.FLAG_INVALID, DIVIDE_TRAP, divisor, result);
-                return result;
-            }
-        }
-
-        /* Test for divide by zero */
-        if (divisor.mant[mant.length-1] == 0) {
-            field.setIEEEFlagsBits(DfpField.FLAG_DIV_ZERO);
-            result = newInstance(getZero());
-            result.sign = (byte) (sign * divisor.sign);
-            result.nans = INFINITE;
-            result = dotrap(DfpField.FLAG_DIV_ZERO, DIVIDE_TRAP, divisor, result);
-            return result;
-        }
-
-        dividend = new int[mant.length+1];  // one extra digit needed
-        quotient = new int[mant.length+2];  // two extra digits needed 1 for overflow, 1 for rounding
-        remainder = new int[mant.length+1]; // one extra digit needed
-
-        /* Initialize our most significant digits to zero */
-
-        dividend[mant.length] = 0;
-        quotient[mant.length] = 0;
-        quotient[mant.length+1] = 0;
-        remainder[mant.length] = 0;
-
-        /* copy our mantissa into the dividend, initialize the
-       quotient while we are at it */
-
-        for (int i = 0; i < mant.length; i++) {
-            dividend[i] = mant[i];
-            quotient[i] = 0;
-            remainder[i] = 0;
-        }
-
-        /* outer loop.  Once per quotient digit */
-        nsqd = 0;
-        for (qd = mant.length+1; qd >= 0; qd--) {
-            /* Determine outer limits of our quotient digit */
-
-            // r =  most sig 2 digits of dividend
-            final int divMsb = dividend[mant.length]*RADIX+dividend[mant.length-1];
-            int min = divMsb       / (divisor.mant[mant.length-1]+1);
-            int max = (divMsb + 1) / divisor.mant[mant.length-1];
-
-            trialgood = false;
-            while (!trialgood) {
-                // try the mean
-                trial = (min+max)/2;
-
-                /* Multiply by divisor and store as remainder */
-                int rh = 0;
-                for (int i = 0; i < mant.length + 1; i++) {
-                    int dm = (i<mant.length)?divisor.mant[i]:0;
-                    final int r = (dm * trial) + rh;
-                    rh = r / RADIX;
-                    remainder[i] = r - rh * RADIX;
-                }
-
-                /* subtract the remainder from the dividend */
-                rh = 1;  // carry in to aid the subtraction
-                for (int i = 0; i < mant.length + 1; i++) {
-                    final int r = ((RADIX-1) - remainder[i]) + dividend[i] + rh;
-                    rh = r / RADIX;
-                    remainder[i] = r - rh * RADIX;
-                }
-
-                /* Lets analyze what we have here */
-                if (rh == 0) {
-                    // trial is too big -- negative remainder
-                    max = trial-1;
-                    continue;
-                }
-
-                /* find out how far off the remainder is telling us we are */
-                minadj = (remainder[mant.length] * RADIX)+remainder[mant.length-1];
-                minadj /= divisor.mant[mant.length-1] + 1;
-
-                if (minadj >= 2) {
-                    min = trial+minadj;  // update the minimum
-                    continue;
-                }
-
-                /* May have a good one here, check more thoroughly.  Basically
-           its a good one if it is less than the divisor */
-                trialgood = false;  // assume false
-                for (int i = mant.length - 1; i >= 0; i--) {
-                    if (divisor.mant[i] > remainder[i]) {
-                        trialgood = true;
-                    }
-                    if (divisor.mant[i] < remainder[i]) {
-                        break;
-                    }
-                }
-
-                if (remainder[mant.length] != 0) {
-                    trialgood = false;
-                }
-
-                if (trialgood == false) {
-                    min = trial+1;
-                }
-            }
-
-            /* Great we have a digit! */
-            quotient[qd] = trial;
-            if (trial != 0 || nsqd != 0) {
-                nsqd++;
-            }
-
-            if (field.getRoundingMode() == DfpField.RoundingMode.ROUND_DOWN && nsqd == mant.length) {
-                // We have enough for this mode
-                break;
-            }
-
-            if (nsqd > mant.length) {
-                // We have enough digits
-                break;
-            }
-
-            /* move the remainder into the dividend while left shifting */
-            dividend[0] = 0;
-            for (int i = 0; i < mant.length; i++) {
-                dividend[i + 1] = remainder[i];
-            }
-        }
-
-        /* Find the most sig digit */
-        md = mant.length;  // default
-        for (int i = mant.length + 1; i >= 0; i--) {
-            if (quotient[i] != 0) {
-                md = i;
-                break;
-            }
-        }
-
-        /* Copy the digits into the result */
-        for (int i=0; i<mant.length; i++) {
-            result.mant[mant.length-i-1] = quotient[md-i];
-        }
-
-        /* Fixup the exponent. */
-        result.exp = exp - divisor.exp + md - mant.length;
-        result.sign = (byte) ((sign == divisor.sign) ? 1 : -1);
-
-        if (result.mant[mant.length-1] == 0) { // if result is zero, set exp to zero
-            result.exp = 0;
-        }
-
-        if (md > (mant.length-1)) {
-            excp = result.round(quotient[md-mant.length]);
-        } else {
-            excp = result.round(0);
-        }
-
-        if (excp != 0) {
-            result = dotrap(excp, DIVIDE_TRAP, divisor, result);
-        }
-
-        return result;
-    }
-
-    /** Divide by a single digit less than radix.
-     *  Special case, so there are speed advantages. 0 &lt;= divisor &lt; radix
-     * @param divisor divisor
-     * @return quotient of this by divisor
-     */
-    public Dfp divide(int divisor) {
-
-        // Handle special cases
-        if (nans != FINITE) {
-            if (isNaN()) {
-                return this;
-            }
-
-            if (nans == INFINITE) {
-                return newInstance(this);
-            }
-        }
-
-        // Test for divide by zero
-        if (divisor == 0) {
-            field.setIEEEFlagsBits(DfpField.FLAG_DIV_ZERO);
-            Dfp result = newInstance(getZero());
-            result.sign = sign;
-            result.nans = INFINITE;
-            result = dotrap(DfpField.FLAG_DIV_ZERO, DIVIDE_TRAP, getZero(), result);
-            return result;
-        }
-
-        // range check divisor
-        if (divisor < 0 || divisor >= RADIX) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            result = dotrap(DfpField.FLAG_INVALID, DIVIDE_TRAP, result, result);
-            return result;
-        }
-
-        Dfp result = newInstance(this);
-
-        int rl = 0;
-        for (int i = mant.length-1; i >= 0; i--) {
-            final int r = rl*RADIX + result.mant[i];
-            final int rh = r / divisor;
-            rl = r - rh * divisor;
-            result.mant[i] = rh;
-        }
-
-        if (result.mant[mant.length-1] == 0) {
-            // normalize
-            result.shiftLeft();
-            final int r = rl * RADIX;        // compute the next digit and put it in
-            final int rh = r / divisor;
-            rl = r - rh * divisor;
-            result.mant[0] = rh;
-        }
-
-        final int excp = result.round(rl * RADIX / divisor);  // do the rounding
-        if (excp != 0) {
-            result = dotrap(excp, DIVIDE_TRAP, result, result);
-        }
-
-        return result;
-
-    }
-
-    /** {@inheritDoc} */
-    public Dfp reciprocal() {
-        return field.getOne().divide(this);
-    }
-
-    /** Compute the square root.
-     * @return square root of the instance
-     * @since 3.2
-     */
-    public Dfp sqrt() {
-
-        // check for unusual cases
-        if (nans == FINITE && mant[mant.length-1] == 0) {
-            // if zero
-            return newInstance(this);
-        }
-
-        if (nans != FINITE) {
-            if (nans == INFINITE && sign == 1) {
-                // if positive infinity
-                return newInstance(this);
-            }
-
-            if (nans == QNAN) {
-                return newInstance(this);
-            }
-
-            if (nans == SNAN) {
-                Dfp result;
-
-                field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-                result = newInstance(this);
-                result = dotrap(DfpField.FLAG_INVALID, SQRT_TRAP, null, result);
-                return result;
-            }
-        }
-
-        if (sign == -1) {
-            // if negative
-            Dfp result;
-
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            result = newInstance(this);
-            result.nans = QNAN;
-            result = dotrap(DfpField.FLAG_INVALID, SQRT_TRAP, null, result);
-            return result;
-        }
-
-        Dfp x = newInstance(this);
-
-        /* Lets make a reasonable guess as to the size of the square root */
-        if (x.exp < -1 || x.exp > 1) {
-            x.exp = this.exp / 2;
-        }
-
-        /* Coarsely estimate the mantissa */
-        switch (x.mant[mant.length-1] / 2000) {
-            case 0:
-                x.mant[mant.length-1] = x.mant[mant.length-1]/2+1;
-                break;
-            case 2:
-                x.mant[mant.length-1] = 1500;
-                break;
-            case 3:
-                x.mant[mant.length-1] = 2200;
-                break;
-            default:
-                x.mant[mant.length-1] = 3000;
-        }
-
-        Dfp dx = newInstance(x);
-
-        /* Now that we have the first pass estimate, compute the rest
-       by the formula dx = (y - x*x) / (2x); */
-
-        Dfp px  = getZero();
-        Dfp ppx = getZero();
-        while (x.unequal(px)) {
-            dx = newInstance(x);
-            dx.sign = -1;
-            dx = dx.add(this.divide(x));
-            dx = dx.divide(2);
-            ppx = px;
-            px = x;
-            x = x.add(dx);
-
-            if (x.equals(ppx)) {
-                // alternating between two values
-                break;
-            }
-
-            // if dx is zero, break.  Note testing the most sig digit
-            // is a sufficient test since dx is normalized
-            if (dx.mant[mant.length-1] == 0) {
-                break;
-            }
-        }
-
-        return x;
-
-    }
-
-    /** Get a string representation of the instance.
-     * @return string representation of the instance
-     */
-    @Override
-    public String toString() {
-        if (nans != FINITE) {
-            // if non-finite exceptional cases
-            if (nans == INFINITE) {
-                return (sign < 0) ? NEG_INFINITY_STRING : POS_INFINITY_STRING;
-            } else {
-                return NAN_STRING;
-            }
-        }
-
-        if (exp > mant.length || exp < -1) {
-            return dfp2sci();
-        }
-
-        return dfp2string();
-
-    }
-
-    /** Convert an instance to a string using scientific notation.
-     * @return string representation of the instance in scientific notation
-     */
-    protected String dfp2sci() {
-        char rawdigits[]    = new char[mant.length * 4];
-        char outputbuffer[] = new char[mant.length * 4 + 20];
-        int p;
-        int q;
-        int e;
-        int ae;
-        int shf;
-
-        // Get all the digits
-        p = 0;
-        for (int i = mant.length - 1; i >= 0; i--) {
-            rawdigits[p++] = (char) ((mant[i] / 1000) + '0');
-            rawdigits[p++] = (char) (((mant[i] / 100) %10) + '0');
-            rawdigits[p++] = (char) (((mant[i] / 10) % 10) + '0');
-            rawdigits[p++] = (char) (((mant[i]) % 10) + '0');
-        }
-
-        // Find the first non-zero one
-        for (p = 0; p < rawdigits.length; p++) {
-            if (rawdigits[p] != '0') {
-                break;
-            }
-        }
-        shf = p;
-
-        // Now do the conversion
-        q = 0;
-        if (sign == -1) {
-            outputbuffer[q++] = '-';
-        }
-
-        if (p != rawdigits.length) {
-            // there are non zero digits...
-            outputbuffer[q++] = rawdigits[p++];
-            outputbuffer[q++] = '.';
-
-            while (p<rawdigits.length) {
-                outputbuffer[q++] = rawdigits[p++];
-            }
-        } else {
-            outputbuffer[q++] = '0';
-            outputbuffer[q++] = '.';
-            outputbuffer[q++] = '0';
-            outputbuffer[q++] = 'e';
-            outputbuffer[q++] = '0';
-            return new String(outputbuffer, 0, 5);
-        }
-
-        outputbuffer[q++] = 'e';
-
-        // Find the msd of the exponent
-
-        e = exp * 4 - shf - 1;
-        ae = e;
-        if (e < 0) {
-            ae = -e;
-        }
-
-        // Find the largest p such that p < e
-        for (p = 1000000000; p > ae; p /= 10) {
-            // nothing to do
-        }
-
-        if (e < 0) {
-            outputbuffer[q++] = '-';
-        }
-
-        while (p > 0) {
-            outputbuffer[q++] = (char)(ae / p + '0');
-            ae %= p;
-            p /= 10;
-        }
-
-        return new String(outputbuffer, 0, q);
-
-    }
-
-    /** Convert an instance to a string using normal notation.
-     * @return string representation of the instance in normal notation
-     */
-    protected String dfp2string() {
-        char buffer[] = new char[mant.length*4 + 20];
-        int p = 1;
-        int q;
-        int e = exp;
-        boolean pointInserted = false;
-
-        buffer[0] = ' ';
-
-        if (e <= 0) {
-            buffer[p++] = '0';
-            buffer[p++] = '.';
-            pointInserted = true;
-        }
-
-        while (e < 0) {
-            buffer[p++] = '0';
-            buffer[p++] = '0';
-            buffer[p++] = '0';
-            buffer[p++] = '0';
-            e++;
-        }
-
-        for (int i = mant.length - 1; i >= 0; i--) {
-            buffer[p++] = (char) ((mant[i] / 1000) + '0');
-            buffer[p++] = (char) (((mant[i] / 100) % 10) + '0');
-            buffer[p++] = (char) (((mant[i] / 10) % 10) + '0');
-            buffer[p++] = (char) (((mant[i]) % 10) + '0');
-            if (--e == 0) {
-                buffer[p++] = '.';
-                pointInserted = true;
-            }
-        }
-
-        while (e > 0) {
-            buffer[p++] = '0';
-            buffer[p++] = '0';
-            buffer[p++] = '0';
-            buffer[p++] = '0';
-            e--;
-        }
-
-        if (!pointInserted) {
-            // Ensure we have a radix point!
-            buffer[p++] = '.';
-        }
-
-        // Suppress leading zeros
-        q = 1;
-        while (buffer[q] == '0') {
-            q++;
-        }
-        if (buffer[q] == '.') {
-            q--;
-        }
-
-        // Suppress trailing zeros
-        while (buffer[p-1] == '0') {
-            p--;
-        }
-
-        // Insert sign
-        if (sign < 0) {
-            buffer[--q] = '-';
-        }
-
-        return new String(buffer, q, p - q);
-
-    }
-
-    /** Raises a trap.  This does not set the corresponding flag however.
-     *  @param type the trap type
-     *  @param what - name of routine trap occurred in
-     *  @param oper - input operator to function
-     *  @param result - the result computed prior to the trap
-     *  @return The suggested return value from the trap handler
-     */
-    public Dfp dotrap(int type, String what, Dfp oper, Dfp result) {
-        Dfp def = result;
-
-        switch (type) {
-            case DfpField.FLAG_INVALID:
-                def = newInstance(getZero());
-                def.sign = result.sign;
-                def.nans = QNAN;
-                break;
-
-            case DfpField.FLAG_DIV_ZERO:
-                if (nans == FINITE && mant[mant.length-1] != 0) {
-                    // normal case, we are finite, non-zero
-                    def = newInstance(getZero());
-                    def.sign = (byte)(sign*oper.sign);
-                    def.nans = INFINITE;
-                }
-
-                if (nans == FINITE && mant[mant.length-1] == 0) {
-                    //  0/0
-                    def = newInstance(getZero());
-                    def.nans = QNAN;
-                }
-
-                if (nans == INFINITE || nans == QNAN) {
-                    def = newInstance(getZero());
-                    def.nans = QNAN;
-                }
-
-                if (nans == INFINITE || nans == SNAN) {
-                    def = newInstance(getZero());
-                    def.nans = QNAN;
-                }
-                break;
-
-            case DfpField.FLAG_UNDERFLOW:
-                if ( (result.exp+mant.length) < MIN_EXP) {
-                    def = newInstance(getZero());
-                    def.sign = result.sign;
-                } else {
-                    def = newInstance(result);  // gradual underflow
-                }
-                result.exp += ERR_SCALE;
-                break;
-
-            case DfpField.FLAG_OVERFLOW:
-                result.exp -= ERR_SCALE;
-                def = newInstance(getZero());
-                def.sign = result.sign;
-                def.nans = INFINITE;
-                break;
-
-            default: def = result; break;
-        }
-
-        return trap(type, what, oper, def, result);
-
-    }
-
-    /** Trap handler.  Subclasses may override this to provide trap
-     *  functionality per IEEE 854-1987.
-     *
-     *  @param type  The exception type - e.g. FLAG_OVERFLOW
-     *  @param what  The name of the routine we were in e.g. divide()
-     *  @param oper  An operand to this function if any
-     *  @param def   The default return value if trap not enabled
-     *  @param result    The result that is specified to be delivered per
-     *                   IEEE 854, if any
-     *  @return the value that should be return by the operation triggering the trap
-     */
-    protected Dfp trap(int type, String what, Dfp oper, Dfp def, Dfp result) {
-        return def;
-    }
-
-    /** Returns the type - one of FINITE, INFINITE, SNAN, QNAN.
-     * @return type of the number
-     */
-    public int classify() {
-        return nans;
-    }
-
-    /** Creates an instance that is the same as x except that it has the sign of y.
-     * abs(x) = dfp.copysign(x, dfp.one)
-     * @param x number to get the value from
-     * @param y number to get the sign from
-     * @return a number with the value of x and the sign of y
-     */
-    public static Dfp copysign(final Dfp x, final Dfp y) {
-        Dfp result = x.newInstance(x);
-        result.sign = y.sign;
-        return result;
-    }
-
-    /** Returns the next number greater than this one in the direction of x.
-     * If this==x then simply returns this.
-     * @param x direction where to look at
-     * @return closest number next to instance in the direction of x
-     */
-    public Dfp nextAfter(final Dfp x) {
-
-        // make sure we don't mix number with different precision
-        if (field.getRadixDigits() != x.field.getRadixDigits()) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            return dotrap(DfpField.FLAG_INVALID, NEXT_AFTER_TRAP, x, result);
-        }
-
-        // if this is greater than x
-        boolean up = false;
-        if (this.lessThan(x)) {
-            up = true;
-        }
-
-        if (compare(this, x) == 0) {
-            return newInstance(x);
-        }
-
-        if (lessThan(getZero())) {
-            up = !up;
-        }
-
-        final Dfp inc;
-        Dfp result;
-        if (up) {
-            inc = newInstance(getOne());
-            inc.exp = this.exp-mant.length+1;
-            inc.sign = this.sign;
-
-            if (this.equals(getZero())) {
-                inc.exp = MIN_EXP-mant.length;
-            }
-
-            result = add(inc);
-        } else {
-            inc = newInstance(getOne());
-            inc.exp = this.exp;
-            inc.sign = this.sign;
-
-            if (this.equals(inc)) {
-                inc.exp = this.exp-mant.length;
-            } else {
-                inc.exp = this.exp-mant.length+1;
-            }
-
-            if (this.equals(getZero())) {
-                inc.exp = MIN_EXP-mant.length;
-            }
-
-            result = this.subtract(inc);
-        }
-
-        if (result.classify() == INFINITE && this.classify() != INFINITE) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            result = dotrap(DfpField.FLAG_INEXACT, NEXT_AFTER_TRAP, x, result);
-        }
-
-        if (result.equals(getZero()) && this.equals(getZero()) == false) {
-            field.setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            result = dotrap(DfpField.FLAG_INEXACT, NEXT_AFTER_TRAP, x, result);
-        }
-
-        return result;
-
-    }
-
-    /** Convert the instance into a double.
-     * @return a double approximating the instance
-     * @see #toSplitDouble()
-     */
-    public double toDouble() {
-
-        if (isInfinite()) {
-            if (lessThan(getZero())) {
-                return Double.NEGATIVE_INFINITY;
-            } else {
-                return Double.POSITIVE_INFINITY;
-            }
-        }
-
-        if (isNaN()) {
-            return Double.NaN;
-        }
-
-        Dfp y = this;
-        boolean negate = false;
-        int cmp0 = compare(this, getZero());
-        if (cmp0 == 0) {
-            return sign < 0 ? -0.0 : +0.0;
-        } else if (cmp0 < 0) {
-            y = negate();
-            negate = true;
-        }
-
-        /* Find the exponent, first estimate by integer log10, then adjust.
-         Should be faster than doing a natural logarithm.  */
-        int exponent = (int)(y.intLog10() * 3.32);
-        if (exponent < 0) {
-            exponent--;
-        }
-
-        Dfp tempDfp = DfpMath.pow(getTwo(), exponent);
-        while (tempDfp.lessThan(y) || tempDfp.equals(y)) {
-            tempDfp = tempDfp.multiply(2);
-            exponent++;
-        }
-        exponent--;
-
-        /* We have the exponent, now work on the mantissa */
-
-        y = y.divide(DfpMath.pow(getTwo(), exponent));
-        if (exponent > -1023) {
-            y = y.subtract(getOne());
-        }
-
-        if (exponent < -1074) {
-            return 0;
-        }
-
-        if (exponent > 1023) {
-            return negate ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
-        }
-
-
-        y = y.multiply(newInstance(4503599627370496l)).rint();
-        String str = y.toString();
-        str = str.substring(0, str.length()-1);
-        long mantissa = Long.parseLong(str);
-
-        if (mantissa == 4503599627370496L) {
-            // Handle special case where we round up to next power of two
-            mantissa = 0;
-            exponent++;
-        }
-
-        /* Its going to be subnormal, so make adjustments */
-        if (exponent <= -1023) {
-            exponent--;
-        }
-
-        while (exponent < -1023) {
-            exponent++;
-            mantissa >>>= 1;
-        }
-
-        long bits = mantissa | ((exponent + 1023L) << 52);
-        double x = Double.longBitsToDouble(bits);
-
-        if (negate) {
-            x = -x;
-        }
-
-        return x;
-
-    }
-
-    /** Convert the instance into a split double.
-     * @return an array of two doubles which sum represent the instance
-     * @see #toDouble()
-     */
-    public double[] toSplitDouble() {
-        double split[] = new double[2];
-        long mask = 0xffffffffc0000000L;
-
-        split[0] = Double.longBitsToDouble(Double.doubleToLongBits(toDouble()) & mask);
-        split[1] = subtract(newInstance(split[0])).toDouble();
-
-        return split;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public double getReal() {
-        return toDouble();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp add(final double a) {
-        return add(newInstance(a));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp subtract(final double a) {
-        return subtract(newInstance(a));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp multiply(final double a) {
-        return multiply(newInstance(a));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp divide(final double a) {
-        return divide(newInstance(a));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp remainder(final double a) {
-        return remainder(newInstance(a));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public long round() {
-        return FastMath.round(toDouble());
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp signum() {
-        if (isNaN() || isZero()) {
-            return this;
-        } else {
-            return newInstance(sign > 0 ? +1 : -1);
-        }
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp copySign(final Dfp s) {
-        if ((sign >= 0 && s.sign >= 0) || (sign < 0 && s.sign < 0)) { // Sign is currently OK
-            return this;
-        }
-        return negate(); // flip sign
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp copySign(final double s) {
-        long sb = Double.doubleToLongBits(s);
-        if ((sign >= 0 && sb >= 0) || (sign < 0 && sb < 0)) { // Sign is currently OK
-            return this;
-        }
-        return negate(); // flip sign
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp scalb(final int n) {
-        return multiply(DfpMath.pow(getTwo(), n));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp hypot(final Dfp y) {
-        return multiply(this).add(y.multiply(y)).sqrt();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp cbrt() {
-        return rootN(3);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp rootN(final int n) {
-        return (sign >= 0) ?
-               DfpMath.pow(this, getOne().divide(n)) :
-               DfpMath.pow(negate(), getOne().divide(n)).negate();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp pow(final double p) {
-        return DfpMath.pow(this, newInstance(p));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp pow(final int n) {
-        return DfpMath.pow(this, n);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp pow(final Dfp e) {
-        return DfpMath.pow(this, e);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp exp() {
-        return DfpMath.exp(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp expm1() {
-        return DfpMath.exp(this).subtract(getOne());
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp log() {
-        return DfpMath.log(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp log1p() {
-        return DfpMath.log(this.add(getOne()));
-    }
-
-//  TODO: deactivate this implementation (and return type) in 4.0
-    /** Get the exponent of the greatest power of 10 that is less than or equal to abs(this).
-     *  @return integer base 10 logarithm
-     *  @deprecated as of 3.2, replaced by {@link #intLog10()}, in 4.0 the return type
-     *  will be changed to Dfp
-     */
-    @Deprecated
-    public int log10()  {
-        return intLog10();
-    }
-
-//    TODO: activate this implementation (and return type) in 4.0
-//    /** {@inheritDoc}
-//     * @since 3.2
-//     */
-//    public Dfp log10() {
-//        return DfpMath.log(this).divide(DfpMath.log(newInstance(10)));
-//    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp cos() {
-        return DfpMath.cos(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp sin() {
-        return DfpMath.sin(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp tan() {
-        return DfpMath.tan(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp acos() {
-        return DfpMath.acos(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp asin() {
-        return DfpMath.asin(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp atan() {
-        return DfpMath.atan(this);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp atan2(final Dfp x)
-        throws DimensionMismatchException {
-
-        // compute r = sqrt(x^2+y^2)
-        final Dfp r = x.multiply(x).add(multiply(this)).sqrt();
-
-        if (x.sign >= 0) {
-
-            // compute atan2(y, x) = 2 atan(y / (r + x))
-            return getTwo().multiply(divide(r.add(x)).atan());
-
-        } else {
-
-            // compute atan2(y, x) = +/- pi - 2 atan(y / (r - x))
-            final Dfp tmp = getTwo().multiply(divide(r.subtract(x)).atan());
-            final Dfp pmPi = newInstance((tmp.sign <= 0) ? -FastMath.PI : FastMath.PI);
-            return pmPi.subtract(tmp);
-
-        }
-
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp cosh() {
-        return DfpMath.exp(this).add(DfpMath.exp(negate())).divide(2);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp sinh() {
-        return DfpMath.exp(this).subtract(DfpMath.exp(negate())).divide(2);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp tanh() {
-        final Dfp ePlus  = DfpMath.exp(this);
-        final Dfp eMinus = DfpMath.exp(negate());
-        return ePlus.subtract(eMinus).divide(ePlus.add(eMinus));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp acosh() {
-        return multiply(this).subtract(getOne()).sqrt().add(this).log();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp asinh() {
-        return multiply(this).add(getOne()).sqrt().add(this).log();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp atanh() {
-        return getOne().add(this).divide(getOne().subtract(this)).log().divide(2);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final Dfp[] a, final Dfp[] b)
-        throws DimensionMismatchException {
-        if (a.length != b.length) {
-            throw new DimensionMismatchException(a.length, b.length);
-        }
-        Dfp r = getZero();
-        for (int i = 0; i < a.length; ++i) {
-            r = r.add(a[i].multiply(b[i]));
-        }
-        return r;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final double[] a, final Dfp[] b)
-        throws DimensionMismatchException {
-        if (a.length != b.length) {
-            throw new DimensionMismatchException(a.length, b.length);
-        }
-        Dfp r = getZero();
-        for (int i = 0; i < a.length; ++i) {
-            r = r.add(b[i].multiply(a[i]));
-        }
-        return r;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final Dfp a1, final Dfp b1, final Dfp a2, final Dfp b2) {
-        return a1.multiply(b1).add(a2.multiply(b2));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final double a1, final Dfp b1, final double a2, final Dfp b2) {
-        return b1.multiply(a1).add(b2.multiply(a2));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final Dfp a1, final Dfp b1,
-                                 final Dfp a2, final Dfp b2,
-                                 final Dfp a3, final Dfp b3) {
-        return a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final double a1, final Dfp b1,
-                                 final double a2, final Dfp b2,
-                                 final double a3, final Dfp b3) {
-        return b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final Dfp a1, final Dfp b1, final Dfp a2, final Dfp b2,
-                                 final Dfp a3, final Dfp b3, final Dfp a4, final Dfp b4) {
-        return a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3)).add(a4.multiply(b4));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.2
-     */
-    public Dfp linearCombination(final double a1, final Dfp b1, final double a2, final Dfp b2,
-                                 final double a3, final Dfp b3, final double a4, final Dfp b4) {
-        return b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3)).add(b4.multiply(a4));
-    }
-
-}


[81/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 73cafa4..08172f4 100644
--- a/README.md
+++ b/README.md
@@ -62,7 +62,7 @@ Alternatively you can pull it from the central Maven repositories:
 <dependency>
   <groupId>org.apache.commons</groupId>
   <artifactId>commons-math3</artifactId>
-  <version>3.4</version>
+  <version>3.4.1</version>
 </dependency>
 ```
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/build.xml
----------------------------------------------------------------------
diff --git a/build.xml b/build.xml
index 09177b0..8072d8e 100644
--- a/build.xml
+++ b/build.xml
@@ -44,13 +44,13 @@
   <property name="component.name"          value="commons-math"/>
 
   <!-- The primary package name of this component -->
-  <property name="component.package"       value="org.apache.commons.math3"/>
+  <property name="component.package"       value="org.apache.commons.math4"/>
 
   <!-- The title of this component -->
   <property name="component.title"         value="Commons MATH"/>
 
   <!-- The current version number of this component -->
-  <property name="component.version"       value="3.1-SNAPSHOT"/>
+  <property name="component.version"       value="4.0-SNAPSHOT"/>
 
   <!-- The base directory for component sources -->
   <property name="source.home"             value="src/main/java"/>
@@ -203,7 +203,7 @@
                <classpath refid="test.classpath"/>
                <!-- If test.entry is defined, run a single test, otherwise run all valid tests -->
                <!-- N.B. test.entry must be the full path to the test class, for example:
-               ant test -Dtest.entry=org.apache.commons.math3.util.FastMathTestPerformance
+               ant test -Dtest.entry=org.apache.commons.math4.util.FastMathTestPerformance
                -->
                <test name="${test.entry}" todir="${test.reports}" if="test.entry"/>
                <batchtest todir="${test.reports}" unless="test.entry">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/clirr-ignored.xml
----------------------------------------------------------------------
diff --git a/clirr-ignored.xml b/clirr-ignored.xml
index 297b0de..1e90cae 100644
--- a/clirr-ignored.xml
+++ b/clirr-ignored.xml
@@ -19,166 +19,166 @@
 <differences>
 
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Region</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Region</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>org.apache.commons.math3.geometry.partitioning.Region$Location checkPoint(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.partitioning.Region$Location checkPoint(org.apache.commons.math3.geometry.Point)</to>
+    <method>org.apache.commons.math4.geometry.partitioning.Region$Location checkPoint(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.partitioning.Region$Location checkPoint(org.apache.commons.math4.geometry.Point)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Region</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Region</className>
     <differenceType>7012</differenceType> <!-- Method Added to Interface -->
     <method>boolean isFull()</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Region</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Region</className>
     <differenceType>7012</differenceType> <!-- Method Added to Interface -->
-    <method>boolean isFull(org.apache.commons.math3.geometry.partitioning.BSPTree)</method>
+    <method>boolean isFull(org.apache.commons.math4.geometry.partitioning.BSPTree)</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Region</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Region</className>
     <differenceType>7012</differenceType> <!-- Method Added to Interface -->
-    <method>org.apache.commons.math3.geometry.partitioning.BoundaryProjection projectToBoundary(org.apache.commons.math3.geometry.Point)</method>
+    <method>org.apache.commons.math4.geometry.partitioning.BoundaryProjection projectToBoundary(org.apache.commons.math4.geometry.Point)</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Region</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Region</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector getBarycenter()</method>
-    <to>org.apache.commons.math3.geometry.Point</to>
+    <method>org.apache.commons.math4.geometry.Vector getBarycenter()</method>
+    <to>org.apache.commons.math4.geometry.Point</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Hyperplane</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Hyperplane</className>
     <differenceType>7012</differenceType> <!-- Method Added to Interface -->
     <method>double getTolerance()</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Hyperplane</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Hyperplane</className>
     <differenceType>7012</differenceType> <!-- Method Added to Interface -->
-    <method>org.apache.commons.math3.geometry.Point project(org.apache.commons.math3.geometry.Point)</method>
+    <method>org.apache.commons.math4.geometry.Point project(org.apache.commons.math4.geometry.Point)</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Hyperplane</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Hyperplane</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>double getOffset(org.apache.commons.math3.geometry.Vector)</method>
-    <to>double getOffset(org.apache.commons.math3.geometry.Point)</to>
+    <method>double getOffset(org.apache.commons.math4.geometry.Vector)</method>
+    <to>double getOffset(org.apache.commons.math4.geometry.Point)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Embedding</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Embedding</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Point)</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Point)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Embedding</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Embedding</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Point</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Point</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Embedding</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Embedding</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSubSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Point</to>
+    <method>org.apache.commons.math4.geometry.Vector toSubSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Point</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Transform</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Transform</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector apply(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Vector apply(org.apache.commons.math3.geometry.Point)</to>
+    <method>org.apache.commons.math4.geometry.Vector apply(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Vector apply(org.apache.commons.math4.geometry.Point)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/Transform</className>
+    <className>org/apache/commons/math4/geometry/partitioning/Transform</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector apply(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Point</to>
+    <method>org.apache.commons.math4.geometry.Vector apply(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Point</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/AbstractRegion</className>
+    <className>org/apache/commons/math4/geometry/partitioning/AbstractRegion</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>AbstractRegion(org.apache.commons.math3.geometry.partitioning.BSPTree)</method>
+    <method>AbstractRegion(org.apache.commons.math4.geometry.partitioning.BSPTree)</method>
     <to>AbstractRegion(double)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/AbstractRegion</className>
+    <className>org/apache/commons/math4/geometry/partitioning/AbstractRegion</className>
     <differenceType>7004</differenceType> <!-- Method Argument Count Changed -->
     <method>AbstractRegion(java.util.Collection)</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/AbstractRegion</className>
+    <className>org/apache/commons/math4/geometry/partitioning/AbstractRegion</className>
     <differenceType>7004</differenceType> <!-- Method Argument Count Changed -->
     <method>AbstractRegion()</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/AbstractRegion</className>
+    <className>org/apache/commons/math4/geometry/partitioning/AbstractRegion</className>
     <differenceType>7004</differenceType> <!-- Method Argument Count Changed -->
-    <method>AbstractRegion(org.apache.commons.math3.geometry.partitioning.Hyperplane[])</method>
+    <method>AbstractRegion(org.apache.commons.math4.geometry.partitioning.Hyperplane[])</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/AbstractRegion</className>
+    <className>org/apache/commons/math4/geometry/partitioning/AbstractRegion</className>
     <differenceType>7009</differenceType> <!-- Method is now Less Accessible -->
-    <method>AbstractRegion(org.apache.commons.math3.geometry.partitioning.Hyperplane[])</method>
+    <method>AbstractRegion(org.apache.commons.math4.geometry.partitioning.Hyperplane[])</method>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/partitioning/AbstractRegion</className>
+    <className>org/apache/commons/math4/geometry/partitioning/AbstractRegion</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector getBarycenter()</method>
-    <to>org.apache.commons.math3.geometry.Point</to>
+    <method>org.apache.commons.math4.geometry.Vector getBarycenter()</method>
+    <to>org.apache.commons.math4.geometry.Point</to>
   </difference>
 
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/threed/Plane</className>
+    <className>org/apache/commons/math4/geometry/euclidean/threed/Plane</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Point)</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Point)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/threed/Plane</className>
+    <className>org/apache/commons/math4/geometry/euclidean/threed/Plane</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.euclidean.threed.Vector3D</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.euclidean.threed.Vector3D</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/threed/Plane</className>
+    <className>org/apache/commons/math4/geometry/euclidean/threed/Plane</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSubSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.euclidean.twod.Vector2D</to>
+    <method>org.apache.commons.math4.geometry.Vector toSubSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.euclidean.twod.Vector2D</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/threed/Line</className>
+    <className>org/apache/commons/math4/geometry/euclidean/threed/Line</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Point)</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Point)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/threed/Line</className>
+    <className>org/apache/commons/math4/geometry/euclidean/threed/Line</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.euclidean.threed.Vector3D</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.euclidean.threed.Vector3D</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/threed/Line</className>
+    <className>org/apache/commons/math4/geometry/euclidean/threed/Line</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSubSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.euclidean.oned.Vector1D</to>
+    <method>org.apache.commons.math4.geometry.Vector toSubSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.euclidean.oned.Vector1D</to>
   </difference>
 
 
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/twod/Line</className>
+    <className>org/apache/commons/math4/geometry/euclidean/twod/Line</className>
     <differenceType>7005</differenceType> <!-- Method Argument Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Point)</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Point)</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/twod/Line</className>
+    <className>org/apache/commons/math4/geometry/euclidean/twod/Line</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.euclidean.twod.Vector2D</to>
+    <method>org.apache.commons.math4.geometry.Vector toSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.euclidean.twod.Vector2D</to>
   </difference>
   <difference>
-    <className>org/apache/commons/math3/geometry/euclidean/twod/Line</className>
+    <className>org/apache/commons/math4/geometry/euclidean/twod/Line</className>
     <differenceType>7006</differenceType> <!-- Method Return Type changed -->
-    <method>org.apache.commons.math3.geometry.Vector toSubSpace(org.apache.commons.math3.geometry.Vector)</method>
-    <to>org.apache.commons.math3.geometry.euclidean.oned.Vector1D</to>
+    <method>org.apache.commons.math4.geometry.Vector toSubSpace(org.apache.commons.math4.geometry.Vector)</method>
+    <to>org.apache.commons.math4.geometry.euclidean.oned.Vector1D</to>
   </difference>
 
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/findbugs-exclude-filter.xml
----------------------------------------------------------------------
diff --git a/findbugs-exclude-filter.xml b/findbugs-exclude-filter.xml
index b971772..6659ad5 100644
--- a/findbugs-exclude-filter.xml
+++ b/findbugs-exclude-filter.xml
@@ -26,12 +26,12 @@
   <!--  the following equality tests are part of the reference algorithms -->
   <!--  which already know about limited precision of the double numbers -->
   <Match>
-    <Class name="org.apache.commons.math3.analysis.solvers.BaseSecantSolver" />
+    <Class name="org.apache.commons.math4.analysis.solvers.BaseSecantSolver" />
     <Method name="doSolve" params="" returns="double" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.distribution.SaddlePointExpansion" />
+    <Class name="org.apache.commons.math4.distribution.SaddlePointExpansion" />
     <Or>
       <Method name="getDeviancePart" params="double,double" returns="double" />
       <Method name="getStirlingError" params="double" returns="double" />
@@ -39,91 +39,91 @@
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optimization.univariate.BrentOptimizer" />
+    <Class name="org.apache.commons.math4.optimization.univariate.BrentOptimizer" />
     <Method name="localMin" params="boolean,double,double,double,double,double" returns="double" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optim.univariate.BrentOptimizer" />
+    <Class name="org.apache.commons.math4.optim.univariate.BrentOptimizer" />
     <Method name="localMin" params="boolean,double,double,double,double,double" returns="double" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.analysis.solvers.BrentSolver" />
+    <Class name="org.apache.commons.math4.analysis.solvers.BrentSolver" />
     <Method name="brent" params="double,double,double,double" returns="double" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.analysis.solvers.MullerSolver" />
+    <Class name="org.apache.commons.math4.analysis.solvers.MullerSolver" />
     <Or>
       <Method name="solve"  params="double,double,double,double" returns="double" />
     </Or>
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.analysis.solvers.MullerSolver2" />
+    <Class name="org.apache.commons.math4.analysis.solvers.MullerSolver2" />
     <Or>
       <Method name="doSolve"  params="" returns="double" />
     </Or>
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.EigenDecomposition" />
+    <Class name="org.apache.commons.math4.linear.EigenDecomposition" />
     <Method name="findEigenVectors" params="double[][]" returns="void" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
     <Or>
-      <Class name="org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" />
-      <Class name="org.apache.commons.math3.optimization.direct.BOBYQAOptimizer" />
+      <Class name="org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" />
+      <Class name="org.apache.commons.math4.optimization.direct.BOBYQAOptimizer" />
     </Or>
     <Method name="altmov" params="int,double" returns="double[]" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer" />
-    <Method name="doOptimize" params="" returns="org.apache.commons.math3.optim.PointValuePair" />
+    <Class name="org.apache.commons.math4.optim.nonlinear.scalar.noderiv.CMAESOptimizer" />
+    <Method name="doOptimize" params="" returns="org.apache.commons.math4.optim.PointValuePair" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   
   <!-- The following equality test is intentional and needed for semantic purposes -->
   <Match>
     <Or>
-      <Class name="org.apache.commons.math3.geometry.euclidean.oned.Vector1D" />
-      <Class name="org.apache.commons.math3.geometry.euclidean.twod.Vector2D" />
-      <Class name="org.apache.commons.math3.geometry.euclidean.threed.Vector3D" />
+      <Class name="org.apache.commons.math4.geometry.euclidean.oned.Vector1D" />
+      <Class name="org.apache.commons.math4.geometry.euclidean.twod.Vector2D" />
+      <Class name="org.apache.commons.math4.geometry.euclidean.threed.Vector3D" />
     </Or>
     <Method name="equals" params="java.lang.Object" returns="boolean" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optimization.linear.LinearConstraint" />
+    <Class name="org.apache.commons.math4.optimization.linear.LinearConstraint" />
     <Method name="equals" params="java.lang.Object" returns="boolean" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optim.linear.LinearConstraint" />
+    <Class name="org.apache.commons.math4.optim.linear.LinearConstraint" />
     <Method name="equals" params="java.lang.Object" returns="boolean" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
 
   <!-- The following equality test is intentional and needed for rounding purposes -->
   <Match>
-    <Class name="org.apache.commons.math3.util.Precision" />
+    <Class name="org.apache.commons.math4.util.Precision" />
     <Method name="roundUnscaled" params="double,double,int" returns="double" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
 
   <!-- The following equality test is intentional for division protection -->
   <Match>
-    <Class name="org.apache.commons.math3.analysis.interpolation.LoessInterpolator" />
+    <Class name="org.apache.commons.math4.analysis.interpolation.LoessInterpolator" />
     <Method name="smooth" params="double[],double[]" returns="double[]" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
 
   <!-- The following equality test is intentional for infinity detection -->
   <Match>
-    <Class name="org.apache.commons.math3.util.FastMath" />
+    <Class name="org.apache.commons.math4.util.FastMath" />
     <Method name="atan2" params="double,double" returns="double" />
     <Bug pattern="FE_FLOATING_POINT_EQUALITY" />
   </Match>
@@ -134,8 +134,8 @@
    -->
   <Match>
     <Or>
-      <Class name="org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" />
-      <Class name="org.apache.commons.math3.optimization.direct.BOBYQAOptimizer" />
+      <Class name="org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer" />
+      <Class name="org.apache.commons.math4.optimization.direct.BOBYQAOptimizer" />
     </Or>
     <Or>
       <Method name="bobyqb" params="double[],double[]" returns="double" />
@@ -148,7 +148,7 @@
        (to be removed in 4.0)
     -->
   <Match>
-    <Class name="org.apache.commons.math3.optimization.general.AbstractLeastSquaresOptimizer" />
+    <Class name="org.apache.commons.math4.optimization.general.AbstractLeastSquaresOptimizer" />
     <Or>
       <Field name="weightedResidualJacobian" />
       <Field name="weightedResiduals" />
@@ -158,54 +158,54 @@
 
   <!-- Spurious: Findbugs confused by final local variables -->
   <Match>
-    <Class name="org.apache.commons.math3.util.FastMath" />
+    <Class name="org.apache.commons.math4.util.FastMath" />
     <Method name="atan" params="double,double,boolean" returns="double" />
     <Bug pattern="DLS_DEAD_LOCAL_STORE" />
   </Match>
 
   <!-- the following expositions of internal representation are intentional and documented -->
   <Match>
-    <Class name="org.apache.commons.math3.stat.regression.RegressionResults"/>
+    <Class name="org.apache.commons.math4.stat.regression.RegressionResults"/>
     <Method name="&lt;init>" params="double[],double[][],boolean,long,int,double,double,double,boolean,boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.stat.descriptive.AbstractUnivariateStatistic"/>
+    <Class name="org.apache.commons.math4.stat.descriptive.AbstractUnivariateStatistic"/>
     <Method name="getDataRef" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optimization.PointValuePair"/>
+    <Class name="org.apache.commons.math4.optimization.PointValuePair"/>
     <Method name="getPointRef" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optim.PointValuePair"/>
+    <Class name="org.apache.commons.math4.optim.PointValuePair"/>
     <Method name="getPointRef" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optimization.PointValuePair"/>
+    <Class name="org.apache.commons.math4.optimization.PointValuePair"/>
     <Method name="&lt;init>" params="double[],double,boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optim.PointValuePair"/>
+    <Class name="org.apache.commons.math4.optim.PointValuePair"/>
     <Method name="&lt;init>" params="double[],double,boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <!-- Serialization is handled by an internal class -->
   <Match>
     <Or>
-      <Class name="org.apache.commons.math3.optim.PointValuePair"/>
-      <Class name="org.apache.commons.math3.optim.PointVectorValuePair"/>
-      <Class name="org.apache.commons.math3.optimization.PointValuePair"/>
-      <Class name="org.apache.commons.math3.optimization.PointVectorValuePair"/>      
+      <Class name="org.apache.commons.math4.optim.PointValuePair"/>
+      <Class name="org.apache.commons.math4.optim.PointVectorValuePair"/>
+      <Class name="org.apache.commons.math4.optimization.PointValuePair"/>
+      <Class name="org.apache.commons.math4.optimization.PointVectorValuePair"/>      
     </Or>
     <Bug pattern="SE_NO_SUITABLE_CONSTRUCTOR" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optimization.PointVectorValuePair"/>
+    <Class name="org.apache.commons.math4.optimization.PointVectorValuePair"/>
     <Or>
       <Method name="getPointRef" params="" returns="double[]" />
       <Method name="getValueRef" params="" returns="double[]" />
@@ -213,7 +213,7 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optim.PointVectorValuePair"/>
+    <Class name="org.apache.commons.math4.optim.PointVectorValuePair"/>
     <Or>
       <Method name="getPointRef" params="" returns="double[]" />
       <Method name="getValueRef" params="" returns="double[]" />
@@ -221,22 +221,22 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optimization.PointVectorValuePair"/>
+    <Class name="org.apache.commons.math4.optimization.PointVectorValuePair"/>
     <Method name="&lt;init>" params="double[],double[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.optim.PointVectorValuePair"/>
+    <Class name="org.apache.commons.math4.optim.PointVectorValuePair"/>
     <Method name="&lt;init>" params="double[],double[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.ode.sampling.DummyStepInterpolator"/>
+    <Class name="org.apache.commons.math4.ode.sampling.DummyStepInterpolator"/>
     <Method name="&lt;init>" params="double[],double[],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.ode.sampling.AbstractStepInterpolator"/>
+    <Class name="org.apache.commons.math4.ode.sampling.AbstractStepInterpolator"/>
     <Or>
       <Method name="getInterpolatedState" params="" returns="double[]" />
       <Method name="getInterpolatedDerivatives" params="" returns="double[]" />
@@ -244,47 +244,47 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.ode.sampling.NordsieckStepInterpolator"/>
-    <Method name="reinitialize" params="double,double,double[],org.apache.commons.math3.linear.Array2DRowRealMatrix" returns="void" />
+    <Class name="org.apache.commons.math4.ode.sampling.NordsieckStepInterpolator"/>
+    <Method name="reinitialize" params="double,double,double[],org.apache.commons.math4.linear.Array2DRowRealMatrix" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.ode.sampling.NordsieckStepInterpolator"/>
+    <Class name="org.apache.commons.math4.ode.sampling.NordsieckStepInterpolator"/>
     <Method name="getInterpolatedStateVariation" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.Array2DRowRealMatrix"/>
+    <Class name="org.apache.commons.math4.linear.Array2DRowRealMatrix"/>
     <Method name="&lt;init>" params="double[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.Array2DRowRealMatrix"/>
+    <Class name="org.apache.commons.math4.linear.Array2DRowRealMatrix"/>
     <Method name="getDataRef" params="" returns="double[][]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.BlockFieldMatrix"/>
-    <Method name="&lt;init>" params="int,int,org.apache.commons.math3.FieldElement[][],boolean" returns="void" />
+    <Class name="org.apache.commons.math4.linear.BlockFieldMatrix"/>
+    <Method name="&lt;init>" params="int,int,org.apache.commons.math4.FieldElement[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.Array2DRowFieldMatrix"/>
-    <Method name="&lt;init>" params="org.apache.commons.math3.Field,org.apache.commons.math3.FieldElement[][],boolean" returns="void" />
+    <Class name="org.apache.commons.math4.linear.Array2DRowFieldMatrix"/>
+    <Method name="&lt;init>" params="org.apache.commons.math4.Field,org.apache.commons.math4.FieldElement[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.Array2DRowFieldMatrix"/>
-    <Method name="getDataRef" params="" returns="org.apache.commons.math3.FieldElement[][]" />
+    <Class name="org.apache.commons.math4.linear.Array2DRowFieldMatrix"/>
+    <Method name="getDataRef" params="" returns="org.apache.commons.math4.FieldElement[][]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.BlockRealMatrix"/>
+    <Class name="org.apache.commons.math4.linear.BlockRealMatrix"/>
     <Method name="&lt;init>" params="int,int,double[][],boolean" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.util.ResizableDoubleArray"/>
+    <Class name="org.apache.commons.math4.util.ResizableDoubleArray"/>
     <Or>
       <Method name="getValues"         params="" returns="double[]" />
       <Method name="getInternalValues" params="" returns="double[]" />
@@ -292,47 +292,47 @@
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.ArrayRealVector"/>
+    <Class name="org.apache.commons.math4.linear.ArrayRealVector"/>
     <Method name="getDataRef" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.ArrayFieldVector"/>
-    <Method name="getDataRef" params="" returns="org.apache.commons.math3.FieldElement[]" />
+    <Class name="org.apache.commons.math4.linear.ArrayFieldVector"/>
+    <Method name="getDataRef" params="" returns="org.apache.commons.math4.FieldElement[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.linear.DiagonalMatrix"/>
+    <Class name="org.apache.commons.math4.linear.DiagonalMatrix"/>
     <Method name="getDataRef" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <!-- The equals method for RealVector intentionally throws an exception -->
   <Match>
-    <Class name="org.apache.commons.math3.linear.RealVector"/>
+    <Class name="org.apache.commons.math4.linear.RealVector"/>
     <Bug pattern="EQ_UNUSUAL" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.stat.clustering.EuclideanIntegerPoint"/>
+    <Class name="org.apache.commons.math4.stat.clustering.EuclideanIntegerPoint"/>
     <Method name="&lt;init>" params="int[]" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.stat.clustering.EuclideanIntegerPoint"/>
+    <Class name="org.apache.commons.math4.stat.clustering.EuclideanIntegerPoint"/>
     <Method name="getPoint" params="" returns="int[]" />
     <Bug pattern="EI_EXPOSE_REP" />
   </Match>
   <Match>
     <Or>
-      <Class name="org.apache.commons.math3.stat.clustering.EuclideanDoublePoint"/>
-      <Class name="org.apache.commons.math3.ml.clustering.DoublePoint"/>      
+      <Class name="org.apache.commons.math4.stat.clustering.EuclideanDoublePoint"/>
+      <Class name="org.apache.commons.math4.ml.clustering.DoublePoint"/>      
     </Or>
     <Method name="&lt;init>" params="double[]" returns="void" />
     <Bug pattern="EI_EXPOSE_REP2" />
   </Match>
   <Match>
     <Or>
-      <Class name="org.apache.commons.math3.stat.clustering.EuclideanDoublePoint"/>
-      <Class name="org.apache.commons.math3.ml.clustering.DoublePoint"/>      
+      <Class name="org.apache.commons.math4.stat.clustering.EuclideanDoublePoint"/>
+      <Class name="org.apache.commons.math4.ml.clustering.DoublePoint"/>      
     </Or>
     <Method name="getPoint" params="" returns="double[]" />
     <Bug pattern="EI_EXPOSE_REP" />
@@ -340,44 +340,44 @@
 
   <!-- The following cases are intentional unit tests for null parameters -->
   <Match>
-    <Class name="org.apache.commons.math3.stat.StatUtilsTest" />
+    <Class name="org.apache.commons.math4.stat.StatUtilsTest" />
     <Method name="testPercentile" params="" returns="void" />
     <Bug pattern="NP_NULL_PARAM_DEREF_NONVIRTUAL" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.analysis.UnivariateRealSolverFactoryImplTest" />
+    <Class name="org.apache.commons.math4.analysis.UnivariateRealSolverFactoryImplTest" />
     <Method name="testNewNewtonSolverNull" params="" returns="void" />
     <Bug pattern="NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS" />
   </Match>
   <Match>
-    <Class name="org.apache.commons.math3.stat.regression.OLSMultipleLinearRegressionTest" />
+    <Class name="org.apache.commons.math4.stat.regression.OLSMultipleLinearRegressionTest" />
     <Method name="cannotAddNullYSampleData" params="" returns="void" />
     <Bug pattern="NP_NULL_PARAM_DEREF_ALL_TARGETS_DANGEROUS" />
   </Match>
   
   <!-- IntDoublePair intentionally implements Comparable inconsistently with equals -->
   <Match>
-    <Class name="org.apache.commons.math3.stat.ranking.NaturalRanking$IntDoublePair" />
+    <Class name="org.apache.commons.math4.stat.ranking.NaturalRanking$IntDoublePair" />
     <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS" />
   </Match>
 
   <!-- False positive warning from findbugs, the integer division result cast to double is correct here -->
   <Match>
-    <Class name="org.apache.commons.math3.stat.inference.MannWhitneyUTest" />
+    <Class name="org.apache.commons.math4.stat.inference.MannWhitneyUTest" />
     <Method name="mannWhitneyU" params="double[],double[]" returns="double" />
     <Bug pattern="ICAST_IDIV_CAST_TO_DOUBLE" />
   </Match>
 
   <!-- The following switch fall-through is intended. -->
   <Match>
-    <Class name="org.apache.commons.math3.ml.neuralnet.twod.NeuronSquareMesh2D" />
+    <Class name="org.apache.commons.math4.ml.neuralnet.twod.NeuronSquareMesh2D" />
     <Method name="createLinks" />
     <Bug pattern="SF_SWITCH_FALLTHROUGH" />
   </Match>
   
   <!-- Integer division results cast to double are intentional. -->
   <Match>
-    <Class name="org.apache.commons.math3.special.BesselJ" />
+    <Class name="org.apache.commons.math4.special.BesselJ" />
     <Method name="rjBesl" />
     <Bug pattern="ICAST_IDIV_CAST_TO_DOUBLE" />
   </Match>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index fbc5508..a36e84e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,8 +23,8 @@
   </parent>
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.commons</groupId>
-  <artifactId>commons-math3</artifactId>
-  <version>3.5-SNAPSHOT</version>
+  <artifactId>commons-math4</artifactId>
+  <version>4.0-SNAPSHOT</version>
   <name>Apache Commons Math</name>
 
   <inceptionYear>2003</inceptionYear>
@@ -359,6 +359,8 @@
     <!-- Do not change: "math" is the name of the component even if the
          name of the base package evolves with major release numbers
          (see "commons.osgi.symbolicName", below). -->
+    <!-- TODO: when releasing 4.0, the properties below need to be updated, and
+         the 3.x release artifacts need to be put int commons.release.3  -->
     <commons.componentid>math</commons.componentid>
     <!-- This value must reflect the current name of the base package. -->
     <commons.osgi.symbolicName>org.apache.commons.math3</commons.osgi.symbolicName>
@@ -484,7 +486,7 @@
                     <attribute name="X-Compile-Target-JDK" value="${maven.compiler.target}" />
                   </manifest>
                   <fileset dir="${project.build.directory}/test-classes"
-                           includes="org/apache/commons/math3/PerfTestUtils*" />
+                           includes="org/apache/commons/math4/PerfTestUtils*" />
                 </jar>
               </target>
             </configuration>
@@ -494,7 +496,7 @@
           </execution>
         </executions>
       </plugin>
-      <!--  Attaches the commons-math3 tools JAR to the Maven lifecycle
+      <!--  Attaches the commons-math4 tools JAR to the Maven lifecycle
             to ensure they will be signed and deployed as normal -->
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
@@ -589,21 +591,21 @@
 
             <!-- the following are test data files with specific syntax that cannot include
                  Apache header (and the contained data is public, it is not owned by Apache) -->
-            <exclude>src/test/resources/org/apache/commons/math3/random/testData.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/random/emptyFile.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/PiDigits.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/NumAcc3.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/Lew.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/NumAcc2.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/NumAcc1.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/Lottery.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/NumAcc4.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/Michelso.txt</exclude>
-            <exclude>src/test/resources/org/apache/commons/math3/stat/data/Mavro.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/random/testData.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/random/emptyFile.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/PiDigits.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/NumAcc3.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/Lew.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/NumAcc2.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/NumAcc1.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/Lottery.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/NumAcc4.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/Michelso.txt</exclude>
+            <exclude>src/test/resources/org/apache/commons/math4/stat/data/Mavro.txt</exclude>
 
             <!-- direction numbers for Sobol generation from Frances Y. Kuo and Stephen Joe,
                  available under a BSD-style license (see NOTICE.txt and LICENSE.txt) -->
-            <exclude>src/main/resources/assets/org/apache/commons/math3/random/new-joe-kuo-6.1000</exclude>
+            <exclude>src/main/resources/assets/org/apache/commons/math4/random/new-joe-kuo-6.1000</exclude>
 
             <!-- text file explaining reference to a public domain image -->
             <exclude>src/userguide/resources/references.txt</exclude>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 3309edf..621aab5 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,7 +53,7 @@ If the output is not quite correct, check for invisible trailing spaces!
     <release version="TBD" date="TBD" description="TBD">
     </release>
 
-    <release version="3.5" date="2015-01-11" description="">
+    <release version="4.0" date="XXXX-XX-XX" description="">
       <action dev="sebb" type="add" issue="MATH-1198">
         Simplified "FastMath#exp(double)" in order to avoid a potential
         Java 1.5 JIT bug when calling with negative infinity as argument.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/Field.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/Field.java b/src/main/java/org/apache/commons/math4/Field.java
index 618536c..ecc9342 100644
--- a/src/main/java/org/apache/commons/math4/Field.java
+++ b/src/main/java/org/apache/commons/math4/Field.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
 /**
  * Interface representing a <a href="http://mathworld.wolfram.com/Field.html">field</a>.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/FieldElement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/FieldElement.java b/src/main/java/org/apache/commons/math4/FieldElement.java
index 8a7533a..7732c00 100644
--- a/src/main/java/org/apache/commons/math4/FieldElement.java
+++ b/src/main/java/org/apache/commons/math4/FieldElement.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NullArgumentException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/RealFieldElement.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/RealFieldElement.java b/src/main/java/org/apache/commons/math4/RealFieldElement.java
index 0e54ba1..aa171f9 100644
--- a/src/main/java/org/apache/commons/math4/RealFieldElement.java
+++ b/src/main/java/org/apache/commons/math4/RealFieldElement.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /**
  * Interface representing a <a href="http://mathworld.wolfram.com/RealNumber.html">real</a>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/BivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/BivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/BivariateFunction.java
index d8aaca5..49ca210 100644
--- a/src/main/java/org/apache/commons/math4/analysis/BivariateFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/BivariateFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a bivariate real function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java
index c7fad48..8ca1ab9 100644
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * Extension of {@link MultivariateFunction} representing a differentiable
  * multivariate real function.
  * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction}
+ * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction}
  */
 @Deprecated
 public interface DifferentiableMultivariateFunction extends MultivariateFunction {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java
index 5bfa97b..7cc7688 100644
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * Extension of {@link MultivariateVectorFunction} representing a differentiable
  * multivariate vectorial function.
  * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction}
+ * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction}
  */
 @Deprecated
 public interface DifferentiableMultivariateVectorFunction

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java
index db0314c..a59f23f 100644
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateFunction.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * Extension of {@link UnivariateFunction} representing a differentiable univariate real function.
  *
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction}
+ * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction}
  */
 @Deprecated
 public interface DifferentiableUnivariateFunction

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java
index 375fcfd..7a6c688 100644
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateMatrixFunction.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * Extension of {@link UnivariateMatrixFunction} representing a differentiable univariate matrix function.
  *
  * @since 2.0
- * @deprecated as of 3.1 replaced by  {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableMatrixFunction}
+ * @deprecated as of 3.1 replaced by  {@link org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableMatrixFunction}
  */
 @Deprecated
 public interface DifferentiableUnivariateMatrixFunction

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java
index b5ab198..9b9a371 100644
--- a/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/DifferentiableUnivariateVectorFunction.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * Extension of {@link UnivariateVectorFunction} representing a differentiable univariate vectorial function.
  *
  * @since 2.0
- * @deprecated as of 3.1 replaced by {@link org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableVectorFunction}
+ * @deprecated as of 3.1 replaced by {@link org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableVectorFunction}
  */
 @Deprecated
 public interface DifferentiableUnivariateVectorFunction

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java b/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java
index 2bc1c48..ecb816d 100644
--- a/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java
+++ b/src/main/java/org/apache/commons/math4/analysis/FunctionUtils.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.function.Identity;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+package org.apache.commons.math4.analysis;
+
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Identity;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Utilities for manipulating function objects.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/MultivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/MultivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/MultivariateFunction.java
index f86ba2a..e694cdc 100644
--- a/src/main/java/org/apache/commons/math4/analysis/MultivariateFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/MultivariateFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a multivariate real function.
@@ -29,9 +29,9 @@ public interface MultivariateFunction {
      *
      * @param point Point at which the function must be evaluated.
      * @return the function value for the given point.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the parameter's dimension is wrong for the function being evaluated.
-     * @throws  org.apache.commons.math3.exception.MathIllegalArgumentException
+     * @throws  org.apache.commons.math4.exception.MathIllegalArgumentException
      * when the activated method itself can ascertain that preconditions,
      * specified in the API expressed at the level of the activated method,
      * have been violated.  In the vast majority of cases where Commons Math

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/MultivariateMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/MultivariateMatrixFunction.java b/src/main/java/org/apache/commons/math4/analysis/MultivariateMatrixFunction.java
index f064904..1f136d7 100644
--- a/src/main/java/org/apache/commons/math4/analysis/MultivariateMatrixFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/MultivariateMatrixFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a multivariate matrix function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/MultivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/MultivariateVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/MultivariateVectorFunction.java
index 26a69f2..14d62da 100644
--- a/src/main/java/org/apache/commons/math4/analysis/MultivariateVectorFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/MultivariateVectorFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a multivariate vectorial function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/ParametricUnivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/ParametricUnivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/ParametricUnivariateFunction.java
index 616b35d..86dc10b 100644
--- a/src/main/java/org/apache/commons/math4/analysis/ParametricUnivariateFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/ParametricUnivariateFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a real function that depends on one independent

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/TrivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/TrivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/TrivariateFunction.java
index 30ba767..b3934a5 100644
--- a/src/main/java/org/apache/commons/math4/analysis/TrivariateFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/TrivariateFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a trivariate real function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/UnivariateFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/UnivariateFunction.java b/src/main/java/org/apache/commons/math4/analysis/UnivariateFunction.java
index e99f1f3..3073d09 100644
--- a/src/main/java/org/apache/commons/math4/analysis/UnivariateFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/UnivariateFunction.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a univariate real function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/UnivariateMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/UnivariateMatrixFunction.java b/src/main/java/org/apache/commons/math4/analysis/UnivariateMatrixFunction.java
index 0c4b1a9..a364cb7 100644
--- a/src/main/java/org/apache/commons/math4/analysis/UnivariateMatrixFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/UnivariateMatrixFunction.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a univariate matrix function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/UnivariateVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/UnivariateVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/UnivariateVectorFunction.java
index 19a9e5d..c836ecb 100644
--- a/src/main/java/org/apache/commons/math4/analysis/UnivariateVectorFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/UnivariateVectorFunction.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
 /**
  * An interface representing a univariate vectorial function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
index 45a3331..979a6c0 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /** Class holding "compiled" computation rules for derivative structures.
  * <p>This class implements the computation rules described in Dan Kalman's paper <a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java
index 7c45d18..a179eba 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructure.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /** Class representing both the value and the differentials of a function.
  * <p>This class is the workhorse of the differentiation package.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiator.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiator.java
index ea92809..42e01ac 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiator.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
-import org.apache.commons.math3.analysis.UnivariateVectorFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateMatrixFunction;
+import org.apache.commons.math4.analysis.UnivariateVectorFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 
 /** Univariate functions differentiator using finite differences.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java
index 25aa7c7..0b75ae8 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/GradientFunction.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
 
 /** Class representing the gradient of a multivariate function.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java
index 0de47db..f7b8082 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/JacobianFunction.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
 
 /** Class representing the Jacobian of a multivariate vector function.
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableFunction.java
index 443671e..068e053 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableFunction.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Extension of {@link MultivariateFunction} representing a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
index a5987ae..fe2bd15 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/MultivariateDifferentiableVectorFunction.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
index 59fcea5..adff345 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/SparseGradient.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import java.io.Serializable;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * First derivative computation with large number of variables.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.java
index 097b4e0..7e651e6 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /** Interface for univariate functions derivatives.
  * <p>This interface represents a simple function which computes

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
index b31771b..26e5834 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.analysis.UnivariateMatrixFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Extension of {@link UnivariateMatrixFunction} representing a univariate differentiable matrix function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableVectorFunction.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
index 7e79eef..c4c2a0f 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.UnivariateVectorFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.analysis.UnivariateVectorFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Extension of {@link UnivariateVectorFunction} representing a univariate differentiable vectorial function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.java
index f19ce20..b4ec86e 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateFunctionDifferentiator.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
 
 /** Interface defining the function differentiation operation.
  * @since 3.1

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
index bc0ccf3..2c42ee5 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
+import org.apache.commons.math4.analysis.UnivariateMatrixFunction;
 
 /** Interface defining the function differentiation operation.
  * @since 3.1

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
index 5500c50..e197525 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.analysis.UnivariateVectorFunction;
+import org.apache.commons.math4.analysis.UnivariateVectorFunction;
 
 /** Interface defining the function differentiation operation.
  * @since 3.1

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/differentiation/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/differentiation/package-info.java b/src/main/java/org/apache/commons/math4/analysis/differentiation/package-info.java
index b828981..6b5f68c 100644
--- a/src/main/java/org/apache/commons/math4/analysis/differentiation/package-info.java
+++ b/src/main/java/org/apache/commons/math4/analysis/differentiation/package-info.java
@@ -19,19 +19,19 @@
  * <p>
  *   This package holds the main interfaces and basic building block classes
  *   dealing with differentiation.
- *   The core class is {@link org.apache.commons.math3.analysis.differentiation.DerivativeStructure
+ *   The core class is {@link org.apache.commons.math4.analysis.differentiation.DerivativeStructure
  *   DerivativeStructure} which holds the value and the differentials of a function. This class
  *   handles some arbitrary number of free parameters and arbitrary differentiation order. It is used
  *   both as the input and the output type for the {@link
- *   org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
+ *   org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction
  *   UnivariateDifferentiableFunction} interface. Any differentiable function should implement this
  *   interface.
  * </p>
  * <p>
- *   The {@link org.apache.commons.math3.analysis.differentiation.UnivariateFunctionDifferentiator
+ *   The {@link org.apache.commons.math4.analysis.differentiation.UnivariateFunctionDifferentiator
  *   UnivariateFunctionDifferentiator} interface defines a way to differentiate a simple {@link
- *   org.apache.commons.math3.analysis.UnivariateFunction UnivariateFunction} and get a {@link
- *   org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
+ *   org.apache.commons.math4.analysis.UnivariateFunction UnivariateFunction} and get a {@link
+ *   org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction
  *   UnivariateDifferentiableFunction}.
  * </p>
  * <p>
@@ -39,4 +39,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/analysis/function/Abs.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/analysis/function/Abs.java b/src/main/java/org/apache/commons/math4/analysis/function/Abs.java
index 9db01fd..6f19b54 100644
--- a/src/main/java/org/apache/commons/math4/analysis/function/Abs.java
+++ b/src/main/java/org/apache/commons/math4/analysis/function/Abs.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Absolute value function.


[26/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresBuilder.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresBuilder.java
deleted file mode 100644
index 7b14b37..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresBuilder.java
+++ /dev/null
@@ -1,226 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-
-/**
- * A mutable builder for {@link LeastSquaresProblem}s.
- *
- * @see LeastSquaresFactory
- * @since 3.3
- */
-public class LeastSquaresBuilder {
-
-    /** max evaluations */
-    private int maxEvaluations;
-    /** max iterations */
-    private int maxIterations;
-    /** convergence checker */
-    private ConvergenceChecker<Evaluation> checker;
-    /** model function */
-    private MultivariateJacobianFunction model;
-    /** observed values */
-    private RealVector target;
-    /** initial guess */
-    private RealVector start;
-    /** weight matrix */
-    private RealMatrix weight;
-    /**
-     * Lazy evaluation.
-     *
-     * @since 3.4
-     */
-    private boolean lazyEvaluation;
-    /** Validator.
-     *
-     * @since 3.4
-     */
-    private ParameterValidator paramValidator;
-
-
-    /**
-     * Construct a {@link LeastSquaresProblem} from the data in this builder.
-     *
-     * @return a new {@link LeastSquaresProblem}.
-     */
-    public LeastSquaresProblem build() {
-        return LeastSquaresFactory.create(model,
-                                          target,
-                                          start,
-                                          weight,
-                                          checker,
-                                          maxEvaluations,
-                                          maxIterations,
-                                          lazyEvaluation,
-                                          paramValidator);
-    }
-
-    /**
-     * Configure the max evaluations.
-     *
-     * @param newMaxEvaluations the maximum number of evaluations permitted.
-     * @return this
-     */
-    public LeastSquaresBuilder maxEvaluations(final int newMaxEvaluations) {
-        this.maxEvaluations = newMaxEvaluations;
-        return this;
-    }
-
-    /**
-     * Configure the max iterations.
-     *
-     * @param newMaxIterations the maximum number of iterations permitted.
-     * @return this
-     */
-    public LeastSquaresBuilder maxIterations(final int newMaxIterations) {
-        this.maxIterations = newMaxIterations;
-        return this;
-    }
-
-    /**
-     * Configure the convergence checker.
-     *
-     * @param newChecker the convergence checker.
-     * @return this
-     */
-    public LeastSquaresBuilder checker(final ConvergenceChecker<Evaluation> newChecker) {
-        this.checker = newChecker;
-        return this;
-    }
-
-    /**
-     * Configure the convergence checker.
-     * <p/>
-     * This function is an overloaded version of {@link #checker(ConvergenceChecker)}.
-     *
-     * @param newChecker the convergence checker.
-     * @return this
-     */
-    public LeastSquaresBuilder checkerPair(final ConvergenceChecker<PointVectorValuePair> newChecker) {
-        return this.checker(LeastSquaresFactory.evaluationChecker(newChecker));
-    }
-
-    /**
-     * Configure the model function.
-     *
-     * @param value the model function value
-     * @param jacobian the Jacobian of {@code value}
-     * @return this
-     */
-    public LeastSquaresBuilder model(final MultivariateVectorFunction value,
-                                     final MultivariateMatrixFunction jacobian) {
-        return model(LeastSquaresFactory.model(value, jacobian));
-    }
-
-    /**
-     * Configure the model function.
-     *
-     * @param newModel the model function value and Jacobian
-     * @return this
-     */
-    public LeastSquaresBuilder model(final MultivariateJacobianFunction newModel) {
-        this.model = newModel;
-        return this;
-    }
-
-    /**
-     * Configure the observed data.
-     *
-     * @param newTarget the observed data.
-     * @return this
-     */
-    public LeastSquaresBuilder target(final RealVector newTarget) {
-        this.target = newTarget;
-        return this;
-    }
-
-    /**
-     * Configure the observed data.
-     *
-     * @param newTarget the observed data.
-     * @return this
-     */
-    public LeastSquaresBuilder target(final double[] newTarget) {
-        return target(new ArrayRealVector(newTarget, false));
-    }
-
-    /**
-     * Configure the initial guess.
-     *
-     * @param newStart the initial guess.
-     * @return this
-     */
-    public LeastSquaresBuilder start(final RealVector newStart) {
-        this.start = newStart;
-        return this;
-    }
-
-    /**
-     * Configure the initial guess.
-     *
-     * @param newStart the initial guess.
-     * @return this
-     */
-    public LeastSquaresBuilder start(final double[] newStart) {
-        return start(new ArrayRealVector(newStart, false));
-    }
-
-    /**
-     * Configure the weight matrix.
-     *
-     * @param newWeight the weight matrix
-     * @return this
-     */
-    public LeastSquaresBuilder weight(final RealMatrix newWeight) {
-        this.weight = newWeight;
-        return this;
-    }
-
-    /**
-     * Configure whether evaluation will be lazy or not.
-     *
-     * @param newValue Whether to perform lazy evaluation.
-     * @return this object.
-     *
-     * @since 3.4
-     */
-    public LeastSquaresBuilder lazyEvaluation(final boolean newValue) {
-        lazyEvaluation = newValue;
-        return this;
-    }
-
-    /**
-     * Configure the validator of the model parameters.
-     *
-     * @param newValidator Parameter validator.
-     * @return this object.
-     *
-     * @since 3.4
-     */
-    public LeastSquaresBuilder parameterValidator(final ParameterValidator newValidator) {
-        paramValidator = newValidator;
-        return this;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java
deleted file mode 100644
index d483c26..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresFactory.java
+++ /dev/null
@@ -1,528 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.AbstractOptimizationProblem;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * A Factory for creating {@link LeastSquaresProblem}s.
- *
- * @since 3.3
- */
-public class LeastSquaresFactory {
-
-    /** Prevent instantiation. */
-    private LeastSquaresFactory() {}
-
-    /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
-     * from the given elements. There will be no weights applied (unit weights).
-     *
-     * @param model          the model function. Produces the computed values.
-     * @param observed       the observed (target) values
-     * @param start          the initial guess.
-     * @param weight         the weight matrix
-     * @param checker        convergence checker
-     * @param maxEvaluations the maximum number of times to evaluate the model
-     * @param maxIterations  the maximum number to times to iterate in the algorithm
-     * @param lazyEvaluation Whether the call to {@link Evaluation#evaluate(RealVector)}
-     * will defer the evaluation until access to the value is requested.
-     * @param paramValidator Model parameters validator.
-     * @return the specified General Least Squares problem.
-     *
-     * @since 3.4
-     */
-    public static LeastSquaresProblem create(final MultivariateJacobianFunction model,
-                                             final RealVector observed,
-                                             final RealVector start,
-                                             final RealMatrix weight,
-                                             final ConvergenceChecker<Evaluation> checker,
-                                             final int maxEvaluations,
-                                             final int maxIterations,
-                                             final boolean lazyEvaluation,
-                                             final ParameterValidator paramValidator) {
-        final LeastSquaresProblem p = new LocalLeastSquaresProblem(model,
-                                                                   observed,
-                                                                   start,
-                                                                   checker,
-                                                                   maxEvaluations,
-                                                                   maxIterations,
-                                                                   lazyEvaluation,
-                                                                   paramValidator);
-        if (weight != null) {
-            return weightMatrix(p, weight);
-        } else {
-            return p;
-        }
-    }
-
-    /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
-     * from the given elements. There will be no weights applied (unit weights).
-     *
-     * @param model          the model function. Produces the computed values.
-     * @param observed       the observed (target) values
-     * @param start          the initial guess.
-     * @param checker        convergence checker
-     * @param maxEvaluations the maximum number of times to evaluate the model
-     * @param maxIterations  the maximum number to times to iterate in the algorithm
-     * @return the specified General Least Squares problem.
-     */
-    public static LeastSquaresProblem create(final MultivariateJacobianFunction model,
-                                             final RealVector observed,
-                                             final RealVector start,
-                                             final ConvergenceChecker<Evaluation> checker,
-                                             final int maxEvaluations,
-                                             final int maxIterations) {
-        return create(model,
-                      observed,
-                      start,
-                      null,
-                      checker,
-                      maxEvaluations,
-                      maxIterations,
-                      false,
-                      null);
-    }
-
-    /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
-     * from the given elements.
-     *
-     * @param model          the model function. Produces the computed values.
-     * @param observed       the observed (target) values
-     * @param start          the initial guess.
-     * @param weight         the weight matrix
-     * @param checker        convergence checker
-     * @param maxEvaluations the maximum number of times to evaluate the model
-     * @param maxIterations  the maximum number to times to iterate in the algorithm
-     * @return the specified General Least Squares problem.
-     */
-    public static LeastSquaresProblem create(final MultivariateJacobianFunction model,
-                                             final RealVector observed,
-                                             final RealVector start,
-                                             final RealMatrix weight,
-                                             final ConvergenceChecker<Evaluation> checker,
-                                             final int maxEvaluations,
-                                             final int maxIterations) {
-        return weightMatrix(create(model,
-                                   observed,
-                                   start,
-                                   checker,
-                                   maxEvaluations,
-                                   maxIterations),
-                            weight);
-    }
-
-    /**
-     * Create a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem}
-     * from the given elements.
-     * <p>
-     * This factory method is provided for continuity with previous interfaces. Newer
-     * applications should use {@link #create(MultivariateJacobianFunction, RealVector,
-     * RealVector, ConvergenceChecker, int, int)}, or {@link #create(MultivariateJacobianFunction,
-     * RealVector, RealVector, RealMatrix, ConvergenceChecker, int, int)}.
-     *
-     * @param model          the model function. Produces the computed values.
-     * @param jacobian       the jacobian of the model with respect to the parameters
-     * @param observed       the observed (target) values
-     * @param start          the initial guess.
-     * @param weight         the weight matrix
-     * @param checker        convergence checker
-     * @param maxEvaluations the maximum number of times to evaluate the model
-     * @param maxIterations  the maximum number to times to iterate in the algorithm
-     * @return the specified General Least Squares problem.
-     */
-    public static LeastSquaresProblem create(final MultivariateVectorFunction model,
-                                             final MultivariateMatrixFunction jacobian,
-                                             final double[] observed,
-                                             final double[] start,
-                                             final RealMatrix weight,
-                                             final ConvergenceChecker<Evaluation> checker,
-                                             final int maxEvaluations,
-                                             final int maxIterations) {
-        return create(model(model, jacobian),
-                      new ArrayRealVector(observed, false),
-                      new ArrayRealVector(start, false),
-                      weight,
-                      checker,
-                      maxEvaluations,
-                      maxIterations);
-    }
-
-    /**
-     * Apply a dense weight matrix to the {@link LeastSquaresProblem}.
-     *
-     * @param problem the unweighted problem
-     * @param weights the matrix of weights
-     * @return a new {@link LeastSquaresProblem} with the weights applied. The original
-     *         {@code problem} is not modified.
-     */
-    public static LeastSquaresProblem weightMatrix(final LeastSquaresProblem problem,
-                                                   final RealMatrix weights) {
-        final RealMatrix weightSquareRoot = squareRoot(weights);
-        return new LeastSquaresAdapter(problem) {
-            @Override
-            public Evaluation evaluate(final RealVector point) {
-                return new DenseWeightedEvaluation(super.evaluate(point), weightSquareRoot);
-            }
-        };
-    }
-
-    /**
-     * Apply a diagonal weight matrix to the {@link LeastSquaresProblem}.
-     *
-     * @param problem the unweighted problem
-     * @param weights the diagonal of the weight matrix
-     * @return a new {@link LeastSquaresProblem} with the weights applied. The original
-     *         {@code problem} is not modified.
-     */
-    public static LeastSquaresProblem weightDiagonal(final LeastSquaresProblem problem,
-                                                     final RealVector weights) {
-        // TODO more efficient implementation
-        return weightMatrix(problem, new DiagonalMatrix(weights.toArray()));
-    }
-
-    /**
-     * Count the evaluations of a particular problem. The {@code counter} will be
-     * incremented every time {@link LeastSquaresProblem#evaluate(RealVector)} is called on
-     * the <em>returned</em> problem.
-     *
-     * @param problem the problem to track.
-     * @param counter the counter to increment.
-     * @return a least squares problem that tracks evaluations
-     */
-    public static LeastSquaresProblem countEvaluations(final LeastSquaresProblem problem,
-                                                       final Incrementor counter) {
-        return new LeastSquaresAdapter(problem) {
-
-            public Evaluation evaluate(final RealVector point) {
-                counter.incrementCount();
-                return super.evaluate(point);
-            }
-
-            // Delegate the rest.
-        };
-    }
-
-    /**
-     * View a convergence checker specified for a {@link PointVectorValuePair} as one
-     * specified for an {@link Evaluation}.
-     *
-     * @param checker the convergence checker to adapt.
-     * @return a convergence checker that delegates to {@code checker}.
-     */
-    public static ConvergenceChecker<Evaluation> evaluationChecker(final ConvergenceChecker<PointVectorValuePair> checker) {
-        return new ConvergenceChecker<Evaluation>() {
-            public boolean converged(final int iteration,
-                                     final Evaluation previous,
-                                     final Evaluation current) {
-                return checker.converged(
-                        iteration,
-                        new PointVectorValuePair(
-                                previous.getPoint().toArray(),
-                                previous.getResiduals().toArray(),
-                                false),
-                        new PointVectorValuePair(
-                                current.getPoint().toArray(),
-                                current.getResiduals().toArray(),
-                                false)
-                );
-            }
-        };
-    }
-
-    /**
-     * Computes the square-root of the weight matrix.
-     *
-     * @param m Symmetric, positive-definite (weight) matrix.
-     * @return the square-root of the weight matrix.
-     */
-    private static RealMatrix squareRoot(final RealMatrix m) {
-        if (m instanceof DiagonalMatrix) {
-            final int dim = m.getRowDimension();
-            final RealMatrix sqrtM = new DiagonalMatrix(dim);
-            for (int i = 0; i < dim; i++) {
-                sqrtM.setEntry(i, i, FastMath.sqrt(m.getEntry(i, i)));
-            }
-            return sqrtM;
-        } else {
-            final EigenDecomposition dec = new EigenDecomposition(m);
-            return dec.getSquareRoot();
-        }
-    }
-
-    /**
-     * Combine a {@link MultivariateVectorFunction} with a {@link
-     * MultivariateMatrixFunction} to produce a {@link MultivariateJacobianFunction}.
-     *
-     * @param value    the vector value function
-     * @param jacobian the Jacobian function
-     * @return a function that computes both at the same time
-     */
-    public static MultivariateJacobianFunction model(final MultivariateVectorFunction value,
-                                                     final MultivariateMatrixFunction jacobian) {
-        return new LocalValueAndJacobianFunction(value, jacobian);
-    }
-
-    /**
-     * Combine a {@link MultivariateVectorFunction} with a {@link
-     * MultivariateMatrixFunction} to produce a {@link MultivariateJacobianFunction}.
-     *
-     * @param value    the vector value function
-     * @param jacobian the Jacobian function
-     * @return a function that computes both at the same time
-     */
-    private static class LocalValueAndJacobianFunction
-        implements ValueAndJacobianFunction {
-        /** Model. */
-        private final MultivariateVectorFunction value;
-        /** Model's Jacobian. */
-        private final MultivariateMatrixFunction jacobian;
-
-        /**
-         * @param value Model function.
-         * @param jacobian Model's Jacobian function.
-         */
-        LocalValueAndJacobianFunction(final MultivariateVectorFunction value,
-                                      final MultivariateMatrixFunction jacobian) {
-            this.value = value;
-            this.jacobian = jacobian;
-        }
-
-        /** {@inheritDoc} */
-        public Pair<RealVector, RealMatrix> value(final RealVector point) {
-            //TODO get array from RealVector without copying?
-            final double[] p = point.toArray();
-
-            // Evaluate.
-            return new Pair<RealVector, RealMatrix>(computeValue(p),
-                                                    computeJacobian(p));
-        }
-
-        /** {@inheritDoc} */
-        public RealVector computeValue(final double[] params) {
-            return new ArrayRealVector(value.value(params), false);
-        }
-
-        /** {@inheritDoc} */
-        public RealMatrix computeJacobian(final double[] params) {
-            return new Array2DRowRealMatrix(jacobian.value(params), false);
-        }
-    }
-
-
-    /**
-     * A private, "field" immutable (not "real" immutable) implementation of {@link
-     * LeastSquaresProblem}.
-     * @since 3.3
-     */
-    private static class LocalLeastSquaresProblem
-            extends AbstractOptimizationProblem<Evaluation>
-            implements LeastSquaresProblem {
-
-        /** Target values for the model function at optimum. */
-        private final RealVector target;
-        /** Model function. */
-        private final MultivariateJacobianFunction model;
-        /** Initial guess. */
-        private final RealVector start;
-        /** Whether to use lazy evaluation. */
-        private final boolean lazyEvaluation;
-        /** Model parameters validator. */
-        private final ParameterValidator paramValidator;
-
-        /**
-         * Create a {@link LeastSquaresProblem} from the given data.
-         *
-         * @param model          the model function
-         * @param target         the observed data
-         * @param start          the initial guess
-         * @param checker        the convergence checker
-         * @param maxEvaluations the allowed evaluations
-         * @param maxIterations  the allowed iterations
-         * @param lazyEvaluation Whether the call to {@link Evaluation#evaluate(RealVector)}
-         * will defer the evaluation until access to the value is requested.
-         * @param paramValidator Model parameters validator.
-         */
-        LocalLeastSquaresProblem(final MultivariateJacobianFunction model,
-                                 final RealVector target,
-                                 final RealVector start,
-                                 final ConvergenceChecker<Evaluation> checker,
-                                 final int maxEvaluations,
-                                 final int maxIterations,
-                                 final boolean lazyEvaluation,
-                                 final ParameterValidator paramValidator) {
-            super(maxEvaluations, maxIterations, checker);
-            this.target = target;
-            this.model = model;
-            this.start = start;
-            this.lazyEvaluation = lazyEvaluation;
-            this.paramValidator = paramValidator;
-
-            if (lazyEvaluation &&
-                !(model instanceof ValueAndJacobianFunction)) {
-                // Lazy evaluation requires that value and Jacobian
-                // can be computed separately.
-                throw new MathIllegalStateException(LocalizedFormats.INVALID_IMPLEMENTATION,
-                                                    model.getClass().getName());
-            }
-        }
-
-        /** {@inheritDoc} */
-        public int getObservationSize() {
-            return target.getDimension();
-        }
-
-        /** {@inheritDoc} */
-        public int getParameterSize() {
-            return start.getDimension();
-        }
-
-        /** {@inheritDoc} */
-        public RealVector getStart() {
-            return start == null ? null : start.copy();
-        }
-
-        /** {@inheritDoc} */
-        public Evaluation evaluate(final RealVector point) {
-            // Copy so optimizer can change point without changing our instance.
-            final RealVector p = paramValidator == null ?
-                point.copy() :
-                paramValidator.validate(point.copy());
-
-            if (lazyEvaluation) {
-                return new LazyUnweightedEvaluation((ValueAndJacobianFunction) model,
-                                                    target,
-                                                    p);
-            } else {
-                // Evaluate value and jacobian in one function call.
-                final Pair<RealVector, RealMatrix> value = model.value(p);
-                return new UnweightedEvaluation(value.getFirst(),
-                                                value.getSecond(),
-                                                target,
-                                                p);
-            }
-        }
-
-        /**
-         * Container with the model evaluation at a particular point.
-         */
-        private static class UnweightedEvaluation extends AbstractEvaluation {
-            /** Point of evaluation. */
-            private final RealVector point;
-            /** Derivative at point. */
-            private final RealMatrix jacobian;
-            /** Computed residuals. */
-            private final RealVector residuals;
-
-            /**
-             * Create an {@link Evaluation} with no weights.
-             *
-             * @param values   the computed function values
-             * @param jacobian the computed function Jacobian
-             * @param target   the observed values
-             * @param point    the abscissa
-             */
-            private UnweightedEvaluation(final RealVector values,
-                                         final RealMatrix jacobian,
-                                         final RealVector target,
-                                         final RealVector point) {
-                super(target.getDimension());
-                this.jacobian = jacobian;
-                this.point = point;
-                this.residuals = target.subtract(values);
-            }
-
-            /** {@inheritDoc} */
-            public RealMatrix getJacobian() {
-                return jacobian;
-            }
-
-            /** {@inheritDoc} */
-            public RealVector getPoint() {
-                return point;
-            }
-
-            /** {@inheritDoc} */
-            public RealVector getResiduals() {
-                return residuals;
-            }
-        }
-
-        /**
-         * Container with the model <em>lazy</em> evaluation at a particular point.
-         */
-        private static class LazyUnweightedEvaluation extends AbstractEvaluation {
-            /** Point of evaluation. */
-            private final RealVector point;
-            /** Model and Jacobian functions. */
-            private final ValueAndJacobianFunction model;
-            /** Target values for the model function at optimum. */
-            private final RealVector target;
-
-            /**
-             * Create an {@link Evaluation} with no weights.
-             *
-             * @param model  the model function
-             * @param target the observed values
-             * @param point  the abscissa
-             */
-            private LazyUnweightedEvaluation(final ValueAndJacobianFunction model,
-                                             final RealVector target,
-                                             final RealVector point) {
-                super(target.getDimension());
-                // Safe to cast as long as we control usage of this class.
-                this.model = model;
-                this.point = point;
-                this.target = target;
-            }
-
-            /** {@inheritDoc} */
-            public RealMatrix getJacobian() {
-                return model.computeJacobian(point.toArray());
-            }
-
-            /** {@inheritDoc} */
-            public RealVector getPoint() {
-                return point;
-            }
-
-            /** {@inheritDoc} */
-            public RealVector getResiduals() {
-                return target.subtract(model.computeValue(point.toArray()));
-            }
-        }
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresOptimizer.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresOptimizer.java
deleted file mode 100644
index 50d5b8a..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresOptimizer.java
+++ /dev/null
@@ -1,62 +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.fitting.leastsquares;
-
-/**
- * An algorithm that can be applied to a non-linear least squares problem.
- *
- * @since 3.3
- */
-public interface LeastSquaresOptimizer {
-
-    /**
-     * Solve the non-linear least squares problem.
-     *
-     *
-     * @param leastSquaresProblem the problem definition, including model function and
-     *                            convergence criteria.
-     * @return The optimum.
-     */
-    Optimum optimize(LeastSquaresProblem leastSquaresProblem);
-
-    /**
-     * The optimum found by the optimizer. This object contains the point, its value, and
-     * some metadata.
-     */
-    //TODO Solution?
-    interface Optimum extends LeastSquaresProblem.Evaluation {
-
-        /**
-         * Get the number of times the model was evaluated in order to produce this
-         * optimum.
-         *
-         * @return the number of model (objective) function evaluations
-         */
-        int getEvaluations();
-
-        /**
-         * Get the number of times the algorithm iterated in order to produce this
-         * optimum. In general least squares it is common to have one {@link
-         * #getEvaluations() evaluation} per iterations.
-         *
-         * @return the number of iterations
-         */
-        int getIterations();
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java
deleted file mode 100644
index 097ff81..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LeastSquaresProblem.java
+++ /dev/null
@@ -1,156 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.OptimizationProblem;
-
-/**
- * The data necessary to define a non-linear least squares problem.
- * <p>
- * Includes the observed values, computed model function, and
- * convergence/divergence criteria. Weights are implicit in {@link
- * Evaluation#getResiduals()} and {@link Evaluation#getJacobian()}.
- * </p>
- * <p>
- * Instances are typically either created progressively using a {@link
- * LeastSquaresBuilder builder} or created at once using a {@link LeastSquaresFactory
- * factory}.
- * </p>
- * @see LeastSquaresBuilder
- * @see LeastSquaresFactory
- * @see LeastSquaresAdapter
- *
- * @since 3.3
- */
-public interface LeastSquaresProblem extends OptimizationProblem<LeastSquaresProblem.Evaluation> {
-
-    /**
-     * Gets the initial guess.
-     *
-     * @return the initial guess values.
-     */
-    RealVector getStart();
-
-    /**
-     * Get the number of observations (rows in the Jacobian) in this problem.
-     *
-     * @return the number of scalar observations
-     */
-    int getObservationSize();
-
-    /**
-     * Get the number of parameters (columns in the Jacobian) in this problem.
-     *
-     * @return the number of scalar parameters
-     */
-    int getParameterSize();
-
-    /**
-     * Evaluate the model at the specified point.
-     *
-     *
-     * @param point the parameter values.
-     * @return the model's value and derivative at the given point.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
-     *          if the maximal number of evaluations (of the model vector function) is
-     *          exceeded.
-     */
-    Evaluation evaluate(RealVector point);
-
-    /**
-     * An evaluation of a {@link LeastSquaresProblem} at a particular point. This class
-     * also computes several quantities derived from the value and its Jacobian.
-     */
-    public interface Evaluation {
-
-        /**
-         * Get the covariance matrix of the optimized parameters. <br/> Note that this
-         * operation involves the inversion of the <code>J<sup>T</sup>J</code> matrix,
-         * where {@code J} is the Jacobian matrix. The {@code threshold} parameter is a
-         * way for the caller to specify that the result of this computation should be
-         * considered meaningless, and thus trigger an exception.
-         *
-         *
-         * @param threshold Singularity threshold.
-         * @return the covariance matrix.
-         * @throws org.apache.commons.math3.linear.SingularMatrixException
-         *          if the covariance matrix cannot be computed (singular problem).
-         */
-        RealMatrix getCovariances(double threshold);
-
-        /**
-         * Get an estimate of the standard deviation of the parameters. The returned
-         * values are the square root of the diagonal coefficients of the covariance
-         * matrix, {@code sd(a[i]) ~= sqrt(C[i][i])}, where {@code a[i]} is the optimized
-         * value of the {@code i}-th parameter, and {@code C} is the covariance matrix.
-         *
-         *
-         * @param covarianceSingularityThreshold Singularity threshold (see {@link
-         *                                       #getCovariances(double) computeCovariances}).
-         * @return an estimate of the standard deviation of the optimized parameters
-         * @throws org.apache.commons.math3.linear.SingularMatrixException
-         *          if the covariance matrix cannot be computed.
-         */
-        RealVector getSigma(double covarianceSingularityThreshold);
-
-        /**
-         * Get the normalized cost. It is the square-root of the sum of squared of
-         * the residuals, divided by the number of measurements.
-         *
-         * @return the cost.
-         */
-        double getRMS();
-
-        /**
-         * Get the weighted Jacobian matrix.
-         *
-         * @return the weighted Jacobian: W<sup>1/2</sup> J.
-         * @throws org.apache.commons.math3.exception.DimensionMismatchException
-         * if the Jacobian dimension does not match problem dimension.
-         */
-        RealMatrix getJacobian();
-
-        /**
-         * Get the cost.
-         *
-         * @return the cost.
-         * @see #getResiduals()
-         */
-        double getCost();
-
-        /**
-         * Get the weighted residuals. The residual is the difference between the
-         * observed (target) values and the model (objective function) value. There is one
-         * residual for each element of the vector-valued function. The raw residuals are
-         * then multiplied by the square root of the weight matrix.
-         *
-         * @return the weighted residuals: W<sup>1/2</sup> K.
-         * @throws org.apache.commons.math3.exception.DimensionMismatchException
-         * if the residuals have the wrong length.
-         */
-        RealVector getResiduals();
-
-        /**
-         * Get the abscissa (independent variables) of this evaluation.
-         *
-         * @return the point provided to {@link #evaluate(RealVector)}.
-         */
-        RealVector getPoint();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizer.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizer.java
deleted file mode 100644
index 358d240..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/LevenbergMarquardtOptimizer.java
+++ /dev/null
@@ -1,1042 +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.fitting.leastsquares;
-
-import java.util.Arrays;
-
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
-
-
-/**
- * This class solves a least-squares problem using the Levenberg-Marquardt
- * algorithm.
- *
- * <p>This implementation <em>should</em> work even for over-determined systems
- * (i.e. systems having more point than equations). Over-determined systems
- * are solved by ignoring the point which have the smallest impact according
- * to their jacobian column norm. Only the rank of the matrix and some loop bounds
- * are changed to implement this.</p>
- *
- * <p>The resolution engine is a simple translation of the MINPACK <a
- * href="http://www.netlib.org/minpack/lmder.f">lmder</a> routine with minor
- * changes. The changes include the over-determined resolution, the use of
- * inherited convergence checker and the Q.R. decomposition which has been
- * rewritten following the algorithm described in the
- * P. Lascaux and R. Theodor book <i>Analyse num&eacute;rique matricielle
- * appliqu&eacute;e &agrave; l'art de l'ing&eacute;nieur</i>, Masson 1986.</p>
- * <p>The authors of the original fortran version are:
- * <ul>
- * <li>Argonne National Laboratory. MINPACK project. March 1980</li>
- * <li>Burton S. Garbow</li>
- * <li>Kenneth E. Hillstrom</li>
- * <li>Jorge J. More</li>
- * </ul>
- * The redistribution policy for MINPACK is available <a
- * href="http://www.netlib.org/minpack/disclaimer">here</a>, for convenience, it
- * is reproduced below.</p>
- *
- * <table border="0" width="80%" cellpadding="10" align="center" bgcolor="#E0E0E0">
- * <tr><td>
- *    Minpack Copyright Notice (1999) University of Chicago.
- *    All rights reserved
- * </td></tr>
- * <tr><td>
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * <ol>
- *  <li>Redistributions of source code must retain the above copyright
- *      notice, this list of conditions and the following disclaimer.</li>
- * <li>Redistributions in binary form must reproduce the above
- *     copyright notice, this list of conditions and the following
- *     disclaimer in the documentation and/or other materials provided
- *     with the distribution.</li>
- * <li>The end-user documentation included with the redistribution, if any,
- *     must include the following acknowledgment:
- *     <code>This product includes software developed by the University of
- *           Chicago, as Operator of Argonne National Laboratory.</code>
- *     Alternately, this acknowledgment may appear in the software itself,
- *     if and wherever such third-party acknowledgments normally appear.</li>
- * <li><strong>WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
- *     WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
- *     UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
- *     THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
- *     IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
- *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
- *     OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
- *     OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
- *     USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
- *     THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
- *     DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
- *     UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
- *     BE CORRECTED.</strong></li>
- * <li><strong>LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
- *     HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
- *     ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
- *     INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
- *     ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
- *     PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
- *     SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
- *     (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
- *     EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
- *     POSSIBILITY OF SUCH LOSS OR DAMAGES.</strong></li>
- * <ol></td></tr>
- * </table>
- *
- * @since 3.3
- */
-public class LevenbergMarquardtOptimizer implements LeastSquaresOptimizer {
-
-    /** Twice the "epsilon machine". */
-    private static final double TWO_EPS = 2 * Precision.EPSILON;
-
-    /* configuration parameters */
-    /** Positive input variable used in determining the initial step bound. */
-    private final double initialStepBoundFactor;
-    /** Desired relative error in the sum of squares. */
-    private final double costRelativeTolerance;
-    /**  Desired relative error in the approximate solution parameters. */
-    private final double parRelativeTolerance;
-    /** Desired max cosine on the orthogonality between the function vector
-     * and the columns of the jacobian. */
-    private final double orthoTolerance;
-    /** Threshold for QR ranking. */
-    private final double qrRankingThreshold;
-
-    /** Default constructor.
-     * <p>
-     * The default values for the algorithm settings are:
-     * <ul>
-     *  <li>Initial step bound factor: 100</li>
-     *  <li>Cost relative tolerance: 1e-10</li>
-     *  <li>Parameters relative tolerance: 1e-10</li>
-     *  <li>Orthogonality tolerance: 1e-10</li>
-     *  <li>QR ranking threshold: {@link Precision#SAFE_MIN}</li>
-     * </ul>
-     **/
-    public LevenbergMarquardtOptimizer() {
-        this(100, 1e-10, 1e-10, 1e-10, Precision.SAFE_MIN);
-    }
-
-    /**
-     * Construct an instance with all parameters specified.
-     *
-     * @param initialStepBoundFactor initial step bound factor
-     * @param costRelativeTolerance  cost relative tolerance
-     * @param parRelativeTolerance   parameters relative tolerance
-     * @param orthoTolerance         orthogonality tolerance
-     * @param qrRankingThreshold     threshold in the QR decomposition. Columns with a 2
-     *                               norm less than this threshold are considered to be
-     *                               all 0s.
-     */
-    public LevenbergMarquardtOptimizer(
-            final double initialStepBoundFactor,
-            final double costRelativeTolerance,
-            final double parRelativeTolerance,
-            final double orthoTolerance,
-            final double qrRankingThreshold) {
-        this.initialStepBoundFactor = initialStepBoundFactor;
-        this.costRelativeTolerance = costRelativeTolerance;
-        this.parRelativeTolerance = parRelativeTolerance;
-        this.orthoTolerance = orthoTolerance;
-        this.qrRankingThreshold = qrRankingThreshold;
-    }
-
-    /**
-     * @param newInitialStepBoundFactor Positive input variable used in
-     * determining the initial step bound. This bound is set to the
-     * product of initialStepBoundFactor and the euclidean norm of
-     * {@code diag * x} if non-zero, or else to {@code newInitialStepBoundFactor}
-     * itself. In most cases factor should lie in the interval
-     * {@code (0.1, 100.0)}. {@code 100} is a generally recommended value.
-     * of the matrix is reduced.
-     * @return a new instance.
-     */
-    public LevenbergMarquardtOptimizer withInitialStepBoundFactor(double newInitialStepBoundFactor) {
-        return new LevenbergMarquardtOptimizer(
-                newInitialStepBoundFactor,
-                costRelativeTolerance,
-                parRelativeTolerance,
-                orthoTolerance,
-                qrRankingThreshold);
-    }
-
-    /**
-     * @param newCostRelativeTolerance Desired relative error in the sum of squares.
-     * @return a new instance.
-     */
-    public LevenbergMarquardtOptimizer withCostRelativeTolerance(double newCostRelativeTolerance) {
-        return new LevenbergMarquardtOptimizer(
-                initialStepBoundFactor,
-                newCostRelativeTolerance,
-                parRelativeTolerance,
-                orthoTolerance,
-                qrRankingThreshold);
-    }
-
-    /**
-     * @param newParRelativeTolerance Desired relative error in the approximate solution
-     * parameters.
-     * @return a new instance.
-     */
-    public LevenbergMarquardtOptimizer withParameterRelativeTolerance(double newParRelativeTolerance) {
-        return new LevenbergMarquardtOptimizer(
-                initialStepBoundFactor,
-                costRelativeTolerance,
-                newParRelativeTolerance,
-                orthoTolerance,
-                qrRankingThreshold);
-    }
-
-    /**
-     * Modifies the given parameter.
-     *
-     * @param newOrthoTolerance Desired max cosine on the orthogonality between
-     * the function vector and the columns of the Jacobian.
-     * @return a new instance.
-     */
-    public LevenbergMarquardtOptimizer withOrthoTolerance(double newOrthoTolerance) {
-        return new LevenbergMarquardtOptimizer(
-                initialStepBoundFactor,
-                costRelativeTolerance,
-                parRelativeTolerance,
-                newOrthoTolerance,
-                qrRankingThreshold);
-    }
-
-    /**
-     * @param newQRRankingThreshold Desired threshold for QR ranking.
-     * If the squared norm of a column vector is smaller or equal to this
-     * threshold during QR decomposition, it is considered to be a zero vector
-     * and hence the rank of the matrix is reduced.
-     * @return a new instance.
-     */
-    public LevenbergMarquardtOptimizer withRankingThreshold(double newQRRankingThreshold) {
-        return new LevenbergMarquardtOptimizer(
-                initialStepBoundFactor,
-                costRelativeTolerance,
-                parRelativeTolerance,
-                orthoTolerance,
-                newQRRankingThreshold);
-    }
-
-    /**
-     * Gets the value of a tuning parameter.
-     * @see #withInitialStepBoundFactor(double)
-     *
-     * @return the parameter's value.
-     */
-    public double getInitialStepBoundFactor() {
-        return initialStepBoundFactor;
-    }
-
-    /**
-     * Gets the value of a tuning parameter.
-     * @see #withCostRelativeTolerance(double)
-     *
-     * @return the parameter's value.
-     */
-    public double getCostRelativeTolerance() {
-        return costRelativeTolerance;
-    }
-
-    /**
-     * Gets the value of a tuning parameter.
-     * @see #withParameterRelativeTolerance(double)
-     *
-     * @return the parameter's value.
-     */
-    public double getParameterRelativeTolerance() {
-        return parRelativeTolerance;
-    }
-
-    /**
-     * Gets the value of a tuning parameter.
-     * @see #withOrthoTolerance(double)
-     *
-     * @return the parameter's value.
-     */
-    public double getOrthoTolerance() {
-        return orthoTolerance;
-    }
-
-    /**
-     * Gets the value of a tuning parameter.
-     * @see #withRankingThreshold(double)
-     *
-     * @return the parameter's value.
-     */
-    public double getRankingThreshold() {
-        return qrRankingThreshold;
-    }
-
-    /** {@inheritDoc} */
-    public Optimum optimize(final LeastSquaresProblem problem) {
-        // Pull in relevant data from the problem as locals.
-        final int nR = problem.getObservationSize(); // Number of observed data.
-        final int nC = problem.getParameterSize(); // Number of parameters.
-        // Counters.
-        final Incrementor iterationCounter = problem.getIterationCounter();
-        final Incrementor evaluationCounter = problem.getEvaluationCounter();
-        // Convergence criterion.
-        final ConvergenceChecker<Evaluation> checker = problem.getConvergenceChecker();
-
-        // arrays shared with the other private methods
-        final int solvedCols  = FastMath.min(nR, nC);
-        /* Parameters evolution direction associated with lmPar. */
-        double[] lmDir = new double[nC];
-        /* Levenberg-Marquardt parameter. */
-        double lmPar = 0;
-
-        // local point
-        double   delta   = 0;
-        double   xNorm   = 0;
-        double[] diag    = new double[nC];
-        double[] oldX    = new double[nC];
-        double[] oldRes  = new double[nR];
-        double[] qtf     = new double[nR];
-        double[] work1   = new double[nC];
-        double[] work2   = new double[nC];
-        double[] work3   = new double[nC];
-
-
-        // Evaluate the function at the starting point and calculate its norm.
-        evaluationCounter.incrementCount();
-        //value will be reassigned in the loop
-        Evaluation current = problem.evaluate(problem.getStart());
-        double[] currentResiduals = current.getResiduals().toArray();
-        double currentCost = current.getCost();
-        double[] currentPoint = current.getPoint().toArray();
-
-        // Outer loop.
-        boolean firstIteration = true;
-        while (true) {
-            iterationCounter.incrementCount();
-
-            final Evaluation previous = current;
-
-            // QR decomposition of the jacobian matrix
-            final InternalData internalData
-                    = qrDecomposition(current.getJacobian(), solvedCols);
-            final double[][] weightedJacobian = internalData.weightedJacobian;
-            final int[] permutation = internalData.permutation;
-            final double[] diagR = internalData.diagR;
-            final double[] jacNorm = internalData.jacNorm;
-
-            //residuals already have weights applied
-            double[] weightedResidual = currentResiduals;
-            for (int i = 0; i < nR; i++) {
-                qtf[i] = weightedResidual[i];
-            }
-
-            // compute Qt.res
-            qTy(qtf, internalData);
-
-            // now we don't need Q anymore,
-            // so let jacobian contain the R matrix with its diagonal elements
-            for (int k = 0; k < solvedCols; ++k) {
-                int pk = permutation[k];
-                weightedJacobian[k][pk] = diagR[pk];
-            }
-
-            if (firstIteration) {
-                // scale the point according to the norms of the columns
-                // of the initial jacobian
-                xNorm = 0;
-                for (int k = 0; k < nC; ++k) {
-                    double dk = jacNorm[k];
-                    if (dk == 0) {
-                        dk = 1.0;
-                    }
-                    double xk = dk * currentPoint[k];
-                    xNorm  += xk * xk;
-                    diag[k] = dk;
-                }
-                xNorm = FastMath.sqrt(xNorm);
-
-                // initialize the step bound delta
-                delta = (xNorm == 0) ? initialStepBoundFactor : (initialStepBoundFactor * xNorm);
-            }
-
-            // check orthogonality between function vector and jacobian columns
-            double maxCosine = 0;
-            if (currentCost != 0) {
-                for (int j = 0; j < solvedCols; ++j) {
-                    int    pj = permutation[j];
-                    double s  = jacNorm[pj];
-                    if (s != 0) {
-                        double sum = 0;
-                        for (int i = 0; i <= j; ++i) {
-                            sum += weightedJacobian[i][pj] * qtf[i];
-                        }
-                        maxCosine = FastMath.max(maxCosine, FastMath.abs(sum) / (s * currentCost));
-                    }
-                }
-            }
-            if (maxCosine <= orthoTolerance) {
-                // Convergence has been reached.
-                return new OptimumImpl(
-                        current,
-                        evaluationCounter.getCount(),
-                        iterationCounter.getCount());
-            }
-
-            // rescale if necessary
-            for (int j = 0; j < nC; ++j) {
-                diag[j] = FastMath.max(diag[j], jacNorm[j]);
-            }
-
-            // Inner loop.
-            for (double ratio = 0; ratio < 1.0e-4;) {
-
-                // save the state
-                for (int j = 0; j < solvedCols; ++j) {
-                    int pj = permutation[j];
-                    oldX[pj] = currentPoint[pj];
-                }
-                final double previousCost = currentCost;
-                double[] tmpVec = weightedResidual;
-                weightedResidual = oldRes;
-                oldRes    = tmpVec;
-
-                // determine the Levenberg-Marquardt parameter
-                lmPar = determineLMParameter(qtf, delta, diag,
-                                     internalData, solvedCols,
-                                     work1, work2, work3, lmDir, lmPar);
-
-                // compute the new point and the norm of the evolution direction
-                double lmNorm = 0;
-                for (int j = 0; j < solvedCols; ++j) {
-                    int pj = permutation[j];
-                    lmDir[pj] = -lmDir[pj];
-                    currentPoint[pj] = oldX[pj] + lmDir[pj];
-                    double s = diag[pj] * lmDir[pj];
-                    lmNorm  += s * s;
-                }
-                lmNorm = FastMath.sqrt(lmNorm);
-                // on the first iteration, adjust the initial step bound.
-                if (firstIteration) {
-                    delta = FastMath.min(delta, lmNorm);
-                }
-
-                // Evaluate the function at x + p and calculate its norm.
-                evaluationCounter.incrementCount();
-                current = problem.evaluate(new ArrayRealVector(currentPoint));
-                currentResiduals = current.getResiduals().toArray();
-                currentCost = current.getCost();
-                currentPoint = current.getPoint().toArray();
-
-                // compute the scaled actual reduction
-                double actRed = -1.0;
-                if (0.1 * currentCost < previousCost) {
-                    double r = currentCost / previousCost;
-                    actRed = 1.0 - r * r;
-                }
-
-                // compute the scaled predicted reduction
-                // and the scaled directional derivative
-                for (int j = 0; j < solvedCols; ++j) {
-                    int pj = permutation[j];
-                    double dirJ = lmDir[pj];
-                    work1[j] = 0;
-                    for (int i = 0; i <= j; ++i) {
-                        work1[i] += weightedJacobian[i][pj] * dirJ;
-                    }
-                }
-                double coeff1 = 0;
-                for (int j = 0; j < solvedCols; ++j) {
-                    coeff1 += work1[j] * work1[j];
-                }
-                double pc2 = previousCost * previousCost;
-                coeff1 /= pc2;
-                double coeff2 = lmPar * lmNorm * lmNorm / pc2;
-                double preRed = coeff1 + 2 * coeff2;
-                double dirDer = -(coeff1 + coeff2);
-
-                // ratio of the actual to the predicted reduction
-                ratio = (preRed == 0) ? 0 : (actRed / preRed);
-
-                // update the step bound
-                if (ratio <= 0.25) {
-                    double tmp =
-                        (actRed < 0) ? (0.5 * dirDer / (dirDer + 0.5 * actRed)) : 0.5;
-                        if ((0.1 * currentCost >= previousCost) || (tmp < 0.1)) {
-                            tmp = 0.1;
-                        }
-                        delta = tmp * FastMath.min(delta, 10.0 * lmNorm);
-                        lmPar /= tmp;
-                } else if ((lmPar == 0) || (ratio >= 0.75)) {
-                    delta = 2 * lmNorm;
-                    lmPar *= 0.5;
-                }
-
-                // test for successful iteration.
-                if (ratio >= 1.0e-4) {
-                    // successful iteration, update the norm
-                    firstIteration = false;
-                    xNorm = 0;
-                    for (int k = 0; k < nC; ++k) {
-                        double xK = diag[k] * currentPoint[k];
-                        xNorm += xK * xK;
-                    }
-                    xNorm = FastMath.sqrt(xNorm);
-
-                    // tests for convergence.
-                    if (checker != null && checker.converged(iterationCounter.getCount(), previous, current)) {
-                        return new OptimumImpl(current, evaluationCounter.getCount(), iterationCounter.getCount());
-                    }
-                } else {
-                    // failed iteration, reset the previous values
-                    currentCost = previousCost;
-                    for (int j = 0; j < solvedCols; ++j) {
-                        int pj = permutation[j];
-                        currentPoint[pj] = oldX[pj];
-                    }
-                    tmpVec    = weightedResidual;
-                    weightedResidual = oldRes;
-                    oldRes    = tmpVec;
-                    // Reset "current" to previous values.
-                    current = previous;
-                }
-
-                // Default convergence criteria.
-                if ((FastMath.abs(actRed) <= costRelativeTolerance &&
-                     preRed <= costRelativeTolerance &&
-                     ratio <= 2.0) ||
-                    delta <= parRelativeTolerance * xNorm) {
-                    return new OptimumImpl(current, evaluationCounter.getCount(), iterationCounter.getCount());
-                }
-
-                // tests for termination and stringent tolerances
-                if (FastMath.abs(actRed) <= TWO_EPS &&
-                    preRed <= TWO_EPS &&
-                    ratio <= 2.0) {
-                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_COST_RELATIVE_TOLERANCE,
-                                                   costRelativeTolerance);
-                } else if (delta <= TWO_EPS * xNorm) {
-                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_PARAMETERS_RELATIVE_TOLERANCE,
-                                                   parRelativeTolerance);
-                } else if (maxCosine <= TWO_EPS) {
-                    throw new ConvergenceException(LocalizedFormats.TOO_SMALL_ORTHOGONALITY_TOLERANCE,
-                                                   orthoTolerance);
-                }
-            }
-        }
-    }
-
-    /**
-     * Holds internal data.
-     * This structure was created so that all optimizer fields can be "final".
-     * Code should be further refactored in order to not pass around arguments
-     * that will modified in-place (cf. "work" arrays).
-     */
-    private static class InternalData {
-        /** Weighted Jacobian. */
-        private final double[][] weightedJacobian;
-        /** Columns permutation array. */
-        private final int[] permutation;
-        /** Rank of the Jacobian matrix. */
-        private final int rank;
-        /** Diagonal elements of the R matrix in the QR decomposition. */
-        private final double[] diagR;
-        /** Norms of the columns of the jacobian matrix. */
-        private final double[] jacNorm;
-        /** Coefficients of the Householder transforms vectors. */
-        private final double[] beta;
-
-        /**
-         * @param weightedJacobian Weighted Jacobian.
-         * @param permutation Columns permutation array.
-         * @param rank Rank of the Jacobian matrix.
-         * @param diagR Diagonal elements of the R matrix in the QR decomposition.
-         * @param jacNorm Norms of the columns of the jacobian matrix.
-         * @param beta Coefficients of the Householder transforms vectors.
-         */
-        InternalData(double[][] weightedJacobian,
-                     int[] permutation,
-                     int rank,
-                     double[] diagR,
-                     double[] jacNorm,
-                     double[] beta) {
-            this.weightedJacobian = weightedJacobian;
-            this.permutation = permutation;
-            this.rank = rank;
-            this.diagR = diagR;
-            this.jacNorm = jacNorm;
-            this.beta = beta;
-        }
-    }
-
-    /**
-     * Determines the Levenberg-Marquardt parameter.
-     *
-     * <p>This implementation is a translation in Java of the MINPACK
-     * <a href="http://www.netlib.org/minpack/lmpar.f">lmpar</a>
-     * routine.</p>
-     * <p>This method sets the lmPar and lmDir attributes.</p>
-     * <p>The authors of the original fortran function are:</p>
-     * <ul>
-     *   <li>Argonne National Laboratory. MINPACK project. March 1980</li>
-     *   <li>Burton  S. Garbow</li>
-     *   <li>Kenneth E. Hillstrom</li>
-     *   <li>Jorge   J. More</li>
-     * </ul>
-     * <p>Luc Maisonobe did the Java translation.</p>
-     *
-     * @param qy Array containing qTy.
-     * @param delta Upper bound on the euclidean norm of diagR * lmDir.
-     * @param diag Diagonal matrix.
-     * @param internalData Data (modified in-place in this method).
-     * @param solvedCols Number of solved point.
-     * @param work1 work array
-     * @param work2 work array
-     * @param work3 work array
-     * @param lmDir the "returned" LM direction will be stored in this array.
-     * @param lmPar the value of the LM parameter from the previous iteration.
-     * @return the new LM parameter
-     */
-    private double determineLMParameter(double[] qy, double delta, double[] diag,
-                                      InternalData internalData, int solvedCols,
-                                      double[] work1, double[] work2, double[] work3,
-                                      double[] lmDir, double lmPar) {
-        final double[][] weightedJacobian = internalData.weightedJacobian;
-        final int[] permutation = internalData.permutation;
-        final int rank = internalData.rank;
-        final double[] diagR = internalData.diagR;
-
-        final int nC = weightedJacobian[0].length;
-
-        // compute and store in x the gauss-newton direction, if the
-        // jacobian is rank-deficient, obtain a least squares solution
-        for (int j = 0; j < rank; ++j) {
-            lmDir[permutation[j]] = qy[j];
-        }
-        for (int j = rank; j < nC; ++j) {
-            lmDir[permutation[j]] = 0;
-        }
-        for (int k = rank - 1; k >= 0; --k) {
-            int pk = permutation[k];
-            double ypk = lmDir[pk] / diagR[pk];
-            for (int i = 0; i < k; ++i) {
-                lmDir[permutation[i]] -= ypk * weightedJacobian[i][pk];
-            }
-            lmDir[pk] = ypk;
-        }
-
-        // evaluate the function at the origin, and test
-        // for acceptance of the Gauss-Newton direction
-        double dxNorm = 0;
-        for (int j = 0; j < solvedCols; ++j) {
-            int pj = permutation[j];
-            double s = diag[pj] * lmDir[pj];
-            work1[pj] = s;
-            dxNorm += s * s;
-        }
-        dxNorm = FastMath.sqrt(dxNorm);
-        double fp = dxNorm - delta;
-        if (fp <= 0.1 * delta) {
-            lmPar = 0;
-            return lmPar;
-        }
-
-        // if the jacobian is not rank deficient, the Newton step provides
-        // a lower bound, parl, for the zero of the function,
-        // otherwise set this bound to zero
-        double sum2;
-        double parl = 0;
-        if (rank == solvedCols) {
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] *= diag[pj] / dxNorm;
-            }
-            sum2 = 0;
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                double sum = 0;
-                for (int i = 0; i < j; ++i) {
-                    sum += weightedJacobian[i][pj] * work1[permutation[i]];
-                }
-                double s = (work1[pj] - sum) / diagR[pj];
-                work1[pj] = s;
-                sum2 += s * s;
-            }
-            parl = fp / (delta * sum2);
-        }
-
-        // calculate an upper bound, paru, for the zero of the function
-        sum2 = 0;
-        for (int j = 0; j < solvedCols; ++j) {
-            int pj = permutation[j];
-            double sum = 0;
-            for (int i = 0; i <= j; ++i) {
-                sum += weightedJacobian[i][pj] * qy[i];
-            }
-            sum /= diag[pj];
-            sum2 += sum * sum;
-        }
-        double gNorm = FastMath.sqrt(sum2);
-        double paru = gNorm / delta;
-        if (paru == 0) {
-            paru = Precision.SAFE_MIN / FastMath.min(delta, 0.1);
-        }
-
-        // if the input par lies outside of the interval (parl,paru),
-        // set par to the closer endpoint
-        lmPar = FastMath.min(paru, FastMath.max(lmPar, parl));
-        if (lmPar == 0) {
-            lmPar = gNorm / dxNorm;
-        }
-
-        for (int countdown = 10; countdown >= 0; --countdown) {
-
-            // evaluate the function at the current value of lmPar
-            if (lmPar == 0) {
-                lmPar = FastMath.max(Precision.SAFE_MIN, 0.001 * paru);
-            }
-            double sPar = FastMath.sqrt(lmPar);
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] = sPar * diag[pj];
-            }
-            determineLMDirection(qy, work1, work2, internalData, solvedCols, work3, lmDir);
-
-            dxNorm = 0;
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                double s = diag[pj] * lmDir[pj];
-                work3[pj] = s;
-                dxNorm += s * s;
-            }
-            dxNorm = FastMath.sqrt(dxNorm);
-            double previousFP = fp;
-            fp = dxNorm - delta;
-
-            // if the function is small enough, accept the current value
-            // of lmPar, also test for the exceptional cases where parl is zero
-            if (FastMath.abs(fp) <= 0.1 * delta ||
-                (parl == 0 &&
-                 fp <= previousFP &&
-                 previousFP < 0)) {
-                return lmPar;
-            }
-
-            // compute the Newton correction
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] = work3[pj] * diag[pj] / dxNorm;
-            }
-            for (int j = 0; j < solvedCols; ++j) {
-                int pj = permutation[j];
-                work1[pj] /= work2[j];
-                double tmp = work1[pj];
-                for (int i = j + 1; i < solvedCols; ++i) {
-                    work1[permutation[i]] -= weightedJacobian[i][pj] * tmp;
-                }
-            }
-            sum2 = 0;
-            for (int j = 0; j < solvedCols; ++j) {
-                double s = work1[permutation[j]];
-                sum2 += s * s;
-            }
-            double correction = fp / (delta * sum2);
-
-            // depending on the sign of the function, update parl or paru.
-            if (fp > 0) {
-                parl = FastMath.max(parl, lmPar);
-            } else if (fp < 0) {
-                paru = FastMath.min(paru, lmPar);
-            }
-
-            // compute an improved estimate for lmPar
-            lmPar = FastMath.max(parl, lmPar + correction);
-        }
-
-        return lmPar;
-    }
-
-    /**
-     * Solve a*x = b and d*x = 0 in the least squares sense.
-     * <p>This implementation is a translation in Java of the MINPACK
-     * <a href="http://www.netlib.org/minpack/qrsolv.f">qrsolv</a>
-     * routine.</p>
-     * <p>This method sets the lmDir and lmDiag attributes.</p>
-     * <p>The authors of the original fortran function are:</p>
-     * <ul>
-     *   <li>Argonne National Laboratory. MINPACK project. March 1980</li>
-     *   <li>Burton  S. Garbow</li>
-     *   <li>Kenneth E. Hillstrom</li>
-     *   <li>Jorge   J. More</li>
-     * </ul>
-     * <p>Luc Maisonobe did the Java translation.</p>
-     *
-     * @param qy array containing qTy
-     * @param diag diagonal matrix
-     * @param lmDiag diagonal elements associated with lmDir
-     * @param internalData Data (modified in-place in this method).
-     * @param solvedCols Number of sloved point.
-     * @param work work array
-     * @param lmDir the "returned" LM direction is stored in this array
-     */
-    private void determineLMDirection(double[] qy, double[] diag,
-                                      double[] lmDiag,
-                                      InternalData internalData,
-                                      int solvedCols,
-                                      double[] work,
-                                      double[] lmDir) {
-        final int[] permutation = internalData.permutation;
-        final double[][] weightedJacobian = internalData.weightedJacobian;
-        final double[] diagR = internalData.diagR;
-
-        // copy R and Qty to preserve input and initialize s
-        //  in particular, save the diagonal elements of R in lmDir
-        for (int j = 0; j < solvedCols; ++j) {
-            int pj = permutation[j];
-            for (int i = j + 1; i < solvedCols; ++i) {
-                weightedJacobian[i][pj] = weightedJacobian[j][permutation[i]];
-            }
-            lmDir[j] = diagR[pj];
-            work[j]  = qy[j];
-        }
-
-        // eliminate the diagonal matrix d using a Givens rotation
-        for (int j = 0; j < solvedCols; ++j) {
-
-            // prepare the row of d to be eliminated, locating the
-            // diagonal element using p from the Q.R. factorization
-            int pj = permutation[j];
-            double dpj = diag[pj];
-            if (dpj != 0) {
-                Arrays.fill(lmDiag, j + 1, lmDiag.length, 0);
-            }
-            lmDiag[j] = dpj;
-
-            //  the transformations to eliminate the row of d
-            // modify only a single element of Qty
-            // beyond the first n, which is initially zero.
-            double qtbpj = 0;
-            for (int k = j; k < solvedCols; ++k) {
-                int pk = permutation[k];
-
-                // determine a Givens rotation which eliminates the
-                // appropriate element in the current row of d
-                if (lmDiag[k] != 0) {
-
-                    final double sin;
-                    final double cos;
-                    double rkk = weightedJacobian[k][pk];
-                    if (FastMath.abs(rkk) < FastMath.abs(lmDiag[k])) {
-                        final double cotan = rkk / lmDiag[k];
-                        sin   = 1.0 / FastMath.sqrt(1.0 + cotan * cotan);
-                        cos   = sin * cotan;
-                    } else {
-                        final double tan = lmDiag[k] / rkk;
-                        cos = 1.0 / FastMath.sqrt(1.0 + tan * tan);
-                        sin = cos * tan;
-                    }
-
-                    // compute the modified diagonal element of R and
-                    // the modified element of (Qty,0)
-                    weightedJacobian[k][pk] = cos * rkk + sin * lmDiag[k];
-                    final double temp = cos * work[k] + sin * qtbpj;
-                    qtbpj = -sin * work[k] + cos * qtbpj;
-                    work[k] = temp;
-
-                    // accumulate the tranformation in the row of s
-                    for (int i = k + 1; i < solvedCols; ++i) {
-                        double rik = weightedJacobian[i][pk];
-                        final double temp2 = cos * rik + sin * lmDiag[i];
-                        lmDiag[i] = -sin * rik + cos * lmDiag[i];
-                        weightedJacobian[i][pk] = temp2;
-                    }
-                }
-            }
-
-            // store the diagonal element of s and restore
-            // the corresponding diagonal element of R
-            lmDiag[j] = weightedJacobian[j][permutation[j]];
-            weightedJacobian[j][permutation[j]] = lmDir[j];
-        }
-
-        // solve the triangular system for z, if the system is
-        // singular, then obtain a least squares solution
-        int nSing = solvedCols;
-        for (int j = 0; j < solvedCols; ++j) {
-            if ((lmDiag[j] == 0) && (nSing == solvedCols)) {
-                nSing = j;
-            }
-            if (nSing < solvedCols) {
-                work[j] = 0;
-            }
-        }
-        if (nSing > 0) {
-            for (int j = nSing - 1; j >= 0; --j) {
-                int pj = permutation[j];
-                double sum = 0;
-                for (int i = j + 1; i < nSing; ++i) {
-                    sum += weightedJacobian[i][pj] * work[i];
-                }
-                work[j] = (work[j] - sum) / lmDiag[j];
-            }
-        }
-
-        // permute the components of z back to components of lmDir
-        for (int j = 0; j < lmDir.length; ++j) {
-            lmDir[permutation[j]] = work[j];
-        }
-    }
-
-    /**
-     * Decompose a matrix A as A.P = Q.R using Householder transforms.
-     * <p>As suggested in the P. Lascaux and R. Theodor book
-     * <i>Analyse num&eacute;rique matricielle appliqu&eacute;e &agrave;
-     * l'art de l'ing&eacute;nieur</i> (Masson, 1986), instead of representing
-     * the Householder transforms with u<sub>k</sub> unit vectors such that:
-     * <pre>
-     * H<sub>k</sub> = I - 2u<sub>k</sub>.u<sub>k</sub><sup>t</sup>
-     * </pre>
-     * we use <sub>k</sub> non-unit vectors such that:
-     * <pre>
-     * H<sub>k</sub> = I - beta<sub>k</sub>v<sub>k</sub>.v<sub>k</sub><sup>t</sup>
-     * </pre>
-     * where v<sub>k</sub> = a<sub>k</sub> - alpha<sub>k</sub> e<sub>k</sub>.
-     * The beta<sub>k</sub> coefficients are provided upon exit as recomputing
-     * them from the v<sub>k</sub> vectors would be costly.</p>
-     * <p>This decomposition handles rank deficient cases since the tranformations
-     * are performed in non-increasing columns norms order thanks to columns
-     * pivoting. The diagonal elements of the R matrix are therefore also in
-     * non-increasing absolute values order.</p>
-     *
-     * @param jacobian Weighted Jacobian matrix at the current point.
-     * @param solvedCols Number of solved point.
-     * @return data used in other methods of this class.
-     * @throws ConvergenceException if the decomposition cannot be performed.
-     */
-    private InternalData qrDecomposition(RealMatrix jacobian,
-                                         int solvedCols) throws ConvergenceException {
-        // Code in this class assumes that the weighted Jacobian is -(W^(1/2) J),
-        // hence the multiplication by -1.
-        final double[][] weightedJacobian = jacobian.scalarMultiply(-1).getData();
-
-        final int nR = weightedJacobian.length;
-        final int nC = weightedJacobian[0].length;
-
-        final int[] permutation = new int[nC];
-        final double[] diagR = new double[nC];
-        final double[] jacNorm = new double[nC];
-        final double[] beta = new double[nC];
-
-        // initializations
-        for (int k = 0; k < nC; ++k) {
-            permutation[k] = k;
-            double norm2 = 0;
-            for (int i = 0; i < nR; ++i) {
-                double akk = weightedJacobian[i][k];
-                norm2 += akk * akk;
-            }
-            jacNorm[k] = FastMath.sqrt(norm2);
-        }
-
-        // transform the matrix column after column
-        for (int k = 0; k < nC; ++k) {
-
-            // select the column with the greatest norm on active components
-            int nextColumn = -1;
-            double ak2 = Double.NEGATIVE_INFINITY;
-            for (int i = k; i < nC; ++i) {
-                double norm2 = 0;
-                for (int j = k; j < nR; ++j) {
-                    double aki = weightedJacobian[j][permutation[i]];
-                    norm2 += aki * aki;
-                }
-                if (Double.isInfinite(norm2) || Double.isNaN(norm2)) {
-                    throw new ConvergenceException(LocalizedFormats.UNABLE_TO_PERFORM_QR_DECOMPOSITION_ON_JACOBIAN,
-                                                   nR, nC);
-                }
-                if (norm2 > ak2) {
-                    nextColumn = i;
-                    ak2        = norm2;
-                }
-            }
-            if (ak2 <= qrRankingThreshold) {
-                return new InternalData(weightedJacobian, permutation, k, diagR, jacNorm, beta);
-            }
-            int pk = permutation[nextColumn];
-            permutation[nextColumn] = permutation[k];
-            permutation[k] = pk;
-
-            // choose alpha such that Hk.u = alpha ek
-            double akk = weightedJacobian[k][pk];
-            double alpha = (akk > 0) ? -FastMath.sqrt(ak2) : FastMath.sqrt(ak2);
-            double betak = 1.0 / (ak2 - akk * alpha);
-            beta[pk] = betak;
-
-            // transform the current column
-            diagR[pk] = alpha;
-            weightedJacobian[k][pk] -= alpha;
-
-            // transform the remaining columns
-            for (int dk = nC - 1 - k; dk > 0; --dk) {
-                double gamma = 0;
-                for (int j = k; j < nR; ++j) {
-                    gamma += weightedJacobian[j][pk] * weightedJacobian[j][permutation[k + dk]];
-                }
-                gamma *= betak;
-                for (int j = k; j < nR; ++j) {
-                    weightedJacobian[j][permutation[k + dk]] -= gamma * weightedJacobian[j][pk];
-                }
-            }
-        }
-
-        return new InternalData(weightedJacobian, permutation, solvedCols, diagR, jacNorm, beta);
-    }
-
-    /**
-     * Compute the product Qt.y for some Q.R. decomposition.
-     *
-     * @param y vector to multiply (will be overwritten with the result)
-     * @param internalData Data.
-     */
-    private void qTy(double[] y,
-                     InternalData internalData) {
-        final double[][] weightedJacobian = internalData.weightedJacobian;
-        final int[] permutation = internalData.permutation;
-        final double[] beta = internalData.beta;
-
-        final int nR = weightedJacobian.length;
-        final int nC = weightedJacobian[0].length;
-
-        for (int k = 0; k < nC; ++k) {
-            int pk = permutation[k];
-            double gamma = 0;
-            for (int i = k; i < nR; ++i) {
-                gamma += weightedJacobian[i][pk] * y[i];
-            }
-            gamma *= beta[pk];
-            for (int i = k; i < nR; ++i) {
-                y[i] -= gamma * weightedJacobian[i][pk];
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.java
deleted file mode 100644
index e673855..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/MultivariateJacobianFunction.java
+++ /dev/null
@@ -1,39 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * A interface for functions that compute a vector of values and can compute their
- * derivatives (Jacobian).
- *
- * @since 3.3
- */
-public interface MultivariateJacobianFunction {
-
-    /**
-     * Compute the function value and its Jacobian.
-     *
-     * @param point the abscissae
-     * @return the values and their Jacobian of this vector valued function.
-     */
-    Pair<RealVector, RealMatrix> value(RealVector point);
-
-}


[72/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializer.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializer.java
index 1f48d45..0525b47 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializer.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializer.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 /**
  * Defines how to assign the first value of a neuron's feature.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java
index f5569b1..1521a60 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/FeatureInitializerFactory.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Constant;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Constant;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * Creates functions that will select the initial values of a neuron's
@@ -42,7 +42,7 @@ public class FeatureInitializerFactory {
      * uniform distribution.
      * @return an initializer such that the features will be initialized with
      * values within the given range.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code min >= max}.
      */
     public static FeatureInitializer uniform(final RandomGenerator rng,
@@ -59,7 +59,7 @@ public class FeatureInitializerFactory {
      * @param max Upper bound of the range.
      * @return an initializer such that the features will be initialized with
      * values within the given range.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code min >= max}.
      */
     public static FeatureInitializer uniform(final double min,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
index 9e67982..a80b0a3 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/MapUtils.java
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 import java.util.HashMap;
 import java.util.Collection;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.neuralnet.twod.NeuronSquareMesh2D;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.util.Pair;
+
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.neuralnet.twod.NeuronSquareMesh2D;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Utilities for network maps.
@@ -44,7 +45,7 @@ public class MapUtils {
      * @param distance Distance function. The neuron's features are
      * passed as the first argument to {@link DistanceMeasure#compute(double[],double[])}.
      * @return the neuron whose features are closest to the given data.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the size of the input is not compatible with the neurons features
      * size.
      */
@@ -73,7 +74,7 @@ public class MapUtils {
      * @param distance Distance function. The neuron's features are
      * passed as the first argument to {@link DistanceMeasure#compute(double[],double[])}.
      * @return the two neurons whose features are closest to the given data.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the size of the input is not compatible with the neurons features
      * size.
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
index 6c4b8e9..89d335f 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Network.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 import java.io.Serializable;
 import java.io.ObjectInputStream;
@@ -30,8 +30,9 @@ import java.util.Comparator;
 import java.util.Collections;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicLong;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
 
 /**
  * Neural network, composed of {@link Neuron} instances and the links

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
index 51c533f..0f58b3a 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/Neuron.java
@@ -15,13 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 import java.io.Serializable;
 import java.io.ObjectInputStream;
 import java.util.concurrent.atomic.AtomicReference;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.exception.DimensionMismatchException;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.Precision;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/SquareNeighbourhood.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/SquareNeighbourhood.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/SquareNeighbourhood.java
index a3c0d95..4f2c175 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/SquareNeighbourhood.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/SquareNeighbourhood.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 /**
  * Defines neighbourhood types.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/UpdateAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/UpdateAction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/UpdateAction.java
index 041d3d6..862a3f2 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/UpdateAction.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/UpdateAction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;
 
 /**
  * Describes how to update the network in response to a training

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronString.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronString.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronString.java
index 747a925..94aff98 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronString.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/NeuronString.java
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.oned;
+package org.apache.commons.math4.ml.neuralnet.oned;
 
 import java.io.Serializable;
 import java.io.ObjectInputStream;
-import org.apache.commons.math3.ml.neuralnet.Network;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializer;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.Network;
 
 /**
  * Neural network with the topology of a one-dimensional line.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/package-info.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/package-info.java
index 0b47fae..b95b8be 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/oned/package-info.java
@@ -19,4 +19,4 @@
  * One-dimensional neural networks.
  */
 
-package org.apache.commons.math3.ml.neuralnet.oned;
+package org.apache.commons.math4.ml.neuralnet.oned;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/package-info.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/package-info.java
index d8e907e..d2a79c4 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/package-info.java
@@ -19,4 +19,4 @@
  * Neural networks.
  */
 
-package org.apache.commons.math3.ml.neuralnet;
+package org.apache.commons.math4.ml.neuralnet;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java
index 9aa497d..0e0fcab 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenTrainingTask.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
 import java.util.Iterator;
-import org.apache.commons.math3.ml.neuralnet.Network;
+
+import org.apache.commons.math4.ml.neuralnet.Network;
 
 /**
  * Trainer for Kohonen's Self-Organizing Map.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
index 91587bf..f09ed24 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/KohonenUpdateAction.java
@@ -15,18 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
 import java.util.Collection;
 import java.util.HashSet;
 import java.util.concurrent.atomic.AtomicLong;
-import org.apache.commons.math3.ml.neuralnet.Network;
-import org.apache.commons.math3.ml.neuralnet.MapUtils;
-import org.apache.commons.math3.ml.neuralnet.Neuron;
-import org.apache.commons.math3.ml.neuralnet.UpdateAction;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.analysis.function.Gaussian;
+
+import org.apache.commons.math4.analysis.function.Gaussian;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.neuralnet.MapUtils;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.UpdateAction;
 
 /**
  * Update formula for <a href="http://en.wikipedia.org/wiki/Kohonen">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunction.java
index ba9d152..a13b2cf 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunction.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
 /**
  * Provides the learning rate as a function of the number of calls

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java
index 9165e82..0371475 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/LearningFactorFunctionFactory.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
-import org.apache.commons.math3.ml.neuralnet.sofm.util.ExponentialDecayFunction;
-import org.apache.commons.math3.ml.neuralnet.sofm.util.QuasiSigmoidDecayFunction;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.ml.neuralnet.sofm.util.ExponentialDecayFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.util.QuasiSigmoidDecayFunction;
 
 /**
  * Factory for creating instances of {@link LearningFactorFunction}.
@@ -45,13 +45,13 @@ public class LearningFactorFunctionFactory {
      * @param numCall Argument for which the function returns
      * {@code valueAtNumCall}.
      * @return the learning factor function.
-     * @throws org.apache.commons.math3.exception.OutOfRangeException
+     * @throws org.apache.commons.math4.exception.OutOfRangeException
      * if {@code initValue <= 0} or {@code initValue > 1}.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code valueAtNumCall <= 0}.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code valueAtNumCall >= initValue}.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code numCall <= 0}.
      */
     public static LearningFactorFunction exponentialDecay(final double initValue,
@@ -88,11 +88,11 @@ public class LearningFactorFunctionFactory {
      * @param slope Value of the function derivative at {@code numCall}.
      * @param numCall Inflexion point.
      * @return the learning factor function.
-     * @throws org.apache.commons.math3.exception.OutOfRangeException
+     * @throws org.apache.commons.math4.exception.OutOfRangeException
      * if {@code initValue <= 0} or {@code initValue > 1}.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code slope >= 0}.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code numCall <= 0}.
      */
     public static LearningFactorFunction quasiSigmoidDecay(final double initValue,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunction.java
index 68149f7..d379f0f 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunction.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunction.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
 /**
  * Provides the network neighbourhood's size as a function of the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java
index bdbfa2f..e87a973 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/NeighbourhoodSizeFunctionFactory.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;
 
-import org.apache.commons.math3.ml.neuralnet.sofm.util.ExponentialDecayFunction;
-import org.apache.commons.math3.ml.neuralnet.sofm.util.QuasiSigmoidDecayFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ml.neuralnet.sofm.util.ExponentialDecayFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.util.QuasiSigmoidDecayFunction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Factory for creating instances of {@link NeighbourhoodSizeFunction}.
@@ -45,13 +45,13 @@ public class NeighbourhoodSizeFunctionFactory {
      * @param numCall Argument for which the function returns
      * {@code valueAtNumCall}.
      * @return the neighbourhood size function.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code initValue <= 0}.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code valueAtNumCall <= 0}.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code valueAtNumCall >= initValue}.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code numCall <= 0}.
      */
     public static NeighbourhoodSizeFunction exponentialDecay(final double initValue,
@@ -83,11 +83,11 @@ public class NeighbourhoodSizeFunctionFactory {
      * @param slope Value of the function derivative at {@code numCall}.
      * @param numCall Inflexion point.
      * @return the neighbourhood size function.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code initValue <= 0}.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      * if {@code slope >= 0}.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code numCall <= 0}.
      */
     public static NeighbourhoodSizeFunction quasiSigmoidDecay(final double initValue,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/package-info.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/package-info.java
index 60c3c61..fec9d90 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/package-info.java
@@ -19,4 +19,4 @@
  * Self Organizing Feature Map.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm;
+package org.apache.commons.math4.ml.neuralnet.sofm;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunction.java
index 19e7380..d914bf1 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunction.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/ExponentialDecayFunction.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm.util;
+package org.apache.commons.math4.ml.neuralnet.sofm.util;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Exponential decay function: <code>a e<sup>-x / b</sup></code>,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunction.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunction.java
index 3d35c17..4abef6f 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunction.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/QuasiSigmoidDecayFunction.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm.util;
+package org.apache.commons.math4.ml.neuralnet.sofm.util;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.analysis.function.Logistic;
+import org.apache.commons.math4.analysis.function.Logistic;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
 
 /**
  * Decay function whose shape is similar to a sigmoid.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/package-info.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/package-info.java
index 5078ed2..8da688b 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/sofm/util/package-info.java
@@ -19,4 +19,4 @@
  * Miscellaneous utilities.
  */
 
-package org.apache.commons.math3.ml.neuralnet.sofm.util;
+package org.apache.commons.math4.ml.neuralnet.sofm.util;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
index ce30d86..a6f4315 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/NeuronSquareMesh2D.java
@@ -15,19 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.neuralnet.twod;
+package org.apache.commons.math4.ml.neuralnet.twod;
 
 import java.util.List;
 import java.util.ArrayList;
 import java.io.Serializable;
 import java.io.ObjectInputStream;
-import org.apache.commons.math3.ml.neuralnet.Neuron;
-import org.apache.commons.math3.ml.neuralnet.Network;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializer;
-import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.MathInternalError;
+
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.Network;
+import org.apache.commons.math4.ml.neuralnet.Neuron;
+import org.apache.commons.math4.ml.neuralnet.SquareNeighbourhood;
 
 /**
  * Neural network with the topology of a two-dimensional surface.
@@ -37,7 +38,7 @@ import org.apache.commons.math3.exception.MathInternalError;
  * <a href="http://en.wikipedia.org/wiki/Kohonen">
  *  Self Organizing Feature Map</a>.
  *
- * @see org.apache.commons.math3.ml.neuralnet.sofm
+ * @see org.apache.commons.math4.ml.neuralnet.sofm
  * @since 3.3
  */
 public class NeuronSquareMesh2D implements Serializable {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/package-info.java b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/package-info.java
index 41535e8..f491843 100644
--- a/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/neuralnet/twod/package-info.java
@@ -19,4 +19,4 @@
  * Two-dimensional neural networks.
  */
 
-package org.apache.commons.math3.ml.neuralnet.twod;
+package org.apache.commons.math4.ml.neuralnet.twod;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/package-info.java b/src/main/java/org/apache/commons/math4/ml/package-info.java
index 80ae917..f0a6e9d 100644
--- a/src/main/java/org/apache/commons/math4/ml/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Base package for machine learning algorithms.
  */
-package org.apache.commons.math3.ml;
+package org.apache.commons.math4.ml;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
index fd170c1..9d23fe2 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractIntegrator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -26,20 +26,20 @@ import java.util.List;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
-import org.apache.commons.math3.analysis.solvers.BracketingNthOrderBrentSolver;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolver;
-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.exception.util.LocalizedFormats;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.events.EventState;
-import org.apache.commons.math3.ode.sampling.AbstractStepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.solvers.BracketingNthOrderBrentSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+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.exception.util.LocalizedFormats;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.events.EventState;
+import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Incrementor;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Base class managing common boilerplate for all integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
index d6beff4..baa5cbb 100644
--- a/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
+++ b/src/main/java/org/apache/commons/math4/ode/AbstractParameterizable.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.ArrayList;
 import java.util.Collection;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
index 75e4979..de3d6c4 100644
--- a/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
+++ b/src/main/java/org/apache/commons/math4/ode/ContinuousOutputModel.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class stores all information provided by an ODE integrator
@@ -78,7 +78,7 @@ import org.apache.commons.math3.util.FastMath;
  * ContinuousOutputModel instance can be important if the state vector
  * is large, if the integration interval is long or if the steps are
  * small (which can result from small tolerance settings in {@link
- * org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator adaptive
+ * org.apache.commons.math4.ode.nonstiff.AdaptiveStepsizeIntegrator adaptive
  * step size integrators}).</p>
  *
  * @see StepHandler
@@ -376,8 +376,8 @@ public class ContinuousOutputModel
    * to be preserved across several calls to the associated
    * {@link #setInterpolatedTime(double)} method.</p>
    * @param secondaryStateIndex index of the secondary set, as returned by {@link
-   * org.apache.commons.math3.ode.ExpandableStatefulODE#addSecondaryEquations(
-   * org.apache.commons.math3.ode.SecondaryEquations)
+   * org.apache.commons.math4.ode.ExpandableStatefulODE#addSecondaryEquations(
+   * org.apache.commons.math4.ode.SecondaryEquations)
    * ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)}
    * @return interpolated secondary state at the current interpolation date
    * @see #setInterpolatedTime(double)
@@ -398,8 +398,8 @@ public class ContinuousOutputModel
    * to be preserved across several calls to the associated
    * {@link #setInterpolatedTime(double)} method.</p>
    * @param secondaryStateIndex index of the secondary set, as returned by {@link
-   * org.apache.commons.math3.ode.ExpandableStatefulODE#addSecondaryEquations(
-   * org.apache.commons.math3.ode.SecondaryEquations)
+   * org.apache.commons.math4.ode.ExpandableStatefulODE#addSecondaryEquations(
+   * org.apache.commons.math4.ode.SecondaryEquations)
    * ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)}
    * @return interpolated secondary derivatives at the current interpolation date
    * @see #setInterpolatedTime(double)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/EquationsMapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/EquationsMapper.java b/src/main/java/org/apache/commons/math4/ode/EquationsMapper.java
index 85b94c8..29fbd35 100644
--- a/src/main/java/org/apache/commons/math4/ode/EquationsMapper.java
+++ b/src/main/java/org/apache/commons/math4/ode/EquationsMapper.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /**
  * Class mapping the part of a complete state or derivative that pertains

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java b/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
index dc7d4a9..711f524 100644
--- a/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
+++ b/src/main/java/org/apache/commons/math4/ode/ExpandableStatefulODE.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/FirstOrderConverter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/FirstOrderConverter.java b/src/main/java/org/apache/commons/math4/ode/FirstOrderConverter.java
index 2252619..d59c9bb 100644
--- a/src/main/java/org/apache/commons/math4/ode/FirstOrderConverter.java
+++ b/src/main/java/org/apache/commons/math4/ode/FirstOrderConverter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 
 /** This class converts second order differential equations to first

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.java b/src/main/java/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.java
index db1a21b..11c7997 100644
--- a/src/main/java/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.java
+++ b/src/main/java/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/FirstOrderIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/FirstOrderIntegrator.java b/src/main/java/org/apache/commons/math4/ode/FirstOrderIntegrator.java
index 945aea8..3ac874e 100644
--- a/src/main/java/org/apache/commons/math4/ode/FirstOrderIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/FirstOrderIntegrator.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-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.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /** This interface represents a first order integrator for
  * differential equations.
@@ -31,8 +31,8 @@ import org.apache.commons.math3.exception.NumberIsTooSmallException;
  * FirstOrderDifferentialEquations} interface.</p>
  *
  * @see FirstOrderDifferentialEquations
- * @see org.apache.commons.math3.ode.sampling.StepHandler
- * @see org.apache.commons.math3.ode.events.EventHandler
+ * @see org.apache.commons.math4.ode.sampling.StepHandler
+ * @see org.apache.commons.math4.ode.events.EventHandler
  * @since 1.2
  */
 
@@ -52,7 +52,7 @@ public interface FirstOrderIntegrator extends ODEIntegrator {
    *  step (and hence at the end of integration), can be the same object as y0
    * @return stop time, will be the same as target time if integration reached its
    * target, but may be different if some {@link
-   * org.apache.commons.math3.ode.events.EventHandler} stops it at some point.
+   * org.apache.commons.math4.ode.events.EventHandler} stops it at some point.
    * @exception DimensionMismatchException if arrays dimension do not match equations settings
    * @exception NumberIsTooSmallException if integration step is too small
    * @exception MaxCountExceededException if the number of functions evaluations is exceeded

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
index 0ce552d..e2f3af9 100644
--- a/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
+++ b/src/main/java/org/apache/commons/math4/ode/JacobianMatrices.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.lang.reflect.Array;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * This class defines a set of {@link SecondaryEquations secondary equations} to

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/MainStateJacobianProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/MainStateJacobianProvider.java b/src/main/java/org/apache/commons/math4/ode/MainStateJacobianProvider.java
index 2bffbee..811a3fb 100644
--- a/src/main/java/org/apache/commons/math4/ode/MainStateJacobianProvider.java
+++ b/src/main/java/org/apache/commons/math4/ode/MainStateJacobianProvider.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 /** Interface expanding {@link FirstOrderDifferentialEquations first order
  *  differential equations} in order to compute exactly the main state jacobian

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java b/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java
index 0fad1a2..df9797d 100644
--- a/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/MultistepIntegrator.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
-
-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.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode;
+
+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.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.ode.nonstiff.AdaptiveStepsizeIntegrator;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class is the base class for multistep integrators for Ordinary
@@ -55,8 +55,8 @@ import org.apache.commons.math3.util.FastMath;
  * factor is therefore set to a quite low value: 2<sup>1/order</sup>.
  * </p>
  *
- * @see org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator
- * @see org.apache.commons.math3.ode.nonstiff.AdamsMoultonIntegrator
+ * @see org.apache.commons.math4.ode.nonstiff.AdamsBashforthIntegrator
+ * @see org.apache.commons.math4.ode.nonstiff.AdamsMoultonIntegrator
  * @since 2.0
  */
 public abstract class MultistepIntegrator extends AdaptiveStepsizeIntegrator {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ODEIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ODEIntegrator.java b/src/main/java/org/apache/commons/math4/ode/ODEIntegrator.java
index 9efddd7..64ea0ee 100644
--- a/src/main/java/org/apache/commons/math4/ode/ODEIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/ODEIntegrator.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.analysis.solvers.UnivariateSolver;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.sampling.StepHandler;
 
 /**
  * This interface defines the common parts shared by integrators

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ParameterConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterConfiguration.java b/src/main/java/org/apache/commons/math4/ode/ParameterConfiguration.java
index 7af2cd5..d71c2b7 100644
--- a/src/main/java/org/apache/commons/math4/ode/ParameterConfiguration.java
+++ b/src/main/java/org/apache/commons/math4/ode/ParameterConfiguration.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ParameterJacobianProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianProvider.java b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianProvider.java
index 911ad28..2ae8ff6 100644
--- a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianProvider.java
+++ b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianProvider.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 /** Interface to compute exactly Jacobian matrix for some parameter
  *  when computing {@link JacobianMatrices partial derivatives equations}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
index 40fcd97..856eb15 100644
--- a/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
+++ b/src/main/java/org/apache/commons/math4/ode/ParameterJacobianWrapper.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 /** Wrapper class to compute Jacobian matrices by finite differences for ODE
  *  which do not compute them by themselves.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/Parameterizable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/Parameterizable.java b/src/main/java/org/apache/commons/math4/ode/Parameterizable.java
index 9854c7a..a424f92 100644
--- a/src/main/java/org/apache/commons/math4/ode/Parameterizable.java
+++ b/src/main/java/org/apache/commons/math4/ode/Parameterizable.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.Collection;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ParameterizedODE.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterizedODE.java b/src/main/java/org/apache/commons/math4/ode/ParameterizedODE.java
index 5e5565b..9b50d65 100644
--- a/src/main/java/org/apache/commons/math4/ode/ParameterizedODE.java
+++ b/src/main/java/org/apache/commons/math4/ode/ParameterizedODE.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 
 /** Interface to compute by finite difference Jacobian matrix for some parameter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
index 1a0bad6..14594d0 100644
--- a/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
+++ b/src/main/java/org/apache/commons/math4/ode/ParameterizedWrapper.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 /** Wrapper class enabling {@link FirstOrderDifferentialEquations basic simple}
  *  ODE instances to be used when processing {@link JacobianMatrices}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/SecondOrderDifferentialEquations.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/SecondOrderDifferentialEquations.java b/src/main/java/org/apache/commons/math4/ode/SecondOrderDifferentialEquations.java
index 058860f..3061913 100644
--- a/src/main/java/org/apache/commons/math4/ode/SecondOrderDifferentialEquations.java
+++ b/src/main/java/org/apache/commons/math4/ode/SecondOrderDifferentialEquations.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
 
 /** This interface represents a second order differential equations set.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/SecondOrderIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/SecondOrderIntegrator.java b/src/main/java/org/apache/commons/math4/ode/SecondOrderIntegrator.java
index 8628435..e61cc72 100644
--- a/src/main/java/org/apache/commons/math4/ode/SecondOrderIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/SecondOrderIntegrator.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
 
 
 /** This interface represents a second order integrator for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/SecondaryEquations.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/SecondaryEquations.java b/src/main/java/org/apache/commons/math4/ode/SecondaryEquations.java
index 358fb72..0e7e5de 100644
--- a/src/main/java/org/apache/commons/math4/ode/SecondaryEquations.java
+++ b/src/main/java/org/apache/commons/math4/ode/SecondaryEquations.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 /**
  * This interface allows users to add secondary differential equations to a primary

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/UnknownParameterException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/UnknownParameterException.java b/src/main/java/org/apache/commons/math4/ode/UnknownParameterException.java
index 172ef8c..75c6210 100644
--- a/src/main/java/org/apache/commons/math4/ode/UnknownParameterException.java
+++ b/src/main/java/org/apache/commons/math4/ode/UnknownParameterException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a parameter is unknown.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java b/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java
index c18f58e..27eab1a 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/EventFilter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.events;
+package org.apache.commons.math4.ode.events;
 
 import java.util.Arrays;
 
@@ -38,7 +38,7 @@ import java.util.Arrays;
  *
  * <p>Users can wrap a regular {@link EventHandler event handler} in
  * an instance of this class and provide this wrapping instance to
- * the {@link org.apache.commons.math3.ode.FirstOrderIntegrator ODE solver}
+ * the {@link org.apache.commons.math4.ode.FirstOrderIntegrator ODE solver}
  * in order to avoid wasting time looking for uninteresting events.
  * The wrapper will intercept the calls to the {@link
  * EventHandler#g(double, double[]) g function} and to the {@link

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/events/EventHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/EventHandler.java b/src/main/java/org/apache/commons/math4/ode/events/EventHandler.java
index 8fb39a4..cb22ea1 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/EventHandler.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/EventHandler.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.events;
+package org.apache.commons.math4.ode.events;
 
 
 /** This interface represents a handler for discrete events triggered
@@ -73,7 +73,7 @@ public interface EventHandler  {
          * #eventOccurred eventOccurred} method when the integration should
          * go on after the event ending the current step, with a new derivatives
          * vector (which will be retrieved thanks to the {@link
-         * org.apache.commons.math3.ode.FirstOrderDifferentialEquations#computeDerivatives}
+         * org.apache.commons.math4.ode.FirstOrderDifferentialEquations#computeDerivatives}
          * method).</p>
          */
         RESET_DERIVATIVES,
@@ -111,7 +111,7 @@ public interface EventHandler  {
    * the sign of the switching function at the start of the next step (i.e.
    * just after the event) is the opposite of the sign just before the event.
    * This consistency between the steps <string>must</strong> be preserved,
-   * otherwise {@link org.apache.commons.math3.exception.NoBracketingException
+   * otherwise {@link org.apache.commons.math4.exception.NoBracketingException
    * exceptions} related to root not being bracketed will occur.</p>
    * <p>This need for consistency is sometimes tricky to achieve. A typical
    * example is using an event to model a ball bouncing on the floor. The first
@@ -143,7 +143,7 @@ public interface EventHandler  {
    * the step handler itself is called (see below for scheduling). It
    * allows the user to update his internal data to acknowledge the fact
    * the event has been handled (for example setting a flag in the {@link
-   * org.apache.commons.math3.ode.FirstOrderDifferentialEquations
+   * org.apache.commons.math4.ode.FirstOrderDifferentialEquations
    * differential equations} to switch the derivatives computation in
    * case of discontinuity), or to direct the integrator to either stop
    * or continue integration, possibly with a reset state or derivatives.</p>
@@ -151,7 +151,7 @@ public interface EventHandler  {
    * <ul>
    *   <li>if {@link Action#STOP} is returned, the step handler will be called
    *   with the <code>isLast</code> flag of the {@link
-   *   org.apache.commons.math3.ode.sampling.StepHandler#handleStep handleStep}
+   *   org.apache.commons.math4.ode.sampling.StepHandler#handleStep handleStep}
    *   method set to true and the integration will be stopped,</li>
    *   <li>if {@link Action#RESET_STATE} is returned, the {@link #resetState
    *   resetState} method will be called once the step handler has
@@ -165,28 +165,28 @@ public interface EventHandler  {
    * </ul>
 
    * <p>The scheduling between this method and the {@link
-   * org.apache.commons.math3.ode.sampling.StepHandler StepHandler} method {@link
-   * org.apache.commons.math3.ode.sampling.StepHandler#handleStep(
-   * org.apache.commons.math3.ode.sampling.StepInterpolator, boolean)
+   * org.apache.commons.math4.ode.sampling.StepHandler StepHandler} method {@link
+   * org.apache.commons.math4.ode.sampling.StepHandler#handleStep(
+   * org.apache.commons.math4.ode.sampling.StepInterpolator, boolean)
    * handleStep(interpolator, isLast)} is to call this method first and
    * <code>handleStep</code> afterwards. This scheduling allows the integrator to
    * pass <code>true</code> as the <code>isLast</code> parameter to the step
    * handler to make it aware the step will be the last one if this method
    * returns {@link Action#STOP}. As the interpolator may be used to navigate back
    * throughout the last step (as {@link
-   * org.apache.commons.math3.ode.sampling.StepNormalizer StepNormalizer}
+   * org.apache.commons.math4.ode.sampling.StepNormalizer StepNormalizer}
    * does for example), user code called by this method and user
    * code called by step handlers may experience apparently out of order values
    * of the independent time variable. As an example, if the same user object
    * implements both this {@link EventHandler EventHandler} interface and the
-   * {@link org.apache.commons.math3.ode.sampling.FixedStepHandler FixedStepHandler}
+   * {@link org.apache.commons.math4.ode.sampling.FixedStepHandler FixedStepHandler}
    * interface, a <em>forward</em> integration may call its
    * <code>eventOccurred</code> method with t = 10 first and call its
    * <code>handleStep</code> method with t = 9 afterwards. Such out of order
    * calls are limited to the size of the integration step for {@link
-   * org.apache.commons.math3.ode.sampling.StepHandler variable step handlers} and
+   * org.apache.commons.math4.ode.sampling.StepHandler variable step handlers} and
    * to the size of the fixed step for {@link
-   * org.apache.commons.math3.ode.sampling.FixedStepHandler fixed step handlers}.</p>
+   * org.apache.commons.math4.ode.sampling.FixedStepHandler fixed step handlers}.</p>
 
    * @param t current value of the independent <i>time</i> variable
    * @param y array containing the current value of the state vector

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/events/EventState.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/EventState.java b/src/main/java/org/apache/commons/math4/ode/events/EventState.java
index 76dae72..fe3039a 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/EventState.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/EventState.java
@@ -15,20 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.events;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.solvers.AllowedSolution;
-import org.apache.commons.math3.analysis.solvers.BracketedUnivariateSolver;
-import org.apache.commons.math3.analysis.solvers.PegasusSolver;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolver;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.events;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.solvers.AllowedSolution;
+import org.apache.commons.math4.analysis.solvers.BracketedUnivariateSolver;
+import org.apache.commons.math4.analysis.solvers.PegasusSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolverUtils;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class handles the state for one {@link EventHandler
  * event handler} during integration steps.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/FilterType.java b/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
index 2ac0df8..4dfaefb 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/FilterType.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.events;
+package org.apache.commons.math4.ode.events;
 
-import org.apache.commons.math3.exception.MathInternalError;
+import org.apache.commons.math4.exception.MathInternalError;
 
 /** Enumerate for {@link EventFilter filtering events}.
  *
@@ -83,7 +83,7 @@ public enum FilterType {
          *   <li>h = min(-s,-g,+g)</li>
          *   <li>h = -g</li>
          * </ul>
-         * where s is a tiny positive value: {@link org.apache.commons.math3.util.Precision#SAFE_MIN}.
+         * where s is a tiny positive value: {@link org.apache.commons.math4.util.Precision#SAFE_MIN}.
          * </p>
          */
         @Override
@@ -261,7 +261,7 @@ public enum FilterType {
          *   <li>h = min(-s,-g,+g)</li>
          *   <li>h = -g</li>
          * </ul>
-         * where s is a tiny positive value: {@link org.apache.commons.math3.util.Precision#SAFE_MIN}.
+         * where s is a tiny positive value: {@link org.apache.commons.math4.util.Precision#SAFE_MIN}.
          * </p>
          */
         @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/Transformer.java b/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
index 5c1f97c..f341f35 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/Transformer.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.events;
+package org.apache.commons.math4.ode.events;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 
 /** Transformer for {@link EventHandler#g(double, double[]) g functions}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/events/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/events/package-info.java b/src/main/java/org/apache/commons/math4/ode/events/package-info.java
index 9d3b917..6e8ecdd 100644
--- a/src/main/java/org/apache/commons/math4/ode/events/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ode/events/package-info.java
@@ -23,7 +23,7 @@
  *
  * <p>
  * Discrete events detection is based on switching functions. The user provides
- * a simple {@link org.apache.commons.math3.ode.events.EventHandler#g g(t, y)}
+ * a simple {@link org.apache.commons.math4.ode.events.EventHandler#g g(t, y)}
  * function depending on the current time and state. The integrator will monitor
  * the value of the function throughout integration range and will trigger the
  * event when its sign changes. The magnitude of the value is almost irrelevant,
@@ -93,4 +93,4 @@
  *
  *
  */
-package org.apache.commons.math3.ode.events;
+package org.apache.commons.math4.ode.events;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegrator.java
index fd80d85..2623756 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegrator.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-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.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.sampling.NordsieckStepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+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.Array2DRowRealMatrix;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.sampling.NordsieckStepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsIntegrator.java
index dd6f2a1..9563d31 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsIntegrator.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-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.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.MultistepIntegrator;
+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.Array2DRowRealMatrix;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.MultistepIntegrator;
 
 
 /** Base class for {@link AdamsBashforthIntegrator Adams-Bashforth} and

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java
index c019fab..dc58b6c 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.java
@@ -15,20 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 import java.util.Arrays;
 
-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.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrixPreservingVisitor;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.sampling.NordsieckStepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+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.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrixPreservingVisitor;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.sampling.NordsieckStepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java
index 68f66c6..a648ce2 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdamsNordsieckTransformer.java
@@ -15,22 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.linear.Array2DRowFieldMatrix;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayFieldVector;
-import org.apache.commons.math3.linear.FieldDecompositionSolver;
-import org.apache.commons.math3.linear.FieldLUDecomposition;
-import org.apache.commons.math3.linear.FieldMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayFieldVector;
+import org.apache.commons.math4.linear.FieldDecompositionSolver;
+import org.apache.commons.math4.linear.FieldLUDecomposition;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /** Transformer to Nordsieck vectors for Adams integrators.
  * <p>This class is used by {@link AdamsBashforthIntegrator Adams-Bashforth} and

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/AdaptiveStepsizeIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdaptiveStepsizeIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdaptiveStepsizeIntegrator.java
index ab79bbf..6dacc1a 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/AdaptiveStepsizeIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/AdaptiveStepsizeIntegrator.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-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.exception.util.LocalizedFormats;
-import org.apache.commons.math3.ode.AbstractIntegrator;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.util.FastMath;
+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.exception.util.LocalizedFormats;
+import org.apache.commons.math4.ode.AbstractIntegrator;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This abstract class holds the common part of all adaptive
@@ -44,7 +44,7 @@ import org.apache.commons.math3.util.FastMath;
  * <p>
  * If the Ordinary Differential Equations is an {@link ExpandableStatefulODE
  * extended ODE} rather than a {@link
- * org.apache.commons.math3.ode.FirstOrderDifferentialEquations basic ODE}, then
+ * org.apache.commons.math4.ode.FirstOrderDifferentialEquations basic ODE}, then
  * <em>only</em> the {@link ExpandableStatefulODE#getPrimaryState() primary part}
  * of the state vector is used for stepsize control, not the complete state vector.
  * </p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegrator.java
index ca915f1..e6df204 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegrator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolator.java
index ba9b11f..1f60963 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaStepInterpolator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /**
  * This class implements a step interpolator for the classical fourth

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54Integrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54Integrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54Integrator.java
index 45229b2..731ea93 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54Integrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54Integrator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolator.java
index a013584..114ce48 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince54StepInterpolator.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.AbstractIntegrator;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.AbstractIntegrator;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /**
  * This class represents an interpolator over the last step during an

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853Integrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853Integrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853Integrator.java
index 895cb88..841d894 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853Integrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853Integrator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**


[69/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java
index b0c8b8a..b237dee 100644
--- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateSimpleBoundsOptimizer.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateFunction;
 
 /**
  * This interface is mainly intended to enforce the internal coherence of
  * Commons-FastMath. Users of the API are advised to base their code on
  * the following interfaces:
  * <ul>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer}</li>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateDifferentiableOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer}</li>
  * </ul>
  *
  * @param <FUNC> Type of the objective function to be optimized.
@@ -48,15 +48,15 @@ public interface BaseMultivariateSimpleBoundsOptimizer<FUNC extends Multivariate
      * @param upperBound Upper bound for each of the parameters.
      * @return the point/value pair giving the optimal value for objective
      * function.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the array sizes are wrong.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if
+     * @throws org.apache.commons.math4.exception.NullArgumentException if
      * {@code f}, {@code goalType} or {@code startPoint} is {@code null}.
-     * @throws org.apache.commons.math3.exception.NumberIsTooSmallException if any
+     * @throws org.apache.commons.math4.exception.NumberIsTooSmallException if any
      * of the initial values is less than its lower bound.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException if any
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException if any
      * of the initial values is greater than its upper bound.
      */
     PointValuePair optimize(int maxEval, FUNC f, GoalType goalType,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java
index d69b13f..f3048d1 100644
--- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorMultiStartOptimizer.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Base class for all implementations of a multi-start optimizer.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java
index c620da5..34908ec 100644
--- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateVectorOptimizer.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
 
 /**
  * This interface is mainly intended to enforce the internal coherence of
  * Commons-Math. Users of the API are advised to base their code on
  * the following interfaces:
  * <ul>
- *  <li>{@link org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer}</li>
  * </ul>
  *
  * @param <FUNC> Type of the objective function to be optimized.
@@ -48,14 +48,14 @@ public interface BaseMultivariateVectorOptimizer<FUNC extends MultivariateVector
      * @return the point/value pair giving the optimal value for objective
      * function.
      * @param maxEval Maximum number of function evaluations.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if
+     * @throws org.apache.commons.math4.exception.NullArgumentException if
      * any argument is {@code null}.
      * @deprecated As of 3.1. In 4.0, this will be replaced by the declaration
-     * corresponding to this {@link org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer#optimize(int,MultivariateVectorFunction,OptimizationData[]) method}.
+     * corresponding to this {@link org.apache.commons.math4.optimization.direct.BaseAbstractMultivariateVectorOptimizer#optimize(int,MultivariateVectorFunction,OptimizationData[]) method}.
      */
     @Deprecated
     PointVectorValuePair optimize(int maxEval, FUNC f, double[] target,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java
index af93b8b..68c1f87 100644
--- a/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/BaseOptimizer.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 /**
  * This interface is mainly intended to enforce the internal coherence of
  * Commons-Math. Users of the API are advised to base their code on
  * the following interfaces:
  * <ul>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer}</li>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateDifferentiableOptimizer}</li>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateDifferentiableVectorOptimizer}</li>
- *  <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableVectorOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.univariate.UnivariateOptimizer}</li>
  * </ul>
  *
  * @param <PAIR> Type of the point/objective pair.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java b/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java
index eb14b3f..3c157dc 100644
--- a/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java
+++ b/src/main/java/org/apache/commons/math4/optimization/ConvergenceChecker.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 /**
  * This interface specifies how to check if an optimization algorithm has
@@ -36,9 +36,9 @@ package org.apache.commons.math3.optimization;
  *
  * @param <PAIR> Type of the (point, objective value) pair.
  *
- * @see org.apache.commons.math3.optimization.SimplePointChecker
- * @see org.apache.commons.math3.optimization.SimpleValueChecker
- * @see org.apache.commons.math3.optimization.SimpleVectorValueChecker
+ * @see org.apache.commons.math4.optimization.SimplePointChecker
+ * @see org.apache.commons.math4.optimization.SimpleValueChecker
+ * @see org.apache.commons.math4.optimization.SimpleVectorValueChecker
  *
  * @deprecated As of 3.1 (to be removed in 4.0).
  * @since 3.0

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java
index a395284..27d2f8c 100644
--- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateMultiStartOptimizer.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.DifferentiableMultivariateFunction;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.analysis.DifferentiableMultivariateFunction;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Special implementation of the {@link DifferentiableMultivariateOptimizer}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java
index 4c2e7ec..f1d8da2 100644
--- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.DifferentiableMultivariateFunction;
+import org.apache.commons.math4.analysis.DifferentiableMultivariateFunction;
 
 /**
  * This interface represents an optimization algorithm for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java
index 88ed197..b76365e 100644
--- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorMultiStartOptimizer.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.DifferentiableMultivariateVectorFunction;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.analysis.DifferentiableMultivariateVectorFunction;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Special implementation of the {@link DifferentiableMultivariateVectorOptimizer}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java
index e3d30ae..d4ecdf5 100644
--- a/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.DifferentiableMultivariateVectorFunction;
+import org.apache.commons.math4.analysis.DifferentiableMultivariateVectorFunction;
 
 /**
  * This interface represents an optimization algorithm for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/GoalType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/GoalType.java b/src/main/java/org/apache/commons/math4/optimization/GoalType.java
index f752397..d61072f 100644
--- a/src/main/java/org/apache/commons/math4/optimization/GoalType.java
+++ b/src/main/java/org/apache/commons/math4/optimization/GoalType.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java b/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java
index e319a48..b12680c 100644
--- a/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java
+++ b/src/main/java/org/apache/commons/math4/optimization/InitialGuess.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 /**
  * Starting point (first guess) of the optimization procedure.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java b/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java
index 06d21bf..74ca4ee 100644
--- a/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java
+++ b/src/main/java/org/apache/commons/math4/optimization/LeastSquaresConverter.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /** This class converts {@link MultivariateVectorFunction vectorial
  * objective functions} to {@link MultivariateFunction scalar objective functions}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java
index fa4d6ef..ca558f0 100644
--- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizer.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Special implementation of the {@link MultivariateDifferentiableOptimizer}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java
index 66c0327..67e894e 100644
--- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableOptimizer.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
 
 /**
  * This interface represents an optimization algorithm for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java
index 26da7d5..63e8953 100644
--- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizer.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Special implementation of the {@link MultivariateDifferentiableVectorOptimizer}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java
index 1abe3bc..569624d 100644
--- a/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorOptimizer.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
 
 /**
  * This interface represents an optimization algorithm for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java
index d33f52a..8c0df54 100644
--- a/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizer.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Special implementation of the {@link MultivariateOptimizer} interface adding

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java
index b2d3cc2..e0d2715 100644
--- a/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/MultivariateOptimizer.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateFunction;
 
 /**
  * This interface represents an optimization algorithm for {@link MultivariateFunction

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/OptimizationData.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/OptimizationData.java b/src/main/java/org/apache/commons/math4/optimization/OptimizationData.java
index e807667..1ddf3c7 100644
--- a/src/main/java/org/apache/commons/math4/optimization/OptimizationData.java
+++ b/src/main/java/org/apache/commons/math4/optimization/OptimizationData.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 /**
  * Marker interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/PointValuePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/PointValuePair.java b/src/main/java/org/apache/commons/math4/optimization/PointValuePair.java
index 7db9261..d3831e9 100644
--- a/src/main/java/org/apache/commons/math4/optimization/PointValuePair.java
+++ b/src/main/java/org/apache/commons/math4/optimization/PointValuePair.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * This class holds a point and the value of an objective function at
  * that point.
  *
  * @see PointVectorValuePair
- * @see org.apache.commons.math3.analysis.MultivariateFunction
+ * @see org.apache.commons.math4.analysis.MultivariateFunction
  * @deprecated As of 3.1 (to be removed in 4.0).
  * @since 3.0
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/PointVectorValuePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/PointVectorValuePair.java b/src/main/java/org/apache/commons/math4/optimization/PointVectorValuePair.java
index 4c1884d..410ba67 100644
--- a/src/main/java/org/apache/commons/math4/optimization/PointVectorValuePair.java
+++ b/src/main/java/org/apache/commons/math4/optimization/PointVectorValuePair.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * This class holds a point and the vectorial value of an objective function at
  * that point.
  *
  * @see PointValuePair
- * @see org.apache.commons.math3.analysis.MultivariateVectorFunction
+ * @see org.apache.commons.math4.analysis.MultivariateVectorFunction
  * @deprecated As of 3.1 (to be removed in 4.0).
  * @since 3.0
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/SimpleBounds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/SimpleBounds.java b/src/main/java/org/apache/commons/math4/optimization/SimpleBounds.java
index 505f5ee..097ba8a 100644
--- a/src/main/java/org/apache/commons/math4/optimization/SimpleBounds.java
+++ b/src/main/java/org/apache/commons/math4/optimization/SimpleBounds.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 /**
  * Simple optimization constraints: lower and upper bounds.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/SimplePointChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/SimplePointChecker.java b/src/main/java/org/apache/commons/math4/optimization/SimplePointChecker.java
index d1fdb8e..0651725 100644
--- a/src/main/java/org/apache/commons/math4/optimization/SimplePointChecker.java
+++ b/src/main/java/org/apache/commons/math4/optimization/SimplePointChecker.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Simple implementation of the {@link ConvergenceChecker} interface using

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/SimpleValueChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/SimpleValueChecker.java b/src/main/java/org/apache/commons/math4/optimization/SimpleValueChecker.java
index 3ee0a90..45f44ba 100644
--- a/src/main/java/org/apache/commons/math4/optimization/SimpleValueChecker.java
+++ b/src/main/java/org/apache/commons/math4/optimization/SimpleValueChecker.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Simple implementation of the {@link ConvergenceChecker} interface using

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/SimpleVectorValueChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/SimpleVectorValueChecker.java b/src/main/java/org/apache/commons/math4/optimization/SimpleVectorValueChecker.java
index 8238ff8..8105988 100644
--- a/src/main/java/org/apache/commons/math4/optimization/SimpleVectorValueChecker.java
+++ b/src/main/java/org/apache/commons/math4/optimization/SimpleVectorValueChecker.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Simple implementation of the {@link ConvergenceChecker} interface using

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/Target.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/Target.java b/src/main/java/org/apache/commons/math4/optimization/Target.java
index 3a0bb44..380d841 100644
--- a/src/main/java/org/apache/commons/math4/optimization/Target.java
+++ b/src/main/java/org/apache/commons/math4/optimization/Target.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 /**
  * Target of the optimization procedure.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/Weight.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/Weight.java b/src/main/java/org/apache/commons/math4/optimization/Weight.java
index 012a1fc..e5a3a9e 100644
--- a/src/main/java/org/apache/commons/math4/optimization/Weight.java
+++ b/src/main/java/org/apache/commons/math4/optimization/Weight.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  * Weight matrix of the residuals between model and observations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/AbstractSimplex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/AbstractSimplex.java b/src/main/java/org/apache/commons/math4/optimization/direct/AbstractSimplex.java
index b229cd1..d30a0c6 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/AbstractSimplex.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/AbstractSimplex.java
@@ -15,21 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.OptimizationData;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optimization.OptimizationData;
+import org.apache.commons.math4.optimization.PointValuePair;
 
 /**
  * This class implements the simplex concept.
@@ -201,7 +201,7 @@ public abstract class AbstractSimplex implements OptimizationData {
      * @param evaluationFunction Evaluation function.
      * @param comparator Comparator to use to sort simplex vertices from best
      * to worst.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the algorithm fails to converge.
      */
     public abstract void iterate(final MultivariateFunction evaluationFunction,
@@ -239,7 +239,7 @@ public abstract class AbstractSimplex implements OptimizationData {
      *
      * @param evaluationFunction Evaluation function.
      * @param comparator Comparator to use to sort simplex vertices from best to worst.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
      */
     public void evaluate(final MultivariateFunction evaluationFunction,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizer.java
index 3b02370..487aad6 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizer.java
@@ -16,20 +16,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.MultivariateOptimizer;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optimization.direct;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.MultivariateOptimizer;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Powell's BOBYQA algorithm. This implementation is translated and

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateOptimizer.java
index d148d8c..8af7c47 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateOptimizer.java
@@ -15,23 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optimization.BaseMultivariateOptimizer;
-import org.apache.commons.math3.optimization.OptimizationData;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.InitialGuess;
-import org.apache.commons.math3.optimization.SimpleBounds;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.SimpleValueChecker;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.BaseMultivariateOptimizer;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.InitialGuess;
+import org.apache.commons.math4.optimization.OptimizationData;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleBounds;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Base class for implementing optimizers for multivariate scalar functions.
@@ -154,11 +154,11 @@ public abstract class BaseAbstractMultivariateOptimizer<FUNC extends Multivariat
      * @param maxEval Maximum number of function evaluations.
      * @return the point/value pair giving the optimal value for objective
      * function.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if
+     * @throws org.apache.commons.math4.exception.NullArgumentException if
      * any argument is {@code null}.
      * @deprecated As of 3.1. Please use
      * {@link #optimize(int,MultivariateFunction,GoalType,OptimizationData[])}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateSimpleBoundsOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateSimpleBoundsOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateSimpleBoundsOptimizer.java
index 67a4296..d179202 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateSimpleBoundsOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateSimpleBoundsOptimizer.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optimization.BaseMultivariateOptimizer;
-import org.apache.commons.math3.optimization.BaseMultivariateSimpleBoundsOptimizer;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.InitialGuess;
-import org.apache.commons.math3.optimization.SimpleBounds;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optimization.BaseMultivariateOptimizer;
+import org.apache.commons.math4.optimization.BaseMultivariateSimpleBoundsOptimizer;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.InitialGuess;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleBounds;
 
 /**
  * Base class for implementing optimizers for multivariate scalar functions,
@@ -48,10 +48,10 @@ public abstract class BaseAbstractMultivariateSimpleBoundsOptimizer<FUNC extends
     /**
      * Simple constructor with default settings.
      * The convergence checker is set to a
-     * {@link org.apache.commons.math3.optimization.SimpleValueChecker}.
+     * {@link org.apache.commons.math4.optimization.SimpleValueChecker}.
      *
      * @see BaseAbstractMultivariateOptimizer#BaseAbstractMultivariateOptimizer()
-     * @deprecated See {@link org.apache.commons.math3.optimization.SimpleValueChecker#SimpleValueChecker()}
+     * @deprecated See {@link org.apache.commons.math4.optimization.SimpleValueChecker#SimpleValueChecker()}
      */
     @Deprecated
     protected BaseAbstractMultivariateSimpleBoundsOptimizer() {}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateVectorOptimizer.java
index e070632..ccca86e 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateVectorOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/BaseAbstractMultivariateVectorOptimizer.java
@@ -15,23 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.optimization.OptimizationData;
-import org.apache.commons.math3.optimization.InitialGuess;
-import org.apache.commons.math3.optimization.Target;
-import org.apache.commons.math3.optimization.Weight;
-import org.apache.commons.math3.optimization.BaseMultivariateVectorOptimizer;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.optimization.SimpleVectorValueChecker;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.BaseMultivariateVectorOptimizer;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.InitialGuess;
+import org.apache.commons.math4.optimization.OptimizationData;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.SimpleVectorValueChecker;
+import org.apache.commons.math4.optimization.Target;
+import org.apache.commons.math4.optimization.Weight;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Base class for implementing optimizers for multivariate scalar functions.
@@ -165,11 +165,11 @@ public abstract class BaseAbstractMultivariateVectorOptimizer<FUNC extends Multi
      * @return the point/value pair giving the optimal value for objective
      * function.
      * @param maxEval Maximum number of function evaluations.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if
+     * @throws org.apache.commons.math4.exception.NullArgumentException if
      * any argument is {@code null}.
      * @deprecated As of 3.1. Please use
      * {@link #optimizeInternal(int,MultivariateVectorFunction,OptimizationData[])}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/CMAESOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/CMAESOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/direct/CMAESOptimizer.java
index 661b569..17d84af 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/CMAESOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/CMAESOptimizer.java
@@ -15,32 +15,32 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.OptimizationData;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.MultivariateOptimizer;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.SimpleValueChecker;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.MultivariateOptimizer;
+import org.apache.commons.math4.optimization.OptimizationData;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * <p>An implementation of the active Covariance Matrix Adaptation Evolution Strategy (CMA-ES)
@@ -473,7 +473,7 @@ public class CMAESOptimizer
      * @param goalType Optimization type.
      * @param optData Optimization data. The following data will be looked for:
      * <ul>
-     *  <li>{@link org.apache.commons.math3.optimization.InitialGuess InitialGuess}</li>
+     *  <li>{@link org.apache.commons.math4.optimization.InitialGuess InitialGuess}</li>
      *  <li>{@link Sigma}</li>
      *  <li>{@link PopulationSize}</li>
      * </ul>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/MultiDirectionalSimplex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/MultiDirectionalSimplex.java b/src/main/java/org/apache/commons/math4/optimization/direct/MultiDirectionalSimplex.java
index c06bf96..cdc0bab 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/MultiDirectionalSimplex.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/MultiDirectionalSimplex.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optimization.PointValuePair;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optimization.PointValuePair;
 
 /**
  * This class implements the multi-directional direct search method.
@@ -138,9 +138,9 @@ public class MultiDirectionalSimplex extends AbstractSimplex {
      * {@link AbstractSimplex#AbstractSimplex(double[][])}.
      * @param khi Expansion coefficient.
      * @param gamma Contraction coefficient.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if the reference simplex does not contain at least one point.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if there is a dimension mismatch in the reference simplex.
      */
     public MultiDirectionalSimplex(final double[][] referenceSimplex,
@@ -189,7 +189,7 @@ public class MultiDirectionalSimplex extends AbstractSimplex {
      * @param comparator Comparator to use to sort simplex vertices from best
      * to poorest.
      * @return the best point in the transformed simplex.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
      */
     private PointValuePair evaluateNewSimplex(final MultivariateFunction evaluationFunction,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapter.java b/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapter.java
index 334138b..d246ed4 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapter.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapter.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Logit;
-import org.apache.commons.math3.analysis.function.Sigmoid;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Logit;
+import org.apache.commons.math4.analysis.function.Sigmoid;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>Adapter for mapping bounded {@link MultivariateFunction} to unbounded ones.</p>
@@ -53,8 +53,8 @@ import org.apache.commons.math3.util.MathUtils;
  * user is responsible for converting his bounded point to unbounded by calling
  * {@link #boundedToUnbounded(double[])} before providing them to the optimizer.
  * For the same reason, the point returned by the {@link
- * org.apache.commons.math3.optimization.BaseMultivariateOptimizer#optimize(int,
- * MultivariateFunction, org.apache.commons.math3.optimization.GoalType, double[])}
+ * org.apache.commons.math4.optimization.BaseMultivariateOptimizer#optimize(int,
+ * MultivariateFunction, org.apache.commons.math4.optimization.GoalType, double[])}
  * method is unbounded. So to convert this point to bounded, users must call
  * {@link #unboundedToBounded(double[])} by themselves!</p>
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapter.java b/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapter.java
index 4946487..113ebc8 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapter.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapter.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>Adapter extending bounded {@link MultivariateFunction} to an unbouded

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/NelderMeadSimplex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/NelderMeadSimplex.java b/src/main/java/org/apache/commons/math4/optimization/direct/NelderMeadSimplex.java
index a17586b..f193ccf 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/NelderMeadSimplex.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/NelderMeadSimplex.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 import java.util.Comparator;
 
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optimization.PointValuePair;
 
 /**
  * This class implements the Nelder-Mead simplex algorithm.
@@ -167,9 +167,9 @@ public class NelderMeadSimplex extends AbstractSimplex {
      * @param khi Expansion coefficient.
      * @param gamma Contraction coefficient.
      * @param sigma Shrinkage coefficient.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if the reference simplex does not contain at least one point.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if there is a dimension mismatch in the reference simplex.
      */
     public NelderMeadSimplex(final double[][] referenceSimplex,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/PowellOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/PowellOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/direct/PowellOptimizer.java
index 28190e1..a0a396e 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/PowellOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/PowellOptimizer.java
@@ -15,22 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.MultivariateOptimizer;
-import org.apache.commons.math3.optimization.univariate.BracketFinder;
-import org.apache.commons.math3.optimization.univariate.BrentOptimizer;
-import org.apache.commons.math3.optimization.univariate.UnivariatePointValuePair;
-import org.apache.commons.math3.optimization.univariate.SimpleUnivariateValueChecker;
+package org.apache.commons.math4.optimization.direct;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.MultivariateOptimizer;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.univariate.BracketFinder;
+import org.apache.commons.math4.optimization.univariate.BrentOptimizer;
+import org.apache.commons.math4.optimization.univariate.SimpleUnivariateValueChecker;
+import org.apache.commons.math4.optimization.univariate.UnivariatePointValuePair;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Powell algorithm.
@@ -324,7 +324,7 @@ public class PowellOptimizer
          * @param p Starting point.
          * @param d Search direction.
          * @return the optimum.
-         * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+         * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
          * if the number of evaluations is exceeded.
          */
         public UnivariatePointValuePair search(final double[] p, final double[] d) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/SimplexOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/SimplexOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/direct/SimplexOptimizer.java
index 8333342..0adcdb3 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/SimplexOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/SimplexOptimizer.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.SimpleValueChecker;
-import org.apache.commons.math3.optimization.MultivariateOptimizer;
-import org.apache.commons.math3.optimization.OptimizationData;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.MultivariateOptimizer;
+import org.apache.commons.math4.optimization.OptimizationData;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
 
 /**
  * This class implements simplex-based direct search optimization.
@@ -138,7 +138,7 @@ public class SimplexOptimizer
      * @param goalType Optimization type.
      * @param optData Optimization data. The following data will be looked for:
      * <ul>
-     *  <li>{@link org.apache.commons.math3.optimization.InitialGuess InitialGuess}</li>
+     *  <li>{@link org.apache.commons.math4.optimization.InitialGuess InitialGuess}</li>
      *  <li>{@link AbstractSimplex}</li>
      * </ul>
      * @return the point/value pair giving the optimal value for objective

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/direct/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/direct/package-info.java b/src/main/java/org/apache/commons/math4/optimization/direct/package-info.java
index a587bcf..57b385d 100644
--- a/src/main/java/org/apache/commons/math4/optimization/direct/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optimization/direct/package-info.java
@@ -21,4 +21,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/fitting/CurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/fitting/CurveFitter.java b/src/main/java/org/apache/commons/math4/optimization/fitting/CurveFitter.java
index ad1e025..7b3a429 100644
--- a/src/main/java/org/apache/commons/math4/optimization/fitting/CurveFitter.java
+++ b/src/main/java/org/apache/commons/math4/optimization/fitting/CurveFitter.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.DifferentiableMultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer;
-import org.apache.commons.math3.optimization.MultivariateDifferentiableVectorOptimizer;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
+import org.apache.commons.math4.analysis.DifferentiableMultivariateVectorFunction;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer;
+import org.apache.commons.math4.optimization.MultivariateDifferentiableVectorOptimizer;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
 
 /** Fitter for parametric univariate real functions y = f(x).
  * <br/>
@@ -146,7 +146,7 @@ public class CurveFitter<T extends ParametricUnivariateFunction> {
      * @param f parametric function to fit.
      * @param initialGuess first guess of the function parameters.
      * @return the fitted parameters.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
      */
     public double[] fit(T f, final double[] initialGuess) {
@@ -164,9 +164,9 @@ public class CurveFitter<T extends ParametricUnivariateFunction> {
      * @param initialGuess first guess of the function parameters.
      * @param maxEval Maximum number of function evaluations.
      * @return the fitted parameters.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the number of allowed evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
      * @since 3.0
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/fitting/GaussianFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/fitting/GaussianFitter.java b/src/main/java/org/apache/commons/math4/optimization/fitting/GaussianFitter.java
index 1676496..bf0f03d 100644
--- a/src/main/java/org/apache/commons/math4/optimization/fitting/GaussianFitter.java
+++ b/src/main/java/org/apache/commons/math4/optimization/fitting/GaussianFitter.java
@@ -15,24 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.function.Gaussian;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Fits points to a {@link
- * org.apache.commons.math3.analysis.function.Gaussian.Parametric Gaussian} function.
+ * org.apache.commons.math4.analysis.function.Gaussian.Parametric Gaussian} function.
  * <p>
  * Usage example:
  * <pre>
@@ -123,7 +123,7 @@ public class GaussianFitter extends CurveFitter<Gaussian.Parametric> {
 
     /**
      * Guesses the parameters {@code norm}, {@code mean}, and {@code sigma}
-     * of a {@link org.apache.commons.math3.analysis.function.Gaussian.Parametric}
+     * of a {@link org.apache.commons.math4.analysis.function.Gaussian.Parametric}
      * based on the specified observed points.
      */
     public static class ParameterGuesser {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/fitting/HarmonicFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/fitting/HarmonicFitter.java b/src/main/java/org/apache/commons/math4/optimization/fitting/HarmonicFitter.java
index 85c6d18..938156d 100644
--- a/src/main/java/org/apache/commons/math4/optimization/fitting/HarmonicFitter.java
+++ b/src/main/java/org/apache/commons/math4/optimization/fitting/HarmonicFitter.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
-import org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer;
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Class that implements a curve fitting specialized for sinusoids.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/fitting/PolynomialFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/fitting/PolynomialFitter.java b/src/main/java/org/apache/commons/math4/optimization/fitting/PolynomialFitter.java
index dbefcc2..3773acb 100644
--- a/src/main/java/org/apache/commons/math4/optimization/fitting/PolynomialFitter.java
+++ b/src/main/java/org/apache/commons/math4/optimization/fitting/PolynomialFitter.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer;
 
 /**
  * Polynomial fitting is a very simple case of {@link CurveFitter curve fitting}.
@@ -67,7 +67,7 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
      * Get the polynomial fitting the weighted (x, y) points.
      *
      * @return the coefficients of the polynomial that best fits the observed points.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
+     * @throws org.apache.commons.math4.exception.ConvergenceException
      * if the algorithm failed to converge.
      * @deprecated Since 3.1 (to be removed in 4.0). Please use {@link #fit(double[])} instead.
      */
@@ -84,9 +84,9 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
      * increasing order of the polynomial's degree.
      * @param maxEval Maximum number of evaluations of the polynomial.
      * @return the coefficients of the polynomial that best fits the observed points.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException if
      * the number of evaluations exceeds {@code maxEval}.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
+     * @throws org.apache.commons.math4.exception.ConvergenceException
      * if the algorithm failed to converge.
      * @since 3.1
      */
@@ -101,7 +101,7 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
      * @param guess First guess for the coefficients. They must be sorted in
      * increasing order of the polynomial's degree.
      * @return the coefficients of the polynomial that best fits the observed points.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
+     * @throws org.apache.commons.math4.exception.ConvergenceException
      * if the algorithm failed to converge.
      * @since 3.1
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/fitting/WeightedObservedPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/fitting/WeightedObservedPoint.java b/src/main/java/org/apache/commons/math4/optimization/fitting/WeightedObservedPoint.java
index 899a502..5c2c6d2 100644
--- a/src/main/java/org/apache/commons/math4/optimization/fitting/WeightedObservedPoint.java
+++ b/src/main/java/org/apache/commons/math4/optimization/fitting/WeightedObservedPoint.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/fitting/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/fitting/package-info.java b/src/main/java/org/apache/commons/math4/optimization/fitting/package-info.java
index b25e5fd..98683a8 100644
--- a/src/main/java/org/apache/commons/math4/optimization/fitting/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optimization/fitting/package-info.java
@@ -27,4 +27,4 @@
  *
  *
  */
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/AbstractDifferentiableOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/AbstractDifferentiableOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/general/AbstractDifferentiableOptimizer.java
index d175863..1fbcbcb 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/AbstractDifferentiableOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/AbstractDifferentiableOptimizer.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.differentiation.GradientFunction;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.OptimizationData;
-import org.apache.commons.math3.optimization.InitialGuess;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateOptimizer;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.differentiation.GradientFunction;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.InitialGuess;
+import org.apache.commons.math4.optimization.OptimizationData;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.direct.BaseAbstractMultivariateOptimizer;
 
 /**
  * Base class for implementing optimizers for multivariate scalar


[77/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java
index cde1f74..d734d96 100644
--- a/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/MultivariateRealDistribution.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 
 /**
  * Base interface for multivariate distributions on the reals.
@@ -69,7 +69,7 @@ public interface MultivariateRealDistribution {
      *
      * @param sampleSize the number of random vectors to generate.
      * @return an array representing the random samples.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code sampleSize} is not positive.
      *
      * @see #sample()

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/NakagamiDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/NakagamiDistribution.java b/src/main/java/org/apache/commons/math4/distribution/NakagamiDistribution.java
index 2b1f81f..94f57df 100644
--- a/src/main/java/org/apache/commons/math4/distribution/NakagamiDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/NakagamiDistribution.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements the Nakagami distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
index 0fc839f..e033223 100644
--- a/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/NormalDistribution.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Erf;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Erf;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the normal (gaussian) distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
index 3c4d77a..d788d95 100644
--- a/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/ParetoDistribution.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the Pareto distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/PascalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/PascalDistribution.java b/src/main/java/org/apache/commons/math4/distribution/PascalDistribution.java
index bf39933..05366aa 100644
--- a/src/main/java/org/apache/commons/math4/distribution/PascalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/PascalDistribution.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Beta;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java b/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java
index 0d885e9..7463925 100644
--- a/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/PoissonDistribution.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implementation of the Poisson distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
index cb2045d..d7b2499 100644
--- a/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/RealDistribution.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Base interface for distributions on the reals.
@@ -189,7 +189,7 @@ public interface RealDistribution {
      *
      * @param sampleSize the number of random values to generate
      * @return an array representing the random sample
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if {@code sampleSize} is not positive
      */
     double[] sample(int sampleSize);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/SaddlePointExpansion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/SaddlePointExpansion.java b/src/main/java/org/apache/commons/math4/distribution/SaddlePointExpansion.java
index 63b3293..01b0f65 100644
--- a/src/main/java/org/apache/commons/math4/distribution/SaddlePointExpansion.java
+++ b/src/main/java/org/apache/commons/math4/distribution/SaddlePointExpansion.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/TDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/TDistribution.java b/src/main/java/org/apache/commons/math4/distribution/TDistribution.java
index 0c0e1cb..6aa15f0 100644
--- a/src/main/java/org/apache/commons/math4/distribution/TDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/TDistribution.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Beta;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of Student's t-distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/TriangularDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/TriangularDistribution.java b/src/main/java/org/apache/commons/math4/distribution/TriangularDistribution.java
index 1a81ecb..5ac6800 100644
--- a/src/main/java/org/apache/commons/math4/distribution/TriangularDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/TriangularDistribution.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the triangular real distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java b/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java
index dd5ffa4..de542b6 100644
--- a/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/UniformIntegerDistribution.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 
 /**
  * Implementation of the uniform integer distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java b/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java
index 10c7712..92913bd 100644
--- a/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/UniformRealDistribution.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 
 /**
  * Implementation of the uniform real distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/WeibullDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/WeibullDistribution.java b/src/main/java/org/apache/commons/math4/distribution/WeibullDistribution.java
index f1fdabd..0cb6f11 100644
--- a/src/main/java/org/apache/commons/math4/distribution/WeibullDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/WeibullDistribution.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.distribution;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the Weibull distribution. This implementation uses the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java
index 18cb2f4..019bde8 100644
--- a/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java
+++ b/src/main/java/org/apache/commons/math4/distribution/ZipfDistribution.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the Zipf distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java b/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
index 0b4ac0d..2aaf65b 100644
--- a/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
+++ b/src/main/java/org/apache/commons/math4/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
@@ -14,27 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution.fitting;
+package org.apache.commons.math4.distribution.fitting;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.distribution.MultivariateNormalDistribution;
-import org.apache.commons.math3.distribution.MixtureMultivariateNormalDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.stat.correlation.Covariance;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.distribution.MixtureMultivariateNormalDistribution;
+import org.apache.commons.math4.distribution.MultivariateNormalDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.stat.correlation.Covariance;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Expectation-Maximization</a> algorithm for fitting the parameters of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/fitting/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/fitting/package-info.java b/src/main/java/org/apache/commons/math4/distribution/fitting/package-info.java
index aa95c6d..4582120 100644
--- a/src/main/java/org/apache/commons/math4/distribution/fitting/package-info.java
+++ b/src/main/java/org/apache/commons/math4/distribution/fitting/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Fitting of parameters against distributions.
  */
-package org.apache.commons.math3.distribution.fitting;
+package org.apache.commons.math4.distribution.fitting;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/distribution/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/distribution/package-info.java b/src/main/java/org/apache/commons/math4/distribution/package-info.java
index 4e11196..690777b 100644
--- a/src/main/java/org/apache/commons/math4/distribution/package-info.java
+++ b/src/main/java/org/apache/commons/math4/distribution/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Implementations of common discrete and continuous distributions.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/ConvergenceException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/ConvergenceException.java b/src/main/java/org/apache/commons/math4/exception/ConvergenceException.java
index 3aecfc2..f9b6207 100644
--- a/src/main/java/org/apache/commons/math4/exception/ConvergenceException.java
+++ b/src/main/java/org/apache/commons/math4/exception/ConvergenceException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Error thrown when a numerical computation can not be performed because the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/DimensionMismatchException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/DimensionMismatchException.java b/src/main/java/org/apache/commons/math4/exception/DimensionMismatchException.java
index 2bf84c8..fa5b30a 100644
--- a/src/main/java/org/apache/commons/math4/exception/DimensionMismatchException.java
+++ b/src/main/java/org/apache/commons/math4/exception/DimensionMismatchException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when two dimensions differ.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/InsufficientDataException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/InsufficientDataException.java b/src/main/java/org/apache/commons/math4/exception/InsufficientDataException.java
index ec61d4e..5968c10 100644
--- a/src/main/java/org/apache/commons/math4/exception/InsufficientDataException.java
+++ b/src/main/java/org/apache/commons/math4/exception/InsufficientDataException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when there is insufficient data to perform a computation.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathArithmeticException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathArithmeticException.java b/src/main/java/org/apache/commons/math4/exception/MathArithmeticException.java
index c3826e4..d753ad5 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathArithmeticException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathArithmeticException.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Base class for arithmetic exceptions.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathIllegalArgumentException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathIllegalArgumentException.java b/src/main/java/org/apache/commons/math4/exception/MathIllegalArgumentException.java
index 89012f0..e975031 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathIllegalArgumentException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathIllegalArgumentException.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * Base class for all preconditions violation exceptions.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathIllegalNumberException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathIllegalNumberException.java b/src/main/java/org/apache/commons/math4/exception/MathIllegalNumberException.java
index 8edb2cb..2930516 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathIllegalNumberException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathIllegalNumberException.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * Base class for exceptions raised by a wrong number.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathIllegalStateException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathIllegalStateException.java b/src/main/java/org/apache/commons/math4/exception/MathIllegalStateException.java
index f516536..d353848 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathIllegalStateException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathIllegalStateException.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Base class for all exceptions that signal that the process

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathInternalError.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathInternalError.java b/src/main/java/org/apache/commons/math4/exception/MathInternalError.java
index 5ca66c9..142bd45 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathInternalError.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathInternalError.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception triggered when something that shouldn't happen does happen.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathParseException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathParseException.java b/src/main/java/org/apache/commons/math4/exception/MathParseException.java
index 0c84767..0ef6a54 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathParseException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathParseException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Class to signal parse failures.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathRuntimeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathRuntimeException.java b/src/main/java/org/apache/commons/math4/exception/MathRuntimeException.java
index 9f04704..4dafc2c 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathRuntimeException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathRuntimeException.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * As of release 4.0, all exceptions thrown by the Commons Math code (except

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MathUnsupportedOperationException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MathUnsupportedOperationException.java b/src/main/java/org/apache/commons/math4/exception/MathUnsupportedOperationException.java
index 4a829f0..bf32e31 100644
--- a/src/main/java/org/apache/commons/math4/exception/MathUnsupportedOperationException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MathUnsupportedOperationException.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.ExceptionContextProvider;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Base class for all unsupported features.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MaxCountExceededException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MaxCountExceededException.java b/src/main/java/org/apache/commons/math4/exception/MaxCountExceededException.java
index e846ce9..2813e6e 100644
--- a/src/main/java/org/apache/commons/math4/exception/MaxCountExceededException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MaxCountExceededException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when some counter maximum value is exceeded.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/MultiDimensionMismatchException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/MultiDimensionMismatchException.java b/src/main/java/org/apache/commons/math4/exception/MultiDimensionMismatchException.java
index 16b1fc9..4028971 100644
--- a/src/main/java/org/apache/commons/math4/exception/MultiDimensionMismatchException.java
+++ b/src/main/java/org/apache/commons/math4/exception/MultiDimensionMismatchException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when two sets of dimensions differ.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NoBracketingException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NoBracketingException.java b/src/main/java/org/apache/commons/math4/exception/NoBracketingException.java
index 50083e1..f48c91f 100644
--- a/src/main/java/org/apache/commons/math4/exception/NoBracketingException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NoBracketingException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when function values have the same sign at both

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NoDataException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NoDataException.java b/src/main/java/org/apache/commons/math4/exception/NoDataException.java
index 8a72c4a..90ca4d4 100644
--- a/src/main/java/org/apache/commons/math4/exception/NoDataException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NoDataException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when the required data is missing.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NonMonotonicSequenceException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NonMonotonicSequenceException.java b/src/main/java/org/apache/commons/math4/exception/NonMonotonicSequenceException.java
index ab479ab..7ee1908 100644
--- a/src/main/java/org/apache/commons/math4/exception/NonMonotonicSequenceException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NonMonotonicSequenceException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Exception to be thrown when the a sequence of values is not monotonically

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NotANumberException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NotANumberException.java b/src/main/java/org/apache/commons/math4/exception/NotANumberException.java
index f50d1e4..78a646f 100644
--- a/src/main/java/org/apache/commons/math4/exception/NotANumberException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NotANumberException.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a number is not a number.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NotFiniteNumberException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NotFiniteNumberException.java b/src/main/java/org/apache/commons/math4/exception/NotFiniteNumberException.java
index d4dcece..5157c6f 100644
--- a/src/main/java/org/apache/commons/math4/exception/NotFiniteNumberException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NotFiniteNumberException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a number is not finite.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NotPositiveException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NotPositiveException.java b/src/main/java/org/apache/commons/math4/exception/NotPositiveException.java
index 936c996..7d5515b 100644
--- a/src/main/java/org/apache/commons/math4/exception/NotPositiveException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NotPositiveException.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * Exception to be thrown when the argument is negative.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NotStrictlyPositiveException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NotStrictlyPositiveException.java b/src/main/java/org/apache/commons/math4/exception/NotStrictlyPositiveException.java
index b4f2bf5..156e78d 100644
--- a/src/main/java/org/apache/commons/math4/exception/NotStrictlyPositiveException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NotStrictlyPositiveException.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * Exception to be thrown when the argument is not greater than 0.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java b/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
index d56f7e0..7b73be7 100644
--- a/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NullArgumentException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * All conditions checks that fail due to a {@code null} argument must throw

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NumberIsTooLargeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NumberIsTooLargeException.java b/src/main/java/org/apache/commons/math4/exception/NumberIsTooLargeException.java
index a65c5e2..9498320 100644
--- a/src/main/java/org/apache/commons/math4/exception/NumberIsTooLargeException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NumberIsTooLargeException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a number is too large.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/NumberIsTooSmallException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/NumberIsTooSmallException.java b/src/main/java/org/apache/commons/math4/exception/NumberIsTooSmallException.java
index 5073ef8..5a6cf70 100644
--- a/src/main/java/org/apache/commons/math4/exception/NumberIsTooSmallException.java
+++ b/src/main/java/org/apache/commons/math4/exception/NumberIsTooSmallException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a number is too small.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/OutOfRangeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/OutOfRangeException.java b/src/main/java/org/apache/commons/math4/exception/OutOfRangeException.java
index 99079d7..4e8dd62 100644
--- a/src/main/java/org/apache/commons/math4/exception/OutOfRangeException.java
+++ b/src/main/java/org/apache/commons/math4/exception/OutOfRangeException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when some argument is out of range.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/TooManyEvaluationsException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/TooManyEvaluationsException.java b/src/main/java/org/apache/commons/math4/exception/TooManyEvaluationsException.java
index 09da0a0..45d3c3a 100644
--- a/src/main/java/org/apache/commons/math4/exception/TooManyEvaluationsException.java
+++ b/src/main/java/org/apache/commons/math4/exception/TooManyEvaluationsException.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when the maximal number of evaluations is exceeded.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/TooManyIterationsException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/TooManyIterationsException.java b/src/main/java/org/apache/commons/math4/exception/TooManyIterationsException.java
index c49f405..bd68f6e 100644
--- a/src/main/java/org/apache/commons/math4/exception/TooManyIterationsException.java
+++ b/src/main/java/org/apache/commons/math4/exception/TooManyIterationsException.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when the maximal number of iterations is exceeded.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/ZeroException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/ZeroException.java b/src/main/java/org/apache/commons/math4/exception/ZeroException.java
index 58acf79..617193a 100644
--- a/src/main/java/org/apache/commons/math4/exception/ZeroException.java
+++ b/src/main/java/org/apache/commons/math4/exception/ZeroException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;
 
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when zero is provided where it is not allowed.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/package-info.java b/src/main/java/org/apache/commons/math4/exception/package-info.java
index f6e7319..884f4c3 100644
--- a/src/main/java/org/apache/commons/math4/exception/package-info.java
+++ b/src/main/java/org/apache/commons/math4/exception/package-info.java
@@ -20,4 +20,4 @@
  *     using simple java properties.
  *
  */
-package org.apache.commons.math3.exception;
+package org.apache.commons.math4.exception;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java b/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java
index 74214cc..577b0a5 100644
--- a/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java
+++ b/src/main/java/org/apache/commons/math4/exception/util/ArgUtils.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 import java.util.List;
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/util/DummyLocalizable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/util/DummyLocalizable.java b/src/main/java/org/apache/commons/math4/exception/util/DummyLocalizable.java
index cd56708..97aa51b 100644
--- a/src/main/java/org/apache/commons/math4/exception/util/DummyLocalizable.java
+++ b/src/main/java/org/apache/commons/math4/exception/util/DummyLocalizable.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java b/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java
index a9fd95c..7eb367a 100644
--- a/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java
+++ b/src/main/java/org/apache/commons/math4/exception/util/ExceptionContext.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 import java.util.List;
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/util/ExceptionContextProvider.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/util/ExceptionContextProvider.java b/src/main/java/org/apache/commons/math4/exception/util/ExceptionContextProvider.java
index 913f66a..06f5e2c 100644
--- a/src/main/java/org/apache/commons/math4/exception/util/ExceptionContextProvider.java
+++ b/src/main/java/org/apache/commons/math4/exception/util/ExceptionContextProvider.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 /**
  * Interface for accessing the context data structure stored in Commons Math

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/util/Localizable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/util/Localizable.java b/src/main/java/org/apache/commons/math4/exception/util/Localizable.java
index 9758bc2..9e4a38f 100644
--- a/src/main/java/org/apache/commons/math4/exception/util/Localizable.java
+++ b/src/main/java/org/apache/commons/math4/exception/util/Localizable.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 import java.io.Serializable;
 import java.util.Locale;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java b/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
index 0f3848f..ebac0d3 100644
--- a/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
+++ b/src/main/java/org/apache/commons/math4/exception/util/LocalizedFormats.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;
 
 import java.util.Locale;
 import java.util.MissingResourceException;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/exception/util/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/exception/util/package-info.java b/src/main/java/org/apache/commons/math4/exception/util/package-info.java
index 6439a8d..25c583b 100644
--- a/src/main/java/org/apache/commons/math4/exception/util/package-info.java
+++ b/src/main/java/org/apache/commons/math4/exception/util/package-info.java
@@ -19,4 +19,4 @@
  *    Classes supporting exception localization.
  *
  */
-package org.apache.commons.math3.exception.util;
+package org.apache.commons.math4.exception.util;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/filter/DefaultMeasurementModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/filter/DefaultMeasurementModel.java b/src/main/java/org/apache/commons/math4/filter/DefaultMeasurementModel.java
index 10c6f2b..d03f63a 100644
--- a/src/main/java/org/apache/commons/math4/filter/DefaultMeasurementModel.java
+++ b/src/main/java/org/apache/commons/math4/filter/DefaultMeasurementModel.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.filter;
+package org.apache.commons.math4.filter;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  * Default implementation of a {@link MeasurementModel} for the use with a {@link KalmanFilter}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/filter/DefaultProcessModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/filter/DefaultProcessModel.java b/src/main/java/org/apache/commons/math4/filter/DefaultProcessModel.java
index 732e2c1..b89be26 100644
--- a/src/main/java/org/apache/commons/math4/filter/DefaultProcessModel.java
+++ b/src/main/java/org/apache/commons/math4/filter/DefaultProcessModel.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.filter;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
+package org.apache.commons.math4.filter;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * Default implementation of a {@link ProcessModel} for the use with a {@link KalmanFilter}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/filter/KalmanFilter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/filter/KalmanFilter.java b/src/main/java/org/apache/commons/math4/filter/KalmanFilter.java
index 2f204bf..81b1807 100644
--- a/src/main/java/org/apache/commons/math4/filter/KalmanFilter.java
+++ b/src/main/java/org/apache/commons/math4/filter/KalmanFilter.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.filter;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.CholeskyDecomposition;
-import org.apache.commons.math3.linear.MatrixDimensionMismatchException;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.NonSquareMatrixException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.filter;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.CholeskyDecomposition;
+import org.apache.commons.math4.linear.MatrixDimensionMismatchException;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implementation of a Kalman filter to estimate the state <i>x<sub>k</sub></i>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/filter/MeasurementModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/filter/MeasurementModel.java b/src/main/java/org/apache/commons/math4/filter/MeasurementModel.java
index 2e0a379..192df2d 100644
--- a/src/main/java/org/apache/commons/math4/filter/MeasurementModel.java
+++ b/src/main/java/org/apache/commons/math4/filter/MeasurementModel.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.filter;
+package org.apache.commons.math4.filter;
 
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  * Defines the measurement model for the use with a {@link KalmanFilter}.
@@ -38,7 +38,7 @@ public interface MeasurementModel {
      *
      * @return the measurement noise matrix
      * @see KalmanFilter#correct(double[])
-     * @see KalmanFilter#correct(org.apache.commons.math3.linear.RealVector)
+     * @see KalmanFilter#correct(org.apache.commons.math4.linear.RealVector)
      */
     RealMatrix getMeasurementNoise();
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/filter/ProcessModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/filter/ProcessModel.java b/src/main/java/org/apache/commons/math4/filter/ProcessModel.java
index 179ed1b..07c91ef 100644
--- a/src/main/java/org/apache/commons/math4/filter/ProcessModel.java
+++ b/src/main/java/org/apache/commons/math4/filter/ProcessModel.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.filter;
+package org.apache.commons.math4.filter;
 
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * Defines the process dynamics model for the use with a {@link KalmanFilter}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/filter/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/filter/package-info.java b/src/main/java/org/apache/commons/math4/filter/package-info.java
index 4e76536..92a5535 100644
--- a/src/main/java/org/apache/commons/math4/filter/package-info.java
+++ b/src/main/java/org/apache/commons/math4/filter/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Implementations of common discrete-time linear filters.
  */
-package org.apache.commons.math3.filter;
+package org.apache.commons.math4.filter;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/AbstractCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/AbstractCurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/AbstractCurveFitter.java
index 6f39c23..62fb0fc 100644
--- a/src/main/java/org/apache/commons/math4/fitting/AbstractCurveFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/AbstractCurveFitter.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.fitting.leastsquares.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresOptimizer;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.fitting.leastsquares.LevenbergMarquardtOptimizer;
 
 /**
  * Base class that contains common code for fitting parametric univariate

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/CurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/CurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/CurveFitter.java
index 0ddeacc..8cce426 100644
--- a/src/main/java/org/apache/commons/math4/fitting/CurveFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/CurveFitter.java
@@ -14,21 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.ArrayList;
 import java.util.List;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.optim.nonlinear.vector.MultivariateVectorOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
 
 /**
  * Fitter for parametric univariate real functions y = f(x).
@@ -131,7 +132,7 @@ public class CurveFitter<T extends ParametricUnivariateFunction> {
      * @param f parametric function to fit.
      * @param initialGuess first guess of the function parameters.
      * @return the fitted parameters.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
      */
     public double[] fit(T f, final double[] initialGuess) {
@@ -149,9 +150,9 @@ public class CurveFitter<T extends ParametricUnivariateFunction> {
      * @param initialGuess first guess of the function parameters.
      * @param maxEval Maximum number of function evaluations.
      * @return the fitted parameters.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the number of allowed evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
      * @since 3.0
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java
index 64e0bda..05fcf47 100644
--- a/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/GaussianCurveFitter.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -22,21 +22,21 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.function.Gaussian;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Fits points to a {@link
- * org.apache.commons.math3.analysis.function.Gaussian.Parametric Gaussian}
+ * org.apache.commons.math4.analysis.function.Gaussian.Parametric Gaussian}
  * function.
  * <br/>
  * The {@link #withStartPoint(double[]) initial guess values} must be passed
@@ -188,7 +188,7 @@ public class GaussianCurveFitter extends AbstractCurveFitter {
 
     /**
      * Guesses the parameters {@code norm}, {@code mean}, and {@code sigma}
-     * of a {@link org.apache.commons.math3.analysis.function.Gaussian.Parametric}
+     * of a {@link org.apache.commons.math4.analysis.function.Gaussian.Parametric}
      * based on the specified observed points.
      */
     public static class ParameterGuesser {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/GaussianFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/GaussianFitter.java b/src/main/java/org/apache/commons/math4/fitting/GaussianFitter.java
index 3946540..285a467 100644
--- a/src/main/java/org/apache/commons/math4/fitting/GaussianFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/GaussianFitter.java
@@ -14,23 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Arrays;
 import java.util.Comparator;
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math3.util.FastMath;
+
+import org.apache.commons.math4.analysis.function.Gaussian;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optim.nonlinear.vector.MultivariateVectorOptimizer;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Fits points to a {@link
- * org.apache.commons.math3.analysis.function.Gaussian.Parametric Gaussian} function.
+ * org.apache.commons.math4.analysis.function.Gaussian.Parametric Gaussian} function.
  * <p>
  * Usage example:
  * <pre>
@@ -122,7 +123,7 @@ public class GaussianFitter extends CurveFitter<Gaussian.Parametric> {
 
     /**
      * Guesses the parameters {@code norm}, {@code mean}, and {@code sigma}
-     * of a {@link org.apache.commons.math3.analysis.function.Gaussian.Parametric}
+     * of a {@link org.apache.commons.math4.analysis.function.Gaussian.Parametric}
      * based on the specified observed points.
      */
     public static class ParameterGuesser {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java
index e5e7be4..c8a2a8e 100644
--- a/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/HarmonicCurveFitter.java
@@ -14,25 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Fits points to a {@link
- * org.apache.commons.math3.analysis.function.HarmonicOscillator.Parametric harmonic oscillator}
+ * org.apache.commons.math4.analysis.function.HarmonicOscillator.Parametric harmonic oscillator}
  * function.
  * <br/>
  * The {@link #withStartPoint(double[]) initial guess values} must be passed

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/HarmonicFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/HarmonicFitter.java b/src/main/java/org/apache/commons/math4/fitting/HarmonicFitter.java
index 24952a6..e74d0ac 100644
--- a/src/main/java/org/apache/commons/math4/fitting/HarmonicFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/HarmonicFitter.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
-import org.apache.commons.math3.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optim.nonlinear.vector.MultivariateVectorOptimizer;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Class that implements a curve fitting specialized for sinusoids.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/fitting/PolynomialCurveFitter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/fitting/PolynomialCurveFitter.java b/src/main/java/org/apache/commons/math4/fitting/PolynomialCurveFitter.java
index 9a6f3a9..30d86a9 100644
--- a/src/main/java/org/apache/commons/math4/fitting/PolynomialCurveFitter.java
+++ b/src/main/java/org/apache/commons/math4/fitting/PolynomialCurveFitter.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.fitting;
+package org.apache.commons.math4.fitting;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem;
-import org.apache.commons.math3.linear.DiagonalMatrix;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresBuilder;
+import org.apache.commons.math4.fitting.leastsquares.LeastSquaresProblem;
+import org.apache.commons.math4.linear.DiagonalMatrix;
 
 /**
  * Fits points to a {@link
- * org.apache.commons.math3.analysis.polynomials.PolynomialFunction.Parametric polynomial}
+ * org.apache.commons.math4.analysis.polynomials.PolynomialFunction.Parametric polynomial}
  * function.
  * <br/>
  * The size of the {@link #withStartPoint(double[]) initial guess} array defines the


[51/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
Update for next development iteration: commons-math4


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

Branch: refs/heads/master
Commit: a7b4803ffe2a05fdafbe01b1791c43897e2e2531
Parents: 68e6de3
Author: Thomas Neidhart <th...@gmail.com>
Authored: Mon Feb 16 23:35:42 2015 +0100
Committer: Thomas Neidhart <th...@gmail.com>
Committed: Mon Feb 16 23:35:42 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/commons/math3/Field.java    |   58 -
 .../org/apache/commons/math3/FieldElement.java  |   87 -
 .../apache/commons/math3/RealFieldElement.java  |  402 --
 .../math3/analysis/BivariateFunction.java       |   35 -
 .../DifferentiableMultivariateFunction.java     |   52 -
 ...ifferentiableMultivariateVectorFunction.java |   36 -
 .../DifferentiableUnivariateFunction.java       |   35 -
 .../DifferentiableUnivariateMatrixFunction.java |   36 -
 .../DifferentiableUnivariateVectorFunction.java |   36 -
 .../commons/math3/analysis/FunctionUtils.java   |  795 ---
 .../math3/analysis/MultivariateFunction.java    |   42 -
 .../analysis/MultivariateMatrixFunction.java    |   35 -
 .../analysis/MultivariateVectorFunction.java    |   35 -
 .../analysis/ParametricUnivariateFunction.java  |   44 -
 .../math3/analysis/TrivariateFunction.java      |   35 -
 .../math3/analysis/UnivariateFunction.java      |   81 -
 .../analysis/UnivariateMatrixFunction.java      |   33 -
 .../analysis/UnivariateVectorFunction.java      |   33 -
 .../analysis/differentiation/DSCompiler.java    | 1822 ------
 .../differentiation/DerivativeStructure.java    | 1195 ----
 .../FiniteDifferencesDifferentiator.java        |  383 --
 .../differentiation/GradientFunction.java       |   65 -
 .../differentiation/JacobianFunction.java       |   69 -
 .../MultivariateDifferentiableFunction.java     |   42 -
 ...ultivariateDifferentiableVectorFunction.java |   43 -
 .../differentiation/SparseGradient.java         |  877 ---
 .../UnivariateDifferentiableFunction.java       |   43 -
 .../UnivariateDifferentiableMatrixFunction.java |   40 -
 .../UnivariateDifferentiableVectorFunction.java |   40 -
 .../UnivariateFunctionDifferentiator.java       |   33 -
 .../UnivariateMatrixFunctionDifferentiator.java |   33 -
 .../UnivariateVectorFunctionDifferentiator.java |   33 -
 .../analysis/differentiation/package-info.java  |   42 -
 .../commons/math3/analysis/function/Abs.java    |   33 -
 .../commons/math3/analysis/function/Acos.java   |   53 -
 .../commons/math3/analysis/function/Acosh.java  |   53 -
 .../commons/math3/analysis/function/Add.java    |   32 -
 .../commons/math3/analysis/function/Asin.java   |   53 -
 .../commons/math3/analysis/function/Asinh.java  |   53 -
 .../commons/math3/analysis/function/Atan.java   |   53 -
 .../commons/math3/analysis/function/Atan2.java  |   33 -
 .../commons/math3/analysis/function/Atanh.java  |   53 -
 .../commons/math3/analysis/function/Cbrt.java   |   53 -
 .../commons/math3/analysis/function/Ceil.java   |   33 -
 .../math3/analysis/function/Constant.java       |   60 -
 .../commons/math3/analysis/function/Cos.java    |   53 -
 .../commons/math3/analysis/function/Cosh.java   |   51 -
 .../commons/math3/analysis/function/Divide.java |   32 -
 .../commons/math3/analysis/function/Exp.java    |   53 -
 .../commons/math3/analysis/function/Expm1.java  |   53 -
 .../commons/math3/analysis/function/Floor.java  |   33 -
 .../math3/analysis/function/Gaussian.java       |  259 -
 .../analysis/function/HarmonicOscillator.java   |  183 -
 .../math3/analysis/function/Identity.java       |   50 -
 .../math3/analysis/function/Inverse.java        |   52 -
 .../commons/math3/analysis/function/Log.java    |   53 -
 .../commons/math3/analysis/function/Log10.java  |   54 -
 .../commons/math3/analysis/function/Log1p.java  |   53 -
 .../math3/analysis/function/Logistic.java       |  228 -
 .../commons/math3/analysis/function/Logit.java  |  212 -
 .../commons/math3/analysis/function/Max.java    |   33 -
 .../commons/math3/analysis/function/Min.java    |   33 -
 .../commons/math3/analysis/function/Minus.java  |   50 -
 .../math3/analysis/function/Multiply.java       |   32 -
 .../commons/math3/analysis/function/Pow.java    |   33 -
 .../commons/math3/analysis/function/Power.java  |   63 -
 .../commons/math3/analysis/function/Rint.java   |   33 -
 .../math3/analysis/function/Sigmoid.java        |  218 -
 .../commons/math3/analysis/function/Signum.java |   33 -
 .../commons/math3/analysis/function/Sin.java    |   51 -
 .../commons/math3/analysis/function/Sinc.java   |  205 -
 .../commons/math3/analysis/function/Sinh.java   |   51 -
 .../commons/math3/analysis/function/Sqrt.java   |   53 -
 .../math3/analysis/function/StepFunction.java   |  100 -
 .../math3/analysis/function/Subtract.java       |   32 -
 .../commons/math3/analysis/function/Tan.java    |   53 -
 .../commons/math3/analysis/function/Tanh.java   |   53 -
 .../commons/math3/analysis/function/Ulp.java    |   33 -
 .../math3/analysis/function/package-info.java   |   26 -
 .../BaseAbstractUnivariateIntegrator.java       |  280 -
 .../IterativeLegendreGaussIntegrator.java       |  182 -
 .../integration/LegendreGaussIntegrator.java    |  265 -
 .../integration/MidPointIntegrator.java         |  169 -
 .../analysis/integration/RombergIntegrator.java |  142 -
 .../analysis/integration/SimpsonIntegrator.java |  129 -
 .../integration/TrapezoidIntegrator.java        |  168 -
 .../integration/UnivariateIntegrator.java       |   92 -
 .../integration/gauss/BaseRuleFactory.java      |  153 -
 .../integration/gauss/GaussIntegrator.java      |  129 -
 .../gauss/GaussIntegratorFactory.java           |  169 -
 .../integration/gauss/HermiteRuleFactory.java   |  178 -
 .../gauss/LegendreHighPrecisionRuleFactory.java |  215 -
 .../integration/gauss/LegendreRuleFactory.java  |  140 -
 .../gauss/SymmetricGaussIntegrator.java         |  103 -
 .../integration/gauss/package-info.java         |   22 -
 .../analysis/integration/package-info.java      |   22 -
 .../interpolation/AkimaSplineInterpolator.java  |  215 -
 .../BicubicInterpolatingFunction.java           |  325 -
 .../interpolation/BicubicInterpolator.java      |  112 -
 .../BicubicSplineInterpolatingFunction.java     |  637 --
 .../BicubicSplineInterpolator.java              |  176 -
 .../BivariateGridInterpolator.java              |   51 -
 .../DividedDifferenceInterpolator.java          |  119 -
 .../interpolation/FieldHermiteInterpolator.java |  209 -
 .../interpolation/HermiteInterpolator.java      |  239 -
 .../interpolation/LinearInterpolator.java       |   79 -
 .../interpolation/LoessInterpolator.java        |  473 --
 .../MicrosphereInterpolatingFunction.java       |  250 -
 .../interpolation/MicrosphereInterpolator.java  |  102 -
 .../interpolation/MultivariateInterpolator.java |   51 -
 .../interpolation/NevilleInterpolator.java      |   60 -
 ...ewiseBicubicSplineInterpolatingFunction.java |  210 -
 .../PiecewiseBicubicSplineInterpolator.java     |   61 -
 ...hingPolynomialBicubicSplineInterpolator.java |  171 -
 .../interpolation/SplineInterpolator.java       |  127 -
 .../TricubicInterpolatingFunction.java          |  508 --
 .../interpolation/TricubicInterpolator.java     |  142 -
 .../TricubicSplineInterpolatingFunction.java    |  482 --
 .../TricubicSplineInterpolator.java             |  201 -
 .../TrivariateGridInterpolator.java             |   54 -
 .../interpolation/UnivariateInterpolator.java   |   41 -
 .../UnivariatePeriodicInterpolator.java         |  123 -
 .../analysis/interpolation/package-info.java    |   22 -
 .../commons/math3/analysis/package-info.java    |   32 -
 .../polynomials/PolynomialFunction.java         |  412 --
 .../PolynomialFunctionLagrangeForm.java         |  326 -
 .../PolynomialFunctionNewtonForm.java           |  245 -
 .../polynomials/PolynomialSplineFunction.java   |  246 -
 .../analysis/polynomials/PolynomialsUtils.java  |  446 --
 .../analysis/polynomials/package-info.java      |   23 -
 .../AbstractDifferentiableUnivariateSolver.java |   82 -
 .../solvers/AbstractPolynomialSolver.java       |   80 -
 .../AbstractUnivariateDifferentiableSolver.java |   82 -
 .../solvers/AbstractUnivariateSolver.java       |   60 -
 .../math3/analysis/solvers/AllowedSolution.java |   75 -
 .../solvers/BaseAbstractUnivariateSolver.java   |  318 -
 .../analysis/solvers/BaseSecantSolver.java      |  278 -
 .../analysis/solvers/BaseUnivariateSolver.java  |  142 -
 .../math3/analysis/solvers/BisectionSolver.java |   91 -
 .../solvers/BracketedUnivariateSolver.java      |   92 -
 .../solvers/BracketingNthOrderBrentSolver.java  |  412 --
 .../math3/analysis/solvers/BrentSolver.java     |  244 -
 .../solvers/DifferentiableUnivariateSolver.java |   30 -
 .../math3/analysis/solvers/IllinoisSolver.java  |   82 -
 .../math3/analysis/solvers/LaguerreSolver.java  |  390 --
 .../math3/analysis/solvers/MullerSolver.java    |  202 -
 .../math3/analysis/solvers/MullerSolver2.java   |  168 -
 .../analysis/solvers/NewtonRaphsonSolver.java   |   92 -
 .../math3/analysis/solvers/NewtonSolver.java    |   92 -
 .../math3/analysis/solvers/PegasusSolver.java   |   84 -
 .../analysis/solvers/PolynomialSolver.java      |   28 -
 .../analysis/solvers/RegulaFalsiSolver.java     |   94 -
 .../math3/analysis/solvers/RiddersSolver.java   |  142 -
 .../math3/analysis/solvers/SecantSolver.java    |  135 -
 .../solvers/UnivariateDifferentiableSolver.java |   29 -
 .../analysis/solvers/UnivariateSolver.java      |   28 -
 .../analysis/solvers/UnivariateSolverUtils.java |  465 --
 .../math3/analysis/solvers/package-info.java    |   22 -
 .../apache/commons/math3/complex/Complex.java   | 1318 ----
 .../commons/math3/complex/ComplexField.java     |   83 -
 .../commons/math3/complex/ComplexFormat.java    |  427 --
 .../commons/math3/complex/ComplexUtils.java     |   86 -
 .../commons/math3/complex/Quaternion.java       |  464 --
 .../commons/math3/complex/RootsOfUnity.java     |  218 -
 .../commons/math3/complex/package-info.java     |   23 -
 .../dfp/BracketingNthOrderBrentSolverDFP.java   |  436 --
 .../java/org/apache/commons/math3/dfp/Dfp.java  | 2882 --------
 .../org/apache/commons/math3/dfp/DfpDec.java    |  368 --
 .../org/apache/commons/math3/dfp/DfpField.java  |  757 ---
 .../org/apache/commons/math3/dfp/DfpMath.java   |  967 ---
 .../math3/dfp/UnivariateDfpFunction.java        |   39 -
 .../apache/commons/math3/dfp/package-info.java  |   88 -
 .../AbstractIntegerDistribution.java            |  253 -
 .../AbstractMultivariateRealDistribution.java   |   70 -
 .../distribution/AbstractRealDistribution.java  |  307 -
 .../math3/distribution/BetaDistribution.java    |  269 -
 .../distribution/BinomialDistribution.java      |  198 -
 .../math3/distribution/CauchyDistribution.java  |  256 -
 .../distribution/ChiSquaredDistribution.java    |  196 -
 .../distribution/ConstantRealDistribution.java  |  121 -
 .../distribution/EnumeratedDistribution.java    |  291 -
 .../EnumeratedIntegerDistribution.java          |  218 -
 .../EnumeratedRealDistribution.java             |  282 -
 .../distribution/ExponentialDistribution.java   |  351 -
 .../math3/distribution/FDistribution.java       |  328 -
 .../math3/distribution/GammaDistribution.java   |  513 --
 .../distribution/GeometricDistribution.java     |  173 -
 .../math3/distribution/GumbelDistribution.java  |  166 -
 .../HypergeometricDistribution.java             |  347 -
 .../math3/distribution/IntegerDistribution.java |  155 -
 .../KolmogorovSmirnovDistribution.java          |  357 -
 .../math3/distribution/LaplaceDistribution.java |  160 -
 .../math3/distribution/LevyDistribution.java    |  192 -
 .../distribution/LogNormalDistribution.java     |  366 --
 .../distribution/LogisticDistribution.java      |  160 -
 .../MixtureMultivariateNormalDistribution.java  |  113 -
 .../MixtureMultivariateRealDistribution.java    |  171 -
 .../MultivariateNormalDistribution.java         |  247 -
 .../MultivariateRealDistribution.java           |   78 -
 .../distribution/NakagamiDistribution.java      |  188 -
 .../math3/distribution/NormalDistribution.java  |  311 -
 .../math3/distribution/ParetoDistribution.java  |  318 -
 .../math3/distribution/PascalDistribution.java  |  248 -
 .../math3/distribution/PoissonDistribution.java |  395 --
 .../math3/distribution/RealDistribution.java    |  196 -
 .../distribution/SaddlePointExpansion.java      |  200 -
 .../math3/distribution/TDistribution.java       |  272 -
 .../distribution/TriangularDistribution.java    |  282 -
 .../UniformIntegerDistribution.java             |  181 -
 .../distribution/UniformRealDistribution.java   |  243 -
 .../math3/distribution/WeibullDistribution.java |  353 -
 .../math3/distribution/ZipfDistribution.java    |  262 -
 ...ateNormalMixtureExpectationMaximization.java |  454 --
 .../distribution/fitting/package-info.java      |   20 -
 .../math3/distribution/package-info.java        |   20 -
 .../math3/exception/ConvergenceException.java   |   50 -
 .../exception/DimensionMismatchException.java   |   64 -
 .../exception/InsufficientDataException.java    |   49 -
 .../exception/MathArithmeticException.java      |   76 -
 .../exception/MathIllegalArgumentException.java |   64 -
 .../exception/MathIllegalNumberException.java   |   60 -
 .../exception/MathIllegalStateException.java    |   88 -
 .../math3/exception/MathInternalError.java      |   57 -
 .../math3/exception/MathParseException.java     |   56 -
 .../math3/exception/MathRuntimeException.java   |   65 -
 .../MathUnsupportedOperationException.java      |   72 -
 .../exception/MaxCountExceededException.java    |   63 -
 .../MultiDimensionMismatchException.java        |   90 -
 .../math3/exception/NoBracketingException.java  |  106 -
 .../math3/exception/NoDataException.java        |   46 -
 .../NonMonotonicSequenceException.java          |  120 -
 .../math3/exception/NotANumberException.java    |   37 -
 .../exception/NotFiniteNumberException.java     |   54 -
 .../math3/exception/NotPositiveException.java   |   48 -
 .../exception/NotStrictlyPositiveException.java |   49 -
 .../math3/exception/NullArgumentException.java  |   51 -
 .../exception/NumberIsTooLargeException.java    |   85 -
 .../exception/NumberIsTooSmallException.java    |   86 -
 .../math3/exception/OutOfRangeException.java    |   78 -
 .../exception/TooManyEvaluationsException.java  |   39 -
 .../exception/TooManyIterationsException.java   |   39 -
 .../commons/math3/exception/ZeroException.java  |   48 -
 .../commons/math3/exception/package-info.java   |   23 -
 .../commons/math3/exception/util/ArgUtils.java  |   55 -
 .../math3/exception/util/DummyLocalizable.java  |   57 -
 .../math3/exception/util/ExceptionContext.java  |  334 -
 .../util/ExceptionContextProvider.java          |   33 -
 .../math3/exception/util/Localizable.java       |   43 -
 .../math3/exception/util/LocalizedFormats.java  |  408 --
 .../math3/exception/util/package-info.java      |   22 -
 .../math3/filter/DefaultMeasurementModel.java   |   84 -
 .../math3/filter/DefaultProcessModel.java       |  165 -
 .../commons/math3/filter/KalmanFilter.java      |  388 --
 .../commons/math3/filter/MeasurementModel.java  |   44 -
 .../commons/math3/filter/ProcessModel.java      |   73 -
 .../commons/math3/filter/package-info.java      |   20 -
 .../math3/fitting/AbstractCurveFitter.java      |  147 -
 .../commons/math3/fitting/CurveFitter.java      |  232 -
 .../math3/fitting/GaussianCurveFitter.java      |  430 --
 .../commons/math3/fitting/GaussianFitter.java   |  364 --
 .../math3/fitting/HarmonicCurveFitter.java      |  445 --
 .../commons/math3/fitting/HarmonicFitter.java   |  384 --
 .../math3/fitting/PolynomialCurveFitter.java    |  131 -
 .../commons/math3/fitting/PolynomialFitter.java |   72 -
 .../math3/fitting/SimpleCurveFitter.java        |  125 -
 .../math3/fitting/WeightedObservedPoint.java    |   78 -
 .../math3/fitting/WeightedObservedPoints.java   |  112 -
 .../leastsquares/AbstractEvaluation.java        |   87 -
 .../leastsquares/DenseWeightedEvaluation.java   |   68 -
 .../leastsquares/EvaluationRmsChecker.java      |   75 -
 .../leastsquares/GaussNewtonOptimizer.java      |  300 -
 .../leastsquares/LeastSquaresAdapter.java       |   77 -
 .../leastsquares/LeastSquaresBuilder.java       |  226 -
 .../leastsquares/LeastSquaresFactory.java       |  528 --
 .../leastsquares/LeastSquaresOptimizer.java     |   62 -
 .../leastsquares/LeastSquaresProblem.java       |  156 -
 .../LevenbergMarquardtOptimizer.java            | 1042 ---
 .../MultivariateJacobianFunction.java           |   39 -
 .../math3/fitting/leastsquares/OptimumImpl.java |   97 -
 .../leastsquares/ParameterValidator.java        |   34 -
 .../leastsquares/ValueAndJacobianFunction.java  |   44 -
 .../fitting/leastsquares/package-info.java      |   39 -
 .../commons/math3/fitting/package-info.java     |   26 -
 .../commons/math3/fraction/AbstractFormat.java  |  209 -
 .../commons/math3/fraction/BigFraction.java     | 1147 ----
 .../math3/fraction/BigFractionField.java        |   82 -
 .../math3/fraction/BigFractionFormat.java       |  287 -
 .../apache/commons/math3/fraction/Fraction.java |  673 --
 .../fraction/FractionConversionException.java   |   55 -
 .../commons/math3/fraction/FractionField.java   |   82 -
 .../commons/math3/fraction/FractionFormat.java  |  264 -
 .../math3/fraction/ProperBigFractionFormat.java |  238 -
 .../math3/fraction/ProperFractionFormat.java    |  231 -
 .../commons/math3/fraction/package-info.java    |   22 -
 .../math3/genetics/AbstractListChromosome.java  |  105 -
 .../math3/genetics/BinaryChromosome.java        |   96 -
 .../commons/math3/genetics/BinaryMutation.java  |   56 -
 .../commons/math3/genetics/Chromosome.java      |  104 -
 .../commons/math3/genetics/ChromosomePair.java  |   65 -
 .../commons/math3/genetics/CrossoverPolicy.java |   38 -
 .../commons/math3/genetics/CycleCrossover.java  |  182 -
 .../math3/genetics/ElitisticListPopulation.java |  117 -
 .../apache/commons/math3/genetics/Fitness.java  |   32 -
 .../math3/genetics/FixedElapsedTime.java        |   77 -
 .../math3/genetics/FixedGenerationCount.java    |   71 -
 .../math3/genetics/GeneticAlgorithm.java        |  233 -
 .../InvalidRepresentationException.java         |   42 -
 .../commons/math3/genetics/ListPopulation.java  |  222 -
 .../commons/math3/genetics/MutationPolicy.java  |   35 -
 .../commons/math3/genetics/NPointCrossover.java |  178 -
 .../math3/genetics/OnePointCrossover.java       |  128 -
 .../math3/genetics/OrderedCrossover.java        |  150 -
 .../math3/genetics/PermutationChromosome.java   |   40 -
 .../commons/math3/genetics/Population.java      |   59 -
 .../commons/math3/genetics/RandomKey.java       |  298 -
 .../math3/genetics/RandomKeyMutation.java       |   54 -
 .../commons/math3/genetics/SelectionPolicy.java |   34 -
 .../math3/genetics/StoppingCondition.java       |   33 -
 .../math3/genetics/TournamentSelection.java     |  114 -
 .../math3/genetics/UniformCrossover.java        |  134 -
 .../commons/math3/genetics/package-info.java    |   20 -
 .../apache/commons/math3/geometry/Point.java    |   46 -
 .../apache/commons/math3/geometry/Space.java    |   42 -
 .../apache/commons/math3/geometry/Vector.java   |  155 -
 .../commons/math3/geometry/VectorFormat.java    |  290 -
 .../math3/geometry/enclosing/Encloser.java      |   36 -
 .../math3/geometry/enclosing/EnclosingBall.java |  103 -
 .../enclosing/SupportBallGenerator.java         |   42 -
 .../math3/geometry/enclosing/WelzlEncloser.java |  181 -
 .../math3/geometry/enclosing/package-info.java  |   24 -
 .../geometry/euclidean/oned/Euclidean1D.java    |  100 -
 .../math3/geometry/euclidean/oned/Interval.java |  129 -
 .../geometry/euclidean/oned/IntervalsSet.java   |  686 --
 .../geometry/euclidean/oned/OrientedPoint.java  |  153 -
 .../euclidean/oned/SubOrientedPoint.java        |   76 -
 .../math3/geometry/euclidean/oned/Vector1D.java |  356 -
 .../geometry/euclidean/oned/Vector1DFormat.java |  135 -
 .../geometry/euclidean/oned/package-info.java   |   24 -
 .../threed/CardanEulerSingularityException.java |   44 -
 .../geometry/euclidean/threed/Euclidean3D.java  |   74 -
 .../euclidean/threed/FieldRotation.java         | 1183 ----
 .../euclidean/threed/FieldVector3D.java         | 1185 ----
 .../math3/geometry/euclidean/threed/Line.java   |  275 -
 .../threed/NotARotationMatrixException.java     |   47 -
 .../euclidean/threed/OutlineExtractor.java      |  263 -
 .../math3/geometry/euclidean/threed/Plane.java  |  527 --
 .../euclidean/threed/PolyhedronsSet.java        |  539 --
 .../geometry/euclidean/threed/Rotation.java     | 1053 ---
 .../euclidean/threed/RotationOrder.java         |  174 -
 .../geometry/euclidean/threed/Segment.java      |   66 -
 .../euclidean/threed/SphereGenerator.java       |  152 -
 .../euclidean/threed/SphericalCoordinates.java  |  395 --
 .../geometry/euclidean/threed/SubLine.java      |  165 -
 .../geometry/euclidean/threed/SubPlane.java     |  144 -
 .../geometry/euclidean/threed/Vector3D.java     |  588 --
 .../euclidean/threed/Vector3DFormat.java        |  155 -
 .../geometry/euclidean/threed/package-info.java |   24 -
 .../geometry/euclidean/twod/DiskGenerator.java  |  108 -
 .../geometry/euclidean/twod/Euclidean2D.java    |   74 -
 .../math3/geometry/euclidean/twod/Line.java     |  540 --
 .../geometry/euclidean/twod/NestedLoops.java    |  200 -
 .../geometry/euclidean/twod/PolygonsSet.java    | 1160 ----
 .../math3/geometry/euclidean/twod/Segment.java  |  112 -
 .../math3/geometry/euclidean/twod/SubLine.java  |  233 -
 .../math3/geometry/euclidean/twod/Vector2D.java |  460 --
 .../geometry/euclidean/twod/Vector2DFormat.java |  138 -
 .../hull/AbstractConvexHullGenerator2D.java     |  116 -
 .../twod/hull/AklToussaintHeuristic.java        |  153 -
 .../euclidean/twod/hull/ConvexHull2D.java       |  172 -
 .../twod/hull/ConvexHullGenerator2D.java        |   37 -
 .../euclidean/twod/hull/MonotoneChain.java      |  179 -
 .../euclidean/twod/hull/package-info.java       |   25 -
 .../geometry/euclidean/twod/package-info.java   |   24 -
 .../commons/math3/geometry/hull/ConvexHull.java |   48 -
 .../geometry/hull/ConvexHullGenerator.java      |   49 -
 .../math3/geometry/hull/package-info.java       |   24 -
 .../commons/math3/geometry/package-info.java    |   25 -
 .../geometry/partitioning/AbstractRegion.java   |  533 --
 .../partitioning/AbstractSubHyperplane.java     |  188 -
 .../math3/geometry/partitioning/BSPTree.java    |  817 ---
 .../geometry/partitioning/BSPTreeVisitor.java   |  114 -
 .../partitioning/BoundaryAttribute.java         |  116 -
 .../geometry/partitioning/BoundaryBuilder.java  |   95 -
 .../partitioning/BoundaryProjection.java        |   83 -
 .../partitioning/BoundaryProjector.java         |  200 -
 .../partitioning/BoundarySizeVisitor.java       |   65 -
 .../geometry/partitioning/Characterization.java |  190 -
 .../math3/geometry/partitioning/Embedding.java  |   68 -
 .../math3/geometry/partitioning/Hyperplane.java |   98 -
 .../geometry/partitioning/InsideFinder.java     |  150 -
 .../math3/geometry/partitioning/NodesSet.java   |   72 -
 .../math3/geometry/partitioning/Region.java     |  218 -
 .../geometry/partitioning/RegionFactory.java    |  349 -
 .../math3/geometry/partitioning/Side.java       |   37 -
 .../geometry/partitioning/SubHyperplane.java    |  131 -
 .../math3/geometry/partitioning/Transform.java  |   80 -
 .../geometry/partitioning/package-info.java     |  114 -
 .../partitioning/utilities/AVLTree.java         |  634 --
 .../partitioning/utilities/OrderedTuple.java    |  431 --
 .../utilities/doc-files/OrderedTuple.png        |  Bin 28882 -> 0 bytes
 .../partitioning/utilities/package-info.java    |   24 -
 .../math3/geometry/spherical/oned/Arc.java      |  132 -
 .../math3/geometry/spherical/oned/ArcsSet.java  |  962 ---
 .../geometry/spherical/oned/LimitAngle.java     |  127 -
 .../math3/geometry/spherical/oned/S1Point.java  |  157 -
 .../math3/geometry/spherical/oned/Sphere1D.java |  106 -
 .../geometry/spherical/oned/SubLimitAngle.java  |   74 -
 .../geometry/spherical/oned/package-info.java   |   30 -
 .../math3/geometry/spherical/twod/Circle.java   |  326 -
 .../math3/geometry/spherical/twod/Edge.java     |  222 -
 .../geometry/spherical/twod/EdgesBuilder.java   |  169 -
 .../spherical/twod/PropertiesComputer.java      |  173 -
 .../math3/geometry/spherical/twod/S2Point.java  |  237 -
 .../math3/geometry/spherical/twod/Sphere2D.java |   80 -
 .../spherical/twod/SphericalPolygonsSet.java    |  563 --
 .../geometry/spherical/twod/SubCircle.java      |   94 -
 .../math3/geometry/spherical/twod/Vertex.java   |  124 -
 .../geometry/spherical/twod/package-info.java   |   30 -
 .../math3/linear/AbstractFieldMatrix.java       | 1156 ----
 .../math3/linear/AbstractRealMatrix.java        |  992 ---
 .../apache/commons/math3/linear/AnyMatrix.java  |   47 -
 .../math3/linear/Array2DRowFieldMatrix.java     |  612 --
 .../math3/linear/Array2DRowRealMatrix.java      |  548 --
 .../commons/math3/linear/ArrayFieldVector.java  | 1147 ----
 .../commons/math3/linear/ArrayRealVector.java   |  954 ---
 .../math3/linear/BiDiagonalTransformer.java     |  380 --
 .../commons/math3/linear/BlockFieldMatrix.java  | 1592 -----
 .../commons/math3/linear/BlockRealMatrix.java   | 1581 -----
 .../math3/linear/CholeskyDecomposition.java     |  310 -
 .../commons/math3/linear/ConjugateGradient.java |  235 -
 .../math3/linear/DecompositionSolver.java       |   97 -
 .../DefaultFieldMatrixChangingVisitor.java      |   58 -
 .../DefaultFieldMatrixPreservingVisitor.java    |   56 -
 .../DefaultIterativeLinearSolverEvent.java      |  143 -
 .../DefaultRealMatrixChangingVisitor.java       |   44 -
 .../DefaultRealMatrixPreservingVisitor.java     |   42 -
 .../commons/math3/linear/DiagonalMatrix.java    |  370 --
 .../math3/linear/EigenDecomposition.java        |  970 ---
 .../math3/linear/FieldDecompositionSolver.java  |   75 -
 .../math3/linear/FieldLUDecomposition.java      |  444 --
 .../commons/math3/linear/FieldMatrix.java       |  816 ---
 .../linear/FieldMatrixChangingVisitor.java      |   57 -
 .../linear/FieldMatrixPreservingVisitor.java    |   56 -
 .../commons/math3/linear/FieldVector.java       |  298 -
 .../linear/FieldVectorChangingVisitor.java      |   56 -
 .../linear/FieldVectorPreservingVisitor.java    |   55 -
 .../math3/linear/HessenbergTransformer.java     |  232 -
 .../linear/IllConditionedOperatorException.java |   42 -
 .../math3/linear/IterativeLinearSolver.java     |  173 -
 .../linear/IterativeLinearSolverEvent.java      |  115 -
 .../math3/linear/JacobiPreconditioner.java      |  135 -
 .../commons/math3/linear/LUDecomposition.java   |  390 --
 .../MatrixDimensionMismatchException.java       |   73 -
 .../commons/math3/linear/MatrixUtils.java       | 1119 ----
 .../NonPositiveDefiniteMatrixException.java     |   73 -
 .../NonPositiveDefiniteOperatorException.java   |   43 -
 .../linear/NonSelfAdjointOperatorException.java |   46 -
 .../math3/linear/NonSquareMatrixException.java  |   41 -
 .../linear/NonSquareOperatorException.java      |   40 -
 .../linear/NonSymmetricMatrixException.java     |   71 -
 .../commons/math3/linear/OpenMapRealMatrix.java |  310 -
 .../commons/math3/linear/OpenMapRealVector.java |  832 ---
 .../PreconditionedIterativeLinearSolver.java    |  214 -
 .../commons/math3/linear/QRDecomposition.java   |  476 --
 .../commons/math3/linear/RRQRDecomposition.java |  244 -
 .../math3/linear/RealLinearOperator.java        |  109 -
 .../apache/commons/math3/linear/RealMatrix.java |  828 ---
 .../math3/linear/RealMatrixChangingVisitor.java |   55 -
 .../commons/math3/linear/RealMatrixFormat.java  |  394 --
 .../linear/RealMatrixPreservingVisitor.java     |   54 -
 .../apache/commons/math3/linear/RealVector.java | 1617 -----
 .../math3/linear/RealVectorChangingVisitor.java |   58 -
 .../commons/math3/linear/RealVectorFormat.java  |  288 -
 .../linear/RealVectorPreservingVisitor.java     |   57 -
 .../RectangularCholeskyDecomposition.java       |  195 -
 .../commons/math3/linear/SchurTransformer.java  |  453 --
 .../math3/linear/SingularMatrixException.java   |   37 -
 .../math3/linear/SingularOperatorException.java |   38 -
 .../linear/SingularValueDecomposition.java      |  740 ---
 .../commons/math3/linear/SparseFieldMatrix.java |  187 -
 .../commons/math3/linear/SparseFieldVector.java |  793 ---
 .../commons/math3/linear/SparseRealMatrix.java  |   34 -
 .../commons/math3/linear/SparseRealVector.java  |   31 -
 .../org/apache/commons/math3/linear/SymmLQ.java | 1221 ----
 .../math3/linear/TriDiagonalTransformer.java    |  253 -
 .../commons/math3/linear/package-info.java      |   20 -
 .../math3/ml/clustering/CentroidCluster.java    |   53 -
 .../commons/math3/ml/clustering/Cluster.java    |   60 -
 .../math3/ml/clustering/Clusterable.java        |   32 -
 .../commons/math3/ml/clustering/Clusterer.java  |   80 -
 .../math3/ml/clustering/DBSCANClusterer.java    |  233 -
 .../math3/ml/clustering/DoublePoint.java        |   86 -
 .../ml/clustering/FuzzyKMeansClusterer.java     |  426 --
 .../ml/clustering/KMeansPlusPlusClusterer.java  |  565 --
 .../MultiKMeansPlusPlusClusterer.java           |  135 -
 .../clustering/evaluation/ClusterEvaluator.java |  122 -
 .../evaluation/SumOfClusterVariances.java       |   68 -
 .../ml/clustering/evaluation/package-info.java  |   20 -
 .../math3/ml/clustering/package-info.java       |   20 -
 .../math3/ml/distance/CanberraDistance.java     |   42 -
 .../math3/ml/distance/ChebyshevDistance.java    |   36 -
 .../math3/ml/distance/DistanceMeasure.java      |   38 -
 .../math3/ml/distance/EarthMoversDistance.java  |   44 -
 .../math3/ml/distance/EuclideanDistance.java    |   36 -
 .../math3/ml/distance/ManhattanDistance.java    |   36 -
 .../commons/math3/ml/distance/package-info.java |   20 -
 .../math3/ml/neuralnet/FeatureInitializer.java  |   32 -
 .../ml/neuralnet/FeatureInitializerFactory.java |  114 -
 .../commons/math3/ml/neuralnet/MapUtils.java    |  247 -
 .../commons/math3/ml/neuralnet/Network.java     |  474 --
 .../commons/math3/ml/neuralnet/Neuron.java      |  215 -
 .../math3/ml/neuralnet/SquareNeighbourhood.java |   38 -
 .../math3/ml/neuralnet/UpdateAction.java        |   34 -
 .../math3/ml/neuralnet/oned/NeuronString.java   |  236 -
 .../math3/ml/neuralnet/oned/package-info.java   |   22 -
 .../math3/ml/neuralnet/package-info.java        |   22 -
 .../ml/neuralnet/sofm/KohonenTrainingTask.java  |   59 -
 .../ml/neuralnet/sofm/KohonenUpdateAction.java  |  212 -
 .../neuralnet/sofm/LearningFactorFunction.java  |   34 -
 .../sofm/LearningFactorFunctionFactory.java     |  117 -
 .../sofm/NeighbourhoodSizeFunction.java         |   37 -
 .../sofm/NeighbourhoodSizeFunctionFactory.java  |  107 -
 .../math3/ml/neuralnet/sofm/package-info.java   |   22 -
 .../sofm/util/ExponentialDecayFunction.java     |   83 -
 .../sofm/util/QuasiSigmoidDecayFunction.java    |   87 -
 .../ml/neuralnet/sofm/util/package-info.java    |   22 -
 .../ml/neuralnet/twod/NeuronSquareMesh2D.java   |  433 --
 .../math3/ml/neuralnet/twod/package-info.java   |   22 -
 .../apache/commons/math3/ml/package-info.java   |   20 -
 .../commons/math3/ode/AbstractIntegrator.java   |  457 --
 .../math3/ode/AbstractParameterizable.java      |   77 -
 .../math3/ode/ContinuousOutputModel.java        |  443 --
 .../commons/math3/ode/EquationsMapper.java      |   97 -
 .../math3/ode/ExpandableStatefulODE.java        |  330 -
 .../commons/math3/ode/FirstOrderConverter.java  |  114 -
 .../ode/FirstOrderDifferentialEquations.java    |   68 -
 .../commons/math3/ode/FirstOrderIntegrator.java |   66 -
 .../commons/math3/ode/JacobianMatrices.java     |  492 --
 .../math3/ode/MainStateJacobianProvider.java    |   41 -
 .../commons/math3/ode/MultistepIntegrator.java  |  447 --
 .../apache/commons/math3/ode/ODEIntegrator.java |  158 -
 .../math3/ode/ParameterConfiguration.java       |   67 -
 .../math3/ode/ParameterJacobianProvider.java    |   48 -
 .../math3/ode/ParameterJacobianWrapper.java     |   99 -
 .../commons/math3/ode/Parameterizable.java      |   42 -
 .../commons/math3/ode/ParameterizedODE.java     |   42 -
 .../commons/math3/ode/ParameterizedWrapper.java |   84 -
 .../ode/SecondOrderDifferentialEquations.java   |   64 -
 .../math3/ode/SecondOrderIntegrator.java        |   60 -
 .../commons/math3/ode/SecondaryEquations.java   |   61 -
 .../math3/ode/UnknownParameterException.java    |   52 -
 .../commons/math3/ode/events/EventFilter.java   |  204 -
 .../commons/math3/ode/events/EventHandler.java  |  219 -
 .../commons/math3/ode/events/EventState.java    |  419 --
 .../commons/math3/ode/events/FilterType.java    |  400 --
 .../commons/math3/ode/events/Transformer.java   |  107 -
 .../commons/math3/ode/events/package-info.java  |   96 -
 .../ode/nonstiff/AdamsBashforthIntegrator.java  |  325 -
 .../math3/ode/nonstiff/AdamsIntegrator.java     |  136 -
 .../ode/nonstiff/AdamsMoultonIntegrator.java    |  421 --
 .../ode/nonstiff/AdamsNordsieckTransformer.java |  339 -
 .../nonstiff/AdaptiveStepsizeIntegrator.java    |  375 --
 .../nonstiff/ClassicalRungeKuttaIntegrator.java |   75 -
 .../ClassicalRungeKuttaStepInterpolator.java    |  133 -
 .../ode/nonstiff/DormandPrince54Integrator.java |  161 -
 .../DormandPrince54StepInterpolator.java        |  222 -
 .../nonstiff/DormandPrince853Integrator.java    |  286 -
 .../DormandPrince853StepInterpolator.java       |  498 --
 .../nonstiff/EmbeddedRungeKuttaIntegrator.java  |  380 --
 .../math3/ode/nonstiff/EulerIntegrator.java     |   72 -
 .../ode/nonstiff/EulerStepInterpolator.java     |   99 -
 .../math3/ode/nonstiff/GillIntegrator.java      |   74 -
 .../ode/nonstiff/GillStepInterpolator.java      |  148 -
 .../nonstiff/GraggBulirschStoerIntegrator.java  |  949 ---
 .../GraggBulirschStoerStepInterpolator.java     |  405 --
 .../ode/nonstiff/HighamHall54Integrator.java    |  135 -
 .../nonstiff/HighamHall54StepInterpolator.java  |  119 -
 .../math3/ode/nonstiff/LutherIntegrator.java    |   89 -
 .../ode/nonstiff/LutherStepInterpolator.java    |  179 -
 .../math3/ode/nonstiff/MidpointIntegrator.java  |   69 -
 .../ode/nonstiff/MidpointStepInterpolator.java  |  113 -
 .../ode/nonstiff/RungeKuttaIntegrator.java      |  269 -
 .../nonstiff/RungeKuttaStepInterpolator.java    |  211 -
 .../ode/nonstiff/ThreeEighthesIntegrator.java   |   72 -
 .../nonstiff/ThreeEighthesStepInterpolator.java |  143 -
 .../math3/ode/nonstiff/package-info.java        |   25 -
 .../apache/commons/math3/ode/package-info.java  |  164 -
 .../ode/sampling/AbstractStepInterpolator.java  |  605 --
 .../math3/ode/sampling/DummyStepHandler.java    |   89 -
 .../math3/ode/sampling/FixedStepHandler.java    |   71 -
 .../ode/sampling/NordsieckStepInterpolator.java |  293 -
 .../commons/math3/ode/sampling/StepHandler.java |   75 -
 .../math3/ode/sampling/StepInterpolator.java    |  181 -
 .../math3/ode/sampling/StepNormalizer.java      |  300 -
 .../ode/sampling/StepNormalizerBounds.java      |   83 -
 .../math3/ode/sampling/StepNormalizerMode.java  |   69 -
 .../math3/ode/sampling/package-info.java        |   60 -
 .../math3/optim/AbstractConvergenceChecker.java |   69 -
 .../optim/AbstractOptimizationProblem.java      |  102 -
 .../BaseMultiStartMultivariateOptimizer.java    |  229 -
 .../math3/optim/BaseMultivariateOptimizer.java  |  155 -
 .../commons/math3/optim/BaseOptimizer.java      |  260 -
 .../commons/math3/optim/ConvergenceChecker.java |   55 -
 .../commons/math3/optim/InitialGuess.java       |   46 -
 .../org/apache/commons/math3/optim/MaxEval.java |   61 -
 .../org/apache/commons/math3/optim/MaxIter.java |   61 -
 .../commons/math3/optim/OptimizationData.java   |   28 -
 .../math3/optim/OptimizationProblem.java        |   53 -
 .../commons/math3/optim/PointValuePair.java     |  121 -
 .../math3/optim/PointVectorValuePair.java       |  146 -
 .../commons/math3/optim/SimpleBounds.java       |   79 -
 .../commons/math3/optim/SimplePointChecker.java |  133 -
 .../commons/math3/optim/SimpleValueChecker.java |  125 -
 .../math3/optim/SimpleVectorValueChecker.java   |  134 -
 .../math3/optim/linear/LinearConstraint.java    |  228 -
 .../math3/optim/linear/LinearConstraintSet.java |   63 -
 .../optim/linear/LinearObjectiveFunction.java   |  148 -
 .../math3/optim/linear/LinearOptimizer.java     |  131 -
 .../linear/NoFeasibleSolutionException.java     |   37 -
 .../optim/linear/NonNegativeConstraint.java     |   47 -
 .../math3/optim/linear/PivotSelectionRule.java  |   38 -
 .../math3/optim/linear/Relationship.java        |   64 -
 .../math3/optim/linear/SimplexSolver.java       |  407 --
 .../math3/optim/linear/SimplexTableau.java      |  711 --
 .../math3/optim/linear/SolutionCallback.java    |   62 -
 .../linear/UnboundedSolutionException.java      |   37 -
 .../math3/optim/linear/package-info.java        |   21 -
 .../math3/optim/nonlinear/scalar/GoalType.java  |   32 -
 .../scalar/GradientMultivariateOptimizer.java   |  102 -
 .../nonlinear/scalar/LeastSquaresConverter.java |  186 -
 .../optim/nonlinear/scalar/LineSearch.java      |  137 -
 .../scalar/MultiStartMultivariateOptimizer.java |  110 -
 .../MultivariateFunctionMappingAdapter.java     |  294 -
 .../MultivariateFunctionPenaltyAdapter.java     |  186 -
 .../nonlinear/scalar/MultivariateOptimizer.java |  117 -
 .../nonlinear/scalar/ObjectiveFunction.java     |   46 -
 .../scalar/ObjectiveFunctionGradient.java       |   46 -
 .../NonLinearConjugateGradientOptimizer.java    |  415 --
 .../scalar/gradient/Preconditioner.java         |   44 -
 .../nonlinear/scalar/gradient/package-info.java |   21 -
 .../scalar/noderiv/AbstractSimplex.java         |  345 -
 .../scalar/noderiv/BOBYQAOptimizer.java         | 2460 -------
 .../scalar/noderiv/CMAESOptimizer.java          | 1354 ----
 .../scalar/noderiv/MultiDirectionalSimplex.java |  215 -
 .../scalar/noderiv/NelderMeadSimplex.java       |  280 -
 .../scalar/noderiv/PowellOptimizer.java         |  299 -
 .../scalar/noderiv/SimplexOptimizer.java        |  220 -
 .../nonlinear/scalar/noderiv/package-info.java  |   21 -
 .../optim/nonlinear/scalar/package-info.java    |   21 -
 .../JacobianMultivariateVectorOptimizer.java    |  116 -
 .../optim/nonlinear/vector/ModelFunction.java   |   51 -
 .../nonlinear/vector/ModelFunctionJacobian.java |   51 -
 .../MultiStartMultivariateVectorOptimizer.java  |  121 -
 .../vector/MultivariateVectorOptimizer.java     |  167 -
 .../math3/optim/nonlinear/vector/Target.java    |   54 -
 .../math3/optim/nonlinear/vector/Weight.java    |   71 -
 .../jacobian/AbstractLeastSquaresOptimizer.java |  281 -
 .../vector/jacobian/GaussNewtonOptimizer.java   |  183 -
 .../jacobian/LevenbergMarquardtOptimizer.java   |  961 ---
 .../nonlinear/vector/jacobian/package-info.java |   26 -
 .../optim/nonlinear/vector/package-info.java    |   26 -
 .../commons/math3/optim/package-info.java       |   77 -
 .../math3/optim/univariate/BracketFinder.java   |  290 -
 .../math3/optim/univariate/BrentOptimizer.java  |  314 -
 .../MultiStartUnivariateOptimizer.java          |  227 -
 .../math3/optim/univariate/SearchInterval.java  |   95 -
 .../SimpleUnivariateValueChecker.java           |  127 -
 .../univariate/UnivariateObjectiveFunction.java |   46 -
 .../optim/univariate/UnivariateOptimizer.java   |  151 -
 .../univariate/UnivariatePointValuePair.java    |   66 -
 .../math3/optim/univariate/package-info.java    |   21 -
 .../AbstractConvergenceChecker.java             |  102 -
 .../BaseMultivariateMultiStartOptimizer.java    |  192 -
 .../optimization/BaseMultivariateOptimizer.java |   61 -
 .../BaseMultivariateSimpleBoundsOptimizer.java  |   65 -
 ...seMultivariateVectorMultiStartOptimizer.java |  204 -
 .../BaseMultivariateVectorOptimizer.java        |   63 -
 .../math3/optimization/BaseOptimizer.java       |   61 -
 .../math3/optimization/ConvergenceChecker.java  |   57 -
 ...entiableMultivariateMultiStartOptimizer.java |   52 -
 .../DifferentiableMultivariateOptimizer.java    |   37 -
 ...leMultivariateVectorMultiStartOptimizer.java |   53 -
 ...fferentiableMultivariateVectorOptimizer.java |   32 -
 .../commons/math3/optimization/GoalType.java    |   37 -
 .../math3/optimization/InitialGuess.java        |   48 -
 .../optimization/LeastSquaresConverter.java     |  182 -
 ...ariateDifferentiableMultiStartOptimizer.java |   52 -
 .../MultivariateDifferentiableOptimizer.java    |   37 -
 ...DifferentiableVectorMultiStartOptimizer.java |   53 -
 ...ltivariateDifferentiableVectorOptimizer.java |   32 -
 .../MultivariateMultiStartOptimizer.java        |   52 -
 .../optimization/MultivariateOptimizer.java     |   35 -
 .../math3/optimization/OptimizationData.java    |   30 -
 .../math3/optimization/PointValuePair.java      |  128 -
 .../optimization/PointVectorValuePair.java      |  151 -
 .../math3/optimization/SimpleBounds.java        |   63 -
 .../math3/optimization/SimplePointChecker.java  |  145 -
 .../math3/optimization/SimpleValueChecker.java  |  136 -
 .../optimization/SimpleVectorValueChecker.java  |  145 -
 .../commons/math3/optimization/Target.java      |   50 -
 .../commons/math3/optimization/Weight.java      |   68 -
 .../optimization/direct/AbstractSimplex.java    |  347 -
 .../optimization/direct/BOBYQAOptimizer.java    | 2465 -------
 .../BaseAbstractMultivariateOptimizer.java      |  318 -
 ...stractMultivariateSimpleBoundsOptimizer.java |   82 -
 ...BaseAbstractMultivariateVectorOptimizer.java |  370 --
 .../optimization/direct/CMAESOptimizer.java     | 1441 ----
 .../direct/MultiDirectionalSimplex.java         |  218 -
 .../MultivariateFunctionMappingAdapter.java     |  301 -
 .../MultivariateFunctionPenaltyAdapter.java     |  190 -
 .../optimization/direct/NelderMeadSimplex.java  |  283 -
 .../optimization/direct/PowellOptimizer.java    |  352 -
 .../optimization/direct/SimplexOptimizer.java   |  233 -
 .../math3/optimization/direct/package-info.java |   24 -
 .../math3/optimization/fitting/CurveFitter.java |  298 -
 .../optimization/fitting/GaussianFitter.java    |  365 --
 .../optimization/fitting/HarmonicFitter.java    |  384 --
 .../optimization/fitting/PolynomialFitter.java  |  111 -
 .../fitting/WeightedObservedPoint.java          |   76 -
 .../optimization/fitting/package-info.java      |   30 -
 .../AbstractDifferentiableOptimizer.java        |   90 -
 .../general/AbstractLeastSquaresOptimizer.java  |  577 --
 .../AbstractScalarDifferentiableOptimizer.java  |  114 -
 .../general/ConjugateGradientFormula.java       |   50 -
 .../general/GaussNewtonOptimizer.java           |  194 -
 .../general/LevenbergMarquardtOptimizer.java    |  943 ---
 .../NonLinearConjugateGradientOptimizer.java    |  311 -
 .../optimization/general/Preconditioner.java    |   46 -
 .../optimization/general/package-info.java      |   22 -
 .../linear/AbstractLinearOptimizer.java         |  162 -
 .../optimization/linear/LinearConstraint.java   |  234 -
 .../linear/LinearObjectiveFunction.java         |  148 -
 .../optimization/linear/LinearOptimizer.java    |   92 -
 .../linear/NoFeasibleSolutionException.java     |   42 -
 .../math3/optimization/linear/Relationship.java |   67 -
 .../optimization/linear/SimplexSolver.java      |  238 -
 .../optimization/linear/SimplexTableau.java     |  635 --
 .../linear/UnboundedSolutionException.java      |   42 -
 .../math3/optimization/linear/package-info.java |   22 -
 .../math3/optimization/package-info.java        |   79 -
 .../BaseAbstractUnivariateOptimizer.java        |  162 -
 .../univariate/BaseUnivariateOptimizer.java     |   86 -
 .../optimization/univariate/BracketFinder.java  |  289 -
 .../optimization/univariate/BrentOptimizer.java |  316 -
 .../SimpleUnivariateValueChecker.java           |  139 -
 .../UnivariateMultiStartOptimizer.java          |  202 -
 .../univariate/UnivariateOptimizer.java         |   29 -
 .../univariate/UnivariatePointValuePair.java    |   68 -
 .../optimization/univariate/package-info.java   |   22 -
 .../org/apache/commons/math3/package-info.java  |   20 -
 .../apache/commons/math3/primes/PollardRho.java |  164 -
 .../org/apache/commons/math3/primes/Primes.java |  129 -
 .../commons/math3/primes/SmallPrimes.java       |  188 -
 .../commons/math3/primes/package-info.java      |   20 -
 .../math3/random/AbstractRandomGenerator.java   |  271 -
 .../commons/math3/random/AbstractWell.java      |  187 -
 .../math3/random/BitsStreamGenerator.java       |  197 -
 .../random/CorrelatedRandomVectorGenerator.java |  184 -
 .../math3/random/EmpiricalDistribution.java     |  837 ---
 .../math3/random/GaussianRandomGenerator.java   |   46 -
 .../math3/random/HaltonSequenceGenerator.java   |  183 -
 .../commons/math3/random/ISAACRandom.java       |  273 -
 .../math3/random/JDKRandomGenerator.java        |   41 -
 .../commons/math3/random/MersenneTwister.java   |  264 -
 .../math3/random/NormalizedRandomGenerator.java |   37 -
 .../commons/math3/random/RandomAdaptor.java     |  197 -
 .../apache/commons/math3/random/RandomData.java |  264 -
 .../math3/random/RandomDataGenerator.java       |  782 ---
 .../commons/math3/random/RandomDataImpl.java    |  585 --
 .../commons/math3/random/RandomGenerator.java   |  147 -
 .../math3/random/RandomGeneratorFactory.java    |  121 -
 .../math3/random/RandomVectorGenerator.java     |   34 -
 .../math3/random/SobolSequenceGenerator.java    |  325 -
 .../math3/random/StableRandomGenerator.java     |  134 -
 .../random/SynchronizedRandomGenerator.java     |  121 -
 .../UncorrelatedRandomVectorGenerator.java      |   92 -
 .../math3/random/UniformRandomGenerator.java    |   57 -
 .../random/UnitSphereRandomVectorGenerator.java |   80 -
 .../commons/math3/random/ValueServer.java       |  458 --
 .../apache/commons/math3/random/Well1024a.java  |  105 -
 .../apache/commons/math3/random/Well19937a.java |  107 -
 .../apache/commons/math3/random/Well19937c.java |  114 -
 .../apache/commons/math3/random/Well44497a.java |  110 -
 .../apache/commons/math3/random/Well44497b.java |  118 -
 .../apache/commons/math3/random/Well512a.java   |  106 -
 .../commons/math3/random/package-info.java      |  132 -
 .../apache/commons/math3/special/BesselJ.java   |  649 --
 .../org/apache/commons/math3/special/Beta.java  |  511 --
 .../org/apache/commons/math3/special/Erf.java   |  243 -
 .../org/apache/commons/math3/special/Gamma.java |  710 --
 .../commons/math3/special/package-info.java     |   20 -
 .../apache/commons/math3/stat/Frequency.java    |  684 --
 .../apache/commons/math3/stat/StatUtils.java    |  887 ---
 .../commons/math3/stat/clustering/Cluster.java  |   76 -
 .../math3/stat/clustering/Clusterable.java      |   48 -
 .../math3/stat/clustering/DBSCANClusterer.java  |  226 -
 .../stat/clustering/EuclideanDoublePoint.java   |  100 -
 .../stat/clustering/EuclideanIntegerPoint.java  |  101 -
 .../clustering/KMeansPlusPlusClusterer.java     |  514 --
 .../math3/stat/clustering/package-info.java     |   29 -
 .../math3/stat/correlation/Covariance.java      |  295 -
 .../stat/correlation/KendallsCorrelation.java   |  271 -
 .../stat/correlation/PearsonsCorrelation.java   |  330 -
 .../stat/correlation/SpearmansCorrelation.java  |  259 -
 .../StorelessBivariateCovariance.java           |  138 -
 .../stat/correlation/StorelessCovariance.java   |  229 -
 .../math3/stat/correlation/package-info.java    |   22 -
 .../AbstractStorelessUnivariateStatistic.java   |  187 -
 .../AbstractUnivariateStatistic.java            |  263 -
 .../descriptive/AggregateSummaryStatistics.java |  420 --
 .../stat/descriptive/DescriptiveStatistics.java |  774 ---
 .../MultivariateSummaryStatistics.java          |  635 --
 .../StatisticalMultivariateSummary.java         |  119 -
 .../stat/descriptive/StatisticalSummary.java    |   64 -
 .../descriptive/StatisticalSummaryValues.java   |  186 -
 .../StorelessUnivariateStatistic.java           |   87 -
 .../stat/descriptive/SummaryStatistics.java     |  765 ---
 .../SynchronizedDescriptiveStatistics.java      |  192 -
 ...nchronizedMultivariateSummaryStatistics.java |  297 -
 .../SynchronizedSummaryStatistics.java          |  366 --
 .../stat/descriptive/UnivariateStatistic.java   |   55 -
 .../stat/descriptive/WeightedEvaluation.java    |   57 -
 .../stat/descriptive/moment/FirstMoment.java    |  169 -
 .../stat/descriptive/moment/FourthMoment.java   |  151 -
 .../stat/descriptive/moment/GeometricMean.java  |  214 -
 .../math3/stat/descriptive/moment/Kurtosis.java |  226 -
 .../math3/stat/descriptive/moment/Mean.java     |  286 -
 .../stat/descriptive/moment/SecondMoment.java   |  134 -
 .../stat/descriptive/moment/SemiVariance.java   |  369 --
 .../math3/stat/descriptive/moment/Skewness.java |  223 -
 .../descriptive/moment/StandardDeviation.java   |  280 -
 .../stat/descriptive/moment/ThirdMoment.java    |  148 -
 .../math3/stat/descriptive/moment/Variance.java |  627 --
 .../descriptive/moment/VectorialCovariance.java |  157 -
 .../stat/descriptive/moment/VectorialMean.java  |  105 -
 .../stat/descriptive/moment/package-info.java   |   20 -
 .../math3/stat/descriptive/package-info.java    |   44 -
 .../math3/stat/descriptive/rank/Max.java        |  171 -
 .../math3/stat/descriptive/rank/Median.java     |   97 -
 .../math3/stat/descriptive/rank/Min.java        |  171 -
 .../descriptive/rank/PSquarePercentile.java     |  996 ---
 .../math3/stat/descriptive/rank/Percentile.java | 1072 ---
 .../stat/descriptive/rank/package-info.java     |   20 -
 .../math3/stat/descriptive/summary/Product.java |  230 -
 .../math3/stat/descriptive/summary/Sum.java     |  226 -
 .../stat/descriptive/summary/SumOfLogs.java     |  170 -
 .../stat/descriptive/summary/SumOfSquares.java  |  159 -
 .../stat/descriptive/summary/package-info.java  |   20 -
 .../stat/inference/AlternativeHypothesis.java   |   40 -
 .../math3/stat/inference/BinomialTest.java      |  160 -
 .../math3/stat/inference/ChiSquareTest.java     |  602 --
 .../commons/math3/stat/inference/GTest.java     |  538 --
 .../stat/inference/KolmogorovSmirnovTest.java   |  998 ---
 .../math3/stat/inference/MannWhitneyUTest.java  |  238 -
 .../math3/stat/inference/OneWayAnova.java       |  355 -
 .../commons/math3/stat/inference/TTest.java     | 1184 ----
 .../commons/math3/stat/inference/TestUtils.java |  547 --
 .../stat/inference/WilcoxonSignedRankTest.java  |  325 -
 .../math3/stat/inference/package-info.java      |   22 -
 .../stat/interval/AgrestiCoullInterval.java     |   48 -
 .../interval/BinomialConfidenceInterval.java    |   62 -
 .../stat/interval/ClopperPearsonInterval.java   |   58 -
 .../math3/stat/interval/ConfidenceInterval.java |  109 -
 .../math3/stat/interval/IntervalUtils.java      |  174 -
 .../interval/NormalApproximationInterval.java   |   44 -
 .../stat/interval/WilsonScoreInterval.java      |   52 -
 .../math3/stat/interval/package-info.java       |   22 -
 .../apache/commons/math3/stat/package-info.java |   20 -
 .../commons/math3/stat/ranking/NaNStrategy.java |   55 -
 .../math3/stat/ranking/NaturalRanking.java      |  474 --
 .../math3/stat/ranking/RankingAlgorithm.java    |   40 -
 .../math3/stat/ranking/TiesStrategy.java        |   54 -
 .../math3/stat/ranking/package-info.java        |   22 -
 .../AbstractMultipleLinearRegression.java       |  383 --
 .../regression/GLSMultipleLinearRegression.java |  135 -
 .../regression/MillerUpdatingRegression.java    | 1101 ----
 .../regression/ModelSpecificationException.java |   40 -
 .../regression/MultipleLinearRegression.java    |   69 -
 .../regression/OLSMultipleLinearRegression.java |  285 -
 .../stat/regression/RegressionResults.java      |  421 --
 .../math3/stat/regression/SimpleRegression.java |  881 ---
 .../UpdatingMultipleLinearRegression.java       |   93 -
 .../math3/stat/regression/package-info.java     |   22 -
 .../math3/transform/DctNormalization.java       |   66 -
 .../math3/transform/DftNormalization.java       |   56 -
 .../math3/transform/DstNormalization.java       |   56 -
 .../math3/transform/FastCosineTransformer.java  |  181 -
 .../math3/transform/FastFourierTransformer.java |  674 --
 .../transform/FastHadamardTransformer.java      |  323 -
 .../math3/transform/FastSineTransformer.java    |  180 -
 .../math3/transform/RealTransformer.java        |   70 -
 .../commons/math3/transform/TransformType.java  |   30 -
 .../commons/math3/transform/TransformUtils.java |  163 -
 .../commons/math3/transform/package-info.java   |   22 -
 .../commons/math3/util/ArithmeticUtils.java     |  907 ---
 .../org/apache/commons/math3/util/BigReal.java  |  325 -
 .../apache/commons/math3/util/BigRealField.java |   83 -
 .../math3/util/CentralPivotingStrategy.java     |   46 -
 .../apache/commons/math3/util/Combinations.java |  406 --
 .../commons/math3/util/CombinatoricsUtils.java  |  462 --
 .../commons/math3/util/CompositeFormat.java     |  218 -
 .../commons/math3/util/ContinuedFraction.java   |  181 -
 .../apache/commons/math3/util/Decimal64.java    |  695 --
 .../commons/math3/util/Decimal64Field.java      |   61 -
 .../commons/math3/util/DefaultTransformer.java  |   81 -
 .../apache/commons/math3/util/DoubleArray.java  |  110 -
 .../org/apache/commons/math3/util/FastMath.java | 4218 ------------
 .../apache/commons/math3/util/FastMathCalc.java |  658 --
 .../math3/util/FastMathLiteralArrays.java       | 6175 ------------------
 .../apache/commons/math3/util/Incrementor.java  |  179 -
 .../commons/math3/util/IterationEvent.java      |   55 -
 .../commons/math3/util/IterationListener.java   |   57 -
 .../commons/math3/util/IterationManager.java    |  172 -
 .../apache/commons/math3/util/KthSelector.java  |  157 -
 .../apache/commons/math3/util/MathArrays.java   | 1778 -----
 .../apache/commons/math3/util/MathUtils.java    |  286 -
 .../math3/util/MedianOf3PivotingStrategy.java   |   63 -
 .../math3/util/MultidimensionalCounter.java     |  303 -
 .../commons/math3/util/NumberTransformer.java   |   38 -
 .../math3/util/OpenIntToDoubleHashMap.java      |  596 --
 .../math3/util/OpenIntToFieldHashMap.java       |  617 --
 .../org/apache/commons/math3/util/Pair.java     |  155 -
 .../math3/util/PivotingStrategyInterface.java   |   44 -
 .../apache/commons/math3/util/Precision.java    |  603 --
 .../math3/util/RandomPivotingStrategy.java      |   57 -
 .../math3/util/ResizableDoubleArray.java        | 1206 ----
 .../commons/math3/util/TransformerMap.java      |  189 -
 .../apache/commons/math3/util/package-info.java |   20 -
 .../java/org/apache/commons/math4/Field.java    |   58 +
 .../org/apache/commons/math4/FieldElement.java  |   87 +
 .../apache/commons/math4/RealFieldElement.java  |  402 ++
 .../math4/analysis/BivariateFunction.java       |   35 +
 .../DifferentiableMultivariateFunction.java     |   52 +
 ...ifferentiableMultivariateVectorFunction.java |   36 +
 .../DifferentiableUnivariateFunction.java       |   35 +
 .../DifferentiableUnivariateMatrixFunction.java |   36 +
 .../DifferentiableUnivariateVectorFunction.java |   36 +
 .../commons/math4/analysis/FunctionUtils.java   |  795 +++
 .../math4/analysis/MultivariateFunction.java    |   42 +
 .../analysis/MultivariateMatrixFunction.java    |   35 +
 .../analysis/MultivariateVectorFunction.java    |   35 +
 .../analysis/ParametricUnivariateFunction.java  |   44 +
 .../math4/analysis/TrivariateFunction.java      |   35 +
 .../math4/analysis/UnivariateFunction.java      |   81 +
 .../analysis/UnivariateMatrixFunction.java      |   33 +
 .../analysis/UnivariateVectorFunction.java      |   33 +
 .../analysis/differentiation/DSCompiler.java    | 1822 ++++++
 .../differentiation/DerivativeStructure.java    | 1195 ++++
 .../FiniteDifferencesDifferentiator.java        |  383 ++
 .../differentiation/GradientFunction.java       |   65 +
 .../differentiation/JacobianFunction.java       |   69 +
 .../MultivariateDifferentiableFunction.java     |   42 +
 ...ultivariateDifferentiableVectorFunction.java |   43 +
 .../differentiation/SparseGradient.java         |  877 +++
 .../UnivariateDifferentiableFunction.java       |   43 +
 .../UnivariateDifferentiableMatrixFunction.java |   40 +
 .../UnivariateDifferentiableVectorFunction.java |   40 +
 .../UnivariateFunctionDifferentiator.java       |   33 +
 .../UnivariateMatrixFunctionDifferentiator.java |   33 +
 .../UnivariateVectorFunctionDifferentiator.java |   33 +
 .../analysis/differentiation/package-info.java  |   42 +
 .../commons/math4/analysis/function/Abs.java    |   33 +
 .../commons/math4/analysis/function/Acos.java   |   53 +
 .../commons/math4/analysis/function/Acosh.java  |   53 +
 .../commons/math4/analysis/function/Add.java    |   32 +
 .../commons/math4/analysis/function/Asin.java   |   53 +
 .../commons/math4/analysis/function/Asinh.java  |   53 +
 .../commons/math4/analysis/function/Atan.java   |   53 +
 .../commons/math4/analysis/function/Atan2.java  |   33 +
 .../commons/math4/analysis/function/Atanh.java  |   53 +
 .../commons/math4/analysis/function/Cbrt.java   |   53 +
 .../commons/math4/analysis/function/Ceil.java   |   33 +
 .../math4/analysis/function/Constant.java       |   60 +
 .../commons/math4/analysis/function/Cos.java    |   53 +
 .../commons/math4/analysis/function/Cosh.java   |   51 +
 .../commons/math4/analysis/function/Divide.java |   32 +
 .../commons/math4/analysis/function/Exp.java    |   53 +
 .../commons/math4/analysis/function/Expm1.java  |   53 +
 .../commons/math4/analysis/function/Floor.java  |   33 +
 .../math4/analysis/function/Gaussian.java       |  259 +
 .../analysis/function/HarmonicOscillator.java   |  183 +
 .../math4/analysis/function/Identity.java       |   50 +
 .../math4/analysis/function/Inverse.java        |   52 +
 .../commons/math4/analysis/function/Log.java    |   53 +
 .../commons/math4/analysis/function/Log10.java  |   54 +
 .../commons/math4/analysis/function/Log1p.java  |   53 +
 .../math4/analysis/function/Logistic.java       |  228 +
 .../commons/math4/analysis/function/Logit.java  |  212 +
 .../commons/math4/analysis/function/Max.java    |   33 +
 .../commons/math4/analysis/function/Min.java    |   33 +
 .../commons/math4/analysis/function/Minus.java  |   50 +
 .../math4/analysis/function/Multiply.java       |   32 +
 .../commons/math4/analysis/function/Pow.java    |   33 +
 .../commons/math4/analysis/function/Power.java  |   63 +
 .../commons/math4/analysis/function/Rint.java   |   33 +
 .../math4/analysis/function/Sigmoid.java        |  218 +
 .../commons/math4/analysis/function/Signum.java |   33 +
 .../commons/math4/analysis/function/Sin.java    |   51 +
 .../commons/math4/analysis/function/Sinc.java   |  205 +
 .../commons/math4/analysis/function/Sinh.java   |   51 +
 .../commons/math4/analysis/function/Sqrt.java   |   53 +
 .../math4/analysis/function/StepFunction.java   |  100 +
 .../math4/analysis/function/Subtract.java       |   32 +
 .../commons/math4/analysis/function/Tan.java    |   53 +
 .../commons/math4/analysis/function/Tanh.java   |   53 +
 .../commons/math4/analysis/function/Ulp.java    |   33 +
 .../math4/analysis/function/package-info.java   |   26 +
 .../BaseAbstractUnivariateIntegrator.java       |  280 +
 .../IterativeLegendreGaussIntegrator.java       |  182 +
 .../integration/LegendreGaussIntegrator.java    |  265 +
 .../integration/MidPointIntegrator.java         |  169 +
 .../analysis/integration/RombergIntegrator.java |  142 +
 .../analysis/integration/SimpsonIntegrator.java |  129 +
 .../integration/TrapezoidIntegrator.java        |  168 +
 .../integration/UnivariateIntegrator.java       |   92 +
 .../integration/gauss/BaseRuleFactory.java      |  153 +
 .../integration/gauss/GaussIntegrator.java      |  129 +
 .../gauss/GaussIntegratorFactory.java           |  169 +
 .../integration/gauss/HermiteRuleFactory.java   |  178 +
 .../gauss/LegendreHighPrecisionRuleFactory.java |  215 +
 .../integration/gauss/LegendreRuleFactory.java  |  140 +
 .../gauss/SymmetricGaussIntegrator.java         |  103 +
 .../integration/gauss/package-info.java         |   22 +
 .../analysis/integration/package-info.java      |   22 +
 .../interpolation/AkimaSplineInterpolator.java  |  215 +
 .../BicubicInterpolatingFunction.java           |  325 +
 .../interpolation/BicubicInterpolator.java      |  112 +
 .../BicubicSplineInterpolatingFunction.java     |  637 ++
 .../BicubicSplineInterpolator.java              |  176 +
 .../BivariateGridInterpolator.java              |   51 +
 .../DividedDifferenceInterpolator.java          |  119 +
 .../interpolation/FieldHermiteInterpolator.java |  209 +
 .../interpolation/HermiteInterpolator.java      |  239 +
 .../interpolation/LinearInterpolator.java       |   79 +
 .../interpolation/LoessInterpolator.java        |  473 ++
 .../MicrosphereInterpolatingFunction.java       |  250 +
 .../interpolation/MicrosphereInterpolator.java  |  102 +
 .../interpolation/MultivariateInterpolator.java |   51 +
 .../interpolation/NevilleInterpolator.java      |   60 +
 ...ewiseBicubicSplineInterpolatingFunction.java |  210 +
 .../PiecewiseBicubicSplineInterpolator.java     |   61 +
 ...hingPolynomialBicubicSplineInterpolator.java |  171 +
 .../interpolation/SplineInterpolator.java       |  127 +
 .../TricubicInterpolatingFunction.java          |  508 ++
 .../interpolation/TricubicInterpolator.java     |  142 +
 .../TricubicSplineInterpolatingFunction.java    |  482 ++
 .../TricubicSplineInterpolator.java             |  201 +
 .../TrivariateGridInterpolator.java             |   54 +
 .../interpolation/UnivariateInterpolator.java   |   41 +
 .../UnivariatePeriodicInterpolator.java         |  123 +
 .../analysis/interpolation/package-info.java    |   22 +
 .../commons/math4/analysis/package-info.java    |   32 +
 .../polynomials/PolynomialFunction.java         |  412 ++
 .../PolynomialFunctionLagrangeForm.java         |  326 +
 .../PolynomialFunctionNewtonForm.java           |  245 +
 .../polynomials/PolynomialSplineFunction.java   |  246 +
 .../analysis/polynomials/PolynomialsUtils.java  |  446 ++
 .../analysis/polynomials/package-info.java      |   23 +
 .../AbstractDifferentiableUnivariateSolver.java |   82 +
 .../solvers/AbstractPolynomialSolver.java       |   80 +
 .../AbstractUnivariateDifferentiableSolver.java |   82 +
 .../solvers/AbstractUnivariateSolver.java       |   60 +
 .../math4/analysis/solvers/AllowedSolution.java |   75 +
 .../solvers/BaseAbstractUnivariateSolver.java   |  318 +
 .../analysis/solvers/BaseSecantSolver.java      |  278 +
 .../analysis/solvers/BaseUnivariateSolver.java  |  142 +
 .../math4/analysis/solvers/BisectionSolver.java |   91 +
 .../solvers/BracketedUnivariateSolver.java      |   92 +
 .../solvers/BracketingNthOrderBrentSolver.java  |  412 ++
 .../math4/analysis/solvers/BrentSolver.java     |  244 +
 .../solvers/DifferentiableUnivariateSolver.java |   30 +
 .../math4/analysis/solvers/IllinoisSolver.java  |   82 +
 .../math4/analysis/solvers/LaguerreSolver.java  |  390 ++
 .../math4/analysis/solvers/MullerSolver.java    |  202 +
 .../math4/analysis/solvers/MullerSolver2.java   |  168 +
 .../analysis/solvers/NewtonRaphsonSolver.java   |   92 +
 .../math4/analysis/solvers/NewtonSolver.java    |   92 +
 .../math4/analysis/solvers/PegasusSolver.java   |   84 +
 .../analysis/solvers/PolynomialSolver.java      |   28 +
 .../analysis/solvers/RegulaFalsiSolver.java     |   94 +
 .../math4/analysis/solvers/RiddersSolver.java   |  142 +
 .../math4/analysis/solvers/SecantSolver.java    |  135 +
 .../solvers/UnivariateDifferentiableSolver.java |   29 +
 .../analysis/solvers/UnivariateSolver.java      |   28 +
 .../analysis/solvers/UnivariateSolverUtils.java |  465 ++
 .../math4/analysis/solvers/package-info.java    |   22 +
 .../apache/commons/math4/complex/Complex.java   | 1318 ++++
 .../commons/math4/complex/ComplexField.java     |   83 +
 .../commons/math4/complex/ComplexFormat.java    |  427 ++
 .../commons/math4/complex/ComplexUtils.java     |   86 +
 .../commons/math4/complex/Quaternion.java       |  464 ++
 .../commons/math4/complex/RootsOfUnity.java     |  218 +
 .../commons/math4/complex/package-info.java     |   23 +
 .../dfp/BracketingNthOrderBrentSolverDFP.java   |  436 ++
 .../java/org/apache/commons/math4/dfp/Dfp.java  | 2882 ++++++++
 .../org/apache/commons/math4/dfp/DfpDec.java    |  368 ++
 .../org/apache/commons/math4/dfp/DfpField.java  |  757 +++
 .../org/apache/commons/math4/dfp/DfpMath.java   |  967 +++
 .../math4/dfp/UnivariateDfpFunction.java        |   39 +
 .../apache/commons/math4/dfp/package-info.java  |   88 +
 .../AbstractIntegerDistribution.java            |  253 +
 .../AbstractMultivariateRealDistribution.java   |   70 +
 .../distribution/AbstractRealDistribution.java  |  307 +
 .../math4/distribution/BetaDistribution.java    |  269 +
 .../distribution/BinomialDistribution.java      |  198 +
 .../math4/distribution/CauchyDistribution.java  |  256 +
 .../distribution/ChiSquaredDistribution.java    |  196 +
 .../distribution/ConstantRealDistribution.java  |  121 +
 .../distribution/EnumeratedDistribution.java    |  291 +
 .../EnumeratedIntegerDistribution.java          |  218 +
 .../EnumeratedRealDistribution.java             |  282 +
 .../distribution/ExponentialDistribution.java   |  351 +
 .../math4/distribution/FDistribution.java       |  328 +
 .../math4/distribution/GammaDistribution.java   |  513 ++
 .../distribution/GeometricDistribution.java     |  173 +
 .../math4/distribution/GumbelDistribution.java  |  166 +
 .../HypergeometricDistribution.java             |  347 +
 .../math4/distribution/IntegerDistribution.java |  155 +
 .../KolmogorovSmirnovDistribution.java          |  357 +
 .../math4/distribution/LaplaceDistribution.java |  160 +
 .../math4/distribution/LevyDistribution.java    |  192 +
 .../distribution/LogNormalDistribution.java     |  366 ++
 .../distribution/LogisticDistribution.java      |  160 +
 .../MixtureMultivariateNormalDistribution.java  |  113 +
 .../MixtureMultivariateRealDistribution.java    |  171 +
 .../MultivariateNormalDistribution.java         |  247 +
 .../MultivariateRealDistribution.java           |   78 +
 .../distribution/NakagamiDistribution.java      |  188 +
 .../math4/distribution/NormalDistribution.java  |  311 +
 .../math4/distribution/ParetoDistribution.java  |  318 +
 .../math4/distribution/PascalDistribution.java  |  248 +
 .../math4/distribution/PoissonDistribution.java |  395 ++
 .../math4/distribution/RealDistribution.java    |  196 +
 .../distribution/SaddlePointExpansion.java      |  200 +
 .../math4/distribution/TDistribution.java       |  272 +
 .../distribution/TriangularDistribution.java    |  282 +
 .../UniformIntegerDistribution.java             |  181 +
 .../distribution/UniformRealDistribution.java   |  243 +
 .../math4/distribution/WeibullDistribution.java |  353 +
 .../math4/distribution/ZipfDistribution.java    |  262 +
 ...ateNormalMixtureExpectationMaximization.java |  454 ++
 .../distribution/fitting/package-info.java      |   20 +
 .../math4/distribution/package-info.java        |   20 +
 .../math4/exception/ConvergenceException.java   |   50 +
 .../exception/DimensionMismatchException.java   |   64 +
 .../exception/InsufficientDataException.java    |   49 +
 .../exception/MathArithmeticException.java      |   76 +
 .../exception/MathIllegalArgumentException.java |   64 +
 .../exception/MathIllegalNumberException.java   |   60 +
 .../exception/MathIllegalStateException.java    |   88 +
 .../math4/exception/MathInternalError.java      |   57 +
 .../math4/exception/MathParseException.java     |   56 +
 .../math4/exception/MathRuntimeException.java   |   65 +
 .../MathUnsupportedOperationException.java      |   72 +
 .../exception/MaxCountExceededException.java    |   63 +
 .../MultiDimensionMismatchException.java        |   90 +
 .../math4/exception/NoBracketingException.java  |  106 +
 .../math4/exception/NoDataException.java        |   46 +
 .../NonMonotonicSequenceException.java          |  120 +
 .../math4/exception/NotANumberException.java    |   37 +
 .../exception/NotFiniteNumberException.java     |   54 +
 .../math4/exception/NotPositiveException.java   |   48 +
 .../exception/NotStrictlyPositiveException.java |   49 +
 .../math4/exception/NullArgumentException.java  |   51 +
 .../exception/NumberIsTooLargeException.java    |   85 +
 .../exception/NumberIsTooSmallException.java    |   86 +
 .../math4/exception/OutOfRangeException.java    |   78 +
 .../exception/TooManyEvaluationsException.java  |   39 +
 .../exception/TooManyIterationsException.java   |   39 +
 .../commons/math4/exception/ZeroException.java  |   48 +
 .../commons/math4/exception/package-info.java   |   23 +
 .../commons/math4/exception/util/ArgUtils.java  |   55 +
 .../math4/exception/util/DummyLocalizable.java  |   57 +
 .../math4/exception/util/ExceptionContext.java  |  334 +
 .../util/ExceptionContextProvider.java          |   33 +
 .../math4/exception/util/Localizable.java       |   43 +
 .../math4/exception/util/LocalizedFormats.java  |  408 ++
 .../math4/exception/util/package-info.java      |   22 +
 .../math4/filter/DefaultMeasurementModel.java   |   84 +
 .../math4/filter/DefaultProcessModel.java       |  165 +
 .../commons/math4/filter/KalmanFilter.java      |  388 ++
 .../commons/math4/filter/MeasurementModel.java  |   44 +
 .../commons/math4/filter/ProcessModel.java      |   73 +
 .../commons/math4/filter/package-info.java      |   20 +
 .../math4/fitting/AbstractCurveFitter.java      |  147 +
 .../commons/math4/fitting/CurveFitter.java      |  232 +
 .../math4/fitting/GaussianCurveFitter.java      |  430 ++
 .../commons/math4/fitting/GaussianFitter.java   |  364 ++
 .../math4/fitting/HarmonicCurveFitter.java      |  445 ++
 .../commons/math4/fitting/HarmonicFitter.java   |  384 ++
 .../math4/fitting/PolynomialCurveFitter.java    |  131 +
 .../commons/math4/fitting/PolynomialFitter.java |   72 +
 .../math4/fitting/SimpleCurveFitter.java        |  125 +
 .../math4/fitting/WeightedObservedPoint.java    |   78 +
 .../math4/fitting/WeightedObservedPoints.java   |  112 +
 .../leastsquares/AbstractEvaluation.java        |   87 +
 .../leastsquares/DenseWeightedEvaluation.java   |   68 +
 .../leastsquares/EvaluationRmsChecker.java      |   75 +
 .../leastsquares/GaussNewtonOptimizer.java      |  300 +
 .../leastsquares/LeastSquaresAdapter.java       |   77 +
 .../leastsquares/LeastSquaresBuilder.java       |  226 +
 .../leastsquares/LeastSquaresFactory.java       |  528 ++
 .../leastsquares/LeastSquaresOptimizer.java     |   62 +
 .../leastsquares/LeastSquaresProblem.java       |  156 +
 .../LevenbergMarquardtOptimizer.java            | 1042 +++
 .../MultivariateJacobianFunction.java           |   39 +
 .../math4/fitting/leastsquares/OptimumImpl.java |   97 +
 .../leastsquares/ParameterValidator.java        |   34 +
 .../leastsquares/ValueAndJacobianFunction.java  |   44 +
 .../fitting/leastsquares/package-info.java      |   39 +
 .../commons/math4/fitting/package-info.java     |   26 +
 .../commons/math4/fraction/AbstractFormat.java  |  209 +
 .../commons/math4/fraction/BigFraction.java     | 1147 ++++
 .../math4/fraction/BigFractionField.java        |   82 +
 .../math4/fraction/BigFractionFormat.java       |  287 +
 .../apache/commons/math4/fraction/Fraction.java |  673 ++
 .../fraction/FractionConversionException.java   |   55 +
 .../commons/math4/fraction/FractionField.java   |   82 +
 .../commons/math4/fraction/FractionFormat.java  |  264 +
 .../math4/fraction/ProperBigFractionFormat.java |  238 +
 .../math4/fraction/ProperFractionFormat.java    |  231 +
 .../commons/math4/fraction/package-info.java    |   22 +
 .../math4/genetics/AbstractListChromosome.java  |  105 +
 .../math4/genetics/BinaryChromosome.java        |   96 +
 .../commons/math4/genetics/BinaryMutation.java  |   56 +
 .../commons/math4/genetics/Chromosome.java      |  104 +
 .../commons/math4/genetics/ChromosomePair.java  |   65 +
 .../commons/math4/genetics/CrossoverPolicy.java |   38 +
 .../commons/math4/genetics/CycleCrossover.java  |  182 +
 .../math4/genetics/ElitisticListPopulation.java |  117 +
 .../apache/commons/math4/genetics/Fitness.java  |   32 +
 .../math4/genetics/FixedElapsedTime.java        |   77 +
 .../math4/genetics/FixedGenerationCount.java    |   71 +
 .../math4/genetics/GeneticAlgorithm.java        |  233 +
 .../InvalidRepresentationException.java         |   42 +
 .../commons/math4/genetics/ListPopulation.java  |  222 +
 .../commons/math4/genetics/MutationPolicy.java  |   35 +
 .../commons/math4/genetics/NPointCrossover.java |  178 +
 .../math4/genetics/OnePointCrossover.java       |  128 +
 .../math4/genetics/OrderedCrossover.java        |  150 +
 .../math4/genetics/PermutationChromosome.java   |   40 +
 .../commons/math4/genetics/Population.java      |   59 +
 .../commons/math4/genetics/RandomKey.java       |  298 +
 .../math4/genetics/RandomKeyMutation.java       |   54 +
 .../commons/math4/genetics/SelectionPolicy.java |   34 +
 .../math4/genetics/StoppingCondition.java       |   33 +
 .../math4/genetics/TournamentSelection.java     |  114 +
 .../math4/genetics/UniformCrossover.java        |  134 +
 .../commons/math4/genetics/package-info.java    |   20 +
 .../apache/commons/math4/geometry/Point.java    |   46 +
 .../apache/commons/math4/geometry/Space.java    |   42 +
 .../apache/commons/math4/geometry/Vector.java   |  155 +
 .../commons/math4/geometry/VectorFormat.java    |  290 +
 .../math4/geometry/enclosing/Encloser.java      |   36 +
 .../math4/geometry/enclosing/EnclosingBall.java |  103 +
 .../enclosing/SupportBallGenerator.java         |   42 +
 .../math4/geometry/enclosing/WelzlEncloser.java |  181 +
 .../math4/geometry/enclosing/package-info.java  |   24 +
 .../geometry/euclidean/oned/Euclidean1D.java    |  100 +
 .../math4/geometry/euclidean/oned/Interval.java |  129 +
 .../geometry/euclidean/oned/IntervalsSet.java   |  686 ++
 .../geometry/euclidean/oned/OrientedPoint.java  |  153 +
 .../euclidean/oned/SubOrientedPoint.java        |   76 +
 .../math4/geometry/euclidean/oned/Vector1D.java |  356 +
 .../geometry/euclidean/oned/Vector1DFormat.java |  135 +
 .../geometry/euclidean/oned/package-info.java   |   24 +
 .../threed/CardanEulerSingularityException.java |   44 +
 .../geometry/euclidean/threed/Euclidean3D.java  |   74 +
 .../euclidean/threed/FieldRotation.java         | 1183 ++++
 .../euclidean/threed/FieldVector3D.java         | 1185 ++++
 .../math4/geometry/euclidean/threed/Line.java   |  275 +
 .../threed/NotARotationMatrixException.java     |   47 +
 .../euclidean/threed/OutlineExtractor.java      |  263 +
 .../math4/geometry/euclidean/threed/Plane.java  |  527 ++
 .../euclidean/threed/PolyhedronsSet.java        |  539 ++
 .../geometry/euclidean/threed/Rotation.java     | 1053 +++
 .../euclidean/threed/RotationOrder.java         |  174 +
 .../geometry/euclidean/threed/Segment.java      |   66 +
 .../euclidean/threed/SphereGenerator.java       |  152 +
 .../euclidean/threed/SphericalCoordinates.java  |  395 ++
 .../geometry/euclidean/threed/SubLine.java      |  165 +
 .../geometry/euclidean/threed/SubPlane.java     |  144 +
 .../geometry/euclidean/threed/Vector3D.java     |  588 ++
 .../euclidean/threed/Vector3DFormat.java        |  155 +
 .../geometry/euclidean/threed/package-info.java |   24 +
 .../geometry/euclidean/twod/DiskGenerator.java  |  108 +
 .../geometry/euclidean/twod/Euclidean2D.java    |   74 +
 .../math4/geometry/euclidean/twod/Line.java     |  540 ++
 .../geometry/euclidean/twod/NestedLoops.java    |  200 +
 .../geometry/euclidean/twod/PolygonsSet.java    | 1160 ++++
 .../math4/geometry/euclidean/twod/Segment.java  |  112 +
 .../math4/geometry/euclidean/twod/SubLine.java  |  233 +
 .../math4/geometry/euclidean/twod/Vector2D.java |  460 ++
 .../geometry/euclidean/twod/Vector2DFormat.java |  138 +
 .../hull/AbstractConvexHullGenerator2D.java     |  116 +
 .../twod/hull/AklToussaintHeuristic.java        |  153 +
 .../euclidean/twod/hull/ConvexHull2D.java       |  172 +
 .../twod/hull/ConvexHullGenerator2D.java        |   37 +
 .../euclidean/twod/hull/MonotoneChain.java      |  179 +
 .../euclidean/twod/hull/package-info.java       |   25 +
 .../geometry/euclidean/twod/package-info.java   |   24 +
 .../commons/math4/geometry/hull/ConvexHull.java |   48 +
 .../geometry/hull/ConvexHullGenerator.java      |   49 +
 .../math4/geometry/hull/package-info.java       |   24 +
 .../commons/math4/geometry/package-info.java    |   25 +
 .../geometry/partitioning/AbstractRegion.java   |  533 ++
 .../partitioning/AbstractSubHyperplane.java     |  188 +
 .../math4/geometry/partitioning/BSPTree.java    |  817 +++
 .../geometry/partitioning/BSPTreeVisitor.java   |  114 +
 .../partitioning/BoundaryAttribute.java         |  116 +
 .../geometry/partitioning/BoundaryBuilder.java  |   95 +
 .../partitioning/BoundaryProjection.java        |   83 +
 .../partitioning/BoundaryProjector.java         |  200 +
 .../partitioning/BoundarySizeVisitor.java       |   65 +
 .../geometry/partitioning/Characterization.java |  190 +
 .../math4/geometry/partitioning/Embedding.java  |   68 +
 .../math4/geometry/partitioning/Hyperplane.java |   98 +
 .../geometry/partitioning/InsideFinder.java     |  150 +
 .../math4/geometry/partitioning/NodesSet.java   |   72 +
 .../math4/geometry/partitioning/Region.java     |  218 +
 .../geometry/partitioning/RegionFactory.java    |  349 +
 .../math4/geometry/partitioning/Side.java       |   37 +
 .../geometry/partitioning/SubHyperplane.java    |  131 +
 .../math4/geometry/partitioning/Transform.java  |   80 +
 .../geometry/partitioning/package-info.java     |  114 +
 .../partitioning/utilities/AVLTree.java         |  634 ++
 .../partitioning/utilities/OrderedTuple.java    |  431 ++
 .../utilities/doc-files/OrderedTuple.png        |  Bin 0 -> 28882 bytes
 .../partitioning/utilities/package-info.java    |   24 +
 .../math4/geometry/spherical/oned/Arc.java      |  132 +
 .../math4/geometry/spherical/oned/ArcsSet.java  |  962 +++
 .../geometry/spherical/oned/LimitAngle.java     |  127 +
 .../math4/geometry/spherical/oned/S1Point.java  |  157 +
 .../math4/geometry/spherical/oned/Sphere1D.java |  106 +
 .../geometry/spherical/oned/SubLimitAngle.java  |   74 +
 .../geometry/spherical/oned/package-info.java   |   30 +
 .../math4/geometry/spherical/twod/Circle.java   |  326 +
 .../math4/geometry/spherical/twod/Edge.java     |  222 +
 .../geometry/spherical/twod/EdgesBuilder.java   |  169 +
 .../spherical/twod/PropertiesComputer.java      |  173 +
 .../math4/geometry/spherical/twod/S2Point.java  |  237 +
 .../math4/geometry/spherical/twod/Sphere2D.java |   80 +
 .../spherical/twod/SphericalPolygonsSet.java    |  563 ++
 .../geometry/spherical/twod/SubCircle.java      |   94 +
 .../math4/geometry/spherical/twod/Vertex.java   |  124 +
 .../geometry/spherical/twod/package-info.java   |   30 +
 .../math4/linear/AbstractFieldMatrix.java       | 1156 ++++
 .../math4/linear/AbstractRealMatrix.java        |  992 +++
 .../apache/commons/math4/linear/AnyMatrix.java  |   47 +
 .../math4/linear/Array2DRowFieldMatrix.java     |  612 ++
 .../math4/linear/Array2DRowRealMatrix.java      |  548 ++
 .../commons/math4/linear/ArrayFieldVector.java  | 1147 ++++
 .../commons/math4/linear/ArrayRealVector.java   |  954 +++
 .../math4/linear/BiDiagonalTransformer.java     |  380 ++
 .../commons/math4/linear/BlockFieldMatrix.java  | 1592 +++++
 .../commons/math4/linear/BlockRealMatrix.java   | 1581 +++++
 .../math4/linear/CholeskyDecomposition.java     |  310 +
 .../commons/math4/linear/ConjugateGradient.java |  235 +
 .../math4/linear/DecompositionSolver.java       |   97 +
 .../DefaultFieldMatrixChangingVisitor.java      |   58 +
 .../DefaultFieldMatrixPreservingVisitor.java    |   56 +
 .../DefaultIterativeLinearSolverEvent.java      |  143 +
 .../DefaultRealMatrixChangingVisitor.java       |   44 +
 .../DefaultRealMatrixPreservingVisitor.java     |   42 +
 .../commons/math4/linear/DiagonalMatrix.java    |  370 ++
 .../math4/linear/EigenDecomposition.java        |  970 +++
 .../math4/linear/FieldDecompositionSolver.java  |   75 +
 .../math4/linear/FieldLUDecomposition.java      |  444 ++
 .../commons/math4/linear/FieldMatrix.java       |  816 +++
 .../linear/FieldMatrixChangingVisitor.java      |   57 +
 .../linear/FieldMatrixPreservingVisitor.java    |   56 +
 .../commons/math4/linear/FieldVector.java       |  298 +
 .../linear/FieldVectorChangingVisitor.java      |   56 +
 .../linear/FieldVectorPreservingVisitor.java    |   55 +
 .../math4/linear/HessenbergTransformer.java     |  232 +
 .../linear/IllConditionedOperatorException.java |   42 +
 .../math4/linear/IterativeLinearSolver.java     |  173 +
 .../linear/IterativeLinearSolverEvent.java      |  115 +
 .../math4/linear/JacobiPreconditioner.java      |  135 +
 .../commons/math4/linear/LUDecomposition.java   |  390 ++
 .../MatrixDimensionMismatchException.java       |   73 +
 .../commons/math4/linear/MatrixUtils.java       | 1119 ++++
 .../NonPositiveDefiniteMatrixException.java     |   73 +
 .../NonPositiveDefiniteOperatorException.java   |   43 +
 .../linear/NonSelfAdjointOperatorException.java |   46 +
 .../math4/linear/NonSquareMatrixException.java  |   41 +
 .../linear/NonSquareOperatorException.java      |   40 +
 .../linear/NonSymmetricMatrixException.java     |   71 +
 .../commons/math4/linear/OpenMapRealMatrix.java |  310 +
 .../commons/math4/linear/OpenMapRealVector.java |  832 +++
 .../PreconditionedIterativeLinearSolver.java    |  214 +
 .../commons/math4/linear/QRDecomposition.java   |  476 ++
 .../commons/math4/linear/RRQRDecomposition.java |  244 +
 .../math4/linear/RealLinearOperator.java        |  109 +
 .../apache/commons/math4/linear/RealMatrix.java |  828 +++
 .../math4/linear/RealMatrixChangingVisitor.java |   55 +
 .../commons/math4/linear/RealMatrixFormat.java  |  394 ++
 .../linear/RealMatrixPreservingVisitor.java     |   54 +
 .../apache/commons/math4/linear/RealVector.java | 1617 +++++
 .../math4/linear/RealVectorChangingVisitor.java |   58 +
 .../commons/math4/linear/RealVectorFormat.java  |  288 +
 .../linear/RealVectorPreservingVisitor.java     |   57 +
 .../RectangularCholeskyDecomposition.java       |  195 +
 .../commons/math4/linear/SchurTransformer.java  |  453 ++
 .../math4/linear/SingularMatrixException.java   |   37 +
 .../math4/linear/SingularOperatorException.java |   38 +
 .../linear/SingularValueDecomposition.java      |  740 +++
 .../commons/math4/linear/SparseFieldMatrix.java |  187 +
 .../commons/math4/linear/SparseFieldVector.java |  793 +++
 .../commons/math4/linear/SparseRealMatrix.java  |   34 +
 .../commons/math4/linear/SparseRealVector.java  |   31 +
 .../org/apache/commons/math4/linear/SymmLQ.java | 1221 ++++
 .../math4/linear/TriDiagonalTransformer.java    |  253 +
 .../commons/math4/linear/package-info.java      |   20 +
 .../math4/ml/clustering/CentroidCluster.java    |   53 +
 .../commons/math4/ml/clustering/Cluster.java    |   60 +
 .../math4/ml/clustering/Clusterable.java        |   32 +
 .../commons/math4/ml/clustering/Clusterer.java  |   80 +
 .../math4/ml/clustering/DBSCANClusterer.java    |  233 +
 .../math4/ml/clustering/DoublePoint.java        |   86 +
 .../ml/clustering/FuzzyKMeansClusterer.java     |  426 ++
 .../ml/clustering/KMeansPlusPlusClusterer.java  |  565 ++
 .../MultiKMeansPlusPlusClusterer.java           |  135 +
 .../clustering/evaluation/ClusterEvaluator.java |  122 +
 .../evaluation/SumOfClusterVariances.java       |   68 +
 .../ml/clustering/evaluation/package-info.java  |   20 +
 .../math4/ml/clustering/package-info.java       |   20 +
 .../math4/ml/distance/CanberraDistance.java     |   42 +
 .../math4/ml/distance/ChebyshevDistance.java    |   36 +
 .../math4/ml/distance/DistanceMeasure.java      |   38 +
 .../math4/ml/distance/EarthMoversDistance.java  |   44 +
 .../math4/ml/distance/EuclideanDistance.java    |   36 +
 .../math4/ml/distance/ManhattanDistance.java    |   36 +
 .../commons/math4/ml/distance/package-info.java |   20 +
 .../math4/ml/neuralnet/FeatureInitializer.java  |   32 +
 .../ml/neuralnet/FeatureInitializerFactory.java |  114 +
 .../commons/math4/ml/neuralnet/MapUtils.java    |  247 +
 .../commons/math4/ml/neuralnet/Network.java     |  474 ++
 .../commons/math4/ml/neuralnet/Neuron.java      |  215 +
 .../math4/ml/neuralnet/SquareNeighbourhood.java |   38 +
 .../math4/ml/neuralnet/UpdateAction.java        |   34 +
 .../math4/ml/neuralnet/oned/NeuronString.java   |  236 +
 .../math4/ml/neuralnet/oned/package-info.java   |   22 +
 .../math4/ml/neuralnet/package-info.java        |   22 +
 .../ml/neuralnet/sofm/KohonenTrainingTask.java  |   59 +
 .../ml/neuralnet/sofm/KohonenUpdateAction.java  |  212 +
 .../neuralnet/sofm/LearningFactorFunction.java  |   34 +
 .../sofm/LearningFactorFunctionFactory.java     |  117 +
 .../sofm/NeighbourhoodSizeFunction.java         |   37 +
 .../sofm/NeighbourhoodSizeFunctionFactory.java  |  107 +
 .../math4/ml/neuralnet/sofm/package-info.java   |   22 +
 .../sofm/util/ExponentialDecayFunction.java     |   83 +
 .../sofm/util/QuasiSigmoidDecayFunction.java    |   87 +
 .../ml/neuralnet/sofm/util/package-info.java    |   22 +
 .../ml/neuralnet/twod/NeuronSquareMesh2D.java   |  433 ++
 .../math4/ml/neuralnet/twod/package-info.java   |   22 +
 .../apache/commons/math4/ml/package-info.java   |   20 +
 .../commons/math4/ode/AbstractIntegrator.java   |  457 ++
 .../math4/ode/AbstractParameterizable.java      |   77 +
 .../math4/ode/ContinuousOutputModel.java        |  443 ++
 .../commons/math4/ode/EquationsMapper.java      |   97 +
 .../math4/ode/ExpandableStatefulODE.java        |  330 +
 .../commons/math4/ode/FirstOrderConverter.java  |  114 +
 .../ode/FirstOrderDifferentialEquations.java    |   68 +
 .../commons/math4/ode/FirstOrderIntegrator.java |   66 +
 .../commons/math4/ode/JacobianMatrices.java     |  492 ++
 .../math4/ode/MainStateJacobianProvider.java    |   41 +
 .../commons/math4/ode/MultistepIntegrator.java  |  447 ++
 .../apache/commons/math4/ode/ODEIntegrator.java |  158 +
 .../math4/ode/ParameterConfiguration.java       |   67 +
 .../math4/ode/ParameterJacobianProvider.java    |   48 +
 .../math4/ode/ParameterJacobianWrapper.java     |   99 +
 .../commons/math4/ode/Parameterizable.java      |   42 +
 .../commons/math4/ode/ParameterizedODE.java     |   42 +
 .../commons/math4/ode/ParameterizedWrapper.java |   84 +
 .../ode/SecondOrderDifferentialEquations.java   |   64 +
 .../math4/ode/SecondOrderIntegrator.java        |   60 +
 .../commons/math4/ode/SecondaryEquations.java   |   61 +
 .../math4/ode/UnknownParameterException.java    |   52 +
 .../commons/math4/ode/events/EventFilter.java   |  204 +
 .../commons/math4/ode/events/EventHandler.java  |  219 +
 .../commons/math4/ode/events/EventState.java    |  419 ++
 .../commons/math4/ode/events/FilterType.java    |  400 ++
 .../commons/math4/ode/events/Transformer.java   |  107 +
 .../commons/math4/ode/events/package-info.java  |   96 +
 .../ode/nonstiff/AdamsBashforthIntegrator.java  |  325 +
 .../math4/ode/nonstiff/AdamsIntegrator.java     |  136 +
 .../ode/nonstiff/AdamsMoultonIntegrator.java    |  421 ++
 .../ode/nonstiff/AdamsNordsieckTransformer.java |  339 +
 .../nonstiff/AdaptiveStepsizeIntegrator.java    |  375 ++
 .../nonstiff/ClassicalRungeKuttaIntegrator.java |   75 +
 .../ClassicalRungeKuttaStepInterpolator.java    |  133 +
 .../ode/nonstiff/DormandPrince54Integrator.java |  161 +
 .../DormandPrince54StepInterpolator.java        |  222 +
 .../nonstiff/DormandPrince853Integrator.java    |  286 +
 .../DormandPrince853StepInterpolator.java       |  498 ++
 .../nonstiff/EmbeddedRungeKuttaIntegrator.java  |  380 ++
 .../math4/ode/nonstiff/EulerIntegrator.java     |   72 +
 .../ode/nonstiff/EulerStepInterpolator.java     |   99 +
 .../math4/ode/nonstiff/GillIntegrator.java      |   74 +
 .../ode/nonstiff/GillStepInterpolator.java      |  148 +
 .../nonstiff/GraggBulirschStoerIntegrator.java  |  949 +++
 .../GraggBulirschStoerStepInterpolator.java     |  405 ++
 .../ode/nonstiff/HighamHall54Integrator.java    |  135 +
 .../nonstiff/HighamHall54StepInterpolator.java  |  119 +
 .../math4/ode/nonstiff/LutherIntegrator.java    |   89 +
 .../ode/nonstiff/LutherStepInterpolator.java    |  179 +
 .../math4/ode/nonstiff/MidpointIntegrator.java  |   69 +
 .../ode/nonstiff/MidpointStepInterpolator.java  |  113 +
 .../ode/nonstiff/RungeKuttaIntegrator.java      |  269 +
 .../nonstiff/RungeKuttaStepInterpolator.java    |  211 +
 .../ode/nonstiff/ThreeEighthesIntegrator.java   |   72 +
 .../nonstiff/ThreeEighthesStepInterpolator.java |  143 +
 .../math4/ode/nonstiff/package-info.java        |   25 +
 .../apache/commons/math4/ode/package-info.java  |  164 +
 .../ode/sampling/AbstractStepInterpolator.java  |  605 ++
 .../math4/ode/sampling/DummyStepHandler.java    |   89 +
 .../math4/ode/sampling/FixedStepHandler.java    |   71 +
 .../ode/sampling/NordsieckStepInterpolator.java |  293 +
 .../commons/math4/ode/sampling/StepHandler.java |   75 +
 .../math4/ode/sampling/StepInterpolator.java    |  181 +
 .../math4/ode/sampling/StepNormalizer.java      |  300 +
 .../ode/sampling/StepNormalizerBounds.java      |   83 +
 .../math4/ode/sampling/StepNormalizerMode.java  |   69 +
 .../math4/ode/sampling/package-info.java        |   60 +
 .../math4/optim/AbstractConvergenceChecker.java |   69 +
 .../optim/AbstractOptimizationProblem.java      |  102 +
 .../BaseMultiStartMultivariateOptimizer.java    |  229 +
 .../math4/optim/BaseMultivariateOptimizer.java  |  155 +
 .../commons/math4/optim/BaseOptimizer.java      |  260 +
 .../commons/math4/optim/ConvergenceChecker.java |   55 +
 .../commons/math4/optim/InitialGuess.java       |   46 +
 .../org/apache/commons/math4/optim/MaxEval.java |   61 +
 .../org/apache/commons/math4/optim/MaxIter.java |   61 +
 .../commons/math4/optim/OptimizationData.java   |   28 +
 .../math4/optim/OptimizationProblem.java        |   53 +
 .../commons/math4/optim/PointValuePair.java     |  121 +
 .../math4/optim/PointVectorValuePair.java       |  146 +
 .../commons/math4/optim/SimpleBounds.java       |   79 +
 .../commons/math4/optim/SimplePointChecker.java |  133 +
 .../commons/math4/optim/SimpleValueChecker.java |  125 +
 .../math4/optim/SimpleVectorValueChecker.java   |  134 +
 .../math4/optim/linear/LinearConstraint.java    |  228 +
 .../math4/optim/linear/LinearConstraintSet.java |   63 +
 .../optim/linear/LinearObjectiveFunction.java   |  148 +
 .../math4/optim/linear/LinearOptimizer.java     |  131 +
 .../linear/NoFeasibleSolutionException.java     |   37 +
 .../optim/linear/NonNegativeConstraint.java     |   47 +
 .../math4/optim/linear/PivotSelectionRule.java  |   38 +
 .../math4/optim/linear/Relationship.java        |   64 +
 .../math4/optim/linear/SimplexSolver.java       |  407 ++
 .../math4/optim/linear/SimplexTableau.java      |  711 ++
 .../math4/optim/linear/SolutionCallback.java    |   62 +
 .../linear/UnboundedSolutionException.java      |   37 +
 .../math4/optim/linear/package-info.java        |   21 +
 .../math4/optim/nonlinear/scalar/GoalType.java  |   32 +
 .../scalar/GradientMultivariateOptimizer.java   |  102 +
 .../nonlinear/scalar/LeastSquaresConverter.java |  186 +
 .../optim/nonlinear/scalar/LineSearch.java      |  137 +
 .../scalar/MultiStartMultivariateOptimizer.java |  110 +
 .../MultivariateFunctionMappingAdapter.java     |  294 +
 .../MultivariateFunctionPenaltyAdapter.java     |  186 +
 .../nonlinear/scalar/MultivariateOptimizer.java |  117 +
 .../nonlinear/scalar/ObjectiveFunction.java     |   46 +
 .../scalar/ObjectiveFunctionGradient.java       |   46 +
 .../NonLinearConjugateGradientOptimizer.java    |  415 ++
 .../scalar/gradient/Preconditioner.java         |   44 +
 .../nonlinear/scalar/gradient/package-info.java |   21 +
 .../scalar/noderiv/AbstractSimplex.java         |  345 +
 .../scalar/noderiv/BOBYQAOptimizer.java         | 2460 +++++++
 .../scalar/noderiv/CMAESOptimizer.java          | 1354 ++++
 .../scalar/noderiv/MultiDirectionalSimplex.java |  215 +
 .../scalar/noderiv/NelderMeadSimplex.java       |  280 +
 .../scalar/noderiv/PowellOptimizer.java         |  299 +
 .../scalar/noderiv/SimplexOptimizer.java        |  220 +
 .../nonlinear/scalar/noderiv/package-info.java  |   21 +
 .../optim/nonlinear/scalar/package-info.java    |   21 +
 .../JacobianMultivariateVectorOptimizer.java    |  116 +
 .../optim/nonlinear/vector/ModelFunction.java   |   51 +
 .../nonlinear/vector/ModelFunctionJacobian.java |   51 +
 .../MultiStartMultivariateVectorOptimizer.java  |  121 +
 .../vector/MultivariateVectorOptimizer.java     |  167 +
 .../math4/optim/nonlinear/vector/Target.java    |   54 +
 .../math4/optim/nonlinear/vector/Weight.java    |   71 +
 .../jacobian/AbstractLeastSquaresOptimizer.java |  281 +
 .../vector/jacobian/GaussNewtonOptimizer.java   |  183 +
 .../jacobian/LevenbergMarquardtOptimizer.java   |  961 +++
 .../nonlinear/vector/jacobian/package-info.java |   26 +
 .../optim/nonlinear/vector/package-info.java    |   26 +
 .../commons/math4/optim/package-info.java       |   77 +
 .../math4/optim/univariate/BracketFinder.java   |  290 +
 .../math4/optim/univariate/BrentOptimizer.java  |  314 +
 .../MultiStartUnivariateOptimizer.java          |  227 +
 .../math4/optim/univariate/SearchInterval.java  |   95 +
 .../SimpleUnivariateValueChecker.java           |  127 +
 .../univariate/UnivariateObjectiveFunction.java |   46 +
 .../optim/univariate/UnivariateOptimizer.java   |  151 +
 .../univariate/UnivariatePointValuePair.java    |   66 +
 .../math4/optim/univariate/package-info.java    |   21 +
 .../AbstractConvergenceChecker.java             |  102 +
 .../BaseMultivariateMultiStartOptimizer.java    |  192 +
 .../optimization/BaseMultivariateOptimizer.java |   61 +
 .../BaseMultivariateSimpleBoundsOptimizer.java  |   65 +
 ...seMultivariateVectorMultiStartOptimizer.java |  204 +
 .../BaseMultivariateVectorOptimizer.java        |   63 +
 .../math4/optimization/BaseOptimizer.java       |   61 +
 .../math4/optimization/ConvergenceChecker.java  |   57 +
 ...entiableMultivariateMultiStartOptimizer.java |   52 +
 .../DifferentiableMultivariateOptimizer.java    |   37 +
 ...leMultivariateVectorMultiStartOptimizer.java |   53 +
 ...fferentiableMultivariateVectorOptimizer.java |   32 +
 .../commons/math4/optimization/GoalType.java    |   37 +
 .../math4/optimization/InitialGuess.java        |   48 +
 .../optimization/LeastSquaresConverter.java     |  182 +
 ...ariateDifferentiableMultiStartOptimizer.java |   52 +
 .../MultivariateDifferentiableOptimizer.java    |   37 +
 ...DifferentiableVectorMultiStartOptimizer.java |   53 +
 ...ltivariateDifferentiableVectorOptimizer.java |   32 +
 .../MultivariateMultiStartOptimizer.java        |   52 +
 .../optimization/MultivariateOptimizer.java     |   35 +
 .../math4/optimization/OptimizationData.java    |   30 +
 .../math4/optimization/PointValuePair.java      |  128 +
 .../optimization/PointVectorValuePair.java      |  151 +
 .../math4/optimization/SimpleBounds.java        |   63 +
 .../math4/optimization/SimplePointChecker.java  |  145 +
 .../math4/optimization/SimpleValueChecker.java  |  136 +
 .../optimization/SimpleVectorValueChecker.java  |  145 +
 .../commons/math4/optimization/Target.java      |   50 +
 .../commons/math4/optimization/Weight.java      |   68 +
 .../optimization/direct/AbstractSimplex.java    |  347 +
 .../optimization/direct/BOBYQAOptimizer.java    | 2465 +++++++
 .../BaseAbstractMultivariateOptimizer.java      |  318 +
 ...stractMultivariateSimpleBoundsOptimizer.java |   82 +
 ...BaseAbstractMultivariateVectorOptimizer.java |  370 ++
 .../optimization/direct/CMAESOptimizer.java     | 1441 ++++
 .../direct/MultiDirectionalSimplex.java         |  218 +
 .../MultivariateFunctionMappingAdapter.java     |  301 +
 .../MultivariateFunctionPenaltyAdapter.java     |  190 +
 .../optimization/direct/NelderMeadSimplex.java  |  283 +
 .../optimization/direct/PowellOptimizer.java    |  352 +
 .../optimization/direct/SimplexOptimizer.java   |  233 +
 .../math4/optimization/direct/package-info.java |   24 +
 .../math4/optimization/fitting/CurveFitter.java |  298 +
 .../optimization/fitting/GaussianFitter.java    |  365 ++
 .../optimization/fitting/HarmonicFitter.java    |  384 ++
 .../optimization/fitting/PolynomialFitter.java  |  111 +
 .../fitting/WeightedObservedPoint.java          |   76 +
 .../optimization/fitting/package-info.java      |   30 +
 .../AbstractDifferentiableOptimizer.java        |   90 +
 .../general/AbstractLeastSquaresOptimizer.java  |  577 ++
 .../AbstractScalarDifferentiableOptimizer.java  |  114 +
 .../general/ConjugateGradientFormula.java       |   50 +
 .../general/GaussNewtonOptimizer.java           |  194 +
 .../general/LevenbergMarquardtOptimizer.java    |  943 +++
 .../NonLinearConjugateGradientOptimizer.java    |  311 +
 .../optimization/general/Preconditioner.java    |   46 +
 .../optimization/general/package-info.java      |   22 +
 .../linear/AbstractLinearOptimizer.java         |  162 +
 .../optimization/linear/LinearConstraint.java   |  234 +
 .../linear/LinearObjectiveFunction.java         |  148 +
 .../optimization/linear/LinearOptimizer.java    |   92 +
 .../linear/NoFeasibleSolutionException.java     |   42 +
 .../math4/optimization/linear/Relationship.java |   67 +
 .../optimization/linear/SimplexSolver.java      |  238 +
 .../optimization/linear/SimplexTableau.java     |  635 ++
 .../linear/UnboundedSolutionException.java      |   42 +
 .../math4/optimization/linear/package-info.java |   22 +
 .../math4/optimization/package-info.java        |   79 +
 .../BaseAbstractUnivariateOptimizer.java        |  162 +
 .../univariate/BaseUnivariateOptimizer.java     |   86 +
 .../optimization/univariate/BracketFinder.java  |  289 +
 .../optimization/univariate/BrentOptimizer.java |  316 +
 .../SimpleUnivariateValueChecker.java           |  139 +
 .../UnivariateMultiStartOptimizer.java          |  202 +
 .../univariate/UnivariateOptimizer.java         |   29 +
 .../univariate/UnivariatePointValuePair.java    |   68 +
 .../optimization/univariate/package-info.java   |   22 +
 .../org/apache/commons/math4/package-info.java  |   20 +
 .../apache/commons/math4/primes/PollardRho.java |  164 +
 .../org/apache/commons/math4/primes/Primes.java |  129 +
 .../commons/math4/primes/SmallPrimes.java       |  188 +
 .../commons/math4/primes/package-info.java      |   20 +
 .../math4/random/AbstractRandomGenerator.java   |  271 +
 .../commons/math4/random/AbstractWell.java      |  187 +
 .../math4/random/BitsStreamGenerator.java       |  197 +
 .../random/CorrelatedRandomVectorGenerator.java |  184 +
 .../math4/random/EmpiricalDistribution.java     |  837 +++
 .../math4/random/GaussianRandomGenerator.java   |   46 +
 .../math4/random/HaltonSequenceGenerator.java   |  183 +
 .../commons/math4/random/ISAACRandom.java       |  273 +
 .../math4/random/JDKRandomGenerator.java        |   41 +
 .../commons/math4/random/MersenneTwister.java   |  264 +
 .../math4/random/NormalizedRandomGenerator.java |   37 +
 .../commons/math4/random/RandomAdaptor.java     |  197 +
 .../apache/commons/math4/random/RandomData.java |  264 +
 .../math4/random/RandomDataGenerator.java       |  782 +++
 .../commons/math4/random/RandomDataImpl.java    |  585 ++
 .../commons/math4/random/RandomGenerator.java   |  147 +
 .../math4/random/RandomGeneratorFactory.java    |  121 +
 .../math4/random/RandomVectorGenerator.java     |   34 +
 .../math4/random/SobolSequenceGenerator.java    |  325 +
 .../math4/random/StableRandomGenerator.java     |  134 +
 .../random/SynchronizedRandomGenerator.java     |  121 +
 .../UncorrelatedRandomVectorGenerator.java      |   92 +
 .../math4/random/UniformRandomGenerator.java    |   57 +
 .../random/UnitSphereRandomVectorGenerator.java |   80 +
 .../commons/math4/random/ValueServer.java       |  458 ++
 .../apache/commons/math4/random/Well1024a.java  |  105 +
 .../apache/commons/math4/random/Well19937a.java |  107 +
 .../apache/commons/math4/random/Well19937c.java |  114 +
 .../apache/commons/math4/random/Well44497a.java |  110 +
 .../apache/commons/math4/random/Well44497b.java |  118 +
 .../apache/commons/math4/random/Well512a.java   |  106 +
 .../commons/math4/random/package-info.java      |  132 +
 .../apache/commons/math4/special/BesselJ.java   |  649 ++
 .../org/apache/commons/math4/special/Beta.java  |  511 ++
 .../org/apache/commons/math4/special/Erf.java   |  243 +
 .../org/apache/commons/math4/special/Gamma.java |  710 ++
 .../commons/math4/special/package-info.java     |   20 +
 .../apache/commons/math4/stat/Frequency.java    |  684 ++
 .../apache/commons/math4/stat/StatUtils.java    |  887 +++
 .../commons/math4/stat/clustering/Cluster.java  |   76 +
 .../math4/stat/clustering/Clusterable.java      |   48 +
 .../math4/stat/clustering/DBSCANClusterer.java  |  226 +
 .../stat/clustering/EuclideanDoublePoint.java   |  100 +
 .../stat/clustering/EuclideanIntegerPoint.java  |  101 +
 .../clustering/KMeansPlusPlusClusterer.java     |  514 ++
 .../math4/stat/clustering/package-info.java     |   29 +
 .../math4/stat/correlation/Covariance.java      |  295 +
 .../stat/correlation/KendallsCorrelation.java   |  271 +
 .../stat/correlation/PearsonsCorrelation.java   |  330 +
 .../stat/correlation/SpearmansCorrelation.java  |  259 +
 .../StorelessBivariateCovariance.java           |  138 +
 .../stat/correlation/StorelessCovariance.java   |  229 +
 .../math4/stat/correlation/package-info.java    |   22 +
 .../AbstractStorelessUnivariateStatistic.java   |  187 +
 .../AbstractUnivariateStatistic.java            |  263 +
 .../descriptive/AggregateSummaryStatistics.java |  420 ++
 .../stat/descriptive/DescriptiveStatistics.java |  774 +++
 .../MultivariateSummaryStatistics.java          |  635 ++
 .../StatisticalMultivariateSummary.java         |  119 +
 .../stat/descriptive/StatisticalSummary.java    |   64 +
 .../descriptive/StatisticalSummaryValues.java   |  186 +
 .../StorelessUnivariateStatistic.java           |   87 +
 .../stat/descriptive/SummaryStatistics.java     |  765 +++
 .../SynchronizedDescriptiveStatistics.java      |  192 +
 ...nchronizedMultivariateSummaryStatistics.java |  297 +
 .../SynchronizedSummaryStatistics.java          |  366 ++
 .../stat/descriptive/UnivariateStatistic.java   |   55 +
 .../stat/descriptive/WeightedEvaluation.java    |   57 +
 .../stat/descriptive/moment/FirstMoment.java    |  169 +
 .../stat/descriptive/moment/FourthMoment.java   |  151 +
 .../stat/descriptive/moment/GeometricMean.java  |  214 +
 .../math4/stat/descriptive/moment/Kurtosis.java |  226 +
 .../math4/stat/descriptive/moment/Mean.java     |  286 +
 .../stat/descriptive/moment/SecondMoment.java   |  134 +
 .../stat/descriptive/moment/SemiVariance.java   |  369 ++
 .../math4/stat/descriptive/moment/Skewness.java |  223 +
 .../descriptive/moment/StandardDeviation.java   |  280 +
 .../stat/descriptive/moment/ThirdMoment.java    |  148 +
 .../math4/stat/descriptive/moment/Variance.java |  627 ++
 .../descriptive/moment/VectorialCovariance.java |  157 +
 .../stat/descriptive/moment/VectorialMean.java  |  105 +
 .../stat/descriptive/moment/package-info.java   |   20 +
 .../math4/stat/descriptive/package-info.java    |   44 +
 .../math4/stat/descriptive/rank/Max.java        |  171 +
 .../math4/stat/descriptive/rank/Median.java     |   97 +
 .../math4/stat/descriptive/rank/Min.java        |  171 +
 .../descriptive/rank/PSquarePercentile.java     |  996 +++
 .../math4/stat/descriptive/rank/Percentile.java | 1072 +++
 .../stat/descriptive/rank/package-info.java     |   20 +
 .../math4/stat/descriptive/summary/Product.java |  230 +
 .../math4/stat/descriptive/summary/Sum.java     |  226 +
 .../stat/descriptive/summary/SumOfLogs.java     |  170 +
 .../stat/descriptive/summary/SumOfSquares.java  |  159 +
 .../stat/descriptive/summary/package-info.java  |   20 +
 .../stat/inference/AlternativeHypothesis.java   |   40 +
 .../math4/stat/inference/BinomialTest.java      |  160 +
 .../math4/stat/inference/ChiSquareTest.java     |  602 ++
 .../commons/math4/stat/inference/GTest.java     |  538 ++
 .../stat/inference/KolmogorovSmirnovTest.java   |  998 +++
 .../math4/stat/inference/MannWhitneyUTest.java  |  238 +
 .../math4/stat/inference/OneWayAnova.java       |  355 +
 .../commons/math4/stat/inference/TTest.java     | 1184 ++++
 .../commons/math4/stat/inference/TestUtils.java |  547 ++
 .../stat/inference/WilcoxonSignedRankTest.java  |  325 +
 .../math4/stat/inference/package-info.java      |   22 +
 .../stat/interval/AgrestiCoullInterval.java     |   48 +
 .../interval/BinomialConfidenceInterval.java    |   62 +
 .../stat/interval/ClopperPearsonInterval.java   |   58 +
 .../math4/stat/interval/ConfidenceInterval.java |  109 +
 .../math4/stat/interval/IntervalUtils.java      |  174 +
 .../interval/NormalApproximationInterval.java   |   44 +
 .../stat/interval/WilsonScoreInterval.java      |   52 +
 .../math4/stat/interval/package-info.java       |   22 +
 .../apache/commons/math4/stat/package-info.java |   20 +
 .../commons/math4/stat/ranking/NaNStrategy.java |   55 +
 .../math4/stat/ranking/NaturalRanking.java      |  474 ++
 .../math4/stat/ranking/RankingAlgorithm.java    |   40 +
 .../math4/stat/ranking/TiesStrategy.java        |   54 +
 .../math4/stat/ranking/package-info.java        |   22 +
 .../AbstractMultipleLinearRegression.java       |  383 ++
 .../regression/GLSMultipleLinearRegression.java |  135 +
 .../regression/MillerUpdatingRegression.java    | 1101 ++++
 .../regression/ModelSpecificationException.java |   40 +
 .../regression/MultipleLinearRegression.java    |   69 +
 .../regression/OLSMultipleLinearRegression.java |  285 +
 .../stat/regression/RegressionResults.java      |  421 ++
 .../math4/stat/regression/SimpleRegression.java |  881 +++
 .../UpdatingMultipleLinearRegression.java       |   93 +
 .../math4/stat/regression/package-info.java     |   22 +
 .../math4/transform/DctNormalization.java       |   66 +
 .../math4/transform/DftNormalization.java       |   56 +
 .../math4/transform/DstNormalization.java       |   56 +
 .../math4/transform/FastCosineTransformer.java  |  181 +
 .../math4/transform/FastFourierTransformer.java |  674 ++
 .../transform/FastHadamardTransformer.java      |  323 +
 .../math4/transform/FastSineTransformer.java    |  180 +
 .../math4/transform/RealTransformer.java        |   70 +
 .../commons/math4/transform/TransformType.java  |   30 +
 .../commons/math4/transform/TransformUtils.java |  163 +
 .../commons/math4/transform/package-info.java   |   22 +
 .../commons/math4/util/ArithmeticUtils.java     |  907 +++
 .../org/apache/commons/math4/util/BigReal.java  |  325 +
 .../apache/commons/math4/util/BigRealField.java |   83 +
 .../math4/util/CentralPivotingStrategy.java     |   46 +
 .../apache/commons/math4/util/Combinations.java |  406 ++
 .../commons/math4/util/CombinatoricsUtils.java  |  462 ++
 .../commons/math4/util/CompositeFormat.java     |  218 +
 .../commons/math4/util/ContinuedFraction.java   |  181 +
 .../apache/commons/math4/util/Decimal64.java    |  695 ++
 .../commons/math4/util/Decimal64Field.java      |   61 +
 .../commons/math4/util/DefaultTransformer.java  |   81 +
 .../apache/commons/math4/util/DoubleArray.java  |  110 +
 .../org/apache/commons/math4/util/FastMath.java | 4218 ++++++++++++
 .../apache/commons/math4/util/FastMathCalc.java |  658 ++
 .../math4/util/FastMathLiteralArrays.java       | 6175 ++++++++++++++++++
 .../apache/commons/math4/util/Incrementor.java  |  179 +
 .../commons/math4/util/IterationEvent.java      |   55 +
 .../commons/math4/util/IterationListener.java   |   57 +
 .../commons/math4/util/IterationManager.java    |  172 +
 .../apache/commons/math4/util/KthSelector.java  |  157 +
 .../apache/commons/math4/util/MathArrays.java   | 1778 +++++
 .../apache/commons/math4/util/MathUtils.java    |  286 +
 .../math4/util/MedianOf3PivotingStrategy.java   |   63 +
 .../math4/util/MultidimensionalCounter.java     |  303 +
 .../commons/math4/util/NumberTransformer.java   |   38 +
 .../math4/util/OpenIntToDoubleHashMap.java      |  596 ++
 .../math4/util/OpenIntToFieldHashMap.java       |  617 ++
 .../org/apache/commons/math4/util/Pair.java     |  155 +
 .../math4/util/PivotingStrategyInterface.java   |   44 +
 .../apache/commons/math4/util/Precision.java    |  603 ++
 .../math4/util/RandomPivotingStrategy.java      |   57 +
 .../math4/util/ResizableDoubleArray.java        | 1206 ++++
 .../commons/math4/util/TransformerMap.java      |  189 +
 .../apache/commons/math4/util/package-info.java |   20 +
 .../util/LocalizedFormats_fr.properties         |  337 -
 .../commons/math3/random/new-joe-kuo-6.1000     | 1000 ---
 .../util/LocalizedFormats_fr.properties         |  337 +
 .../commons/math4/random/new-joe-kuo-6.1000     | 1000 +++
 .../math3/ExtendedFieldElementAbstractTest.java |  539 --
 .../org/apache/commons/math3/PerfTestUtils.java |  260 -
 .../java/org/apache/commons/math3/Retry.java    |   29 -
 .../org/apache/commons/math3/RetryRunner.java   |   81 -
 .../apache/commons/math3/RetryRunnerTest.java   |   55 -
 .../org/apache/commons/math3/TestUtils.java     |  522 --
 .../math3/analysis/FunctionUtilsTest.java       |  349 -
 .../math3/analysis/MonitoredFunction.java       |   46 -
 .../commons/math3/analysis/QuinticFunction.java |   39 -
 .../commons/math3/analysis/SumSincFunction.java |   54 -
 .../commons/math3/analysis/XMinus5Function.java |   39 -
 .../differentiation/DSCompilerTest.java         |  477 --
 .../DerivativeStructureTest.java                | 1597 -----
 .../FiniteDifferencesDifferentiatorTest.java    |  404 --
 .../differentiation/GradientFunctionTest.java   |   88 -
 .../differentiation/JacobianFunctionTest.java   |   96 -
 .../differentiation/SparseGradientTest.java     | 1128 ----
 .../math3/analysis/function/GaussianTest.java   |  161 -
 .../function/HarmonicOscillatorTest.java        |  139 -
 .../math3/analysis/function/LogisticTest.java   |  200 -
 .../math3/analysis/function/LogitTest.java      |  225 -
 .../math3/analysis/function/SigmoidTest.java    |  111 -
 .../math3/analysis/function/SincTest.java       |  120 -
 .../math3/analysis/function/SqrtTest.java       |   71 -
 .../analysis/function/StepFunctionTest.java     |  116 -
 .../IterativeLegendreGaussIntegratorTest.java   |  170 -
 .../LegendreGaussIntegratorTest.java            |  151 -
 .../integration/MidPointIntegratorTest.java     |  150 -
 .../integration/RombergIntegratorTest.java      |  123 -
 .../integration/SimpsonIntegratorTest.java      |  121 -
 .../integration/TrapezoidIntegratorTest.java    |  123 -
 .../integration/gauss/BaseRuleFactoryTest.java  |  110 -
 .../integration/gauss/GaussIntegratorTest.java  |   74 -
 .../gauss/GaussianQuadratureAbstractTest.java   |  116 -
 .../gauss/HermiteParametricTest.java            |   96 -
 .../analysis/integration/gauss/HermiteTest.java |  109 -
 .../LegendreHighPrecisionParametricTest.java    |   85 -
 .../gauss/LegendreHighPrecisionTest.java        |   58 -
 .../gauss/LegendreParametricTest.java           |   85 -
 .../integration/gauss/LegendreTest.java         |   58 -
 .../AkimaSplineInterpolatorTest.java            |  227 -
 .../BicubicInterpolatingFunctionTest.java       |  383 --
 .../interpolation/BicubicInterpolatorTest.java  |  175 -
 .../BicubicSplineInterpolatingFunctionTest.java |  668 --
 .../BicubicSplineInterpolatorTest.java          |  184 -
 .../DividedDifferenceInterpolatorTest.java      |  146 -
 .../FieldHermiteInterpolatorTest.java           |  275 -
 .../interpolation/HermiteInterpolatorTest.java  |  256 -
 .../interpolation/LinearInterpolatorTest.java   |  147 -
 .../interpolation/LoessInterpolatorTest.java    |  260 -
 .../MicrosphereInterpolatorTest.java            |  131 -
 .../interpolation/NevilleInterpolatorTest.java  |  146 -
 ...eBicubicSplineInterpolatingFunctionTest.java |  268 -
 .../PiecewiseBicubicSplineInterpolatorTest.java |  228 -
 ...PolynomialBicubicSplineInterpolatorTest.java |  179 -
 .../interpolation/SplineInterpolatorTest.java   |  223 -
 .../TricubicInterpolatingFunctionTest.java      |  631 --
 .../interpolation/TricubicInterpolatorTest.java |  225 -
 ...TricubicSplineInterpolatingFunctionTest.java |  544 --
 .../TricubicSplineInterpolatorTest.java         |  212 -
 .../UnivariatePeriodicInterpolatorTest.java     |  163 -
 .../PolynomialFunctionLagrangeFormTest.java     |  153 -
 .../PolynomialFunctionNewtonFormTest.java       |  178 -
 .../polynomials/PolynomialFunctionTest.java     |  264 -
 .../PolynomialSplineFunctionTest.java           |  187 -
 .../polynomials/PolynomialsUtilsTest.java       |  388 --
 .../solvers/BaseSecantSolverAbstractTest.java   |  257 -
 .../analysis/solvers/BisectionSolverTest.java   |   90 -
 .../BracketingNthOrderBrentSolverTest.java      |  211 -
 .../math3/analysis/solvers/BrentSolverTest.java |  267 -
 .../analysis/solvers/IllinoisSolverTest.java    |   36 -
 .../analysis/solvers/LaguerreSolverTest.java    |  159 -
 .../analysis/solvers/MullerSolver2Test.java     |  145 -
 .../analysis/solvers/MullerSolverTest.java      |  148 -
 .../solvers/NewtonRaphsonSolverTest.java        |   90 -
 .../analysis/solvers/NewtonSolverTest.java      |  110 -
 .../analysis/solvers/PegasusSolverTest.java     |   36 -
 .../analysis/solvers/RegulaFalsiSolverTest.java |   59 -
 .../analysis/solvers/RiddersSolverTest.java     |  141 -
 .../analysis/solvers/SecantSolverTest.java      |   39 -
 .../solvers/UnivariateSolverUtilsTest.java      |  206 -
 .../commons/math3/complex/ComplexFieldTest.java |   42 -
 .../complex/ComplexFormatAbstractTest.java      |  310 -
 .../math3/complex/ComplexFormatTest.java        |   33 -
 .../commons/math3/complex/ComplexTest.java      | 1482 -----
 .../commons/math3/complex/ComplexUtilsTest.java |  111 -
 .../math3/complex/FrenchComplexFormatTest.java  |   34 -
 .../commons/math3/complex/QuaternionTest.java   |  451 --
 .../commons/math3/complex/RootsOfUnityTest.java |  101 -
 .../BracketingNthOrderBrentSolverDFPTest.java   |  170 -
 .../org/apache/commons/math3/dfp/Decimal10.java |   99 -
 .../apache/commons/math3/dfp/DfpDecTest.java    |  565 --
 .../apache/commons/math3/dfp/DfpMathTest.java   |  587 --
 .../org/apache/commons/math3/dfp/DfpTest.java   | 1653 -----
 .../AbstractIntegerDistributionTest.java        |  127 -
 .../AbstractRealDistributionTest.java           |  211 -
 .../distribution/BetaDistributionTest.java      |  306 -
 .../distribution/BinomialDistributionTest.java  |  173 -
 .../distribution/CauchyDistributionTest.java    |  120 -
 .../ChiSquaredDistributionTest.java             |  136 -
 .../ConstantRealDistributionTest.java           |   91 -
 .../EnumeratedIntegerDistributionTest.java      |  171 -
 .../EnumeratedRealDistributionTest.java         |  259 -
 .../ExponentialDistributionTest.java            |  134 -
 .../math3/distribution/FDistributionTest.java   |  158 -
 .../distribution/GammaDistributionTest.java     |  357 -
 .../distribution/GeometricDistributionTest.java |  170 -
 .../distribution/GumbelDistributionTest.java    |   71 -
 .../HypergeometricDistributionTest.java         |  324 -
 .../IntegerDistributionAbstractTest.java        |  422 --
 .../KolmogorovSmirnovDistributionTest.java      |  118 -
 .../distribution/LaplaceDistributionTest.java   |   72 -
 .../distribution/LevyDistributionTest.java      |   82 -
 .../distribution/LogNormalDistributionTest.java |  253 -
 .../distribution/LogisticsDistributionTest.java |   72 -
 .../MultivariateNormalDistributionTest.java     |  152 -
 ...riateNormalMixtureModelDistributionTest.java |  297 -
 .../distribution/NakagamiDistributionTest.java  |   72 -
 .../distribution/NormalDistributionTest.java    |  204 -
 .../distribution/ParetoDistributionTest.java    |  205 -
 .../distribution/PascalDistributionTest.java    |  132 -
 .../distribution/PoissonDistributionTest.java   |  246 -
 .../RealDistributionAbstractTest.java           |  548 --
 .../math3/distribution/TDistributionTest.java   |  172 -
 .../TriangularDistributionTest.java             |  193 -
 .../UniformIntegerDistributionTest.java         |  113 -
 .../UniformRealDistributionTest.java            |  124 -
 .../distribution/WeibullDistributionTest.java   |  125 -
 .../distribution/ZipfDistributionTest.java      |  122 -
 ...ormalMixtureExpectationMaximizationTest.java |  349 -
 .../DimensionMismatchExceptionTest.java         |   33 -
 .../MaxCountExceededExceptionTest.java          |   32 -
 .../NonMonotonicSequenceExceptionTest.java      |   46 -
 .../exception/NotPositiveExceptionTest.java     |   34 -
 .../NotStrictlyPositiveExceptionTest.java       |   34 -
 .../NumberIsTooLargeExceptionTest.java          |   34 -
 .../NumberIsTooSmallExceptionTest.java          |   34 -
 .../exception/OutOfRangeExceptionTest.java      |   34 -
 .../TooManyEvaluationsExceptionTest.java        |   39 -
 .../math3/exception/util/ArgUtilsTest.java      |   75 -
 .../exception/util/ExceptionContextTest.java    |  130 -
 .../exception/util/LocalizedFormatsTest.java    |  104 -
 .../commons/math3/filter/KalmanFilterTest.java  |  443 --
 .../commons/math3/fitting/CurveFitterTest.java  |  142 -
 .../math3/fitting/GaussianCurveFitterTest.java  |  395 --
 .../math3/fitting/GaussianFitterTest.java       |  363 -
 .../math3/fitting/HarmonicCurveFitterTest.java  |  182 -
 .../math3/fitting/HarmonicFitterTest.java       |  185 -
 .../fitting/PolynomialCurveFitterTest.java      |  166 -
 .../math3/fitting/PolynomialFitterTest.java     |  286 -
 .../math3/fitting/SimpleCurveFitterTest.java    |   60 -
 .../fitting/WeightedObservedPointsTest.java     |  125 -
 ...stractLeastSquaresOptimizerAbstractTest.java |  603 --
 .../fitting/leastsquares/CircleProblem.java     |  175 -
 .../fitting/leastsquares/CircleVectorial.java   |   94 -
 .../leastsquares/EvaluationRmsCheckerTest.java  |   86 -
 .../fitting/leastsquares/EvaluationTest.java    |  326 -
 .../leastsquares/EvaluationTestValidation.java  |  304 -
 .../GaussNewtonOptimizerWithCholeskyTest.java   |  133 -
 .../GaussNewtonOptimizerWithLUTest.java         |  133 -
 .../GaussNewtonOptimizerWithQRTest.java         |  119 -
 .../GaussNewtonOptimizerWithSVDTest.java        |  148 -
 .../LevenbergMarquardtOptimizerTest.java        |  386 --
 .../math3/fitting/leastsquares/MinpackTest.java | 1481 -----
 .../RandomCirclePointGenerator.java             |   91 -
 .../RandomStraightLinePointGenerator.java       |   98 -
 .../StatisticalReferenceDataset.java            |  370 --
 .../StatisticalReferenceDatasetFactory.java     |  201 -
 .../leastsquares/StraightLineProblem.java       |  165 -
 .../math3/fraction/BigFractionFieldTest.java    |   43 -
 .../math3/fraction/BigFractionFormatTest.java   |  332 -
 .../commons/math3/fraction/BigFractionTest.java |  640 --
 .../math3/fraction/FractionFieldTest.java       |   43 -
 .../math3/fraction/FractionFormatTest.java      |  351 -
 .../commons/math3/fraction/FractionTest.java    |  618 --
 .../math3/genetics/BinaryChromosomeTest.java    |   65 -
 .../math3/genetics/BinaryMutationTest.java      |   44 -
 .../commons/math3/genetics/ChromosomeTest.java  |  111 -
 .../math3/genetics/CycleCrossoverTest.java      |  149 -
 .../math3/genetics/DummyBinaryChromosome.java   |   44 -
 .../math3/genetics/DummyListChromosome.java     |   78 -
 .../commons/math3/genetics/DummyRandomKey.java  |   44 -
 .../genetics/ElitisticListPopulationTest.java   |  105 -
 .../math3/genetics/FitnessCachingTest.java      |   95 -
 .../math3/genetics/FixedElapsedTimeTest.java    |   74 -
 .../genetics/FixedGenerationCountTest.java      |   64 -
 .../genetics/GeneticAlgorithmTestBinary.java    |  123 -
 .../GeneticAlgorithmTestPermutations.java       |  132 -
 .../math3/genetics/ListPopulationTest.java      |  207 -
 .../math3/genetics/NPointCrossoverTest.java     |  129 -
 .../math3/genetics/OnePointCrossoverTest.java   |   61 -
 .../math3/genetics/OrderedCrossoverTest.java    |  102 -
 .../math3/genetics/RandomKeyMutationTest.java   |   44 -
 .../commons/math3/genetics/RandomKeyTest.java   |  170 -
 .../math3/genetics/TournamentSelectionTest.java |   56 -
 .../math3/genetics/UniformCrossoverTest.java    |  152 -
 .../geometry/enclosing/WelzlEncloser2DTest.java |  177 -
 .../geometry/enclosing/WelzlEncloser3DTest.java |  184 -
 .../euclidean/oned/Euclidean1DTest.java         |   43 -
 .../oned/FrenchVector1DFormatTest.java          |   34 -
 .../geometry/euclidean/oned/IntervalTest.java   |   74 -
 .../euclidean/oned/IntervalsSetTest.java        |  106 -
 .../oned/Vector1DFormatAbstractTest.java        |  273 -
 .../euclidean/oned/Vector1DFormatTest.java      |   34 -
 .../geometry/euclidean/oned/Vector1DTest.java   |  219 -
 .../euclidean/threed/Euclidean3DTest.java       |   44 -
 .../euclidean/threed/FieldRotationDSTest.java   |  845 ---
 .../euclidean/threed/FieldRotationDfpTest.java  |  716 --
 .../euclidean/threed/FieldVector3DTest.java     |  730 ---
 .../threed/FrenchVector3DFormatTest.java        |   34 -
 .../geometry/euclidean/threed/LineTest.java     |  149 -
 .../geometry/euclidean/threed/PlaneTest.java    |  171 -
 .../euclidean/threed/PolyhedronsSetTest.java    |  316 -
 .../euclidean/threed/RotationOrderTest.java     |   59 -
 .../geometry/euclidean/threed/RotationTest.java |  552 --
 .../euclidean/threed/SphereGeneratorTest.java   |  186 -
 .../threed/SphericalCoordinatesTest.java        |  186 -
 .../geometry/euclidean/threed/SubLineTest.java  |  164 -
 .../threed/Vector3DFormatAbstractTest.java      |  330 -
 .../euclidean/threed/Vector3DFormatTest.java    |   34 -
 .../geometry/euclidean/threed/Vector3DTest.java |  412 --
 .../euclidean/twod/DiskGeneratorTest.java       |  118 -
 .../euclidean/twod/Euclidean2DTest.java         |   45 -
 .../twod/FrenchVector2DFormatTest.java          |   34 -
 .../math3/geometry/euclidean/twod/LineTest.java |  137 -
 .../euclidean/twod/PolygonsSetTest.java         | 1318 ----
 .../geometry/euclidean/twod/SegmentTest.java    |   45 -
 .../geometry/euclidean/twod/SubLineTest.java    |  155 -
 .../twod/Vector2DFormatAbstractTest.java        |  314 -
 .../euclidean/twod/Vector2DFormatTest.java      |   34 -
 .../geometry/euclidean/twod/Vector2DTest.java   |   40 -
 .../twod/hull/AklToussaintHeuristicTest.java    |   38 -
 .../hull/ConvexHullGenerator2DAbstractTest.java |  444 --
 .../euclidean/twod/hull/MonotoneChainTest.java  |   55 -
 .../partitioning/utilities/AVLTreeTest.java     |  176 -
 .../math3/geometry/spherical/oned/ArcTest.java  |   81 -
 .../geometry/spherical/oned/ArcsSetTest.java    |  580 --
 .../geometry/spherical/oned/LimitAngleTest.java |   38 -
 .../geometry/spherical/oned/S1PointTest.java    |   75 -
 .../geometry/spherical/oned/Sphere1Test.java    |   43 -
 .../geometry/spherical/twod/CircleTest.java     |  186 -
 .../geometry/spherical/twod/S2PointTest.java    |   88 -
 .../twod/SphericalPolygonsSetTest.java          |  536 --
 .../geometry/spherical/twod/SubCircleTest.java  |  121 -
 .../math3/linear/Array2DRowRealMatrixTest.java  | 1172 ----
 .../math3/linear/ArrayFieldVectorTest.java      | 1196 ----
 .../math3/linear/ArrayRealVectorTest.java       |  172 -
 .../math3/linear/BiDiagonalTransformerTest.java |  204 -
 .../math3/linear/BlockFieldMatrixTest.java      | 1377 ----
 .../math3/linear/BlockRealMatrixTest.java       | 1281 ----
 .../math3/linear/CholeskyDecompositionTest.java |  138 -
 .../math3/linear/CholeskySolverTest.java        |  112 -
 .../math3/linear/ConjugateGradientTest.java     |  602 --
 .../math3/linear/DiagonalMatrixTest.java        |  368 --
 .../math3/linear/EigenDecompositionTest.java    |  782 ---
 .../commons/math3/linear/EigenSolverTest.java   |  200 -
 .../math3/linear/FieldLUDecompositionTest.java  |  303 -
 .../commons/math3/linear/FieldLUSolverTest.java |  177 -
 .../math3/linear/FieldMatrixImplTest.java       | 1145 ----
 .../linear/FrenchRealVectorFormatTest.java      |   34 -
 .../math3/linear/HessenbergTransformerTest.java |  221 -
 .../commons/math3/linear/HilbertMatrix.java     |   75 -
 .../math3/linear/InverseHilbertMatrix.java      |  101 -
 .../math3/linear/LUDecompositionTest.java       |  291 -
 .../commons/math3/linear/LUSolverTest.java      |  169 -
 .../MatrixDimensionMismatchExceptionTest.java   |   36 -
 .../commons/math3/linear/MatrixUtilsTest.java   |  484 --
 .../math3/linear/OpenMapRealMatrixTest.java     |   49 -
 .../math3/linear/QRDecompositionTest.java       |  286 -
 .../commons/math3/linear/QRSolverTest.java      |  196 -
 .../math3/linear/RRQRDecompositionTest.java     |  233 -
 .../commons/math3/linear/RRQRSolverTest.java    |  202 -
 .../linear/RealMatrixFormatAbstractTest.java    |  363 -
 .../math3/linear/RealMatrixFormatTest.java      |   34 -
 .../math3/linear/RealVectorAbstractTest.java    | 1972 ------
 .../linear/RealVectorFormatAbstractTest.java    |  355 -
 .../math3/linear/RealVectorFormatTest.java      |   34 -
 .../commons/math3/linear/RealVectorTest.java    |  233 -
 .../RectangularCholeskyDecompositionTest.java   |  114 -
 .../math3/linear/SchurTransformerTest.java      |  202 -
 .../linear/SingularValueDecompositionTest.java  |  331 -
 .../math3/linear/SingularValueSolverTest.java   |  159 -
 .../math3/linear/SparseFieldMatrixTest.java     |  707 --
 .../math3/linear/SparseFieldVectorTest.java     |  781 ---
 .../math3/linear/SparseRealMatrixTest.java      |  698 --
 .../math3/linear/SparseRealVectorTest.java      |  150 -
 .../apache/commons/math3/linear/SymmLQTest.java |  688 --
 .../linear/TriDiagonalTransformerTest.java      |  178 -
 .../linear/UnmodifiableArrayRealVectorTest.java |   39 -
 .../UnmodifiableOpenMapRealVectorTest.java      |   45 -
 .../UnmodifiableRealVectorAbstractTest.java     |  455 --
 .../ml/clustering/DBSCANClustererTest.java      |  190 -
 .../ml/clustering/FuzzyKMeansClustererTest.java |  135 -
 .../clustering/KMeansPlusPlusClustererTest.java |  191 -
 .../MultiKMeansPlusPlusClustererTest.java       |   98 -
 .../evaluation/SumOfClusterVariancesTest.java   |   80 -
 .../math3/ml/distance/CanberraDistanceTest.java |   48 -
 .../ml/distance/ChebyshevDistanceTest.java      |   42 -
 .../ml/distance/EarthMoversDistanceTest.java    |   50 -
 .../ml/distance/EuclideanDistanceTest.java      |   43 -
 .../ml/distance/ManhattanDistanceTest.java      |   42 -
 .../math3/ml/neuralnet/MapUtilsTest.java        |   91 -
 .../commons/math3/ml/neuralnet/NetworkTest.java |  168 -
 .../commons/math3/ml/neuralnet/NeuronTest.java  |  112 -
 .../ml/neuralnet/OffsetFeatureInitializer.java  |   47 -
 .../ml/neuralnet/oned/NeuronStringTest.java     |  184 -
 .../neuralnet/sofm/KohonenTrainingTaskTest.java |  208 -
 .../neuralnet/sofm/KohonenUpdateActionTest.java |   92 -
 .../sofm/LearningFactorFunctionFactoryTest.java |   94 -
 .../NeighbourhoodSizeFunctionFactoryTest.java   |   83 -
 .../sofm/TravellingSalesmanSolver.java          |  392 --
 .../sofm/util/ExponentialDecayFunctionTest.java |   57 -
 .../util/QuasiSigmoidDecayFunctionTest.java     |   54 -
 .../neuralnet/twod/NeuronSquareMesh2DTest.java  |  684 --
 .../math3/ode/ContinuousOutputModelTest.java    |  204 -
 .../math3/ode/FirstOrderConverterTest.java      |  112 -
 .../commons/math3/ode/JacobianMatricesTest.java |  590 --
 .../apache/commons/math3/ode/TestProblem1.java  |   88 -
 .../apache/commons/math3/ode/TestProblem2.java  |   90 -
 .../apache/commons/math3/ode/TestProblem3.java  |  129 -
 .../apache/commons/math3/ode/TestProblem4.java  |  159 -
 .../apache/commons/math3/ode/TestProblem5.java  |   41 -
 .../apache/commons/math3/ode/TestProblem6.java  |   90 -
 .../commons/math3/ode/TestProblemAbstract.java  |  188 -
 .../commons/math3/ode/TestProblemFactory.java   |   50 -
 .../commons/math3/ode/TestProblemHandler.java   |  153 -
 .../math3/ode/events/EventFilterTest.java       |  269 -
 .../math3/ode/events/EventStateTest.java        |  227 -
 .../math3/ode/events/OverlappingEventsTest.java |  168 -
 .../math3/ode/events/ReappearingEventTest.java  |   96 -
 .../nonstiff/AdamsBashforthIntegratorTest.java  |  158 -
 .../nonstiff/AdamsMoultonIntegratorTest.java    |  169 -
 .../ClassicalRungeKuttaIntegratorTest.java      |  337 -
 ...ClassicalRungeKuttaStepInterpolatorTest.java |   98 -
 .../nonstiff/DormandPrince54IntegratorTest.java |  354 -
 .../DormandPrince54StepInterpolatorTest.java    |  153 -
 .../DormandPrince853IntegratorTest.java         |  480 --
 .../DormandPrince853StepInterpolatorTest.java   |  153 -
 .../math3/ode/nonstiff/EulerIntegratorTest.java |  189 -
 .../ode/nonstiff/EulerStepInterpolatorTest.java |  194 -
 .../math3/ode/nonstiff/GillIntegratorTest.java  |  244 -
 .../ode/nonstiff/GillStepInterpolatorTest.java  |   98 -
 .../GraggBulirschStoerIntegratorTest.java       |  426 --
 .../GraggBulirschStoerStepInterpolatorTest.java |  155 -
 .../nonstiff/HighamHall54IntegratorTest.java    |  367 --
 .../HighamHall54StepInterpolatorTest.java       |  153 -
 .../ode/nonstiff/LutherIntegratorTest.java      |  329 -
 .../nonstiff/LutherStepInterpolatorTest.java    |   98 -
 .../ode/nonstiff/MidpointIntegratorTest.java    |  189 -
 .../nonstiff/MidpointStepInterpolatorTest.java  |   99 -
 .../commons/math3/ode/nonstiff/StepProblem.java |   65 -
 .../nonstiff/ThreeEighthesIntegratorTest.java   |  238 -
 .../ThreeEighthesStepInterpolatorTest.java      |   98 -
 .../ode/sampling/DummyStepInterpolator.java     |  153 -
 .../ode/sampling/DummyStepInterpolatorTest.java |  136 -
 .../sampling/NordsieckStepInterpolatorTest.java |   96 -
 .../ode/sampling/StepInterpolatorTestUtils.java |   89 -
 .../StepNormalizerOutputOverlapTest.java        |   69 -
 .../ode/sampling/StepNormalizerOutputTest.java  |   69 -
 .../sampling/StepNormalizerOutputTestBase.java  |  282 -
 .../math3/ode/sampling/StepNormalizerTest.java  |  126 -
 .../commons/math3/optim/PointValuePairTest.java |   35 -
 .../math3/optim/PointVectorValuePairTest.java   |   39 -
 .../math3/optim/SimplePointCheckerTest.java     |   53 -
 .../math3/optim/SimpleValueCheckerTest.java     |   52 -
 .../optim/SimpleVectorValueCheckerTest.java     |   53 -
 .../math3/optim/linear/SimplexSolverTest.java   |  849 ---
 .../math3/optim/linear/SimplexTableauTest.java  |  108 -
 .../MultiStartMultivariateOptimizerTest.java    |  135 -
 .../MultivariateFunctionMappingAdapterTest.java |  192 -
 .../MultivariateFunctionPenaltyAdapterTest.java |  202 -
 .../nonlinear/scalar/gradient/CircleScalar.java |   85 -
 ...NonLinearConjugateGradientOptimizerTest.java |  477 --
 .../scalar/noderiv/BOBYQAOptimizerTest.java     |  632 --
 .../scalar/noderiv/CMAESOptimizerTest.java      |  794 ---
 .../scalar/noderiv/PowellOptimizerTest.java     |  268 -
 .../SimplexOptimizerMultiDirectionalTest.java   |  256 -
 .../noderiv/SimplexOptimizerNelderMeadTest.java |  323 -
 ...ltiStartMultivariateVectorOptimizerTest.java |  247 -
 ...stractLeastSquaresOptimizerAbstractTest.java |  640 --
 .../AbstractLeastSquaresOptimizerTest.java      |  128 -
 ...ractLeastSquaresOptimizerTestValidation.java |  334 -
 .../vector/jacobian/CircleProblem.java          |  179 -
 .../vector/jacobian/CircleVectorial.java        |   99 -
 .../jacobian/GaussNewtonOptimizerTest.java      |  171 -
 .../LevenbergMarquardtOptimizerTest.java        |  373 --
 .../nonlinear/vector/jacobian/MinpackTest.java  | 1466 -----
 .../jacobian/RandomCirclePointGenerator.java    |   92 -
 .../RandomStraightLinePointGenerator.java       |  100 -
 .../jacobian/StatisticalReferenceDataset.java   |  385 --
 .../StatisticalReferenceDatasetFactory.java     |  203 -
 .../vector/jacobian/StraightLineProblem.java    |  169 -
 .../optim/univariate/BracketFinderTest.java     |  117 -
 .../optim/univariate/BrentOptimizerTest.java    |  301 -
 .../MultiStartUnivariateOptimizerTest.java      |  133 -
 .../SimpleUnivariateValueCheckerTest.java       |   52 -
 ...teDifferentiableMultiStartOptimizerTest.java |   94 -
 ...erentiableVectorMultiStartOptimizerTest.java |  241 -
 .../MultivariateMultiStartOptimizerTest.java    |   75 -
 .../math3/optimization/PointValuePairTest.java  |   39 -
 .../optimization/PointVectorValuePairTest.java  |   43 -
 .../optimization/SimplePointCheckerTest.java    |   55 -
 .../optimization/SimpleValueCheckerTest.java    |   53 -
 .../SimpleVectorValueCheckerTest.java           |   55 -
 .../direct/BOBYQAOptimizerTest.java             |  630 --
 .../optimization/direct/CMAESOptimizerTest.java |  760 ---
 .../MultivariateFunctionMappingAdapterTest.java |  191 -
 .../MultivariateFunctionPenaltyAdapterTest.java |  193 -
 .../direct/PowellOptimizerTest.java             |  238 -
 .../SimplexOptimizerMultiDirectionalTest.java   |  205 -
 .../direct/SimplexOptimizerNelderMeadTest.java  |  266 -
 .../optimization/fitting/CurveFitterTest.java   |  153 -
 .../fitting/GaussianFitterTest.java             |  364 --
 .../fitting/HarmonicFitterTest.java             |  201 -
 .../fitting/PolynomialFitterTest.java           |  286 -
 ...stractLeastSquaresOptimizerAbstractTest.java |  523 --
 .../AbstractLeastSquaresOptimizerTest.java      |   99 -
 ...ractLeastSquaresOptimizerTestValidation.java |  321 -
 .../optimization/general/CircleProblem.java     |  139 -
 .../optimization/general/CircleScalar.java      |   89 -
 .../optimization/general/CircleVectorial.java   |   91 -
 .../general/GaussNewtonOptimizerTest.java       |  152 -
 .../LevenbergMarquardtOptimizerTest.java        |  386 --
 .../math3/optimization/general/MinpackTest.java | 1211 ----
 ...NonLinearConjugateGradientOptimizerTest.java |  385 --
 .../general/RandomCirclePointGenerator.java     |   93 -
 .../RandomStraightLinePointGenerator.java       |  100 -
 .../general/StatisticalReferenceDataset.java    |  367 --
 .../StatisticalReferenceDatasetFactory.java     |  150 -
 .../general/StraightLineProblem.java            |  159 -
 .../optimization/linear/SimplexSolverTest.java  |  640 --
 .../optimization/linear/SimplexTableauTest.java |  112 -
 .../univariate/BracketFinderTest.java           |  118 -
 .../univariate/BrentOptimizerTest.java          |  252 -
 .../SimpleUnivariateValueCheckerTest.java       |   53 -
 .../UnivariateMultiStartOptimizerTest.java      |  107 -
 .../apache/commons/math3/primes/PrimesTest.java |  172 -
 .../random/AbstractRandomGeneratorTest.java     |   37 -
 .../math3/random/BitsStreamGeneratorTest.java   |   83 -
 .../CorrelatedRandomVectorGeneratorTest.java    |  198 -
 .../math3/random/EmpiricalDistributionTest.java |  547 --
 .../random/GaussianRandomGeneratorTest.java     |   40 -
 .../random/HaltonSequenceGeneratorTest.java     |  135 -
 .../apache/commons/math3/random/ISAACTest.java  |  393 --
 .../math3/random/MersenneTwisterTest.java       |  304 -
 .../commons/math3/random/RandomAdaptorTest.java |  113 -
 .../math3/random/RandomDataGeneratorTest.java   | 1249 ----
 .../random/RandomGeneratorAbstractTest.java     |  431 --
 .../random/RandomGeneratorFactoryTest.java      |   33 -
 .../random/SobolSequenceGeneratorTest.java      |  107 -
 .../math3/random/StableRandomGeneratorTest.java |  131 -
 .../random/SynchronizedRandomGeneratorTest.java |  117 -
 .../math3/random/TestRandomGenerator.java       |   41 -
 .../UncorrelatedRandomVectorGeneratorTest.java  |   66 -
 .../random/UniformRandomGeneratorTest.java      |   40 -
 .../UnitSphereRandomVectorGeneratorTest.java    |   68 -
 .../commons/math3/random/ValueServerTest.java   |  240 -
 .../commons/math3/random/Well1024aTest.java     |   79 -
 .../commons/math3/random/Well19937aTest.java    |  115 -
 .../commons/math3/random/Well19937cTest.java    |  115 -
 .../commons/math3/random/Well44497aTest.java    |  115 -
 .../commons/math3/random/Well44497bTest.java    |  115 -
 .../commons/math3/random/Well512aTest.java      |   75 -
 .../commons/math3/special/BesselJTest.java      |  776 ---
 .../apache/commons/math3/special/BetaTest.java  |  978 ---
 .../apache/commons/math3/special/ErfTest.java   |  261 -
 .../apache/commons/math3/special/GammaTest.java |  968 ---
 .../commons/math3/stat/CertifiedDataTest.java   |  150 -
 .../commons/math3/stat/FrequencyTest.java       |  463 --
 .../commons/math3/stat/StatUtilsTest.java       |  555 --
 .../stat/clustering/DBSCANClustererTest.java    |  191 -
 .../clustering/EuclideanDoublePointTest.java    |   63 -
 .../clustering/EuclideanIntegerPointTest.java   |   65 -
 .../clustering/KMeansPlusPlusClustererTest.java |  273 -
 .../math3/stat/correlation/CovarianceTest.java  |  252 -
 .../correlation/KendallsCorrelationTest.java    |  261 -
 .../correlation/PearsonsCorrelationTest.java    |  317 -
 .../SpearmansRankCorrelationTest.java           |  160 -
 .../correlation/StorelessCovarianceTest.java    |  263 -
 .../stat/data/CertifiedDataAbstractTest.java    |  159 -
 .../apache/commons/math3/stat/data/LewTest.java |   28 -
 .../commons/math3/stat/data/LotteryTest.java    |   28 -
 .../AbstractUnivariateStatisticTest.java        |  102 -
 .../AggregateSummaryStatisticsTest.java         |  300 -
 .../descriptive/DescriptiveStatisticsTest.java  |  387 --
 .../stat/descriptive/ListUnivariateImpl.java    |  205 -
 .../descriptive/ListUnivariateImplTest.java     |  158 -
 .../MixedListUnivariateImplTest.java            |  205 -
 .../MultivariateSummaryStatisticsTest.java      |  314 -
 .../StatisticalSummaryValuesTest.java           |   83 -
 ...torelessUnivariateStatisticAbstractTest.java |  219 -
 .../stat/descriptive/SummaryStatisticsTest.java |  372 --
 .../SynchronizedDescriptiveStatisticsTest.java  |   27 -
 ...onizedMultivariateSummaryStatisticsTest.java |   27 -
 .../SynchronizedSummaryStatisticsTest.java      |   26 -
 .../UnivariateStatisticAbstractTest.java        |  225 -
 .../descriptive/moment/FirstMomentTest.java     |  111 -
 .../descriptive/moment/FourthMomentTest.java    |   46 -
 .../descriptive/moment/GeometricMeanTest.java   |   78 -
 .../descriptive/moment/InteractionTest.java     |   79 -
 .../stat/descriptive/moment/KurtosisTest.java   |   65 -
 .../math3/stat/descriptive/moment/MeanTest.java |   67 -
 .../descriptive/moment/SecondMomentTest.java    |   46 -
 .../descriptive/moment/SemiVarianceTest.java    |  153 -
 .../stat/descriptive/moment/SkewnessTest.java   |   64 -
 .../moment/StandardDeviationTest.java           |   95 -
 .../descriptive/moment/ThirdMomentTest.java     |   46 -
 .../stat/descriptive/moment/VarianceTest.java   |  117 -
 .../moment/VectorialCovarianceTest.java         |   92 -
 .../descriptive/moment/VectorialMeanTest.java   |   87 -
 .../math3/stat/descriptive/rank/MaxTest.java    |   74 -
 .../math3/stat/descriptive/rank/MedianTest.java |  121 -
 .../math3/stat/descriptive/rank/MinTest.java    |   74 -
 .../descriptive/rank/PSquarePercentileTest.java |  760 ---
 .../stat/descriptive/rank/PercentileTest.java   |  877 ---
 .../stat/descriptive/summary/ProductTest.java   |   90 -
 .../stat/descriptive/summary/SumLogTest.java    |   85 -
 .../stat/descriptive/summary/SumSqTest.java     |   71 -
 .../math3/stat/descriptive/summary/SumTest.java |   80 -
 .../math3/stat/inference/BinomialTestTest.java  |   81 -
 .../math3/stat/inference/ChiSquareTestTest.java |  260 -
 .../commons/math3/stat/inference/GTestTest.java |  291 -
 .../inference/KolmogorovSmirnovTestTest.java    |  339 -
 .../stat/inference/MannWhitneyUTestTest.java    |  127 -
 .../math3/stat/inference/OneWayAnovaTest.java   |  154 -
 .../commons/math3/stat/inference/TTestTest.java |  297 -
 .../math3/stat/inference/TestUtilsTest.java     |  557 --
 .../inference/WilcoxonSignedRankTestTest.java   |  183 -
 .../stat/interval/AgrestiCoullIntervalTest.java |   43 -
 .../BinomialConfidenceIntervalAbstractTest.java |   82 -
 .../interval/ClopperPearsonIntervalTest.java    |   43 -
 .../math3/stat/interval/IntervalUtilsTest.java  |   64 -
 .../NormalApproximationIntervalTest.java        |   43 -
 .../stat/interval/WilsonScoreIntervalTest.java  |   43 -
 .../math3/stat/ranking/NaturalRankingTest.java  |  226 -
 .../GLSMultipleLinearRegressionTest.java        |  297 -
 .../MillerUpdatingRegressionTest.java           | 1082 ---
 .../MultipleLinearRegressionAbstractTest.java   |  135 -
 .../OLSMultipleLinearRegressionTest.java        |  820 ---
 .../stat/regression/SimpleRegressionTest.java   |  697 --
 .../transform/FastCosineTransformerTest.java    |  277 -
 .../transform/FastFourierTransformerTest.java   |  562 --
 .../transform/FastHadamardTransformerTest.java  |  126 -
 .../transform/FastSineTransformerTest.java      |  300 -
 .../transform/RealTransformerAbstractTest.java  |  344 -
 .../commons/math3/util/ArithmeticUtilsTest.java |  598 --
 .../commons/math3/util/BigRealFieldTest.java    |   43 -
 .../apache/commons/math3/util/BigRealTest.java  |  189 -
 .../commons/math3/util/CombinationsTest.java    |  197 -
 .../math3/util/CombinatoricsUtilsTest.java      |  376 --
 .../math3/util/ContinuedFractionTest.java       |   45 -
 .../commons/math3/util/Decimal64Test.java       |  427 --
 .../math3/util/DefaultTransformerTest.java      |  105 -
 .../math3/util/DoubleArrayAbstractTest.java     |  132 -
 .../util/FastMathStrictComparisonTest.java      |  261 -
 .../apache/commons/math3/util/FastMathTest.java | 1606 -----
 .../math3/util/FastMathTestPerformance.java     | 1090 ----
 .../commons/math3/util/IncrementorTest.java     |  137 -
 .../commons/math3/util/MathArraysTest.java      | 1151 ----
 .../commons/math3/util/MathUtilsTest.java       |  353 -
 .../math3/util/MultidimensionalCounterTest.java |  217 -
 .../math3/util/OpenIntToDoubleHashMapTest.java  |  325 -
 .../commons/math3/util/OpenIntToFieldTest.java  |  335 -
 .../org/apache/commons/math3/util/PairTest.java |  118 -
 .../commons/math3/util/PrecisionTest.java       |  551 --
 .../math3/util/ResizableDoubleArrayTest.java    |  598 --
 .../org/apache/commons/math3/util/TestBean.java |   71 -
 .../commons/math3/util/TransformerMapTest.java  |  122 -
 .../math4/ExtendedFieldElementAbstractTest.java |  539 ++
 .../org/apache/commons/math4/PerfTestUtils.java |  260 +
 .../java/org/apache/commons/math4/Retry.java    |   29 +
 .../org/apache/commons/math4/RetryRunner.java   |   81 +
 .../apache/commons/math4/RetryRunnerTest.java   |   55 +
 .../org/apache/commons/math4/TestUtils.java     |  522 ++
 .../math4/analysis/FunctionUtilsTest.java       |  349 +
 .../math4/analysis/MonitoredFunction.java       |   46 +
 .../commons/math4/analysis/QuinticFunction.java |   39 +
 .../commons/math4/analysis/SumSincFunction.java |   54 +
 .../commons/math4/analysis/XMinus5Function.java |   39 +
 .../differentiation/DSCompilerTest.java         |  477 ++
 .../DerivativeStructureTest.java                | 1597 +++++
 .../FiniteDifferencesDifferentiatorTest.java    |  404 ++
 .../differentiation/GradientFunctionTest.java   |   88 +
 .../differentiation/JacobianFunctionTest.java   |   96 +
 .../differentiation/SparseGradientTest.java     | 1128 ++++
 .../math4/analysis/function/GaussianTest.java   |  161 +
 .../function/HarmonicOscillatorTest.java        |  139 +
 .../math4/analysis/function/LogisticTest.java   |  200 +
 .../math4/analysis/function/LogitTest.java      |  225 +
 .../math4/analysis/function/SigmoidTest.java    |  111 +
 .../math4/analysis/function/SincTest.java       |  120 +
 .../math4/analysis/function/SqrtTest.java       |   71 +
 .../analysis/function/StepFunctionTest.java     |  116 +
 .../IterativeLegendreGaussIntegratorTest.java   |  170 +
 .../LegendreGaussIntegratorTest.java            |  151 +
 .../integration/MidPointIntegratorTest.java     |  150 +
 .../integration/RombergIntegratorTest.java      |  123 +
 .../integration/SimpsonIntegratorTest.java      |  121 +
 .../integration/TrapezoidIntegratorTest.java    |  123 +
 .../integration/gauss/BaseRuleFactoryTest.java  |  110 +
 .../integration/gauss/GaussIntegratorTest.java  |   74 +
 .../gauss/GaussianQuadratureAbstractTest.java   |  116 +
 .../gauss/HermiteParametricTest.java            |   96 +
 .../analysis/integration/gauss/HermiteTest.java |  109 +
 .../LegendreHighPrecisionParametricTest.java    |   85 +
 .../gauss/LegendreHighPrecisionTest.java        |   58 +
 .../gauss/LegendreParametricTest.java           |   85 +
 .../integration/gauss/LegendreTest.java         |   58 +
 .../AkimaSplineInterpolatorTest.java            |  227 +
 .../BicubicInterpolatingFunctionTest.java       |  383 ++
 .../interpolation/BicubicInterpolatorTest.java  |  175 +
 .../BicubicSplineInterpolatingFunctionTest.java |  668 ++
 .../BicubicSplineInterpolatorTest.java          |  184 +
 .../DividedDifferenceInterpolatorTest.java      |  146 +
 .../FieldHermiteInterpolatorTest.java           |  275 +
 .../interpolation/HermiteInterpolatorTest.java  |  256 +
 .../interpolation/LinearInterpolatorTest.java   |  147 +
 .../interpolation/LoessInterpolatorTest.java    |  260 +
 .../MicrosphereInterpolatorTest.java            |  131 +
 .../interpolation/NevilleInterpolatorTest.java  |  146 +
 ...eBicubicSplineInterpolatingFunctionTest.java |  268 +
 .../PiecewiseBicubicSplineInterpolatorTest.java |  228 +
 ...PolynomialBicubicSplineInterpolatorTest.java |  179 +
 .../interpolation/SplineInterpolatorTest.java   |  223 +
 .../TricubicInterpolatingFunctionTest.java      |  631 ++
 .../interpolation/TricubicInterpolatorTest.java |  225 +
 ...TricubicSplineInterpolatingFunctionTest.java |  544 ++
 .../TricubicSplineInterpolatorTest.java         |  212 +
 .../UnivariatePeriodicInterpolatorTest.java     |  163 +
 .../PolynomialFunctionLagrangeFormTest.java     |  153 +
 .../PolynomialFunctionNewtonFormTest.java       |  178 +
 .../polynomials/PolynomialFunctionTest.java     |  264 +
 .../PolynomialSplineFunctionTest.java           |  187 +
 .../polynomials/PolynomialsUtilsTest.java       |  388 ++
 .../solvers/BaseSecantSolverAbstractTest.java   |  257 +
 .../analysis/solvers/BisectionSolverTest.java   |   90 +
 .../BracketingNthOrderBrentSolverTest.java      |  211 +
 .../math4/analysis/solvers/BrentSolverTest.java |  267 +
 .../analysis/solvers/IllinoisSolverTest.java    |   36 +
 .../analysis/solvers/LaguerreSolverTest.java    |  159 +
 .../analysis/solvers/MullerSolver2Test.java     |  145 +
 .../analysis/solvers/MullerSolverTest.java      |  148 +
 .../solvers/NewtonRaphsonSolverTest.java        |   90 +
 .../analysis/solvers/NewtonSolverTest.java      |  110 +
 .../analysis/solvers/PegasusSolverTest.java     |   36 +
 .../analysis/solvers/RegulaFalsiSolverTest.java |   59 +
 .../analysis/solvers/RiddersSolverTest.java     |  141 +
 .../analysis/solvers/SecantSolverTest.java      |   39 +
 .../solvers/UnivariateSolverUtilsTest.java      |  206 +
 .../commons/math4/complex/ComplexFieldTest.java |   42 +
 .../complex/ComplexFormatAbstractTest.java      |  310 +
 .../math4/complex/ComplexFormatTest.java        |   33 +
 .../commons/math4/complex/ComplexTest.java      | 1482 +++++
 .../commons/math4/complex/ComplexUtilsTest.java |  111 +
 .../math4/complex/FrenchComplexFormatTest.java  |   34 +
 .../commons/math4/complex/QuaternionTest.java   |  451 ++
 .../commons/math4/complex/RootsOfUnityTest.java |  101 +
 .../BracketingNthOrderBrentSolverDFPTest.java   |  170 +
 .../org/apache/commons/math4/dfp/Decimal10.java |   99 +
 .../apache/commons/math4/dfp/DfpDecTest.java    |  565 ++
 .../apache/commons/math4/dfp/DfpMathTest.java   |  587 ++
 .../org/apache/commons/math4/dfp/DfpTest.java   | 1653 +++++
 .../AbstractIntegerDistributionTest.java        |  127 +
 .../AbstractRealDistributionTest.java           |  211 +
 .../distribution/BetaDistributionTest.java      |  306 +
 .../distribution/BinomialDistributionTest.java  |  173 +
 .../distribution/CauchyDistributionTest.java    |  120 +
 .../ChiSquaredDistributionTest.java             |  136 +
 .../ConstantRealDistributionTest.java           |   91 +
 .../EnumeratedIntegerDistributionTest.java      |  171 +
 .../EnumeratedRealDistributionTest.java         |  259 +
 .../ExponentialDistributionTest.java            |  134 +
 .../math4/distribution/FDistributionTest.java   |  158 +
 .../distribution/GammaDistributionTest.java     |  357 +
 .../distribution/GeometricDistributionTest.java |  170 +
 .../distribution/GumbelDistributionTest.java    |   71 +
 .../HypergeometricDistributionTest.java         |  324 +
 .../IntegerDistributionAbstractTest.java        |  422 ++
 .../KolmogorovSmirnovDistributionTest.java      |  118 +
 .../distribution/LaplaceDistributionTest.java   |   72 +
 .../distribution/LevyDistributionTest.java      |   82 +
 .../distribution/LogNormalDistributionTest.java |  253 +
 .../distribution/LogisticsDistributionTest.java |   72 +
 .../MultivariateNormalDistributionTest.java     |  152 +
 ...riateNormalMixtureModelDistributionTest.java |  297 +
 .../distribution/NakagamiDistributionTest.java  |   72 +
 .../distribution/NormalDistributionTest.java    |  204 +
 .../distribution/ParetoDistributionTest.java    |  205 +
 .../distribution/PascalDistributionTest.java    |  132 +
 .../distribution/PoissonDistributionTest.java   |  246 +
 .../RealDistributionAbstractTest.java           |  548 ++
 .../math4/distribution/TDistributionTest.java   |  172 +
 .../TriangularDistributionTest.java             |  193 +
 .../UniformIntegerDistributionTest.java         |  113 +
 .../UniformRealDistributionTest.java            |  124 +
 .../distribution/WeibullDistributionTest.java   |  125 +
 .../distribution/ZipfDistributionTest.java      |  122 +
 ...ormalMixtureExpectationMaximizationTest.java |  349 +
 .../DimensionMismatchExceptionTest.java         |   33 +
 .../MaxCountExceededExceptionTest.java          |   32 +
 .../NonMonotonicSequenceExceptionTest.java      |   46 +
 .../exception/NotPositiveExceptionTest.java     |   34 +
 .../NotStrictlyPositiveExceptionTest.java       |   34 +
 .../NumberIsTooLargeExceptionTest.java          |   34 +
 .../NumberIsTooSmallExceptionTest.java          |   34 +
 .../exception/OutOfRangeExceptionTest.java      |   34 +
 .../TooManyEvaluationsExceptionTest.java        |   39 +
 .../math4/exception/util/ArgUtilsTest.java      |   75 +
 .../exception/util/ExceptionContextTest.java    |  130 +
 .../exception/util/LocalizedFormatsTest.java    |  104 +
 .../commons/math4/filter/KalmanFilterTest.java  |  443 ++
 .../commons/math4/fitting/CurveFitterTest.java  |  142 +
 .../math4/fitting/GaussianCurveFitterTest.java  |  395 ++
 .../math4/fitting/GaussianFitterTest.java       |  363 +
 .../math4/fitting/HarmonicCurveFitterTest.java  |  182 +
 .../math4/fitting/HarmonicFitterTest.java       |  185 +
 .../fitting/PolynomialCurveFitterTest.java      |  166 +
 .../math4/fitting/PolynomialFitterTest.java     |  286 +
 .../math4/fitting/SimpleCurveFitterTest.java    |   60 +
 .../fitting/WeightedObservedPointsTest.java     |  125 +
 ...stractLeastSquaresOptimizerAbstractTest.java |  603 ++
 .../fitting/leastsquares/CircleProblem.java     |  175 +
 .../fitting/leastsquares/CircleVectorial.java   |   94 +
 .../leastsquares/EvaluationRmsCheckerTest.java  |   86 +
 .../fitting/leastsquares/EvaluationTest.java    |  326 +
 .../leastsquares/EvaluationTestValidation.java  |  304 +
 .../GaussNewtonOptimizerWithCholeskyTest.java   |  133 +
 .../GaussNewtonOptimizerWithLUTest.java         |  133 +
 .../GaussNewtonOptimizerWithQRTest.java         |  119 +
 .../GaussNewtonOptimizerWithSVDTest.java        |  148 +
 .../LevenbergMarquardtOptimizerTest.java        |  386 ++
 .../math4/fitting/leastsquares/MinpackTest.java | 1481 +++++
 .../RandomCirclePointGenerator.java             |   91 +
 .../RandomStraightLinePointGenerator.java       |   98 +
 .../StatisticalReferenceDataset.java            |  370 ++
 .../StatisticalReferenceDatasetFactory.java     |  201 +
 .../leastsquares/StraightLineProblem.java       |  165 +
 .../math4/fraction/BigFractionFieldTest.java    |   43 +
 .../math4/fraction/BigFractionFormatTest.java   |  332 +
 .../commons/math4/fraction/BigFractionTest.java |  640 ++
 .../math4/fraction/FractionFieldTest.java       |   43 +
 .../math4/fraction/FractionFormatTest.java      |  351 +
 .../commons/math4/fraction/FractionTest.java    |  618 ++
 .../math4/genetics/BinaryChromosomeTest.java    |   65 +
 .../math4/genetics/BinaryMutationTest.java      |   44 +
 .../commons/math4/genetics/ChromosomeTest.java  |  111 +
 .../math4/genetics/CycleCrossoverTest.java      |  149 +
 .../math4/genetics/DummyBinaryChromosome.java   |   44 +
 .../math4/genetics/DummyListChromosome.java     |   78 +
 .../commons/math4/genetics/DummyRandomKey.java  |   44 +
 .../genetics/ElitisticListPopulationTest.java   |  105 +
 .../math4/genetics/FitnessCachingTest.java      |   95 +
 .../math4/genetics/FixedElapsedTimeTest.java    |   74 +
 .../genetics/FixedGenerationCountTest.java      |   64 +
 .../genetics/GeneticAlgorithmTestBinary.java    |  123 +
 .../GeneticAlgorithmTestPermutations.java       |  132 +
 .../math4/genetics/ListPopulationTest.java      |  207 +
 .../math4/genetics/NPointCrossoverTest.java     |  129 +
 .../math4/genetics/OnePointCrossoverTest.java   |   61 +
 .../math4/genetics/OrderedCrossoverTest.java    |  102 +
 .../math4/genetics/RandomKeyMutationTest.java   |   44 +
 .../commons/math4/genetics/RandomKeyTest.java   |  170 +
 .../math4/genetics/TournamentSelectionTest.java |   56 +
 .../math4/genetics/UniformCrossoverTest.java    |  152 +
 .../geometry/enclosing/WelzlEncloser2DTest.java |  177 +
 .../geometry/enclosing/WelzlEncloser3DTest.java |  184 +
 .../euclidean/oned/Euclidean1DTest.java         |   43 +
 .../oned/FrenchVector1DFormatTest.java          |   34 +
 .../geometry/euclidean/oned/IntervalTest.java   |   74 +
 .../euclidean/oned/IntervalsSetTest.java        |  106 +
 .../oned/Vector1DFormatAbstractTest.java        |  273 +
 .../euclidean/oned/Vector1DFormatTest.java      |   34 +
 .../geometry/euclidean/oned/Vector1DTest.java   |  219 +
 .../euclidean/threed/Euclidean3DTest.java       |   44 +
 .../euclidean/threed/FieldRotationDSTest.java   |  845 +++
 .../euclidean/threed/FieldRotationDfpTest.java  |  716 ++
 .../euclidean/threed/FieldVector3DTest.java     |  730 +++
 .../threed/FrenchVector3DFormatTest.java        |   34 +
 .../geometry/euclidean/threed/LineTest.java     |  149 +
 .../geometry/euclidean/threed/PlaneTest.java    |  171 +
 .../euclidean/threed/PolyhedronsSetTest.java    |  316 +
 .../euclidean/threed/RotationOrderTest.java     |   59 +
 .../geometry/euclidean/threed/RotationTest.java |  552 ++
 .../euclidean/threed/SphereGeneratorTest.java   |  186 +
 .../threed/SphericalCoordinatesTest.java        |  186 +
 .../geometry/euclidean/threed/SubLineTest.java  |  164 +
 .../threed/Vector3DFormatAbstractTest.java      |  330 +
 .../euclidean/threed/Vector3DFormatTest.java    |   34 +
 .../geometry/euclidean/threed/Vector3DTest.java |  412 ++
 .../euclidean/twod/DiskGeneratorTest.java       |  118 +
 .../euclidean/twod/Euclidean2DTest.java         |   45 +
 .../twod/FrenchVector2DFormatTest.java          |   34 +
 .../math4/geometry/euclidean/twod/LineTest.java |  137 +
 .../euclidean/twod/PolygonsSetTest.java         | 1318 ++++
 .../geometry/euclidean/twod/SegmentTest.java    |   45 +
 .../geometry/euclidean/twod/SubLineTest.java    |  155 +
 .../twod/Vector2DFormatAbstractTest.java        |  314 +
 .../euclidean/twod/Vector2DFormatTest.java      |   34 +
 .../geometry/euclidean/twod/Vector2DTest.java   |   40 +
 .../twod/hull/AklToussaintHeuristicTest.java    |   38 +
 .../hull/ConvexHullGenerator2DAbstractTest.java |  444 ++
 .../euclidean/twod/hull/MonotoneChainTest.java  |   55 +
 .../partitioning/utilities/AVLTreeTest.java     |  176 +
 .../math4/geometry/spherical/oned/ArcTest.java  |   81 +
 .../geometry/spherical/oned/ArcsSetTest.java    |  580 ++
 .../geometry/spherical/oned/LimitAngleTest.java |   38 +
 .../geometry/spherical/oned/S1PointTest.java    |   75 +
 .../geometry/spherical/oned/Sphere1Test.java    |   43 +
 .../geometry/spherical/twod/CircleTest.java     |  186 +
 .../geometry/spherical/twod/S2PointTest.java    |   88 +
 .../twod/SphericalPolygonsSetTest.java          |  536 ++
 .../geometry/spherical/twod/SubCircleTest.java  |  121 +
 .../math4/linear/Array2DRowRealMatrixTest.java  | 1172 ++++
 .../math4/linear/ArrayFieldVectorTest.java      | 1196 ++++
 .../math4/linear/ArrayRealVectorTest.java       |  172 +
 .../math4/linear/BiDiagonalTransformerTest.java |  204 +
 .../math4/linear/BlockFieldMatrixTest.java      | 1377 ++++
 .../math4/linear/BlockRealMatrixTest.java       | 1281 ++++
 .../math4/linear/CholeskyDecompositionTest.java |  138 +
 .../math4/linear/CholeskySolverTest.java        |  112 +
 .../math4/linear/ConjugateGradientTest.java     |  602 ++
 .../math4/linear/DiagonalMatrixTest.java        |  368 ++
 .../math4/linear/EigenDecompositionTest.java    |  782 +++
 .../commons/math4/linear/EigenSolverTest.java   |  200 +
 .../math4/linear/FieldLUDecompositionTest.java  |  303 +
 .../commons/math4/linear/FieldLUSolverTest.java |  177 +
 .../math4/linear/FieldMatrixImplTest.java       | 1145 ++++
 .../linear/FrenchRealVectorFormatTest.java      |   34 +
 .../math4/linear/HessenbergTransformerTest.java |  221 +
 .../commons/math4/linear/HilbertMatrix.java     |   75 +
 .../math4/linear/InverseHilbertMatrix.java      |  101 +
 .../math4/linear/LUDecompositionTest.java       |  291 +
 .../commons/math4/linear/LUSolverTest.java      |  169 +
 .../MatrixDimensionMismatchExceptionTest.java   |   36 +
 .../commons/math4/linear/MatrixUtilsTest.java   |  484 ++
 .../math4/linear/OpenMapRealMatrixTest.java     |   49 +
 .../math4/linear/QRDecompositionTest.java       |  286 +
 .../commons/math4/linear/QRSolverTest.java      |  196 +
 .../math4/linear/RRQRDecompositionTest.java     |  233 +
 .../commons/math4/linear/RRQRSolverTest.java    |  202 +
 .../linear/RealMatrixFormatAbstractTest.java    |  363 +
 .../math4/linear/RealMatrixFormatTest.java      |   34 +
 .../math4/linear/RealVectorAbstractTest.java    | 1972 ++++++
 .../linear/RealVectorFormatAbstractTest.java    |  355 +
 .../math4/linear/RealVectorFormatTest.java      |   34 +
 .../commons/math4/linear/RealVectorTest.java    |  233 +
 .../RectangularCholeskyDecompositionTest.java   |  114 +
 .../math4/linear/SchurTransformerTest.java      |  202 +
 .../linear/SingularValueDecompositionTest.java  |  331 +
 .../math4/linear/SingularValueSolverTest.java   |  159 +
 .../math4/linear/SparseFieldMatrixTest.java     |  707 ++
 .../math4/linear/SparseFieldVectorTest.java     |  781 +++
 .../math4/linear/SparseRealMatrixTest.java      |  698 ++
 .../math4/linear/SparseRealVectorTest.java      |  150 +
 .../apache/commons/math4/linear/SymmLQTest.java |  688 ++
 .../linear/TriDiagonalTransformerTest.java      |  178 +
 .../linear/UnmodifiableArrayRealVectorTest.java |   39 +
 .../UnmodifiableOpenMapRealVectorTest.java      |   45 +
 .../UnmodifiableRealVectorAbstractTest.java     |  455 ++
 .../ml/clustering/DBSCANClustererTest.java      |  190 +
 .../ml/clustering/FuzzyKMeansClustererTest.java |  135 +
 .../clustering/KMeansPlusPlusClustererTest.java |  191 +
 .../MultiKMeansPlusPlusClustererTest.java       |   98 +
 .../evaluation/SumOfClusterVariancesTest.java   |   80 +
 .../math4/ml/distance/CanberraDistanceTest.java |   48 +
 .../ml/distance/ChebyshevDistanceTest.java      |   42 +
 .../ml/distance/EarthMoversDistanceTest.java    |   50 +
 .../ml/distance/EuclideanDistanceTest.java      |   43 +
 .../ml/distance/ManhattanDistanceTest.java      |   42 +
 .../math4/ml/neuralnet/MapUtilsTest.java        |   91 +
 .../commons/math4/ml/neuralnet/NetworkTest.java |  168 +
 .../commons/math4/ml/neuralnet/NeuronTest.java  |  112 +
 .../ml/neuralnet/OffsetFeatureInitializer.java  |   47 +
 .../ml/neuralnet/oned/NeuronStringTest.java     |  184 +
 .../neuralnet/sofm/KohonenTrainingTaskTest.java |  208 +
 .../neuralnet/sofm/KohonenUpdateActionTest.java |   92 +
 .../sofm/LearningFactorFunctionFactoryTest.java |   94 +
 .../NeighbourhoodSizeFunctionFactoryTest.java   |   83 +
 .../sofm/TravellingSalesmanSolver.java          |  392 ++
 .../sofm/util/ExponentialDecayFunctionTest.java |   57 +
 .../util/QuasiSigmoidDecayFunctionTest.java     |   54 +
 .../neuralnet/twod/NeuronSquareMesh2DTest.java  |  684 ++
 .../math4/ode/ContinuousOutputModelTest.java    |  204 +
 .../math4/ode/FirstOrderConverterTest.java      |  112 +
 .../commons/math4/ode/JacobianMatricesTest.java |  590 ++
 .../apache/commons/math4/ode/TestProblem1.java  |   88 +
 .../apache/commons/math4/ode/TestProblem2.java  |   90 +
 .../apache/commons/math4/ode/TestProblem3.java  |  129 +
 .../apache/commons/math4/ode/TestProblem4.java  |  159 +
 .../apache/commons/math4/ode/TestProblem5.java  |   41 +
 .../apache/commons/math4/ode/TestProblem6.java  |   90 +
 .../commons/math4/ode/TestProblemAbstract.java  |  188 +
 .../commons/math4/ode/TestProblemFactory.java   |   50 +
 .../commons/math4/ode/TestProblemHandler.java   |  153 +
 .../math4/ode/events/EventFilterTest.java       |  269 +
 .../math4/ode/events/EventStateTest.java        |  227 +
 .../math4/ode/events/OverlappingEventsTest.java |  168 +
 .../math4/ode/events/ReappearingEventTest.java  |   96 +
 .../nonstiff/AdamsBashforthIntegratorTest.java  |  158 +
 .../nonstiff/AdamsMoultonIntegratorTest.java    |  169 +
 .../ClassicalRungeKuttaIntegratorTest.java      |  337 +
 ...ClassicalRungeKuttaStepInterpolatorTest.java |   98 +
 .../nonstiff/DormandPrince54IntegratorTest.java |  354 +
 .../DormandPrince54StepInterpolatorTest.java    |  153 +
 .../DormandPrince853IntegratorTest.java         |  480 ++
 .../DormandPrince853StepInterpolatorTest.java   |  153 +
 .../math4/ode/nonstiff/EulerIntegratorTest.java |  189 +
 .../ode/nonstiff/EulerStepInterpolatorTest.java |  194 +
 .../math4/ode/nonstiff/GillIntegratorTest.java  |  244 +
 .../ode/nonstiff/GillStepInterpolatorTest.java  |   98 +
 .../GraggBulirschStoerIntegratorTest.java       |  426 ++
 .../GraggBulirschStoerStepInterpolatorTest.java |  155 +
 .../nonstiff/HighamHall54IntegratorTest.java    |  367 ++
 .../HighamHall54StepInterpolatorTest.java       |  153 +
 .../ode/nonstiff/LutherIntegratorTest.java      |  329 +
 .../nonstiff/LutherStepInterpolatorTest.java    |   98 +
 .../ode/nonstiff/MidpointIntegratorTest.java    |  189 +
 .../nonstiff/MidpointStepInterpolatorTest.java  |   99 +
 .../commons/math4/ode/nonstiff/StepProblem.java |   65 +
 .../nonstiff/ThreeEighthesIntegratorTest.java   |  238 +
 .../ThreeEighthesStepInterpolatorTest.java      |   98 +
 .../ode/sampling/DummyStepInterpolator.java     |  153 +
 .../ode/sampling/DummyStepInterpolatorTest.java |  136 +
 .../sampling/NordsieckStepInterpolatorTest.java |   96 +
 .../ode/sampling/StepInterpolatorTestUtils.java |   89 +
 .../StepNormalizerOutputOverlapTest.java        |   69 +
 .../ode/sampling/StepNormalizerOutputTest.java  |   69 +
 .../sampling/StepNormalizerOutputTestBase.java  |  282 +
 .../math4/ode/sampling/StepNormalizerTest.java  |  126 +
 .../commons/math4/optim/PointValuePairTest.java |   35 +
 .../math4/optim/PointVectorValuePairTest.java   |   39 +
 .../math4/optim/SimplePointCheckerTest.java     |   53 +
 .../math4/optim/SimpleValueCheckerTest.java     |   52 +
 .../optim/SimpleVectorValueCheckerTest.java     |   53 +
 .../math4/optim/linear/SimplexSolverTest.java   |  849 +++
 .../math4/optim/linear/SimplexTableauTest.java  |  108 +
 .../MultiStartMultivariateOptimizerTest.java    |  135 +
 .../MultivariateFunctionMappingAdapterTest.java |  192 +
 .../MultivariateFunctionPenaltyAdapterTest.java |  202 +
 .../nonlinear/scalar/gradient/CircleScalar.java |   85 +
 ...NonLinearConjugateGradientOptimizerTest.java |  477 ++
 .../scalar/noderiv/BOBYQAOptimizerTest.java     |  632 ++
 .../scalar/noderiv/CMAESOptimizerTest.java      |  794 +++
 .../scalar/noderiv/PowellOptimizerTest.java     |  268 +
 .../SimplexOptimizerMultiDirectionalTest.java   |  256 +
 .../noderiv/SimplexOptimizerNelderMeadTest.java |  323 +
 ...ltiStartMultivariateVectorOptimizerTest.java |  247 +
 ...stractLeastSquaresOptimizerAbstractTest.java |  640 ++
 .../AbstractLeastSquaresOptimizerTest.java      |  128 +
 ...ractLeastSquaresOptimizerTestValidation.java |  334 +
 .../vector/jacobian/CircleProblem.java          |  179 +
 .../vector/jacobian/CircleVectorial.java        |   99 +
 .../jacobian/GaussNewtonOptimizerTest.java      |  171 +
 .../LevenbergMarquardtOptimizerTest.java        |  373 ++
 .../nonlinear/vector/jacobian/MinpackTest.java  | 1466 +++++
 .../jacobian/RandomCirclePointGenerator.java    |   92 +
 .../RandomStraightLinePointGenerator.java       |  100 +
 .../jacobian/StatisticalReferenceDataset.java   |  385 ++
 .../StatisticalReferenceDatasetFactory.java     |  203 +
 .../vector/jacobian/StraightLineProblem.java    |  169 +
 .../optim/univariate/BracketFinderTest.java     |  117 +
 .../optim/univariate/BrentOptimizerTest.java    |  301 +
 .../MultiStartUnivariateOptimizerTest.java      |  133 +
 .../SimpleUnivariateValueCheckerTest.java       |   52 +
 ...teDifferentiableMultiStartOptimizerTest.java |   94 +
 ...erentiableVectorMultiStartOptimizerTest.java |  241 +
 .../MultivariateMultiStartOptimizerTest.java    |   75 +
 .../math4/optimization/PointValuePairTest.java  |   39 +
 .../optimization/PointVectorValuePairTest.java  |   43 +
 .../optimization/SimplePointCheckerTest.java    |   55 +
 .../optimization/SimpleValueCheckerTest.java    |   53 +
 .../SimpleVectorValueCheckerTest.java           |   55 +
 .../direct/BOBYQAOptimizerTest.java             |  630 ++
 .../optimization/direct/CMAESOptimizerTest.java |  760 +++
 .../MultivariateFunctionMappingAdapterTest.java |  191 +
 .../MultivariateFunctionPenaltyAdapterTest.java |  193 +
 .../direct/PowellOptimizerTest.java             |  238 +
 .../SimplexOptimizerMultiDirectionalTest.java   |  205 +
 .../direct/SimplexOptimizerNelderMeadTest.java  |  266 +
 .../optimization/fitting/CurveFitterTest.java   |  153 +
 .../fitting/GaussianFitterTest.java             |  364 ++
 .../fitting/HarmonicFitterTest.java             |  201 +
 .../fitting/PolynomialFitterTest.java           |  286 +
 ...stractLeastSquaresOptimizerAbstractTest.java |  523 ++
 .../AbstractLeastSquaresOptimizerTest.java      |   99 +
 ...ractLeastSquaresOptimizerTestValidation.java |  321 +
 .../optimization/general/CircleProblem.java     |  139 +
 .../optimization/general/CircleScalar.java      |   89 +
 .../optimization/general/CircleVectorial.java   |   91 +
 .../general/GaussNewtonOptimizerTest.java       |  152 +
 .../LevenbergMarquardtOptimizerTest.java        |  386 ++
 .../math4/optimization/general/MinpackTest.java | 1211 ++++
 ...NonLinearConjugateGradientOptimizerTest.java |  385 ++
 .../general/RandomCirclePointGenerator.java     |   93 +
 .../RandomStraightLinePointGenerator.java       |  100 +
 .../general/StatisticalReferenceDataset.java    |  367 ++
 .../StatisticalReferenceDatasetFactory.java     |  150 +
 .../general/StraightLineProblem.java            |  159 +
 .../optimization/linear/SimplexSolverTest.java  |  640 ++
 .../optimization/linear/SimplexTableauTest.java |  112 +
 .../univariate/BracketFinderTest.java           |  118 +
 .../univariate/BrentOptimizerTest.java          |  252 +
 .../SimpleUnivariateValueCheckerTest.java       |   53 +
 .../UnivariateMultiStartOptimizerTest.java      |  107 +
 .../apache/commons/math4/primes/PrimesTest.java |  172 +
 .../random/AbstractRandomGeneratorTest.java     |   37 +
 .../math4/random/BitsStreamGeneratorTest.java   |   83 +
 .../CorrelatedRandomVectorGeneratorTest.java    |  198 +
 .../math4/random/EmpiricalDistributionTest.java |  547 ++
 .../random/GaussianRandomGeneratorTest.java     |   40 +
 .../random/HaltonSequenceGeneratorTest.java     |  135 +
 .../apache/commons/math4/random/ISAACTest.java  |  393 ++
 .../math4/random/MersenneTwisterTest.java       |  304 +
 .../commons/math4/random/RandomAdaptorTest.java |  113 +
 .../math4/random/RandomDataGeneratorTest.java   | 1249 ++++
 .../random/RandomGeneratorAbstractTest.java     |  431 ++
 .../random/RandomGeneratorFactoryTest.java      |   33 +
 .../random/SobolSequenceGeneratorTest.java      |  107 +
 .../math4/random/StableRandomGeneratorTest.java |  131 +
 .../random/SynchronizedRandomGeneratorTest.java |  117 +
 .../math4/random/TestRandomGenerator.java       |   41 +
 .../UncorrelatedRandomVectorGeneratorTest.java  |   66 +
 .../random/UniformRandomGeneratorTest.java      |   40 +
 .../UnitSphereRandomVectorGeneratorTest.java    |   68 +
 .../commons/math4/random/ValueServerTest.java   |  240 +
 .../commons/math4/random/Well1024aTest.java     |   79 +
 .../commons/math4/random/Well19937aTest.java    |  115 +
 .../commons/math4/random/Well19937cTest.java    |  115 +
 .../commons/math4/random/Well44497aTest.java    |  115 +
 .../commons/math4/random/Well44497bTest.java    |  115 +
 .../commons/math4/random/Well512aTest.java      |   75 +
 .../commons/math4/special/BesselJTest.java      |  776 +++
 .../apache/commons/math4/special/BetaTest.java  |  978 +++
 .../apache/commons/math4/special/ErfTest.java   |  261 +
 .../apache/commons/math4/special/GammaTest.java |  968 +++
 .../commons/math4/stat/CertifiedDataTest.java   |  150 +
 .../commons/math4/stat/FrequencyTest.java       |  463 ++
 .../commons/math4/stat/StatUtilsTest.java       |  555 ++
 .../stat/clustering/DBSCANClustererTest.java    |  191 +
 .../clustering/EuclideanDoublePointTest.java    |   63 +
 .../clustering/EuclideanIntegerPointTest.java   |   65 +
 .../clustering/KMeansPlusPlusClustererTest.java |  273 +
 .../math4/stat/correlation/CovarianceTest.java  |  252 +
 .../correlation/KendallsCorrelationTest.java    |  261 +
 .../correlation/PearsonsCorrelationTest.java    |  317 +
 .../SpearmansRankCorrelationTest.java           |  160 +
 .../correlation/StorelessCovarianceTest.java    |  263 +
 .../stat/data/CertifiedDataAbstractTest.java    |  159 +
 .../apache/commons/math4/stat/data/LewTest.java |   28 +
 .../commons/math4/stat/data/LotteryTest.java    |   28 +
 .../AbstractUnivariateStatisticTest.java        |  102 +
 .../AggregateSummaryStatisticsTest.java         |  300 +
 .../descriptive/DescriptiveStatisticsTest.java  |  387 ++
 .../stat/descriptive/ListUnivariateImpl.java    |  205 +
 .../descriptive/ListUnivariateImplTest.java     |  158 +
 .../MixedListUnivariateImplTest.java            |  205 +
 .../MultivariateSummaryStatisticsTest.java      |  314 +
 .../StatisticalSummaryValuesTest.java           |   83 +
 ...torelessUnivariateStatisticAbstractTest.java |  219 +
 .../stat/descriptive/SummaryStatisticsTest.java |  372 ++
 .../SynchronizedDescriptiveStatisticsTest.java  |   27 +
 ...onizedMultivariateSummaryStatisticsTest.java |   27 +
 .../SynchronizedSummaryStatisticsTest.java      |   26 +
 .../UnivariateStatisticAbstractTest.java        |  225 +
 .../descriptive/moment/FirstMomentTest.java     |  111 +
 .../descriptive/moment/FourthMomentTest.java    |   46 +
 .../descriptive/moment/GeometricMeanTest.java   |   78 +
 .../descriptive/moment/InteractionTest.java     |   79 +
 .../stat/descriptive/moment/KurtosisTest.java   |   65 +
 .../math4/stat/descriptive/moment/MeanTest.java |   67 +
 .../descriptive/moment/SecondMomentTest.java    |   46 +
 .../descriptive/moment/SemiVarianceTest.java    |  153 +
 .../stat/descriptive/moment/SkewnessTest.java   |   64 +
 .../moment/StandardDeviationTest.java           |   95 +
 .../descriptive/moment/ThirdMomentTest.java     |   46 +
 .../stat/descriptive/moment/VarianceTest.java   |  117 +
 .../moment/VectorialCovarianceTest.java         |   92 +
 .../descriptive/moment/VectorialMeanTest.java   |   87 +
 .../math4/stat/descriptive/rank/MaxTest.java    |   74 +
 .../math4/stat/descriptive/rank/MedianTest.java |  121 +
 .../math4/stat/descriptive/rank/MinTest.java    |   74 +
 .../descriptive/rank/PSquarePercentileTest.java |  760 +++
 .../stat/descriptive/rank/PercentileTest.java   |  877 +++
 .../stat/descriptive/summary/ProductTest.java   |   90 +
 .../stat/descriptive/summary/SumLogTest.java    |   85 +
 .../stat/descriptive/summary/SumSqTest.java     |   71 +
 .../math4/stat/descriptive/summary/SumTest.java |   80 +
 .../math4/stat/inference/BinomialTestTest.java  |   81 +
 .../math4/stat/inference/ChiSquareTestTest.java |  260 +
 .../commons/math4/stat/inference/GTestTest.java |  291 +
 .../inference/KolmogorovSmirnovTestTest.java    |  339 +
 .../stat/inference/MannWhitneyUTestTest.java    |  127 +
 .../math4/stat/inference/OneWayAnovaTest.java   |  154 +
 .../commons/math4/stat/inference/TTestTest.java |  297 +
 .../math4/stat/inference/TestUtilsTest.java     |  557 ++
 .../inference/WilcoxonSignedRankTestTest.java   |  183 +
 .../stat/interval/AgrestiCoullIntervalTest.java |   43 +
 .../BinomialConfidenceIntervalAbstractTest.java |   82 +
 .../interval/ClopperPearsonIntervalTest.java    |   43 +
 .../math4/stat/interval/IntervalUtilsTest.java  |   64 +
 .../NormalApproximationIntervalTest.java        |   43 +
 .../stat/interval/WilsonScoreIntervalTest.java  |   43 +
 .../math4/stat/ranking/NaturalRankingTest.java  |  226 +
 .../GLSMultipleLinearRegressionTest.java        |  297 +
 .../MillerUpdatingRegressionTest.java           | 1082 +++
 .../MultipleLinearRegressionAbstractTest.java   |  135 +
 .../OLSMultipleLinearRegressionTest.java        |  820 +++
 .../stat/regression/SimpleRegressionTest.java   |  697 ++
 .../transform/FastCosineTransformerTest.java    |  277 +
 .../transform/FastFourierTransformerTest.java   |  562 ++
 .../transform/FastHadamardTransformerTest.java  |  126 +
 .../transform/FastSineTransformerTest.java      |  300 +
 .../transform/RealTransformerAbstractTest.java  |  344 +
 .../commons/math4/util/ArithmeticUtilsTest.java |  598 ++
 .../commons/math4/util/BigRealFieldTest.java    |   43 +
 .../apache/commons/math4/util/BigRealTest.java  |  189 +
 .../commons/math4/util/CombinationsTest.java    |  197 +
 .../math4/util/CombinatoricsUtilsTest.java      |  376 ++
 .../math4/util/ContinuedFractionTest.java       |   45 +
 .../commons/math4/util/Decimal64Test.java       |  427 ++
 .../math4/util/DefaultTransformerTest.java      |  105 +
 .../math4/util/DoubleArrayAbstractTest.java     |  132 +
 .../util/FastMathStrictComparisonTest.java      |  261 +
 .../apache/commons/math4/util/FastMathTest.java | 1606 +++++
 .../math4/util/FastMathTestPerformance.java     | 1090 ++++
 .../commons/math4/util/IncrementorTest.java     |  137 +
 .../commons/math4/util/MathArraysTest.java      | 1151 ++++
 .../commons/math4/util/MathUtilsTest.java       |  353 +
 .../math4/util/MultidimensionalCounterTest.java |  217 +
 .../math4/util/OpenIntToDoubleHashMapTest.java  |  325 +
 .../commons/math4/util/OpenIntToFieldTest.java  |  335 +
 .../org/apache/commons/math4/util/PairTest.java |  118 +
 .../commons/math4/util/PrecisionTest.java       |  551 ++
 .../math4/util/ResizableDoubleArrayTest.java    |  598 ++
 .../org/apache/commons/math4/util/TestBean.java |   71 +
 .../commons/math4/util/TransformerMapTest.java  |  122 +
 .../distribution/gamma-distribution-shape-1.csv | 3215 ---------
 .../gamma-distribution-shape-10.csv             |  415 --
 .../gamma-distribution-shape-100.csv            |  408 --
 .../gamma-distribution-shape-1000.csv           | 3325 ----------
 .../gamma-distribution-shape-142.csv            |  775 ---
 .../distribution/gamma-distribution-shape-8.csv | 3215 ---------
 .../math3/distribution/gamma-distribution.mac   |   73 -
 .../math3/fitting/leastsquares/Hahn1.dat        |  296 -
 .../math3/fitting/leastsquares/Kirby2.dat       |  211 -
 .../math3/fitting/leastsquares/Lanczos1.dat     |   84 -
 .../math3/fitting/leastsquares/MGH17.dat        |   93 -
 .../org/apache/commons/math3/linear/matrix1.csv |  216 -
 .../org/apache/commons/math3/linear/matrix2.csv |   22 -
 .../optim/nonlinear/vector/jacobian/Hahn1.dat   |  296 -
 .../optim/nonlinear/vector/jacobian/Kirby2.dat  |  211 -
 .../nonlinear/vector/jacobian/Lanczos1.dat      |   84 -
 .../optim/nonlinear/vector/jacobian/MGH17.dat   |   93 -
 .../math3/optimization/general/Hahn1.dat        |  296 -
 .../math3/optimization/general/Kirby2.dat       |  211 -
 .../math3/optimization/general/Lanczos1.dat     |   84 -
 .../math3/optimization/general/MGH17.dat        |   93 -
 .../apache/commons/math3/random/emptyFile.txt   |    0
 .../apache/commons/math3/random/testData.txt    | 1000 ---
 .../org/apache/commons/math3/stat/data/Lew.txt  |  252 -
 .../apache/commons/math3/stat/data/Lottery.txt  |  261 -
 .../apache/commons/math3/stat/data/Mavro.txt    |  110 -
 .../apache/commons/math3/stat/data/Michelso.txt |  160 -
 .../apache/commons/math3/stat/data/NumAcc1.txt  |   63 -
 .../apache/commons/math3/stat/data/NumAcc2.txt  | 1061 ---
 .../apache/commons/math3/stat/data/NumAcc3.txt  | 1061 ---
 .../apache/commons/math3/stat/data/NumAcc4.txt  | 1061 ---
 .../apache/commons/math3/stat/data/PiDigits.txt | 5060 --------------
 .../distribution/gamma-distribution-shape-1.csv | 3215 +++++++++
 .../gamma-distribution-shape-10.csv             |  415 ++
 .../gamma-distribution-shape-100.csv            |  408 ++
 .../gamma-distribution-shape-1000.csv           | 3325 ++++++++++
 .../gamma-distribution-shape-142.csv            |  775 +++
 .../distribution/gamma-distribution-shape-8.csv | 3215 +++++++++
 .../math4/distribution/gamma-distribution.mac   |   73 +
 .../math4/fitting/leastsquares/Hahn1.dat        |  296 +
 .../math4/fitting/leastsquares/Kirby2.dat       |  211 +
 .../math4/fitting/leastsquares/Lanczos1.dat     |   84 +
 .../math4/fitting/leastsquares/MGH17.dat        |   93 +
 .../org/apache/commons/math4/linear/matrix1.csv |  216 +
 .../org/apache/commons/math4/linear/matrix2.csv |   22 +
 .../optim/nonlinear/vector/jacobian/Hahn1.dat   |  296 +
 .../optim/nonlinear/vector/jacobian/Kirby2.dat  |  211 +
 .../nonlinear/vector/jacobian/Lanczos1.dat      |   84 +
 .../optim/nonlinear/vector/jacobian/MGH17.dat   |   93 +
 .../math4/optimization/general/Hahn1.dat        |  296 +
 .../math4/optimization/general/Kirby2.dat       |  211 +
 .../math4/optimization/general/Lanczos1.dat     |   84 +
 .../math4/optimization/general/MGH17.dat        |   93 +
 .../apache/commons/math4/random/emptyFile.txt   |    0
 .../apache/commons/math4/random/testData.txt    | 1000 +++
 .../org/apache/commons/math4/stat/data/Lew.txt  |  252 +
 .../apache/commons/math4/stat/data/Lottery.txt  |  261 +
 .../apache/commons/math4/stat/data/Mavro.txt    |  110 +
 .../apache/commons/math4/stat/data/Michelso.txt |  160 +
 .../apache/commons/math4/stat/data/NumAcc1.txt  |   63 +
 .../apache/commons/math4/stat/data/NumAcc2.txt  | 1061 +++
 .../apache/commons/math4/stat/data/NumAcc3.txt  | 1061 +++
 .../apache/commons/math4/stat/data/NumAcc4.txt  | 1061 +++
 .../apache/commons/math4/stat/data/PiDigits.txt | 5060 ++++++++++++++
 .../userguide/ClusterAlgorithmComparison.java   |  304 -
 .../commons/math3/userguide/ExampleUtils.java   |  104 -
 .../LowDiscrepancyGeneratorComparison.java      |  253 -
 .../userguide/RealDistributionComparison.java   |  309 -
 .../userguide/filter/CannonballExample.java     |  321 -
 .../filter/ConstantVoltageExample.java          |  240 -
 .../userguide/genetics/HelloWorldExample.java   |  187 -
 .../genetics/ImageEvolutionExample.java         |  230 -
 .../math3/userguide/genetics/Polygon.java       |  121 -
 .../userguide/genetics/PolygonChromosome.java   |  135 -
 .../genetics/RandomPolygonMutation.java         |   49 -
 .../userguide/geometry/GeometryExample.java     |  280 -
 .../math3/userguide/sofm/ChineseRings.java      |  109 -
 .../userguide/sofm/ChineseRingsClassifier.java  |  335 -
 .../userguide/ClusterAlgorithmComparison.java   |  304 +
 .../commons/math4/userguide/ExampleUtils.java   |  104 +
 .../LowDiscrepancyGeneratorComparison.java      |  253 +
 .../userguide/RealDistributionComparison.java   |  309 +
 .../userguide/filter/CannonballExample.java     |  321 +
 .../filter/ConstantVoltageExample.java          |  240 +
 .../userguide/genetics/HelloWorldExample.java   |  187 +
 .../genetics/ImageEvolutionExample.java         |  230 +
 .../math4/userguide/genetics/Polygon.java       |  121 +
 .../userguide/genetics/PolygonChromosome.java   |  135 +
 .../genetics/RandomPolygonMutation.java         |   49 +
 .../userguide/geometry/GeometryExample.java     |  280 +
 .../math4/userguide/sofm/ChineseRings.java      |  109 +
 .../userguide/sofm/ChineseRingsClassifier.java  |  335 +
 3088 files changed, 374463 insertions(+), 374463 deletions(-)
----------------------------------------------------------------------



[75/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1D.java
index 14d130d..91610d9 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Euclidean1D.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Space;
 
 /**
  * This class implements a one-dimensional space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Interval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Interval.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Interval.java
index 18ebac7..278b7f4 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Interval.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Interval.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
 
 
 /** This class represents a 1D interval.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
index 383ea9f..82e7a21 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/IntervalsSet.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -22,12 +22,12 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BoundaryProjection;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.partitioning.AbstractRegion;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BoundaryProjection;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.util.Precision;
 
 /** This class represents a 1D region: a set of intervals.
  * @since 3.0
@@ -85,7 +85,7 @@ public class IntervalsSet extends AbstractRegion<Euclidean1D, Euclidean1D> imple
      * boundary does not really separate an inside open from an outside
      * open (open having here its topological meaning), then subsequent
      * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
+     * org.apache.commons.math4.geometry.partitioning.Region#checkPoint(org.apache.commons.math4.geometry.Point)
      * checkPoint} method will not be meaningful anymore.</p>
      * <p>If the boundary is empty, the region will represent the whole
      * space.</p>
@@ -146,7 +146,7 @@ public class IntervalsSet extends AbstractRegion<Euclidean1D, Euclidean1D> imple
      * boundary does not really separate an inside open from an outside
      * open (open having here its topological meaning), then subsequent
      * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
+     * org.apache.commons.math4.geometry.partitioning.Region#checkPoint(org.apache.commons.math4.geometry.Point)
      * checkPoint} method will not be meaningful anymore.</p>
      * <p>If the boundary is empty, the region will represent the whole
      * space.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/OrientedPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/OrientedPoint.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/OrientedPoint.java
index 512bf5d..4fed866 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/OrientedPoint.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/OrientedPoint.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
 
 /** This class represents a 1D oriented hyperplane.
  * <p>An hyperplane in 1D is a simple point, its orientation being a
@@ -91,9 +91,9 @@ public class OrientedPoint implements Hyperplane<Euclidean1D> {
      * <p>Since this class represent zero dimension spaces which does
      * not have lower dimension sub-spaces, this method returns a dummy
      * implementation of a {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane SubHyperplane}.
+     * org.apache.commons.math4.geometry.partitioning.SubHyperplane SubHyperplane}.
      * This implementation is only used to allow the {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
+     * org.apache.commons.math4.geometry.partitioning.SubHyperplane
      * SubHyperplane} class implementation to work properly, it should
      * <em>not</em> be used otherwise.</p>
      * @return a dummy sub hyperplane

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java
index 697cfaf..dc654e9 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/SubOrientedPoint.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.Side;
 
 /** This class represents sub-hyperplane for {@link OrientedPoint}.
  * <p>An hyperplane in 1D is a simple point, its orientation being a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1D.java
index 1ec7a4e..ca402af 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1D.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.text.NumberFormat;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /** This class represents a 1D vector.
  * <p>Instances of this class are guaranteed to be immutable.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormat.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormat.java
index 27f1905..d3c4bd8 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormat.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/Vector1DFormat.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.VectorFormat;
-import org.apache.commons.math3.util.CompositeFormat;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.VectorFormat;
+import org.apache.commons.math4.util.CompositeFormat;
 
 /**
  * Formats a 1D vector in components list format "{x}".

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/package-info.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/package-info.java
index 0fa3788..9ec9d8b 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/oned/package-info.java
@@ -21,4 +21,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.euclidean.oned;
+package org.apache.commons.math4.geometry.euclidean.oned;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/CardanEulerSingularityException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/CardanEulerSingularityException.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/CardanEulerSingularityException.java
index 728074d..ad9c33e 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/CardanEulerSingularityException.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/CardanEulerSingularityException.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /** This class represents exceptions thrown while extractiong Cardan
  * or Euler angles from a rotation.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3D.java
index dc06936..20138a7 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Euclidean3D.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
 
 /**
  * This class implements a three-dimensional space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 dd6f3e4..ce9e4ea 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
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class is a re-implementation of {@link Rotation} using {@link RealFieldElement}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
index 0bd04e5..f03a1ec 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/FieldVector3D.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.io.Serializable;
 import java.text.NumberFormat;
 
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class is a re-implementation of {@link Vector3D} using {@link RealFieldElement}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
index e234495..88f9549 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Line.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.partitioning.Embedding;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /** The class represent lines in a three dimensional space.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/NotARotationMatrixException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/NotARotationMatrixException.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/NotARotationMatrixException.java
index 3f1f3d3..28be3be 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/NotARotationMatrixException.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/NotARotationMatrixException.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * This class represents exceptions thrown while building rotations

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
index 328018b..cd9c8b0 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/OutlineExtractor.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
+import org.apache.commons.math4.geometry.partitioning.BoundaryAttribute;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.util.FastMath;
 
 /** Extractor for {@link PolygonsSet polyhedrons sets} outlines.
  * <p>This class extracts the 2D outlines from {{@link PolygonsSet
@@ -213,16 +213,16 @@ public class OutlineExtractor {
                         final Vector3D current3D = plane.toSpace((Point<Euclidean2D>) loop[current]);
                         final Vector2D  cPoint    = new Vector2D(current3D.dotProduct(u),
                                                                  current3D.dotProduct(v));
-                        final org.apache.commons.math3.geometry.euclidean.twod.Line line =
-                            new org.apache.commons.math3.geometry.euclidean.twod.Line(pPoint, cPoint, tolerance);
+                        final org.apache.commons.math4.geometry.euclidean.twod.Line line =
+                            new org.apache.commons.math4.geometry.euclidean.twod.Line(pPoint, cPoint, tolerance);
                         SubHyperplane<Euclidean2D> edge = line.wholeHyperplane();
 
                         if (closed || (previous != 1)) {
                             // the previous point is a real vertex
                             // it defines one bounding point of the edge
                             final double angle = line.getAngle() + 0.5 * FastMath.PI;
-                            final org.apache.commons.math3.geometry.euclidean.twod.Line l =
-                                new org.apache.commons.math3.geometry.euclidean.twod.Line(pPoint, angle, tolerance);
+                            final org.apache.commons.math4.geometry.euclidean.twod.Line l =
+                                new org.apache.commons.math4.geometry.euclidean.twod.Line(pPoint, angle, tolerance);
                             edge = edge.split(l).getPlus();
                         }
 
@@ -230,8 +230,8 @@ public class OutlineExtractor {
                             // the current point is a real vertex
                             // it defines one bounding point of the edge
                             final double angle = line.getAngle() + 0.5 * FastMath.PI;
-                            final org.apache.commons.math3.geometry.euclidean.twod.Line l =
-                                new org.apache.commons.math3.geometry.euclidean.twod.Line(cPoint, angle, tolerance);
+                            final org.apache.commons.math4.geometry.euclidean.twod.Line l =
+                                new org.apache.commons.math4.geometry.euclidean.twod.Line(cPoint, angle, tolerance);
                             edge = edge.split(l).getMinus();
                         }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
index a63e806..4fad126 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Plane.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.Embedding;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.util.FastMath;
 
 /** The class represent planes in a three dimensional space.
  * @since 3.0
@@ -306,7 +306,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
      * @param point point of the space (must be a {@link Vector3D
      * Vector3D} instance)
      * @return in-plane point (really a {@link
-     * org.apache.commons.math3.geometry.euclidean.twod.Vector2D Vector2D} instance)
+     * org.apache.commons.math4.geometry.euclidean.twod.Vector2D Vector2D} instance)
      * @see #toSpace
      */
     public Vector2D toSubSpace(final Point<Euclidean3D> point) {
@@ -316,7 +316,7 @@ public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Eu
 
     /** Transform an in-plane point into a 3D space point.
      * @param point in-plane point (must be a {@link
-     * org.apache.commons.math3.geometry.euclidean.twod.Vector2D Vector2D} instance)
+     * org.apache.commons.math4.geometry.euclidean.twod.Vector2D Vector2D} instance)
      * @return 3D space point (really a {@link Vector3D Vector3D} instance)
      * @see #toSubSpace
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
index d41d133..5e420d6 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/PolyhedronsSet.java
@@ -14,26 +14,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.awt.geom.AffineTransform;
 import java.util.Collection;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.SubLine;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.SubLine;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.AbstractRegion;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
+import org.apache.commons.math4.geometry.partitioning.BoundaryAttribute;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Transform;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class represents a 3D region: a set of polyhedrons.
  * @since 3.0
@@ -465,7 +465,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
                                         tP00.getX(), tP00.getY());
 
                 cachedOriginal  = (Plane) original;
-                cachedTransform = org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
+                cachedTransform = org.apache.commons.math4.geometry.euclidean.twod.Line.getTransform(at);
 
             }
             return ((SubLine) sub).applyTransform(cachedTransform);
@@ -526,7 +526,7 @@ public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
 
                 cachedOriginal  = (Plane) original;
                 cachedTransform =
-                        org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
+                        org.apache.commons.math4.geometry.euclidean.twod.Line.getTransform(at);
 
             }
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Rotation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Rotation.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Rotation.java
index 7945c7c..1a7b0ab 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Rotation.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Rotation.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class implements rotations in a three-dimensional space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrder.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrder.java
index 03bc1c2..83822e5 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrder.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/RotationOrder.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 /**
  * This class is a utility representing a rotation order specification

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Segment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Segment.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Segment.java
index 200b462..2f765de 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Segment.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Segment.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 
 /** Simple container for a two-points segment.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java
index b553510..9604b0d 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphereGenerator.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.enclosing.SupportBallGenerator;
-import org.apache.commons.math3.geometry.euclidean.twod.DiskGenerator;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.enclosing.SupportBallGenerator;
+import org.apache.commons.math4.geometry.euclidean.twod.DiskGenerator;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.util.FastMath;
 
 /** Class generating an enclosing ball from its support points.
  * @since 3.3

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinates.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinates.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinates.java
index 23d818e..b623af9 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinates.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SphericalCoordinates.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class provides conversions related to <a
  * href="http://mathworld.wolfram.com/SphericalCoordinates.html">spherical coordinates</a>.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java
index 2ac917f..4ae814d 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubLine.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Interval;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
 
 /** This class represents a subset of a {@link Line}.
  * @since 3.0

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java
index 64fe1ed..9bab72f 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/SubPlane.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
+package org.apache.commons.math4.geometry.euclidean.threed;
+
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.PolygonsSet;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
 
 /** This class represents a sub-hyperplane for {@link Plane}.
  * @since 3.0
@@ -81,8 +81,8 @@ public class SubPlane extends AbstractSubHyperplane<Euclidean3D, Euclidean2D> {
             p           = q;
             q           = tmp;
         }
-        final org.apache.commons.math3.geometry.euclidean.twod.Line line2D =
-            new org.apache.commons.math3.geometry.euclidean.twod.Line(p, q, tolerance);
+        final org.apache.commons.math4.geometry.euclidean.twod.Line line2D =
+            new org.apache.commons.math4.geometry.euclidean.twod.Line(p, q, tolerance);
 
         // check the side on the 2D plane
         return getRemainingRegion().side(line2D);
@@ -121,9 +121,9 @@ public class SubPlane extends AbstractSubHyperplane<Euclidean3D, Euclidean2D> {
             q           = tmp;
         }
         final SubHyperplane<Euclidean2D> l2DMinus =
-            new org.apache.commons.math3.geometry.euclidean.twod.Line(p, q, tolerance).wholeHyperplane();
+            new org.apache.commons.math4.geometry.euclidean.twod.Line(p, q, tolerance).wholeHyperplane();
         final SubHyperplane<Euclidean2D> l2DPlus =
-            new org.apache.commons.math3.geometry.euclidean.twod.Line(q, p, tolerance).wholeHyperplane();
+            new org.apache.commons.math4.geometry.euclidean.twod.Line(q, p, tolerance).wholeHyperplane();
 
         final BSPTree<Euclidean2D> splitTree = getRemainingRegion().getTree(false).split(l2DMinus);
         final BSPTree<Euclidean2D> plusTree  = getRemainingRegion().isEmpty(splitTree.getPlus()) ?

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3D.java
index 3eaea3a..7a885b6 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3D.java
@@ -15,20 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.io.Serializable;
 import java.text.NumberFormat;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * This class implements vectors in a three-dimensional space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormat.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormat.java
index da3f71e..e6033ae 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormat.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/Vector3DFormat.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.VectorFormat;
-import org.apache.commons.math3.util.CompositeFormat;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.VectorFormat;
+import org.apache.commons.math4.util.CompositeFormat;
 
 /**
  * Formats a 3D vector in components list format "{x; y; z}".

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/package-info.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/package-info.java
index eaa3c6a..92e2739 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/threed/package-info.java
@@ -21,4 +21,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.euclidean.threed;
+package org.apache.commons.math4.geometry.euclidean.threed;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java
index 332b1b7..6ab1cfa 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/DiskGenerator.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.List;
 
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.enclosing.SupportBallGenerator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.enclosing.SupportBallGenerator;
+import org.apache.commons.math4.util.FastMath;
 
 /** Class generating an enclosing ball from its support points.
  * @since 3.3

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2D.java
index af7630d..3e6aa3c 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Euclidean2D.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
 
 /**
  * This class implements a two-dimensional space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Line.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Line.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Line.java
index d6fd487..6ff7a90 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Line.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Line.java
@@ -14,25 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.awt.geom.AffineTransform;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.OrientedPoint;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.oned.OrientedPoint;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.partitioning.Embedding;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Transform;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /** This class represents an oriented line in the 2D plane.
 
@@ -377,7 +377,7 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
     /** Compute the distance between the instance and a point.
      * <p>This is a shortcut for invoking FastMath.abs(getOffset(p)),
      * and provides consistency with what is in the
-     * org.apache.commons.math3.geometry.euclidean.threed.Line class.</p>
+     * org.apache.commons.math4.geometry.euclidean.threed.Line class.</p>
      *
      * @param p to check
      * @return distance between the instance and the point
@@ -435,16 +435,16 @@ public class Line implements Hyperplane<Euclidean2D>, Embedding<Euclidean2D, Euc
         originOffset = offset;
     }
 
-    /** Get a {@link org.apache.commons.math3.geometry.partitioning.Transform
+    /** Get a {@link org.apache.commons.math4.geometry.partitioning.Transform
      * Transform} embedding an affine transform.
      * @param transform affine transform to embed (must be inversible
      * otherwise the {@link
-     * org.apache.commons.math3.geometry.partitioning.Transform#apply(Hyperplane)
+     * org.apache.commons.math4.geometry.partitioning.Transform#apply(Hyperplane)
      * apply(Hyperplane)} method would work only for some lines, and
      * fail for other ones)
      * @return a new transform that can be applied to either {@link
      * Vector2D Vector2D}, {@link Line Line} or {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
+     * org.apache.commons.math4.geometry.partitioning.SubHyperplane
      * SubHyperplane} instances
      * @exception MathIllegalArgumentException if the transform is non invertible
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java
index a58caf1..faead92 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/NestedLoops.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
 
 /** This class represent a tree of nested 2D boundary loops.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
index 46268f5..640550c 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
@@ -14,27 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Interval;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.partitioning.AbstractRegion;
+import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor;
+import org.apache.commons.math4.geometry.partitioning.BoundaryAttribute;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /** This class represents a 2D region: a set of polygons.
  * @since 3.0
@@ -93,7 +93,7 @@ public class PolygonsSet extends AbstractRegion<Euclidean2D, Euclidean1D> {
      * boundary does not really separate an inside open from an outside
      * open (open having here its topological meaning), then subsequent
      * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
+     * org.apache.commons.math4.geometry.partitioning.Region#checkPoint(org.apache.commons.math4.geometry.Point)
      * checkPoint} method will not be meaningful anymore.</p>
      * <p>If the boundary is empty, the region will represent the whole
      * space.</p>
@@ -190,7 +190,7 @@ public class PolygonsSet extends AbstractRegion<Euclidean2D, Euclidean1D> {
      * boundary does not really separate an inside open from an outside
      * open (open having here its topological meaning), then subsequent
      * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
+     * org.apache.commons.math4.geometry.partitioning.Region#checkPoint(org.apache.commons.math4.geometry.Point)
      * checkPoint} method will not be meaningful anymore.</p>
      * <p>If the boundary is empty, the region will represent the whole
      * space.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Segment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Segment.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Segment.java
index 2ef7f4e..32e5c6b 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Segment.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Segment.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.util.FastMath;
 
 /** Simple container for a two-points segment.
  * @since 3.0

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java
index d27b116..a3851ee 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/SubLine.java
@@ -14,25 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Interval;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.OrientedPoint;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D;
+import org.apache.commons.math4.geometry.euclidean.oned.Interval;
+import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet;
+import org.apache.commons.math4.geometry.euclidean.oned.OrientedPoint;
+import org.apache.commons.math4.geometry.euclidean.oned.Vector1D;
+import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.BSPTree;
+import org.apache.commons.math4.geometry.partitioning.Hyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class represents a sub-hyperplane for {@link Line}.
  * @since 3.0

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2D.java
index 191d225..3570e39 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2D.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.text.NumberFormat;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /** This class represents a 2D vector.
  * <p>Instances of this class are guaranteed to be immutable.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormat.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormat.java
index 21261c5..af54313 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormat.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/Vector2DFormat.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
 import java.text.ParsePosition;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.VectorFormat;
-import org.apache.commons.math3.util.CompositeFormat;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.geometry.VectorFormat;
+import org.apache.commons.math4.util.CompositeFormat;
 
 /**
  * Formats a 2D vector in components list format "{x; y}".

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
index b234ad5..ff2b435 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Abstract base class for convex hull generators in the two-dimensional euclidean space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java
index f5d1b84..2388db0 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/AklToussaintHeuristic.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
 
 /**
  * A simple heuristic to improve the performance of convex hull algorithms.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
index 5d9734b..dadfaa8 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHull2D.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Line;
-import org.apache.commons.math3.geometry.euclidean.twod.Segment;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.hull.ConvexHull;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Line;
+import org.apache.commons.math4.geometry.euclidean.twod.Segment;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.hull.ConvexHull;
+import org.apache.commons.math4.geometry.partitioning.Region;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * This class represents a convex hull in an two-dimensional euclidean space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
index 3e13e1a..a7febe3 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.hull.ConvexHullGenerator;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.hull.ConvexHullGenerator;
 
 /**
  * Interface for convex hull generators in the two-dimensional euclidean space.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
index a811dda..bbd0532 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/MonotoneChain.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -22,10 +22,10 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.euclidean.twod.Line;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.geometry.euclidean.twod.Line;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Implements Andrew's monotone chain method to generate the convex hull of a finite set of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/package-info.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/package-info.java
index d0469a4..120f5c7 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/hull/package-info.java
@@ -22,4 +22,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;
+package org.apache.commons.math4.geometry.euclidean.twod.hull;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/package-info.java b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/package-info.java
index feb43b1..7872044 100644
--- a/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/package-info.java
@@ -21,4 +21,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.euclidean.twod;
+package org.apache.commons.math4.geometry.euclidean.twod;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHull.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHull.java b/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHull.java
index 8dfa3f3..b78d229 100644
--- a/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHull.java
+++ b/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHull.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.hull;
+package org.apache.commons.math4.geometry.hull;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.partitioning.Region;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.partitioning.Region;
 
 /**
  * This class represents a convex hull.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHullGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHullGenerator.java b/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHullGenerator.java
index 8f601d2..eadc0af 100644
--- a/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHullGenerator.java
+++ b/src/main/java/org/apache/commons/math4/geometry/hull/ConvexHullGenerator.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.hull;
+package org.apache.commons.math4.geometry.hull;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
 
 /**
  * Interface for convex hull generators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/hull/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/hull/package-info.java b/src/main/java/org/apache/commons/math4/geometry/hull/package-info.java
index 2246682..70468bf 100644
--- a/src/main/java/org/apache/commons/math4/geometry/hull/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/hull/package-info.java
@@ -21,4 +21,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry.hull;
+package org.apache.commons.math4.geometry.hull;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/package-info.java b/src/main/java/org/apache/commons/math4/geometry/package-info.java
index 31929e2..8b9bd9d 100644
--- a/src/main/java/org/apache/commons/math4/geometry/package-info.java
+++ b/src/main/java/org/apache/commons/math4/geometry/package-info.java
@@ -22,4 +22,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.geometry;
+package org.apache.commons.math4.geometry;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java
index 6928331..71e552f 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractRegion.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -24,9 +24,9 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.TreeSet;
 
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.Vector;
 
 /** Abstract class for all regions, independently of geometry type or dimension.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java
index 3fd6b54..5c62ae7 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/AbstractSubHyperplane.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.math3.geometry.Space;
+import org.apache.commons.math4.geometry.Space;
 
 /** This class implements the dimension-independent parts of {@link SubHyperplane}.
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java b/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java
index 26ae45f..68cdb62 100644
--- a/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java
+++ b/src/main/java/org/apache/commons/math4/geometry/partitioning/BSPTree.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.partitioning;
+package org.apache.commons.math4.geometry.partitioning;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.geometry.Point;
+import org.apache.commons.math4.geometry.Space;
+import org.apache.commons.math4.geometry.Vector;
+import org.apache.commons.math4.util.FastMath;
 
 /** This class represent a Binary Space Partition tree.
 


[13/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTree.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTree.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTree.java
deleted file mode 100644
index 26ae45f..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTree.java
+++ /dev/null
@@ -1,817 +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.geometry.partitioning;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.util.FastMath;
-
-/** This class represent a Binary Space Partition tree.
-
- * <p>BSP trees are an efficient way to represent space partitions and
- * to associate attributes with each cell. Each node in a BSP tree
- * represents a convex region which is partitioned in two convex
- * sub-regions at each side of a cut hyperplane. The root tree
- * contains the complete space.</p>
-
- * <p>The main use of such partitions is to use a boolean attribute to
- * define an inside/outside property, hence representing arbitrary
- * polytopes (line segments in 1D, polygons in 2D and polyhedrons in
- * 3D) and to operate on them.</p>
-
- * <p>Another example would be to represent Voronoi tesselations, the
- * attribute of each cell holding the defining point of the cell.</p>
-
- * <p>The application-defined attributes are shared among copied
- * instances and propagated to split parts. These attributes are not
- * used by the BSP-tree algorithms themselves, so the application can
- * use them for any purpose. Since the tree visiting method holds
- * internal and leaf nodes differently, it is possible to use
- * different classes for internal nodes attributes and leaf nodes
- * attributes. This should be used with care, though, because if the
- * tree is modified in any way after attributes have been set, some
- * internal nodes may become leaf nodes and some leaf nodes may become
- * internal nodes.</p>
-
- * <p>One of the main sources for the development of this package was
- * Bruce Naylor, John Amanatides and William Thibault paper <a
- * href="http://www.cs.yorku.ca/~amana/research/bsptSetOp.pdf">Merging
- * BSP Trees Yields Polyhedral Set Operations</a> Proc. Siggraph '90,
- * Computer Graphics 24(4), August 1990, pp 115-124, published by the
- * Association for Computing Machinery (ACM).</p>
-
- * @param <S> Type of the space.
-
- * @since 3.0
- */
-public class BSPTree<S extends Space> {
-
-    /** Cut sub-hyperplane. */
-    private SubHyperplane<S> cut;
-
-    /** Tree at the plus side of the cut hyperplane. */
-    private BSPTree<S> plus;
-
-    /** Tree at the minus side of the cut hyperplane. */
-    private BSPTree<S> minus;
-
-    /** Parent tree. */
-    private BSPTree<S> parent;
-
-    /** Application-defined attribute. */
-    private Object attribute;
-
-    /** Build a tree having only one root cell representing the whole space.
-     */
-    public BSPTree() {
-        cut       = null;
-        plus      = null;
-        minus     = null;
-        parent    = null;
-        attribute = null;
-    }
-
-    /** Build a tree having only one root cell representing the whole space.
-     * @param attribute attribute of the tree (may be null)
-     */
-    public BSPTree(final Object attribute) {
-        cut    = null;
-        plus   = null;
-        minus  = null;
-        parent = null;
-        this.attribute = attribute;
-    }
-
-    /** Build a BSPTree from its underlying elements.
-     * <p>This method does <em>not</em> perform any verification on
-     * consistency of its arguments, it should therefore be used only
-     * when then caller knows what it is doing.</p>
-     * <p>This method is mainly useful to build trees
-     * bottom-up. Building trees top-down is realized with the help of
-     * method {@link #insertCut insertCut}.</p>
-     * @param cut cut sub-hyperplane for the tree
-     * @param plus plus side sub-tree
-     * @param minus minus side sub-tree
-     * @param attribute attribute associated with the node (may be null)
-     * @see #insertCut
-     */
-    public BSPTree(final SubHyperplane<S> cut, final BSPTree<S> plus, final BSPTree<S> minus,
-                   final Object attribute) {
-        this.cut       = cut;
-        this.plus      = plus;
-        this.minus     = minus;
-        this.parent    = null;
-        this.attribute = attribute;
-        plus.parent    = this;
-        minus.parent   = this;
-    }
-
-    /** Insert a cut sub-hyperplane in a node.
-     * <p>The sub-tree starting at this node will be completely
-     * overwritten. The new cut sub-hyperplane will be built from the
-     * intersection of the provided hyperplane with the cell. If the
-     * hyperplane does intersect the cell, the cell will have two
-     * children cells with {@code null} attributes on each side of
-     * the inserted cut sub-hyperplane. If the hyperplane does not
-     * intersect the cell then <em>no</em> cut hyperplane will be
-     * inserted and the cell will be changed to a leaf cell. The
-     * attribute of the node is never changed.</p>
-     * <p>This method is mainly useful when called on leaf nodes
-     * (i.e. nodes for which {@link #getCut getCut} returns
-     * {@code null}), in this case it provides a way to build a
-     * tree top-down (whereas the {@link #BSPTree(SubHyperplane,
-     * BSPTree, BSPTree, Object) 4 arguments constructor} is devoted to
-     * build trees bottom-up).</p>
-     * @param hyperplane hyperplane to insert, it will be chopped in
-     * order to fit in the cell defined by the parent nodes of the
-     * instance
-     * @return true if a cut sub-hyperplane has been inserted (i.e. if
-     * the cell now has two leaf child nodes)
-     * @see #BSPTree(SubHyperplane, BSPTree, BSPTree, Object)
-     */
-    public boolean insertCut(final Hyperplane<S> hyperplane) {
-
-        if (cut != null) {
-            plus.parent  = null;
-            minus.parent = null;
-        }
-
-        final SubHyperplane<S> chopped = fitToCell(hyperplane.wholeHyperplane());
-        if (chopped == null || chopped.isEmpty()) {
-            cut          = null;
-            plus         = null;
-            minus        = null;
-            return false;
-        }
-
-        cut          = chopped;
-        plus         = new BSPTree<S>();
-        plus.parent  = this;
-        minus        = new BSPTree<S>();
-        minus.parent = this;
-        return true;
-
-    }
-
-    /** Copy the instance.
-     * <p>The instance created is completely independent of the original
-     * one. A deep copy is used, none of the underlying objects are
-     * shared (except for the nodes attributes and immutable
-     * objects).</p>
-     * @return a new tree, copy of the instance
-     */
-    public BSPTree<S> copySelf() {
-
-        if (cut == null) {
-            return new BSPTree<S>(attribute);
-        }
-
-        return new BSPTree<S>(cut.copySelf(), plus.copySelf(), minus.copySelf(),
-                           attribute);
-
-    }
-
-    /** Get the cut sub-hyperplane.
-     * @return cut sub-hyperplane, null if this is a leaf tree
-     */
-    public SubHyperplane<S> getCut() {
-        return cut;
-    }
-
-    /** Get the tree on the plus side of the cut hyperplane.
-     * @return tree on the plus side of the cut hyperplane, null if this
-     * is a leaf tree
-     */
-    public BSPTree<S> getPlus() {
-        return plus;
-    }
-
-    /** Get the tree on the minus side of the cut hyperplane.
-     * @return tree on the minus side of the cut hyperplane, null if this
-     * is a leaf tree
-     */
-    public BSPTree<S> getMinus() {
-        return minus;
-    }
-
-    /** Get the parent node.
-     * @return parent node, null if the node has no parents
-     */
-    public BSPTree<S> getParent() {
-        return parent;
-    }
-
-    /** Associate an attribute with the instance.
-     * @param attribute attribute to associate with the node
-     * @see #getAttribute
-     */
-    public void setAttribute(final Object attribute) {
-        this.attribute = attribute;
-    }
-
-    /** Get the attribute associated with the instance.
-     * @return attribute associated with the node or null if no
-     * attribute has been explicitly set using the {@link #setAttribute
-     * setAttribute} method
-     * @see #setAttribute
-     */
-    public Object getAttribute() {
-        return attribute;
-    }
-
-    /** Visit the BSP tree nodes.
-     * @param visitor object visiting the tree nodes
-     */
-    public void visit(final BSPTreeVisitor<S> visitor) {
-        if (cut == null) {
-            visitor.visitLeafNode(this);
-        } else {
-            switch (visitor.visitOrder(this)) {
-            case PLUS_MINUS_SUB:
-                plus.visit(visitor);
-                minus.visit(visitor);
-                visitor.visitInternalNode(this);
-                break;
-            case PLUS_SUB_MINUS:
-                plus.visit(visitor);
-                visitor.visitInternalNode(this);
-                minus.visit(visitor);
-                break;
-            case MINUS_PLUS_SUB:
-                minus.visit(visitor);
-                plus.visit(visitor);
-                visitor.visitInternalNode(this);
-                break;
-            case MINUS_SUB_PLUS:
-                minus.visit(visitor);
-                visitor.visitInternalNode(this);
-                plus.visit(visitor);
-                break;
-            case SUB_PLUS_MINUS:
-                visitor.visitInternalNode(this);
-                plus.visit(visitor);
-                minus.visit(visitor);
-                break;
-            case SUB_MINUS_PLUS:
-                visitor.visitInternalNode(this);
-                minus.visit(visitor);
-                plus.visit(visitor);
-                break;
-            default:
-                throw new MathInternalError();
-            }
-
-        }
-    }
-
-    /** Fit a sub-hyperplane inside the cell defined by the instance.
-     * <p>Fitting is done by chopping off the parts of the
-     * sub-hyperplane that lie outside of the cell using the
-     * cut-hyperplanes of the parent nodes of the instance.</p>
-     * @param sub sub-hyperplane to fit
-     * @return a new sub-hyperplane, guaranteed to have no part outside
-     * of the instance cell
-     */
-    private SubHyperplane<S> fitToCell(final SubHyperplane<S> sub) {
-        SubHyperplane<S> s = sub;
-        for (BSPTree<S> tree = this; tree.parent != null && s != null; tree = tree.parent) {
-            if (tree == tree.parent.plus) {
-                s = s.split(tree.parent.cut.getHyperplane()).getPlus();
-            } else {
-                s = s.split(tree.parent.cut.getHyperplane()).getMinus();
-            }
-        }
-        return s;
-    }
-
-    /** Get the cell to which a point belongs.
-     * <p>If the returned cell is a leaf node the points belongs to the
-     * interior of the node, if the cell is an internal node the points
-     * belongs to the node cut sub-hyperplane.</p>
-     * @param point point to check
-     * @return the tree cell to which the point belongs
-     * @deprecated as of 3.3, replaced with {@link #getCell(Point, double)}
-     */
-    @Deprecated
-    public BSPTree<S> getCell(final Vector<S> point) {
-        return getCell((Point<S>) point, 1.0e-10);
-    }
-
-    /** Get the cell to which a point belongs.
-     * <p>If the returned cell is a leaf node the points belongs to the
-     * interior of the node, if the cell is an internal node the points
-     * belongs to the node cut sub-hyperplane.</p>
-     * @param point point to check
-     * @param tolerance tolerance below which points close to a cut hyperplane
-     * are considered to belong to the hyperplane itself
-     * @return the tree cell to which the point belongs
-     */
-    public BSPTree<S> getCell(final Point<S> point, final double tolerance) {
-
-        if (cut == null) {
-            return this;
-        }
-
-        // position of the point with respect to the cut hyperplane
-        final double offset = cut.getHyperplane().getOffset(point);
-
-        if (FastMath.abs(offset) < tolerance) {
-            return this;
-        } else if (offset <= 0) {
-            // point is on the minus side of the cut hyperplane
-            return minus.getCell(point, tolerance);
-        } else {
-            // point is on the plus side of the cut hyperplane
-            return plus.getCell(point, tolerance);
-        }
-
-    }
-
-    /** Get the cells whose cut sub-hyperplanes are close to the point.
-     * @param point point to check
-     * @param maxOffset offset below which a cut sub-hyperplane is considered
-     * close to the point (in absolute value)
-     * @return close cells (may be empty if all cut sub-hyperplanes are farther
-     * than maxOffset from the point)
-     */
-    public List<BSPTree<S>> getCloseCuts(final Point<S> point, final double maxOffset) {
-        final List<BSPTree<S>> close = new ArrayList<BSPTree<S>>();
-        recurseCloseCuts(point, maxOffset, close);
-        return close;
-    }
-
-    /** Get the cells whose cut sub-hyperplanes are close to the point.
-     * @param point point to check
-     * @param maxOffset offset below which a cut sub-hyperplane is considered
-     * close to the point (in absolute value)
-     * @param close list to fill
-     */
-    private void recurseCloseCuts(final Point<S> point, final double maxOffset,
-                                  final List<BSPTree<S>> close) {
-        if (cut != null) {
-
-            // position of the point with respect to the cut hyperplane
-            final double offset = cut.getHyperplane().getOffset(point);
-
-            if (offset < -maxOffset) {
-                // point is on the minus side of the cut hyperplane
-                minus.recurseCloseCuts(point, maxOffset, close);
-            } else if (offset > maxOffset) {
-                // point is on the plus side of the cut hyperplane
-                plus.recurseCloseCuts(point, maxOffset, close);
-            } else {
-                // point is close to the cut hyperplane
-                close.add(this);
-                minus.recurseCloseCuts(point, maxOffset, close);
-                plus.recurseCloseCuts(point, maxOffset, close);
-            }
-
-        }
-    }
-
-    /** Perform condensation on a tree.
-     * <p>The condensation operation is not recursive, it must be called
-     * explicitly from leaves to root.</p>
-     */
-    private void condense() {
-        if ((cut != null) && (plus.cut == null) && (minus.cut == null) &&
-            (((plus.attribute == null) && (minus.attribute == null)) ||
-             ((plus.attribute != null) && plus.attribute.equals(minus.attribute)))) {
-            attribute = (plus.attribute == null) ? minus.attribute : plus.attribute;
-            cut       = null;
-            plus      = null;
-            minus     = null;
-        }
-    }
-
-    /** Merge a BSP tree with the instance.
-     * <p>All trees are modified (parts of them are reused in the new
-     * tree), it is the responsibility of the caller to ensure a copy
-     * has been done before if any of the former tree should be
-     * preserved, <em>no</em> such copy is done here!</p>
-     * <p>The algorithm used here is directly derived from the one
-     * described in the Naylor, Amanatides and Thibault paper (section
-     * III, Binary Partitioning of a BSP Tree).</p>
-     * @param tree other tree to merge with the instance (will be
-     * <em>unusable</em> after the operation, as well as the
-     * instance itself)
-     * @param leafMerger object implementing the final merging phase
-     * (this is where the semantic of the operation occurs, generally
-     * depending on the attribute of the leaf node)
-     * @return a new tree, result of <code>instance &lt;op&gt;
-     * tree</code>, this value can be ignored if parentTree is not null
-     * since all connections have already been established
-     */
-    public BSPTree<S> merge(final BSPTree<S> tree, final LeafMerger<S> leafMerger) {
-        return merge(tree, leafMerger, null, false);
-    }
-
-    /** Merge a BSP tree with the instance.
-     * @param tree other tree to merge with the instance (will be
-     * <em>unusable</em> after the operation, as well as the
-     * instance itself)
-     * @param leafMerger object implementing the final merging phase
-     * (this is where the semantic of the operation occurs, generally
-     * depending on the attribute of the leaf node)
-     * @param parentTree parent tree to connect to (may be null)
-     * @param isPlusChild if true and if parentTree is not null, the
-     * resulting tree should be the plus child of its parent, ignored if
-     * parentTree is null
-     * @return a new tree, result of <code>instance &lt;op&gt;
-     * tree</code>, this value can be ignored if parentTree is not null
-     * since all connections have already been established
-     */
-    private BSPTree<S> merge(final BSPTree<S> tree, final LeafMerger<S> leafMerger,
-                             final BSPTree<S> parentTree, final boolean isPlusChild) {
-        if (cut == null) {
-            // cell/tree operation
-            return leafMerger.merge(this, tree, parentTree, isPlusChild, true);
-        } else if (tree.cut == null) {
-            // tree/cell operation
-            return leafMerger.merge(tree, this, parentTree, isPlusChild, false);
-        } else {
-            // tree/tree operation
-            final BSPTree<S> merged = tree.split(cut);
-            if (parentTree != null) {
-                merged.parent = parentTree;
-                if (isPlusChild) {
-                    parentTree.plus = merged;
-                } else {
-                    parentTree.minus = merged;
-                }
-            }
-
-            // merging phase
-            plus.merge(merged.plus, leafMerger, merged, true);
-            minus.merge(merged.minus, leafMerger, merged, false);
-            merged.condense();
-            if (merged.cut != null) {
-                merged.cut = merged.fitToCell(merged.cut.getHyperplane().wholeHyperplane());
-            }
-
-            return merged;
-
-        }
-    }
-
-    /** This interface gather the merging operations between a BSP tree
-     * leaf and another BSP tree.
-     * <p>As explained in Bruce Naylor, John Amanatides and William
-     * Thibault paper <a
-     * href="http://www.cs.yorku.ca/~amana/research/bsptSetOp.pdf">Merging
-     * BSP Trees Yields Polyhedral Set Operations</a>,
-     * the operations on {@link BSPTree BSP trees} can be expressed as a
-     * generic recursive merging operation where only the final part,
-     * when one of the operand is a leaf, is specific to the real
-     * operation semantics. For example, a tree representing a region
-     * using a boolean attribute to identify inside cells and outside
-     * cells would use four different objects to implement the final
-     * merging phase of the four set operations union, intersection,
-     * difference and symmetric difference (exclusive or).</p>
-     * @param <S> Type of the space.
-     */
-    public interface LeafMerger<S extends Space> {
-
-        /** Merge a leaf node and a tree node.
-         * <p>This method is called at the end of a recursive merging
-         * resulting from a {@code tree1.merge(tree2, leafMerger)}
-         * call, when one of the sub-trees involved is a leaf (i.e. when
-         * its cut-hyperplane is null). This is the only place where the
-         * precise semantics of the operation are required. For all upper
-         * level nodes in the tree, the merging operation is only a
-         * generic partitioning algorithm.</p>
-         * <p>Since the final operation may be non-commutative, it is
-         * important to know if the leaf node comes from the instance tree
-         * ({@code tree1}) or the argument tree
-         * ({@code tree2}). The third argument of the method is
-         * devoted to this. It can be ignored for commutative
-         * operations.</p>
-         * <p>The {@link BSPTree#insertInTree BSPTree.insertInTree} method
-         * may be useful to implement this method.</p>
-         * @param leaf leaf node (its cut hyperplane is guaranteed to be
-         * null)
-         * @param tree tree node (its cut hyperplane may be null or not)
-         * @param parentTree parent tree to connect to (may be null)
-         * @param isPlusChild if true and if parentTree is not null, the
-         * resulting tree should be the plus child of its parent, ignored if
-         * parentTree is null
-         * @param leafFromInstance if true, the leaf node comes from the
-         * instance tree ({@code tree1}) and the tree node comes from
-         * the argument tree ({@code tree2})
-         * @return the BSP tree resulting from the merging (may be one of
-         * the arguments)
-         */
-        BSPTree<S> merge(BSPTree<S> leaf, BSPTree<S> tree, BSPTree<S> parentTree,
-                         boolean isPlusChild, boolean leafFromInstance);
-
-    }
-
-    /** This interface handles the corner cases when an internal node cut sub-hyperplane vanishes.
-     * <p>
-     * Such cases happens for example when a cut sub-hyperplane is inserted into
-     * another tree (during a merge operation), and is split in several parts,
-     * some of which becomes smaller than the tolerance. The corresponding node
-     * as then no cut sub-hyperplane anymore, but does have children. This interface
-     * specifies how to handle this situation.
-     * setting
-     * </p>
-     * @since 3.4
-     */
-    public interface VanishingCutHandler<S extends Space> {
-
-        /** Fix a node with both vanished cut and children.
-         * @param node node to fix
-         * @return fixed node
-         */
-        BSPTree<S> fixNode(BSPTree<S> node);
-
-    }
-
-    /** Split a BSP tree by an external sub-hyperplane.
-     * <p>Split a tree in two halves, on each side of the
-     * sub-hyperplane. The instance is not modified.</p>
-     * <p>The tree returned is not upward-consistent: despite all of its
-     * sub-trees cut sub-hyperplanes (including its own cut
-     * sub-hyperplane) are bounded to the current cell, it is <em>not</em>
-     * attached to any parent tree yet. This tree is intended to be
-     * later inserted into an higher level tree.</p>
-     * <p>The algorithm used here is the one given in Naylor, Amanatides
-     * and Thibault paper (section III, Binary Partitioning of a BSP
-     * Tree).</p>
-     * @param sub partitioning sub-hyperplane, must be already clipped
-     * to the convex region represented by the instance, will be used as
-     * the cut sub-hyperplane of the returned tree
-     * @return a tree having the specified sub-hyperplane as its cut
-     * sub-hyperplane, the two parts of the split instance as its two
-     * sub-trees and a null parent
-     */
-    public BSPTree<S> split(final SubHyperplane<S> sub) {
-
-        if (cut == null) {
-            return new BSPTree<S>(sub, copySelf(), new BSPTree<S>(attribute), null);
-        }
-
-        final Hyperplane<S> cHyperplane = cut.getHyperplane();
-        final Hyperplane<S> sHyperplane = sub.getHyperplane();
-        switch (sub.side(cHyperplane)) {
-        case PLUS :
-        { // the partitioning sub-hyperplane is entirely in the plus sub-tree
-            final BSPTree<S> split = plus.split(sub);
-            if (cut.side(sHyperplane) == Side.PLUS) {
-                split.plus =
-                    new BSPTree<S>(cut.copySelf(), split.plus, minus.copySelf(), attribute);
-                split.plus.condense();
-                split.plus.parent = split;
-            } else {
-                split.minus =
-                    new BSPTree<S>(cut.copySelf(), split.minus, minus.copySelf(), attribute);
-                split.minus.condense();
-                split.minus.parent = split;
-            }
-            return split;
-        }
-        case MINUS :
-        { // the partitioning sub-hyperplane is entirely in the minus sub-tree
-            final BSPTree<S> split = minus.split(sub);
-            if (cut.side(sHyperplane) == Side.PLUS) {
-                split.plus =
-                    new BSPTree<S>(cut.copySelf(), plus.copySelf(), split.plus, attribute);
-                split.plus.condense();
-                split.plus.parent = split;
-            } else {
-                split.minus =
-                    new BSPTree<S>(cut.copySelf(), plus.copySelf(), split.minus, attribute);
-                split.minus.condense();
-                split.minus.parent = split;
-            }
-            return split;
-        }
-        case BOTH :
-        {
-            final SubHyperplane.SplitSubHyperplane<S> cutParts = cut.split(sHyperplane);
-            final SubHyperplane.SplitSubHyperplane<S> subParts = sub.split(cHyperplane);
-            final BSPTree<S> split =
-                new BSPTree<S>(sub, plus.split(subParts.getPlus()), minus.split(subParts.getMinus()),
-                               null);
-            split.plus.cut          = cutParts.getPlus();
-            split.minus.cut         = cutParts.getMinus();
-            final BSPTree<S> tmp    = split.plus.minus;
-            split.plus.minus        = split.minus.plus;
-            split.plus.minus.parent = split.plus;
-            split.minus.plus        = tmp;
-            split.minus.plus.parent = split.minus;
-            split.plus.condense();
-            split.minus.condense();
-            return split;
-        }
-        default :
-            return cHyperplane.sameOrientationAs(sHyperplane) ?
-                   new BSPTree<S>(sub, plus.copySelf(),  minus.copySelf(), attribute) :
-                   new BSPTree<S>(sub, minus.copySelf(), plus.copySelf(),  attribute);
-        }
-
-    }
-
-    /** Insert the instance into another tree.
-     * <p>The instance itself is modified so its former parent should
-     * not be used anymore.</p>
-     * @param parentTree parent tree to connect to (may be null)
-     * @param isPlusChild if true and if parentTree is not null, the
-     * resulting tree should be the plus child of its parent, ignored if
-     * parentTree is null
-     * @see LeafMerger
-     * @deprecated as of 3.4, replaced with {@link #insertInTree(BSPTree, boolean, VanishingCutHandler)}
-     */
-    @Deprecated
-    public void insertInTree(final BSPTree<S> parentTree, final boolean isPlusChild) {
-        insertInTree(parentTree, isPlusChild, new VanishingCutHandler<S>() {
-            /** {@inheritDoc} */
-            public BSPTree<S> fixNode(BSPTree<S> node) {
-                // the cut should not be null
-                throw new MathIllegalStateException(LocalizedFormats.NULL_NOT_ALLOWED);
-            }
-        });
-    }
-
-    /** Insert the instance into another tree.
-     * <p>The instance itself is modified so its former parent should
-     * not be used anymore.</p>
-     * @param parentTree parent tree to connect to (may be null)
-     * @param isPlusChild if true and if parentTree is not null, the
-     * resulting tree should be the plus child of its parent, ignored if
-     * parentTree is null
-     * @param vanishingHandler handler to use for handling very rare corner
-     * cases of vanishing cut sub-hyperplanes in internal nodes during merging
-     * @see LeafMerger
-     * @since 3.4
-     */
-    public void insertInTree(final BSPTree<S> parentTree, final boolean isPlusChild,
-                             final VanishingCutHandler<S> vanishingHandler) {
-
-        // set up parent/child links
-        parent = parentTree;
-        if (parentTree != null) {
-            if (isPlusChild) {
-                parentTree.plus = this;
-            } else {
-                parentTree.minus = this;
-            }
-        }
-
-        // make sure the inserted tree lies in the cell defined by its parent nodes
-        if (cut != null) {
-
-            // explore the parent nodes from here towards tree root
-            for (BSPTree<S> tree = this; tree.parent != null; tree = tree.parent) {
-
-                // this is an hyperplane of some parent node
-                final Hyperplane<S> hyperplane = tree.parent.cut.getHyperplane();
-
-                // chop off the parts of the inserted tree that extend
-                // on the wrong side of this parent hyperplane
-                if (tree == tree.parent.plus) {
-                    cut = cut.split(hyperplane).getPlus();
-                    plus.chopOffMinus(hyperplane, vanishingHandler);
-                    minus.chopOffMinus(hyperplane, vanishingHandler);
-                } else {
-                    cut = cut.split(hyperplane).getMinus();
-                    plus.chopOffPlus(hyperplane, vanishingHandler);
-                    minus.chopOffPlus(hyperplane, vanishingHandler);
-                }
-
-                if (cut == null) {
-                    // the cut sub-hyperplane has vanished
-                    final BSPTree<S> fixed = vanishingHandler.fixNode(this);
-                    cut       = fixed.cut;
-                    plus      = fixed.plus;
-                    minus     = fixed.minus;
-                    attribute = fixed.attribute;
-                }
-
-            }
-
-            // since we may have drop some parts of the inserted tree,
-            // perform a condensation pass to keep the tree structure simple
-            condense();
-
-        }
-
-    }
-
-    /** Prune a tree around a cell.
-     * <p>
-     * This method can be used to extract a convex cell from a tree.
-     * The original cell may either be a leaf node or an internal node.
-     * If it is an internal node, it's subtree will be ignored (i.e. the
-     * extracted cell will be a leaf node in all cases). The original
-     * tree to which the original cell belongs is not touched at all,
-     * a new independent tree will be built.
-     * </p>
-     * @param cellAttribute attribute to set for the leaf node
-     * corresponding to the initial instance cell
-     * @param otherLeafsAttributes attribute to set for the other leaf
-     * nodes
-     * @param internalAttributes attribute to set for the internal nodes
-     * @return a new tree (the original tree is left untouched) containing
-     * a single branch with the cell as a leaf node, and other leaf nodes
-     * as the remnants of the pruned branches
-     * @since 3.3
-     */
-    public BSPTree<S> pruneAroundConvexCell(final Object cellAttribute,
-                                            final Object otherLeafsAttributes,
-                                            final Object internalAttributes) {
-
-        // build the current cell leaf
-        BSPTree<S> tree = new BSPTree<S>(cellAttribute);
-
-        // build the pruned tree bottom-up
-        for (BSPTree<S> current = this; current.parent != null; current = current.parent) {
-            final SubHyperplane<S> parentCut = current.parent.cut.copySelf();
-            final BSPTree<S>       sibling   = new BSPTree<S>(otherLeafsAttributes);
-            if (current == current.parent.plus) {
-                tree = new BSPTree<S>(parentCut, tree, sibling, internalAttributes);
-            } else {
-                tree = new BSPTree<S>(parentCut, sibling, tree, internalAttributes);
-            }
-        }
-
-        return tree;
-
-    }
-
-    /** Chop off parts of the tree.
-     * <p>The instance is modified in place, all the parts that are on
-     * the minus side of the chopping hyperplane are discarded, only the
-     * parts on the plus side remain.</p>
-     * @param hyperplane chopping hyperplane
-     * @param vanishingHandler handler to use for handling very rare corner
-     * cases of vanishing cut sub-hyperplanes in internal nodes during merging
-     */
-    private void chopOffMinus(final Hyperplane<S> hyperplane, final VanishingCutHandler<S> vanishingHandler) {
-        if (cut != null) {
-
-            cut = cut.split(hyperplane).getPlus();
-            plus.chopOffMinus(hyperplane, vanishingHandler);
-            minus.chopOffMinus(hyperplane, vanishingHandler);
-
-            if (cut == null) {
-                // the cut sub-hyperplane has vanished
-                final BSPTree<S> fixed = vanishingHandler.fixNode(this);
-                cut       = fixed.cut;
-                plus      = fixed.plus;
-                minus     = fixed.minus;
-                attribute = fixed.attribute;
-            }
-
-        }
-    }
-
-    /** Chop off parts of the tree.
-     * <p>The instance is modified in place, all the parts that are on
-     * the plus side of the chopping hyperplane are discarded, only the
-     * parts on the minus side remain.</p>
-     * @param hyperplane chopping hyperplane
-     * @param vanishingHandler handler to use for handling very rare corner
-     * cases of vanishing cut sub-hyperplanes in internal nodes during merging
-     */
-    private void chopOffPlus(final Hyperplane<S> hyperplane, final VanishingCutHandler<S> vanishingHandler) {
-        if (cut != null) {
-
-            cut = cut.split(hyperplane).getMinus();
-            plus.chopOffPlus(hyperplane, vanishingHandler);
-            minus.chopOffPlus(hyperplane, vanishingHandler);
-
-            if (cut == null) {
-                // the cut sub-hyperplane has vanished
-                final BSPTree<S> fixed = vanishingHandler.fixNode(this);
-                cut       = fixed.cut;
-                plus      = fixed.plus;
-                minus     = fixed.minus;
-                attribute = fixed.attribute;
-            }
-
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTreeVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTreeVisitor.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTreeVisitor.java
deleted file mode 100644
index 3d09939..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/BSPTreeVisitor.java
+++ /dev/null
@@ -1,114 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** This interface is used to visit {@link BSPTree BSP tree} nodes.
-
- * <p>Navigation through {@link BSPTree BSP trees} can be done using
- * two different point of views:</p>
- * <ul>
- *   <li>
- *     the first one is in a node-oriented way using the {@link
- *     BSPTree#getPlus}, {@link BSPTree#getMinus} and {@link
- *     BSPTree#getParent} methods. Terminal nodes without associated
- *     {@link SubHyperplane sub-hyperplanes} can be visited this way,
- *     there is no constraint in the visit order, and it is possible
- *     to visit either all nodes or only a subset of the nodes
- *   </li>
- *   <li>
- *     the second one is in a sub-hyperplane-oriented way using
- *     classes implementing this interface which obeys the visitor
- *     design pattern. The visit order is provided by the visitor as
- *     each node is first encountered. Each node is visited exactly
- *     once.
- *   </li>
- * </ul>
-
- * @param <S> Type of the space.
-
- * @see BSPTree
- * @see SubHyperplane
-
- * @since 3.0
- */
-public interface BSPTreeVisitor<S extends Space> {
-
-    /** Enumerate for visit order with respect to plus sub-tree, minus sub-tree and cut sub-hyperplane. */
-    enum Order {
-        /** Indicator for visit order plus sub-tree, then minus sub-tree,
-         * and last cut sub-hyperplane.
-         */
-        PLUS_MINUS_SUB,
-
-        /** Indicator for visit order plus sub-tree, then cut sub-hyperplane,
-         * and last minus sub-tree.
-         */
-        PLUS_SUB_MINUS,
-
-        /** Indicator for visit order minus sub-tree, then plus sub-tree,
-         * and last cut sub-hyperplane.
-         */
-        MINUS_PLUS_SUB,
-
-        /** Indicator for visit order minus sub-tree, then cut sub-hyperplane,
-         * and last plus sub-tree.
-         */
-        MINUS_SUB_PLUS,
-
-        /** Indicator for visit order cut sub-hyperplane, then plus sub-tree,
-         * and last minus sub-tree.
-         */
-        SUB_PLUS_MINUS,
-
-        /** Indicator for visit order cut sub-hyperplane, then minus sub-tree,
-         * and last plus sub-tree.
-         */
-        SUB_MINUS_PLUS;
-    }
-
-    /** Determine the visit order for this node.
-     * <p>Before attempting to visit an internal node, this method is
-     * called to determine the desired ordering of the visit. It is
-     * guaranteed that this method will be called before {@link
-     * #visitInternalNode visitInternalNode} for a given node, it will be
-     * called exactly once for each internal node.</p>
-     * @param node BSP node guaranteed to have a non null cut sub-hyperplane
-     * @return desired visit order, must be one of
-     * {@link Order#PLUS_MINUS_SUB}, {@link Order#PLUS_SUB_MINUS},
-     * {@link Order#MINUS_PLUS_SUB}, {@link Order#MINUS_SUB_PLUS},
-     * {@link Order#SUB_PLUS_MINUS}, {@link Order#SUB_MINUS_PLUS}
-     */
-    Order visitOrder(BSPTree<S> node);
-
-    /** Visit a BSP tree node node having a non-null sub-hyperplane.
-     * <p>It is guaranteed that this method will be called after {@link
-     * #visitOrder visitOrder} has been called for a given node,
-     * it wil be called exactly once for each internal node.</p>
-     * @param node BSP node guaranteed to have a non null cut sub-hyperplane
-     * @see #visitLeafNode
-     */
-    void visitInternalNode(BSPTree<S> node);
-
-    /** Visit a leaf BSP tree node node having a null sub-hyperplane.
-     * @param node leaf BSP node having a null sub-hyperplane
-     * @see #visitInternalNode
-     */
-    void visitLeafNode(BSPTree<S> node);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryAttribute.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryAttribute.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryAttribute.java
deleted file mode 100644
index dad884c..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryAttribute.java
+++ /dev/null
@@ -1,116 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** Class holding boundary attributes.
- * <p>This class is used for the attributes associated with the
- * nodes of region boundary shell trees returned by the {@link
- * Region#getTree(boolean) Region.getTree(includeBoundaryAttributes)}
- * when the boolean {@code includeBoundaryAttributes} parameter is
- * set to {@code true}. It contains the parts of the node cut
- * sub-hyperplane that belong to the boundary.</p>
- * <p>This class is a simple placeholder, it does not provide any
- * processing methods.</p>
- * @param <S> Type of the space.
- * @see Region#getTree
- * @since 3.0
- */
-public class BoundaryAttribute<S extends Space> {
-
-    /** Part of the node cut sub-hyperplane that belongs to the
-     * boundary and has the outside of the region on the plus side of
-     * its underlying hyperplane (may be null).
-     */
-    private final SubHyperplane<S> plusOutside;
-
-    /** Part of the node cut sub-hyperplane that belongs to the
-     * boundary and has the inside of the region on the plus side of
-     * its underlying hyperplane (may be null).
-     */
-    private final SubHyperplane<S> plusInside;
-
-    /** Sub-hyperplanes that were used to split the boundary part. */
-    private final NodesSet<S> splitters;
-
-    /** Simple constructor.
-     * @param plusOutside part of the node cut sub-hyperplane that
-     * belongs to the boundary and has the outside of the region on
-     * the plus side of its underlying hyperplane (may be null)
-     * @param plusInside part of the node cut sub-hyperplane that
-     * belongs to the boundary and has the inside of the region on the
-     * plus side of its underlying hyperplane (may be null)
-     * @deprecated as of 3.4, the constructor has been replaced by a new one
-     * which is not public anymore, as it is intended to be used only by
-     * {@link BoundaryBuilder}
-     */
-    @Deprecated
-    public BoundaryAttribute(final SubHyperplane<S> plusOutside,
-                             final SubHyperplane<S> plusInside) {
-        this(plusOutside, plusInside, null);
-    }
-
-    /** Simple constructor.
-     * @param plusOutside part of the node cut sub-hyperplane that
-     * belongs to the boundary and has the outside of the region on
-     * the plus side of its underlying hyperplane (may be null)
-     * @param plusInside part of the node cut sub-hyperplane that
-     * belongs to the boundary and has the inside of the region on the
-     * plus side of its underlying hyperplane (may be null)
-     * @param splitters sub-hyperplanes that were used to
-     * split the boundary part (may be null)
-     * @since 3.4
-     */
-    BoundaryAttribute(final SubHyperplane<S> plusOutside,
-                      final SubHyperplane<S> plusInside,
-                      final NodesSet<S> splitters) {
-        this.plusOutside = plusOutside;
-        this.plusInside  = plusInside;
-        this.splitters   = splitters;
-    }
-
-    /** Get the part of the node cut sub-hyperplane that belongs to the
-     * boundary and has the outside of the region on the plus side of
-     * its underlying hyperplane.
-     * @return part of the node cut sub-hyperplane that belongs to the
-     * boundary and has the outside of the region on the plus side of
-     * its underlying hyperplane
-     */
-    public SubHyperplane<S> getPlusOutside() {
-        return plusOutside;
-    }
-
-    /** Get the part of the node cut sub-hyperplane that belongs to the
-     * boundary and has the inside of the region on the plus side of
-     * its underlying hyperplane.
-     * @return part of the node cut sub-hyperplane that belongs to the
-     * boundary and has the inside of the region on the plus side of
-     * its underlying hyperplane
-     */
-    public SubHyperplane<S> getPlusInside() {
-        return plusInside;
-    }
-
-    /** Get the sub-hyperplanes that were used to split the boundary part.
-     * @return sub-hyperplanes that were used to split the boundary part
-     */
-    public NodesSet<S> getSplitters() {
-        return splitters;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryBuilder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryBuilder.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryBuilder.java
deleted file mode 100644
index cea4de3..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryBuilder.java
+++ /dev/null
@@ -1,95 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** Visitor building boundary shell tree.
- * <p>
- * The boundary shell is represented as {@link BoundaryAttribute boundary attributes}
- * at each internal node.
- * </p>
- * @param <S> Type of the space.
- * @since 3.4
- */
-class BoundaryBuilder<S extends Space> implements BSPTreeVisitor<S> {
-
-    /** {@inheritDoc} */
-    public Order visitOrder(BSPTree<S> node) {
-        return Order.PLUS_MINUS_SUB;
-    }
-
-    /** {@inheritDoc} */
-    public void visitInternalNode(BSPTree<S> node) {
-
-        SubHyperplane<S> plusOutside = null;
-        SubHyperplane<S> plusInside  = null;
-        NodesSet<S>      splitters   = null;
-
-        // characterize the cut sub-hyperplane,
-        // first with respect to the plus sub-tree
-        final Characterization<S> plusChar = new Characterization<S>(node.getPlus(), node.getCut().copySelf());
-
-        if (plusChar.touchOutside()) {
-            // plusChar.outsideTouching() corresponds to a subset of the cut sub-hyperplane
-            // known to have outside cells on its plus side, we want to check if parts
-            // of this subset do have inside cells on their minus side
-            final Characterization<S> minusChar = new Characterization<S>(node.getMinus(), plusChar.outsideTouching());
-            if (minusChar.touchInside()) {
-                // this part belongs to the boundary,
-                // it has the outside on its plus side and the inside on its minus side
-                plusOutside = minusChar.insideTouching();
-                splitters = new NodesSet<S>();
-                splitters.addAll(minusChar.getInsideSplitters());
-                splitters.addAll(plusChar.getOutsideSplitters());
-            }
-        }
-
-        if (plusChar.touchInside()) {
-            // plusChar.insideTouching() corresponds to a subset of the cut sub-hyperplane
-            // known to have inside cells on its plus side, we want to check if parts
-            // of this subset do have outside cells on their minus side
-            final Characterization<S> minusChar = new Characterization<S>(node.getMinus(), plusChar.insideTouching());
-            if (minusChar.touchOutside()) {
-                // this part belongs to the boundary,
-                // it has the inside on its plus side and the outside on its minus side
-                plusInside = minusChar.outsideTouching();
-                if (splitters == null) {
-                    splitters = new NodesSet<S>();
-                }
-                splitters.addAll(minusChar.getOutsideSplitters());
-                splitters.addAll(plusChar.getInsideSplitters());
-            }
-        }
-
-        if (splitters != null) {
-            // the parent nodes are natural splitters for boundary sub-hyperplanes
-            for (BSPTree<S> up = node.getParent(); up != null; up = up.getParent()) {
-                splitters.add(up);
-            }
-        }
-
-        // set the boundary attribute at non-leaf nodes
-        node.setAttribute(new BoundaryAttribute<S>(plusOutside, plusInside, splitters));
-
-    }
-
-    /** {@inheritDoc} */
-    public void visitLeafNode(BSPTree<S> node) {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjection.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjection.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjection.java
deleted file mode 100644
index 03526e4..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjection.java
+++ /dev/null
@@ -1,83 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/** Class holding the result of point projection on region boundary.
- * <p>This class is a simple placeholder, it does not provide any
- * processing methods.</p>
- * <p>Instances of this class are guaranteed to be immutable</p>
- * @param <S> Type of the space.
- * @since 3.3
- * @see AbstractRegion#projectToBoundary(Point)
- */
-public class BoundaryProjection<S extends Space> {
-
-    /** Original point. */
-    private final Point<S> original;
-
-    /** Projected point. */
-    private final Point<S> projected;
-
-    /** Offset of the point with respect to the boundary it is projected on. */
-    private final double offset;
-
-    /** Constructor from raw elements.
-     * @param original original point
-     * @param projected projected point
-     * @param offset offset of the point with respect to the boundary it is projected on
-     */
-    public BoundaryProjection(final Point<S> original, final Point<S> projected, final double offset) {
-        this.original  = original;
-        this.projected = projected;
-        this.offset    = offset;
-    }
-
-    /** Get the original point.
-     * @return original point
-     */
-    public Point<S> getOriginal() {
-        return original;
-    }
-
-    /** Projected point.
-     * @return projected point, or null if there are no boundary
-     */
-    public Point<S> getProjected() {
-        return projected;
-    }
-
-    /** Offset of the point with respect to the boundary it is projected on.
-     * <p>
-     * The offset with respect to the boundary is negative if the {@link
-     * #getOriginal() original point} is inside the region, and positive otherwise.
-     * </p>
-     * <p>
-     * If there are no boundary, the value is set to either {@code
-     * Double.POSITIVE_INFINITY} if the region is empty (i.e. all points are
-     * outside of the region) or {@code Double.NEGATIVE_INFINITY} if the region
-     * covers the whole space (i.e. all points are inside of the region).
-     * </p>
-     * @return offset of the point with respect to the boundary it is projected on
-     */
-    public double getOffset() {
-        return offset;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjector.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjector.java
deleted file mode 100644
index 9f660bf..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundaryProjector.java
+++ /dev/null
@@ -1,200 +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.geometry.partitioning;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.util.FastMath;
-
-/** Local tree visitor to compute projection on boundary.
- * @param <S> Type of the space.
- * @param <T> Type of the sub-space.
- * @since 3.3
- */
-class BoundaryProjector<S extends Space, T extends Space> implements BSPTreeVisitor<S> {
-
-    /** Original point. */
-    private final Point<S> original;
-
-    /** Current best projected point. */
-    private Point<S> projected;
-
-    /** Leaf node closest to the test point. */
-    private BSPTree<S> leaf;
-
-    /** Current offset. */
-    private double offset;
-
-    /** Simple constructor.
-     * @param original original point
-     */
-    public BoundaryProjector(final Point<S> original) {
-        this.original  = original;
-        this.projected = null;
-        this.leaf      = null;
-        this.offset    = Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public Order visitOrder(final BSPTree<S> node) {
-        // we want to visit the tree so that the first encountered
-        // leaf is the one closest to the test point
-        if (node.getCut().getHyperplane().getOffset(original) <= 0) {
-            return Order.MINUS_SUB_PLUS;
-        } else {
-            return Order.PLUS_SUB_MINUS;
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void visitInternalNode(final BSPTree<S> node) {
-
-        // project the point on the cut sub-hyperplane
-        final Hyperplane<S> hyperplane = node.getCut().getHyperplane();
-        final double signedOffset = hyperplane.getOffset(original);
-        if (FastMath.abs(signedOffset) < offset) {
-
-            // project point
-            final Point<S> regular = hyperplane.project(original);
-
-            // get boundary parts
-            final List<Region<T>> boundaryParts = boundaryRegions(node);
-
-            // check if regular projection really belongs to the boundary
-            boolean regularFound = false;
-            for (final Region<T> part : boundaryParts) {
-                if (!regularFound && belongsToPart(regular, hyperplane, part)) {
-                    // the projected point lies in the boundary
-                    projected    = regular;
-                    offset       = FastMath.abs(signedOffset);
-                    regularFound = true;
-                }
-            }
-
-            if (!regularFound) {
-                // the regular projected point is not on boundary,
-                // so we have to check further if a singular point
-                // (i.e. a vertex in 2D case) is a possible projection
-                for (final Region<T> part : boundaryParts) {
-                    final Point<S> spI = singularProjection(regular, hyperplane, part);
-                    if (spI != null) {
-                        final double distance = original.distance(spI);
-                        if (distance < offset) {
-                            projected = spI;
-                            offset    = distance;
-                        }
-                    }
-                }
-
-            }
-
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public void visitLeafNode(final BSPTree<S> node) {
-        if (leaf == null) {
-            // this is the first leaf we visit,
-            // it is the closest one to the original point
-            leaf = node;
-        }
-    }
-
-    /** Get the projection.
-     * @return projection
-     */
-    public BoundaryProjection<S> getProjection() {
-
-        // fix offset sign
-        offset = FastMath.copySign(offset, (Boolean) leaf.getAttribute() ? -1 : +1);
-
-        return new BoundaryProjection<S>(original, projected, offset);
-
-    }
-
-    /** Extract the regions of the boundary on an internal node.
-     * @param node internal node
-     * @return regions in the node sub-hyperplane
-     */
-    private List<Region<T>> boundaryRegions(final BSPTree<S> node) {
-
-        final List<Region<T>> regions = new ArrayList<Region<T>>(2);
-
-        @SuppressWarnings("unchecked")
-        final BoundaryAttribute<S> ba = (BoundaryAttribute<S>) node.getAttribute();
-        addRegion(ba.getPlusInside(),  regions);
-        addRegion(ba.getPlusOutside(), regions);
-
-        return regions;
-
-    }
-
-    /** Add a boundary region to a list.
-     * @param sub sub-hyperplane defining the region
-     * @param list to fill up
-     */
-    private void addRegion(final SubHyperplane<S> sub, final List<Region<T>> list) {
-        if (sub != null) {
-            @SuppressWarnings("unchecked")
-            final Region<T> region = ((AbstractSubHyperplane<S, T>) sub).getRemainingRegion();
-            if (region != null) {
-                list.add(region);
-            }
-        };
-    }
-
-    /** Check if a projected point lies on a boundary part.
-     * @param point projected point to check
-     * @param hyperplane hyperplane into which the point was projected
-     * @param part boundary part
-     * @return true if point lies on the boundary part
-     */
-    private boolean belongsToPart(final Point<S> point, final Hyperplane<S> hyperplane,
-                                  final Region<T> part) {
-
-        // there is a non-null sub-space, we can dive into smaller dimensions
-        @SuppressWarnings("unchecked")
-        final Embedding<S, T> embedding = (Embedding<S, T>) hyperplane;
-        return part.checkPoint(embedding.toSubSpace(point)) != Location.OUTSIDE;
-
-    }
-
-    /** Get the projection to the closest boundary singular point.
-     * @param point projected point to check
-     * @param hyperplane hyperplane into which the point was projected
-     * @param part boundary part
-     * @return projection to a singular point of boundary part (may be null)
-     */
-    private Point<S> singularProjection(final Point<S> point, final Hyperplane<S> hyperplane,
-                                        final Region<T> part) {
-
-        // there is a non-null sub-space, we can dive into smaller dimensions
-        @SuppressWarnings("unchecked")
-        final Embedding<S, T> embedding = (Embedding<S, T>) hyperplane;
-        final BoundaryProjection<T> bp = part.projectToBoundary(embedding.toSubSpace(point));
-
-        // back to initial dimension
-        return (bp.getProjected() == null) ? null : embedding.toSpace(bp.getProjected());
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundarySizeVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundarySizeVisitor.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundarySizeVisitor.java
deleted file mode 100644
index e29083a..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/BoundarySizeVisitor.java
+++ /dev/null
@@ -1,65 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** Visitor computing the boundary size.
- * @param <S> Type of the space.
- * @since 3.0
- */
-class BoundarySizeVisitor<S extends Space> implements BSPTreeVisitor<S> {
-
-    /** Size of the boundary. */
-    private double boundarySize;
-
-    /** Simple constructor.
-     */
-    public BoundarySizeVisitor() {
-        boundarySize = 0;
-    }
-
-    /** {@inheritDoc}*/
-    public Order visitOrder(final BSPTree<S> node) {
-        return Order.MINUS_SUB_PLUS;
-    }
-
-    /** {@inheritDoc}*/
-    public void visitInternalNode(final BSPTree<S> node) {
-        @SuppressWarnings("unchecked")
-        final BoundaryAttribute<S> attribute =
-            (BoundaryAttribute<S>) node.getAttribute();
-        if (attribute.getPlusOutside() != null) {
-            boundarySize += attribute.getPlusOutside().getSize();
-        }
-        if (attribute.getPlusInside() != null) {
-            boundarySize += attribute.getPlusInside().getSize();
-        }
-    }
-
-    /** {@inheritDoc}*/
-    public void visitLeafNode(final BSPTree<S> node) {
-    }
-
-    /** Get the size of the boundary.
-     * @return size of the boundary
-     */
-    public double getSize() {
-        return boundarySize;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/Characterization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/Characterization.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/Characterization.java
deleted file mode 100644
index 58efe0f..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/Characterization.java
+++ /dev/null
@@ -1,190 +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.geometry.partitioning;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.geometry.Space;
-
-/** Cut sub-hyperplanes characterization with respect to inside/outside cells.
- * @see BoundaryBuilder
- * @param <S> Type of the space.
- * @since 3.4
- */
-class Characterization<S extends Space> {
-
-    /** Part of the cut sub-hyperplane that touch outside cells. */
-    private SubHyperplane<S> outsideTouching;
-
-    /** Part of the cut sub-hyperplane that touch inside cells. */
-    private SubHyperplane<S> insideTouching;
-
-    /** Nodes that were used to split the outside touching part. */
-    private final NodesSet<S> outsideSplitters;
-
-    /** Nodes that were used to split the outside touching part. */
-    private final NodesSet<S> insideSplitters;
-
-    /** Simple constructor.
-     * <p>Characterization consists in splitting the specified
-     * sub-hyperplane into several parts lying in inside and outside
-     * cells of the tree. The principle is to compute characterization
-     * twice for each cut sub-hyperplane in the tree, once on the plus
-     * node and once on the minus node. The parts that have the same flag
-     * (inside/inside or outside/outside) do not belong to the boundary
-     * while parts that have different flags (inside/outside or
-     * outside/inside) do belong to the boundary.</p>
-     * @param node current BSP tree node
-     * @param sub sub-hyperplane to characterize
-     */
-    public Characterization(final BSPTree<S> node, final SubHyperplane<S> sub) {
-        outsideTouching  = null;
-        insideTouching   = null;
-        outsideSplitters = new NodesSet<S>();
-        insideSplitters  = new NodesSet<S>();
-        characterize(node, sub, new ArrayList<BSPTree<S>>());
-    }
-
-    /** Filter the parts of an hyperplane belonging to the boundary.
-     * <p>The filtering consist in splitting the specified
-     * sub-hyperplane into several parts lying in inside and outside
-     * cells of the tree. The principle is to call this method twice for
-     * each cut sub-hyperplane in the tree, once on the plus node and
-     * once on the minus node. The parts that have the same flag
-     * (inside/inside or outside/outside) do not belong to the boundary
-     * while parts that have different flags (inside/outside or
-     * outside/inside) do belong to the boundary.</p>
-     * @param node current BSP tree node
-     * @param sub sub-hyperplane to characterize
-     * @param splitters nodes that did split the current one
-     */
-    private void characterize(final BSPTree<S> node, final SubHyperplane<S> sub,
-                              final List<BSPTree<S>> splitters) {
-        if (node.getCut() == null) {
-            // we have reached a leaf node
-            final boolean inside = (Boolean) node.getAttribute();
-            if (inside) {
-                addInsideTouching(sub, splitters);
-            } else {
-                addOutsideTouching(sub, splitters);
-            }
-        } else {
-            final Hyperplane<S> hyperplane = node.getCut().getHyperplane();
-            switch (sub.side(hyperplane)) {
-            case PLUS:
-                characterize(node.getPlus(),  sub, splitters);
-                break;
-            case MINUS:
-                characterize(node.getMinus(), sub, splitters);
-                break;
-            case BOTH:
-                final SubHyperplane.SplitSubHyperplane<S> split = sub.split(hyperplane);
-                splitters.add(node);
-                characterize(node.getPlus(),  split.getPlus(),  splitters);
-                characterize(node.getMinus(), split.getMinus(), splitters);
-                splitters.remove(splitters.size() - 1);
-                break;
-            default:
-                // this should not happen
-                throw new MathInternalError();
-            }
-        }
-    }
-
-    /** Add a part of the cut sub-hyperplane known to touch an outside cell.
-     * @param sub part of the cut sub-hyperplane known to touch an outside cell
-     * @param splitters sub-hyperplanes that did split the current one
-     */
-    private void addOutsideTouching(final SubHyperplane<S> sub,
-                                    final List<BSPTree<S>> splitters) {
-        if (outsideTouching == null) {
-            outsideTouching = sub;
-        } else {
-            outsideTouching = outsideTouching.reunite(sub);
-        }
-        outsideSplitters.addAll(splitters);
-    }
-
-    /** Add a part of the cut sub-hyperplane known to touch an inside cell.
-     * @param sub part of the cut sub-hyperplane known to touch an inside cell
-     * @param splitters sub-hyperplanes that did split the current one
-     */
-    private void addInsideTouching(final SubHyperplane<S> sub,
-                                   final List<BSPTree<S>> splitters) {
-        if (insideTouching == null) {
-            insideTouching = sub;
-        } else {
-            insideTouching = insideTouching.reunite(sub);
-        }
-        insideSplitters.addAll(splitters);
-    }
-
-    /** Check if the cut sub-hyperplane touches outside cells.
-     * @return true if the cut sub-hyperplane touches outside cells
-     */
-    public boolean touchOutside() {
-        return outsideTouching != null && !outsideTouching.isEmpty();
-    }
-
-    /** Get all the parts of the cut sub-hyperplane known to touch outside cells.
-     * @return parts of the cut sub-hyperplane known to touch outside cells
-     * (may be null or empty)
-     */
-    public SubHyperplane<S> outsideTouching() {
-        return outsideTouching;
-    }
-
-    /** Get the nodes that were used to split the outside touching part.
-     * <p>
-     * Splitting nodes are internal nodes (i.e. they have a non-null
-     * cut sub-hyperplane).
-     * </p>
-     * @return nodes that were used to split the outside touching part
-     */
-    public NodesSet<S> getOutsideSplitters() {
-        return outsideSplitters;
-    }
-
-    /** Check if the cut sub-hyperplane touches inside cells.
-     * @return true if the cut sub-hyperplane touches inside cells
-     */
-    public boolean touchInside() {
-        return insideTouching != null && !insideTouching.isEmpty();
-    }
-
-    /** Get all the parts of the cut sub-hyperplane known to touch inside cells.
-     * @return parts of the cut sub-hyperplane known to touch inside cells
-     * (may be null or empty)
-     */
-    public SubHyperplane<S> insideTouching() {
-        return insideTouching;
-    }
-
-    /** Get the nodes that were used to split the inside touching part.
-     * <p>
-     * Splitting nodes are internal nodes (i.e. they have a non-null
-     * cut sub-hyperplane).
-     * </p>
-     * @return nodes that were used to split the inside touching part
-     */
-    public NodesSet<S> getInsideSplitters() {
-        return insideSplitters;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/Embedding.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/Embedding.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/Embedding.java
deleted file mode 100644
index 74e2c00..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/Embedding.java
+++ /dev/null
@@ -1,68 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/** This interface defines mappers between a space and one of its sub-spaces.
-
- * <p>Sub-spaces are the lower dimensions subsets of a n-dimensions
- * space. The (n-1)-dimension sub-spaces are specific sub-spaces known
- * as {@link Hyperplane hyperplanes}. This interface can be used regardless
- * of the dimensions differences. As an example, {@link
- * org.apache.commons.math3.geometry.euclidean.threed.Line Line} in 3D
- * implements Embedding<{@link
- * org.apache.commons.math3.geometry.euclidean.threed.Vector3D Vector3D}, {link
- * org.apache.commons.math3.geometry.euclidean.oned.Vector1D Vector1D>, i.e. it
- * maps directly dimensions 3 and 1.</p>
-
- * <p>In the 3D euclidean space, hyperplanes are 2D planes, and the 1D
- * sub-spaces are lines.</p>
-
- * <p>
- * Note that this interface is <em>not</em> intended to be implemented
- * by Apache Commons Math users, it is only intended to be implemented
- * within the library itself. New methods may be added even for minor
- * versions, which breaks compatibility for external implementations.
- * </p>
-
- * @param <S> Type of the embedding space.
- * @param <T> Type of the embedded sub-space.
-
- * @see Hyperplane
- * @since 3.0
- */
-public interface Embedding<S extends Space, T extends Space> {
-
-    /** Transform a space point into a sub-space point.
-     * @param point n-dimension point of the space
-     * @return (n-1)-dimension point of the sub-space corresponding to
-     * the specified space point
-     * @see #toSpace
-     */
-    Point<T> toSubSpace(Point<S> point);
-
-    /** Transform a sub-space point into a space point.
-     * @param point (n-1)-dimension point of the sub-space
-     * @return n-dimension point of the space corresponding to the
-     * specified sub-space point
-     * @see #toSubSpace
-     */
-    Point<S> toSpace(Point<T> point);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/Hyperplane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/Hyperplane.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/Hyperplane.java
deleted file mode 100644
index f90c3bc..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/Hyperplane.java
+++ /dev/null
@@ -1,98 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/** This interface represents an hyperplane of a space.
-
- * <p>The most prominent place where hyperplane appears in space
- * partitioning is as cutters. Each partitioning node in a {@link
- * BSPTree BSP tree} has a cut {@link SubHyperplane sub-hyperplane}
- * which is either an hyperplane or a part of an hyperplane. In an
- * n-dimensions euclidean space, an hyperplane is an (n-1)-dimensions
- * hyperplane (for example a traditional plane in the 3D euclidean
- * space). They can be more exotic objects in specific fields, for
- * example a circle on the surface of the unit sphere.</p>
-
- * <p>
- * Note that this interface is <em>not</em> intended to be implemented
- * by Apache Commons Math users, it is only intended to be implemented
- * within the library itself. New methods may be added even for minor
- * versions, which breaks compatibility for external implementations.
- * </p>
-
- * @param <S> Type of the space.
-
- * @since 3.0
- */
-public interface Hyperplane<S extends Space> {
-
-    /** Copy the instance.
-     * <p>The instance created is completely independant of the original
-     * one. A deep copy is used, none of the underlying objects are
-     * shared (except for immutable objects).</p>
-     * @return a new hyperplane, copy of the instance
-     */
-    Hyperplane<S> copySelf();
-
-    /** Get the offset (oriented distance) of a point.
-     * <p>The offset is 0 if the point is on the underlying hyperplane,
-     * it is positive if the point is on one particular side of the
-     * hyperplane, and it is negative if the point is on the other side,
-     * according to the hyperplane natural orientation.</p>
-     * @param point point to check
-     * @return offset of the point
-     */
-    double getOffset(Point<S> point);
-
-    /** Project a point to the hyperplane.
-     * @param point point to project
-     * @return projected point
-     * @since 3.3
-     */
-    Point<S> project(Point<S> point);
-
-    /** Get the tolerance below which points are considered to belong to the hyperplane.
-     * @return tolerance below which points are considered to belong to the hyperplane
-     * @since 3.3
-     */
-    double getTolerance();
-
-    /** Check if the instance has the same orientation as another hyperplane.
-     * <p>This method is expected to be called on parallel hyperplanes. The
-     * method should <em>not</em> re-check for parallelism, only for
-     * orientation, typically by testing something like the sign of the
-     * dot-products of normals.</p>
-     * @param other other hyperplane to check against the instance
-     * @return true if the instance and the other hyperplane have
-     * the same orientation
-     */
-    boolean sameOrientationAs(Hyperplane<S> other);
-
-    /** Build a sub-hyperplane covering the whole hyperplane.
-     * @return a sub-hyperplane covering the whole hyperplane
-     */
-    SubHyperplane<S> wholeHyperplane();
-
-    /** Build a region covering the whole space.
-     * @return a region containing the instance
-     */
-    Region<S> wholeSpace();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/InsideFinder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/InsideFinder.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/InsideFinder.java
deleted file mode 100644
index 2b0b405..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/InsideFinder.java
+++ /dev/null
@@ -1,150 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** Utility class checking if inside nodes can be found
- * on the plus and minus sides of an hyperplane.
- * @param <S> Type of the space.
- * @since 3.4
- */
-class InsideFinder<S extends Space> {
-
-    /** Region on which to operate. */
-    private final Region<S> region;
-
-    /** Indicator of inside leaf nodes found on the plus side. */
-    private boolean plusFound;
-
-    /** Indicator of inside leaf nodes found on the plus side. */
-    private boolean minusFound;
-
-    /** Simple constructor.
-     * @param region region on which to operate
-     */
-    public InsideFinder(final Region<S> region) {
-        this.region = region;
-        plusFound  = false;
-        minusFound = false;
-    }
-
-    /** Search recursively for inside leaf nodes on each side of the given hyperplane.
-
-     * <p>The algorithm used here is directly derived from the one
-     * described in section III (<i>Binary Partitioning of a BSP
-     * Tree</i>) of the Bruce Naylor, John Amanatides and William
-     * Thibault paper <a
-     * href="http://www.cs.yorku.ca/~amana/research/bsptSetOp.pdf">Merging
-     * BSP Trees Yields Polyhedral Set Operations</a> Proc. Siggraph
-     * '90, Computer Graphics 24(4), August 1990, pp 115-124, published
-     * by the Association for Computing Machinery (ACM)..</p>
-
-     * @param node current BSP tree node
-     * @param sub sub-hyperplane
-     */
-    public void recurseSides(final BSPTree<S> node, final SubHyperplane<S> sub) {
-
-        if (node.getCut() == null) {
-            if ((Boolean) node.getAttribute()) {
-                // this is an inside cell expanding across the hyperplane
-                plusFound  = true;
-                minusFound = true;
-            }
-            return;
-        }
-
-        final Hyperplane<S> hyperplane = node.getCut().getHyperplane();
-        switch (sub.side(hyperplane)) {
-        case PLUS :
-            // the sub-hyperplane is entirely in the plus sub-tree
-            if (node.getCut().side(sub.getHyperplane()) == Side.PLUS) {
-                if (!region.isEmpty(node.getMinus())) {
-                    plusFound  = true;
-                }
-            } else {
-                if (!region.isEmpty(node.getMinus())) {
-                    minusFound = true;
-                }
-            }
-            if (!(plusFound && minusFound)) {
-                recurseSides(node.getPlus(), sub);
-            }
-            break;
-        case MINUS :
-            // the sub-hyperplane is entirely in the minus sub-tree
-            if (node.getCut().side(sub.getHyperplane()) == Side.PLUS) {
-                if (!region.isEmpty(node.getPlus())) {
-                    plusFound  = true;
-                }
-            } else {
-                if (!region.isEmpty(node.getPlus())) {
-                    minusFound = true;
-                }
-            }
-            if (!(plusFound && minusFound)) {
-                recurseSides(node.getMinus(), sub);
-            }
-            break;
-        case BOTH :
-            // the sub-hyperplane extends in both sub-trees
-            final SubHyperplane.SplitSubHyperplane<S> split = sub.split(hyperplane);
-
-            // explore first the plus sub-tree
-            recurseSides(node.getPlus(), split.getPlus());
-
-            // if needed, explore the minus sub-tree
-            if (!(plusFound && minusFound)) {
-                recurseSides(node.getMinus(), split.getMinus());
-            }
-            break;
-        default :
-            // the sub-hyperplane and the cut sub-hyperplane share the same hyperplane
-            if (node.getCut().getHyperplane().sameOrientationAs(sub.getHyperplane())) {
-                if ((node.getPlus().getCut() != null) || ((Boolean) node.getPlus().getAttribute())) {
-                    plusFound  = true;
-                }
-                if ((node.getMinus().getCut() != null) || ((Boolean) node.getMinus().getAttribute())) {
-                    minusFound = true;
-                }
-            } else {
-                if ((node.getPlus().getCut() != null) || ((Boolean) node.getPlus().getAttribute())) {
-                    minusFound = true;
-                }
-                if ((node.getMinus().getCut() != null) || ((Boolean) node.getMinus().getAttribute())) {
-                    plusFound  = true;
-                }
-            }
-        }
-
-    }
-
-    /** Check if inside leaf nodes have been found on the plus side.
-     * @return true if inside leaf nodes have been found on the plus side
-     */
-    public boolean plusFound() {
-        return plusFound;
-    }
-
-    /** Check if inside leaf nodes have been found on the minus side.
-     * @return true if inside leaf nodes have been found on the minus side
-     */
-    public boolean minusFound() {
-        return minusFound;
-    }
-
-}


[52/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/MathArraysTest.java b/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
index e4918ce..71d75b9 100644
--- a/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
+++ b/src/test/java/org/apache/commons/math4/util/MathArraysTest.java
@@ -11,21 +11,24 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NotANumberException;
-import org.apache.commons.math3.random.Well1024a;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/MathUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/MathUtilsTest.java b/src/test/java/org/apache/commons/math4/util/MathUtilsTest.java
index 2089bf5..b9beee3 100644
--- a/src/test/java/org/apache/commons/math4/util/MathUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/util/MathUtilsTest.java
@@ -11,15 +11,17 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.util;
-
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotFiniteNumberException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomDataGenerator;
+package org.apache.commons.math4.util;
+
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomDataGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/MultidimensionalCounterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/MultidimensionalCounterTest.java b/src/test/java/org/apache/commons/math4/util/MultidimensionalCounterTest.java
index 4f88d96..9966810 100644
--- a/src/test/java/org/apache/commons/math4/util/MultidimensionalCounterTest.java
+++ b/src/test/java/org/apache/commons/math4/util/MultidimensionalCounterTest.java
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.NoSuchElementException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.MultidimensionalCounter;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
index 2e3d72b..0841868 100644
--- a/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
+++ b/src/test/java/org/apache/commons/math4/util/OpenIntToDoubleHashMapTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.ConcurrentModificationException;
 import java.util.HashMap;
@@ -24,6 +24,8 @@ import java.util.NoSuchElementException;
 import java.util.Random;
 import java.util.Set;
 
+import org.apache.commons.math4.util.OpenIntToDoubleHashMap;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java b/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
index 3a5ea08..6df12dd 100644
--- a/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
+++ b/src/test/java/org/apache/commons/math4/util/OpenIntToFieldTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.ConcurrentModificationException;
 import java.util.HashMap;
@@ -25,10 +25,11 @@ import java.util.Random;
 import java.util.Set;
 import java.util.Map.Entry;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionConversionException;
-import org.apache.commons.math3.fraction.FractionField;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.util.OpenIntToFieldHashMap;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/PairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/PairTest.java b/src/test/java/org/apache/commons/math4/util/PairTest.java
index 73d1fdb..904c93c 100644
--- a/src/test/java/org/apache/commons/math4/util/PairTest.java
+++ b/src/test/java/org/apache/commons/math4/util/PairTest.java
@@ -11,8 +11,9 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
+import org.apache.commons.math4.util.Pair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/PrecisionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/PrecisionTest.java b/src/test/java/org/apache/commons/math4/util/PrecisionTest.java
index 12a520e..3d133d7 100644
--- a/src/test/java/org/apache/commons/math4/util/PrecisionTest.java
+++ b/src/test/java/org/apache/commons/math4/util/PrecisionTest.java
@@ -11,13 +11,15 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.math.BigDecimal;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.TestUtils;
 
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/ResizableDoubleArrayTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/ResizableDoubleArrayTest.java b/src/test/java/org/apache/commons/math4/util/ResizableDoubleArrayTest.java
index 6d9d244..c91de57 100644
--- a/src/test/java/org/apache/commons/math4/util/ResizableDoubleArrayTest.java
+++ b/src/test/java/org/apache/commons/math4/util/ResizableDoubleArrayTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
-
-import org.apache.commons.math3.distribution.IntegerDistribution;
-import org.apache.commons.math3.distribution.UniformIntegerDistribution;
+package org.apache.commons.math4.util;
 
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.UniformIntegerDistribution;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.ResizableDoubleArray;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/TestBean.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/TestBean.java b/src/test/java/org/apache/commons/math4/util/TestBean.java
index ee3b70e..627a20b 100644
--- a/src/test/java/org/apache/commons/math4/util/TestBean.java
+++ b/src/test/java/org/apache/commons/math4/util/TestBean.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/util/TransformerMapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/util/TransformerMapTest.java b/src/test/java/org/apache/commons/math4/util/TransformerMapTest.java
index 11fe5ef..796ec69 100644
--- a/src/test/java/org/apache/commons/math4/util/TransformerMapTest.java
+++ b/src/test/java/org/apache/commons/math4/util/TransformerMapTest.java
@@ -15,9 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.util.DefaultTransformer;
+import org.apache.commons.math4.util.NumberTransformer;
+import org.apache.commons.math4.util.TransformerMap;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/maxima/special/RealFunctionValidation/README.txt
----------------------------------------------------------------------
diff --git a/src/test/maxima/special/RealFunctionValidation/README.txt b/src/test/maxima/special/RealFunctionValidation/README.txt
index a9a2d46..dc346e3 100644
--- a/src/test/maxima/special/RealFunctionValidation/README.txt
+++ b/src/test/maxima/special/RealFunctionValidation/README.txt
@@ -42,7 +42,7 @@ Compile the source file. The jar file of Commons-Math3 should be included in
 your classpath. If it is installed in your local maven repository, the
 following command should work
 
-  javac -classpath $HOME/.m2/repository/org/apache/commons/commons-math3/3.1-SNAPSHOT/commons-math3-3.1-SNAPSHOT.jar RealFunctionValidation.java
+  javac -classpath $HOME/.m2/repository/org/apache/commons/commons-math4/4.0-SNAPSHOT/commons-math4-4.0-SNAPSHOT.jar RealFunctionValidation.java
 
 Create a jar file
 
@@ -99,7 +99,7 @@ file
 As an example, here is the properties file for evaluation of
 double Gamma.logGamma(double)
 
-method=org.apache.commons.math3.special.Gamma.logGamma
+method=org.apache.commons.math4.special.Gamma.logGamma
 signature=double
 inputFileMask=logGamma-%02d.dat
 outputFileMask=logGamma-out-%02d.dat

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java
----------------------------------------------------------------------
diff --git a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java b/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java
index a9ef129..873e5c4 100755
--- a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java
+++ b/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.java
@@ -28,8 +28,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 
 /*
  * plot 'logGamma.dat' binary format="%double%double" endian=big u 1:2 w l

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh
----------------------------------------------------------------------
diff --git a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh b/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh
index 2cf3037..ec49121 100755
--- a/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh
+++ b/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.sh
@@ -15,10 +15,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Location of the Commons-Math3 jar file
-CM3_JAR=$HOME/.m2/repository/org/apache/commons/commons-math3/3.1-SNAPSHOT/commons-math3-3.1-SNAPSHOT.jar
+# Location of the Commons-Math4 jar file
+CM4_JAR=$HOME/.m2/repository/org/apache/commons/commons-math4/4.0-SNAPSHOT/commons-math4-4.0-SNAPSHOT.jar
 
 # Location of file RealFunctionValidation.jar
-APP_JAR=$HOME/Documents/workspace/commons-math3/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.jar
+APP_JAR=$HOME/Documents/workspace/commons-math4/src/test/maxima/special/RealFunctionValidation/RealFunctionValidation.jar
 
-java -cp $CM3_JAR:$APP_JAR RealFunctionValidation $1
\ No newline at end of file
+java -cp $CM4_JAR:$APP_JAR RealFunctionValidation $1
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/maxima/special/reference/gamma.properties
----------------------------------------------------------------------
diff --git a/src/test/maxima/special/reference/gamma.properties b/src/test/maxima/special/reference/gamma.properties
index 296ee28..8a13d13 100755
--- a/src/test/maxima/special/reference/gamma.properties
+++ b/src/test/maxima/special/reference/gamma.properties
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-method=org.apache.commons.math3.special.Gamma.gamma
+method=org.apache.commons.math4.special.Gamma.gamma
 signature=double
 inputFileMask=gamma-%02d.dat
 outputFileMask=gamma-out-%02d.dat

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/maxima/special/reference/logBeta.properties
----------------------------------------------------------------------
diff --git a/src/test/maxima/special/reference/logBeta.properties b/src/test/maxima/special/reference/logBeta.properties
index 7b79f60..ecc5751 100755
--- a/src/test/maxima/special/reference/logBeta.properties
+++ b/src/test/maxima/special/reference/logBeta.properties
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-method=org.apache.commons.math3.special.Beta.logBeta
+method=org.apache.commons.math4.special.Beta.logBeta
 signature=double, double
 inputFileMask=logBeta-%02d.dat
 outputFileMask=logBeta-out-%02d.dat

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/maxima/special/reference/logGamma.properties
----------------------------------------------------------------------
diff --git a/src/test/maxima/special/reference/logGamma.properties b/src/test/maxima/special/reference/logGamma.properties
index aac96de..4608031 100755
--- a/src/test/maxima/special/reference/logGamma.properties
+++ b/src/test/maxima/special/reference/logGamma.properties
@@ -14,7 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-method=org.apache.commons.math3.special.Gamma.logGamma
+method=org.apache.commons.math4.special.Gamma.logGamma
 signature=double
 inputFileMask=logGamma-%02d.dat
 outputFileMask=logGamma-out-%02d.dat

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/README
----------------------------------------------------------------------
diff --git a/src/userguide/README b/src/userguide/README
index 2bf7766..9aa0238 100644
--- a/src/userguide/README
+++ b/src/userguide/README
@@ -1,8 +1,8 @@
 This directory contains source code that is not part of the Apache
-Commons Math library.  It contains syntaxically correct and working
+Commons Math library.  It contains syntactically correct and working
 examples of use.
 
 In order to run one of the applications (a class that must contain a
 "main" method), you would type (in a shell console) a command similar
 to the following:
- $ mvn -q exec:java -Dexec.mainClass=org.apache.commons.math3.userguide.sofm.ChineseRingsClassifier
+ $ mvn -q exec:java -Dexec.mainClass=org.apache.commons.math4.userguide.sofm.ChineseRingsClassifier

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java b/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
index 946d39c..b85b2ef 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/ClusterAlgorithmComparison.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide;
+package org.apache.commons.math4.userguide;
 
 import java.awt.Color;
 import java.awt.Dimension;
@@ -34,23 +34,23 @@ import java.util.List;
 import javax.swing.JComponent;
 import javax.swing.JLabel;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.ml.clustering.CentroidCluster;
-import org.apache.commons.math3.ml.clustering.Cluster;
-import org.apache.commons.math3.ml.clustering.Clusterable;
-import org.apache.commons.math3.ml.clustering.Clusterer;
-import org.apache.commons.math3.ml.clustering.DBSCANClusterer;
-import org.apache.commons.math3.ml.clustering.DoublePoint;
-import org.apache.commons.math3.ml.clustering.FuzzyKMeansClusterer;
-import org.apache.commons.math3.ml.clustering.KMeansPlusPlusClusterer;
-import org.apache.commons.math3.random.RandomAdaptor;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.SobolSequenceGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.ml.clustering.CentroidCluster;
+import org.apache.commons.math4.ml.clustering.Cluster;
+import org.apache.commons.math4.ml.clustering.Clusterable;
+import org.apache.commons.math4.ml.clustering.Clusterer;
+import org.apache.commons.math4.ml.clustering.DBSCANClusterer;
+import org.apache.commons.math4.ml.clustering.DoublePoint;
+import org.apache.commons.math4.ml.clustering.FuzzyKMeansClusterer;
+import org.apache.commons.math4.ml.clustering.KMeansPlusPlusClusterer;
+import org.apache.commons.math4.random.RandomAdaptor;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.SobolSequenceGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
+import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 /**
  * Plots clustering results for various algorithms and datasets.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/ExampleUtils.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/ExampleUtils.java b/src/userguide/java/org/apache/commons/math4/userguide/ExampleUtils.java
index b173519..e58540d 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/ExampleUtils.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/ExampleUtils.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide;
+package org.apache.commons.math4.userguide;
 
 import java.awt.Component;
 import java.awt.event.ActionEvent;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java b/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
index 19426de..39b0b32 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/LowDiscrepancyGeneratorComparison.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide;
+package org.apache.commons.math4.userguide;
 
 import java.awt.Color;
 import java.awt.Dimension;
@@ -32,18 +32,18 @@ import javax.swing.JComponent;
 import javax.swing.JLabel;
 import javax.swing.JTextArea;
 
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.random.HaltonSequenceGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.random.SobolSequenceGenerator;
-import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator;
-import org.apache.commons.math3.random.UniformRandomGenerator;
-import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.random.HaltonSequenceGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.RandomVectorGenerator;
+import org.apache.commons.math4.random.SobolSequenceGenerator;
+import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
+import org.apache.commons.math4.random.UniformRandomGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
+import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 /**
  * Plots 2D samples drawn from various pseudo / quasi-random generators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/RealDistributionComparison.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/RealDistributionComparison.java b/src/userguide/java/org/apache/commons/math4/userguide/RealDistributionComparison.java
index b8971cd..6c7ec71 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/RealDistributionComparison.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/RealDistributionComparison.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide;
+package org.apache.commons.math4.userguide;
 
 import java.awt.BasicStroke;
 import java.awt.Color;
@@ -33,23 +33,23 @@ import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
 
-import org.apache.commons.math3.distribution.BetaDistribution;
-import org.apache.commons.math3.distribution.CauchyDistribution;
-import org.apache.commons.math3.distribution.ChiSquaredDistribution;
-import org.apache.commons.math3.distribution.ExponentialDistribution;
-import org.apache.commons.math3.distribution.FDistribution;
-import org.apache.commons.math3.distribution.GammaDistribution;
-import org.apache.commons.math3.distribution.LevyDistribution;
-import org.apache.commons.math3.distribution.LogNormalDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.distribution.ParetoDistribution;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.TDistribution;
-import org.apache.commons.math3.distribution.WeibullDistribution;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.BetaDistribution;
+import org.apache.commons.math4.distribution.CauchyDistribution;
+import org.apache.commons.math4.distribution.ChiSquaredDistribution;
+import org.apache.commons.math4.distribution.ExponentialDistribution;
+import org.apache.commons.math4.distribution.FDistribution;
+import org.apache.commons.math4.distribution.GammaDistribution;
+import org.apache.commons.math4.distribution.LevyDistribution;
+import org.apache.commons.math4.distribution.LogNormalDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.ParetoDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.distribution.WeibullDistribution;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 import com.xeiam.xchart.Chart;
 import com.xeiam.xchart.ChartBuilder;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java b/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
index c4414ee..7211a6b 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/filter/CannonballExample.java
@@ -12,7 +12,7 @@
  * governing permissions and limitations under the License.
  */
 
-package org.apache.commons.math3.userguide.filter;
+package org.apache.commons.math4.userguide.filter;
 
 import java.awt.Color;
 import java.awt.Component;
@@ -25,19 +25,19 @@ import javax.swing.BoxLayout;
 import javax.swing.JComponent;
 import javax.swing.JPanel;
 
-import org.apache.commons.math3.filter.DefaultMeasurementModel;
-import org.apache.commons.math3.filter.DefaultProcessModel;
-import org.apache.commons.math3.filter.KalmanFilter;
-import org.apache.commons.math3.filter.MeasurementModel;
-import org.apache.commons.math3.filter.ProcessModel;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.userguide.ExampleUtils;
-import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.filter.DefaultMeasurementModel;
+import org.apache.commons.math4.filter.DefaultProcessModel;
+import org.apache.commons.math4.filter.KalmanFilter;
+import org.apache.commons.math4.filter.MeasurementModel;
+import org.apache.commons.math4.filter.ProcessModel;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.userguide.ExampleUtils;
+import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 import com.xeiam.xchart.Chart;
 import com.xeiam.xchart.ChartBuilder;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java b/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
index d6d9f51..bf554d5 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/filter/ConstantVoltageExample.java
@@ -12,7 +12,7 @@
  * governing permissions and limitations under the License.
  */
 
-package org.apache.commons.math3.userguide.filter;
+package org.apache.commons.math4.userguide.filter;
 
 import java.awt.Color;
 import java.awt.Component;
@@ -25,19 +25,19 @@ import javax.swing.BoxLayout;
 import javax.swing.JComponent;
 import javax.swing.JPanel;
 
-import org.apache.commons.math3.filter.DefaultMeasurementModel;
-import org.apache.commons.math3.filter.DefaultProcessModel;
-import org.apache.commons.math3.filter.KalmanFilter;
-import org.apache.commons.math3.filter.MeasurementModel;
-import org.apache.commons.math3.filter.ProcessModel;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.userguide.ExampleUtils;
-import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame;
+import org.apache.commons.math4.filter.DefaultMeasurementModel;
+import org.apache.commons.math4.filter.DefaultProcessModel;
+import org.apache.commons.math4.filter.KalmanFilter;
+import org.apache.commons.math4.filter.MeasurementModel;
+import org.apache.commons.math4.filter.ProcessModel;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.userguide.ExampleUtils;
+import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 import com.xeiam.xchart.Chart;
 import com.xeiam.xchart.ChartBuilder;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java b/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
index b4db00f..a02cc8e 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/genetics/HelloWorldExample.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide.genetics;
+package org.apache.commons.math4.userguide.genetics;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -23,19 +23,19 @@ import java.util.List;
 
 import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.genetics.AbstractListChromosome;
-import org.apache.commons.math3.genetics.Chromosome;
-import org.apache.commons.math3.genetics.ElitisticListPopulation;
-import org.apache.commons.math3.genetics.GeneticAlgorithm;
-import org.apache.commons.math3.genetics.InvalidRepresentationException;
-import org.apache.commons.math3.genetics.MutationPolicy;
-import org.apache.commons.math3.genetics.OnePointCrossover;
-import org.apache.commons.math3.genetics.Population;
-import org.apache.commons.math3.genetics.StoppingCondition;
-import org.apache.commons.math3.genetics.TournamentSelection;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.genetics.AbstractListChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.genetics.InvalidRepresentationException;
+import org.apache.commons.math4.genetics.MutationPolicy;
+import org.apache.commons.math4.genetics.OnePointCrossover;
+import org.apache.commons.math4.genetics.Population;
+import org.apache.commons.math4.genetics.StoppingCondition;
+import org.apache.commons.math4.genetics.TournamentSelection;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 public class HelloWorldExample {
     public static final int    POPULATION_SIZE   = 1000;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java b/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
index 6912384..ee038a3 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/genetics/ImageEvolutionExample.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide.genetics;
+package org.apache.commons.math4.userguide.genetics;
 
 import java.awt.Component;
 import java.awt.Dimension;
@@ -35,14 +35,14 @@ import javax.swing.ImageIcon;
 import javax.swing.JButton;
 import javax.swing.JLabel;
 
-import org.apache.commons.math3.genetics.Chromosome;
-import org.apache.commons.math3.genetics.ElitisticListPopulation;
-import org.apache.commons.math3.genetics.GeneticAlgorithm;
-import org.apache.commons.math3.genetics.Population;
-import org.apache.commons.math3.genetics.TournamentSelection;
-import org.apache.commons.math3.genetics.UniformCrossover;
-import org.apache.commons.math3.userguide.ExampleUtils;
-import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.ElitisticListPopulation;
+import org.apache.commons.math4.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.genetics.Population;
+import org.apache.commons.math4.genetics.TournamentSelection;
+import org.apache.commons.math4.genetics.UniformCrossover;
+import org.apache.commons.math4.userguide.ExampleUtils;
+import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 
 /**
  * This example shows a more advanced use of a genetic algorithm: approximate a raster image

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java b/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java
index 1950803..b6ad577 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/genetics/Polygon.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide.genetics;
+package org.apache.commons.math4.userguide.genetics;
 
 import java.awt.Color;
 import java.awt.Graphics2D;
 import java.awt.geom.GeneralPath;
 
-import org.apache.commons.math3.genetics.GeneticAlgorithm;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.genetics.GeneticAlgorithm;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Represents a fixed size polgon with its fill color.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java b/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
index 783b39f..d453541 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/genetics/PolygonChromosome.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide.genetics;
+package org.apache.commons.math4.userguide.genetics;
 
 import java.awt.AlphaComposite;
 import java.awt.Color;
@@ -24,9 +24,9 @@ import java.awt.image.BufferedImage;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.genetics.AbstractListChromosome;
-import org.apache.commons.math3.genetics.Chromosome;
-import org.apache.commons.math3.genetics.InvalidRepresentationException;
+import org.apache.commons.math4.genetics.AbstractListChromosome;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.InvalidRepresentationException;
 
 /**
  * A simple chromosome representing a list of polygons.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java b/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
index 57b4d10..9b6835a 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/genetics/RandomPolygonMutation.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide.genetics;
+package org.apache.commons.math4.userguide.genetics;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.genetics.Chromosome;
-import org.apache.commons.math3.genetics.MutationPolicy;
+import org.apache.commons.math4.genetics.Chromosome;
+import org.apache.commons.math4.genetics.MutationPolicy;
 
 public class RandomPolygonMutation implements MutationPolicy {
     

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/geometry/GeometryExample.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/geometry/GeometryExample.java b/src/userguide/java/org/apache/commons/math4/userguide/geometry/GeometryExample.java
index ea3ea3f..941243b 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/geometry/GeometryExample.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/geometry/GeometryExample.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.userguide.geometry;
+package org.apache.commons.math4.userguide.geometry;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
@@ -31,21 +31,21 @@ import javax.swing.JComponent;
 import javax.swing.JPanel;
 import javax.swing.JSplitPane;
 
-import org.apache.commons.math3.geometry.enclosing.Encloser;
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.enclosing.WelzlEncloser;
-import org.apache.commons.math3.geometry.euclidean.twod.DiskGenerator;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Segment;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.euclidean.twod.hull.ConvexHull2D;
-import org.apache.commons.math3.geometry.euclidean.twod.hull.ConvexHullGenerator2D;
-import org.apache.commons.math3.geometry.euclidean.twod.hull.MonotoneChain;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.userguide.ExampleUtils;
-import org.apache.commons.math3.userguide.ExampleUtils.ExampleFrame;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.geometry.enclosing.Encloser;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.enclosing.WelzlEncloser;
+import org.apache.commons.math4.geometry.euclidean.twod.DiskGenerator;
+import org.apache.commons.math4.geometry.euclidean.twod.Euclidean2D;
+import org.apache.commons.math4.geometry.euclidean.twod.Segment;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHull2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.ConvexHullGenerator2D;
+import org.apache.commons.math4.geometry.euclidean.twod.hull.MonotoneChain;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.userguide.ExampleUtils;
+import org.apache.commons.math4.userguide.ExampleUtils.ExampleFrame;
 import org.piccolo2d.PCamera;
 import org.piccolo2d.PCanvas;
 import org.piccolo2d.PNode;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRings.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRings.java b/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRings.java
index 1a7ad86..77cc75a 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRings.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRings.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.userguide.sofm;
+package org.apache.commons.math4.userguide.sofm;
 
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
 
 /**
  * Class that creates two intertwined rings.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRingsClassifier.java
----------------------------------------------------------------------
diff --git a/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRingsClassifier.java b/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRingsClassifier.java
index 871d9d6..6dbd36c 100644
--- a/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRingsClassifier.java
+++ b/src/userguide/java/org/apache/commons/math4/userguide/sofm/ChineseRingsClassifier.java
@@ -15,30 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.userguide.sofm;
+package org.apache.commons.math4.userguide.sofm;
 
 import java.util.Iterator;
 import java.io.PrintWriter;
 import java.io.IOException;
-import org.apache.commons.math3.ml.neuralnet.SquareNeighbourhood;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializer;
-import org.apache.commons.math3.ml.neuralnet.FeatureInitializerFactory;
-import org.apache.commons.math3.ml.neuralnet.MapUtils;
-import org.apache.commons.math3.ml.neuralnet.twod.NeuronSquareMesh2D;
-import org.apache.commons.math3.ml.neuralnet.sofm.LearningFactorFunction;
-import org.apache.commons.math3.ml.neuralnet.sofm.LearningFactorFunctionFactory;
-import org.apache.commons.math3.ml.neuralnet.sofm.NeighbourhoodSizeFunction;
-import org.apache.commons.math3.ml.neuralnet.sofm.NeighbourhoodSizeFunctionFactory;
-import org.apache.commons.math3.ml.neuralnet.sofm.KohonenUpdateAction;
-import org.apache.commons.math3.ml.neuralnet.sofm.KohonenTrainingTask;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.ml.neuralnet.SquareNeighbourhood;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializer;
+import org.apache.commons.math4.ml.neuralnet.FeatureInitializerFactory;
+import org.apache.commons.math4.ml.neuralnet.MapUtils;
+import org.apache.commons.math4.ml.neuralnet.twod.NeuronSquareMesh2D;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.LearningFactorFunctionFactory;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunction;
+import org.apache.commons.math4.ml.neuralnet.sofm.NeighbourhoodSizeFunctionFactory;
+import org.apache.commons.math4.ml.neuralnet.sofm.KohonenUpdateAction;
+import org.apache.commons.math4.ml.neuralnet.sofm.KohonenTrainingTask;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
 
 /**
  * SOFM for categorizing points that belong to each of two intertwined rings.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/userguide/pom.xml
----------------------------------------------------------------------
diff --git a/src/userguide/pom.xml b/src/userguide/pom.xml
index 1daa91f..629d17f 100644
--- a/src/userguide/pom.xml
+++ b/src/userguide/pom.xml
@@ -21,8 +21,8 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.apache.commons</groupId>
-  <artifactId>commons-math3-examples</artifactId>
-  <version>3.5-SNAPSHOT</version>  
+  <artifactId>commons-math4-examples</artifactId>
+  <version>4.0-SNAPSHOT</version>  
   <name>Commons Math User Guide</name>
   <inceptionYear>2003</inceptionYear>
   <description>Examples</description>
@@ -45,24 +45,6 @@
 
   <build>
     <sourceDirectory>java</sourceDirectory>
-    
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-shade-plugin</artifactId>
-        <executions>
-          <execution>
-            <phase>package</phase>
-            <goals>
-              <goal>shade</goal>
-            </goals>
-          </execution>
-        </executions>
-        <configuration>
-          <finalName>${artifactId}-uber-${version}</finalName>
-        </configuration>
-      </plugin>
-    </plugins>
   </build>
   <reporting>
   </reporting>
@@ -70,8 +52,8 @@
   <dependencies>
       <dependency>
           <groupId>org.apache.commons</groupId>
-          <artifactId>commons-math3</artifactId>
-          <version>3.5-SNAPSHOT</version>
+          <artifactId>commons-math4</artifactId>
+          <version>4.0-SNAPSHOT</version>
       </dependency>
       <dependency>
           <groupId>com.xeiam.xchart</groupId>


[11/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Arc.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Arc.java b/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Arc.java
deleted file mode 100644
index af0388e..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Arc.java
+++ /dev/null
@@ -1,132 +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.geometry.spherical.oned;
-
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-
-
-/** This class represents an arc on a circle.
- * @see ArcsSet
- * @since 3.3
- */
-public class Arc {
-
-    /** The lower angular bound of the arc. */
-    private final double lower;
-
-    /** The upper angular bound of the arc. */
-    private final double upper;
-
-    /** Middle point of the arc. */
-    private final double middle;
-
-    /** Tolerance below which angles are considered identical. */
-    private final double tolerance;
-
-    /** Simple constructor.
-     * <p>
-     * If either {@code lower} is equals to {@code upper} or
-     * the interval exceeds \( 2 \pi \), the arc is considered
-     * to be the full circle and its initial defining boundaries
-     * will be forgotten. {@code lower} is not allowed to be
-     * greater than {@code upper} (an exception is thrown in this case).
-     * {@code lower} will be canonicalized between 0 and \( 2 \pi \), and
-     * upper shifted accordingly, so the {@link #getInf()} and {@link #getSup()}
-     * may not return the value used at instance construction.
-     * </p>
-     * @param lower lower angular bound of the arc
-     * @param upper upper angular bound of the arc
-     * @param tolerance tolerance below which angles are considered identical
-     * @exception NumberIsTooLargeException if lower is greater than upper
-     */
-    public Arc(final double lower, final double upper, final double tolerance)
-        throws NumberIsTooLargeException {
-        this.tolerance = tolerance;
-        if (Precision.equals(lower, upper, 0) || (upper - lower) >= MathUtils.TWO_PI) {
-            // the arc must cover the whole circle
-            this.lower  = 0;
-            this.upper  = MathUtils.TWO_PI;
-            this.middle = FastMath.PI;
-        } else  if (lower <= upper) {
-            this.lower  = MathUtils.normalizeAngle(lower, FastMath.PI);
-            this.upper  = this.lower + (upper - lower);
-            this.middle = 0.5 * (this.lower + this.upper);
-        } else {
-            throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
-                                                lower, upper, true);
-        }
-    }
-
-    /** Get the lower angular bound of the arc.
-     * @return lower angular bound of the arc,
-     * always between 0 and \( 2 \pi \)
-     */
-    public double getInf() {
-        return lower;
-    }
-
-    /** Get the upper angular bound of the arc.
-     * @return upper angular bound of the arc,
-     * always between {@link #getInf()} and {@link #getInf()} \( + 2 \pi \)
-     */
-    public double getSup() {
-        return upper;
-    }
-
-    /** Get the angular size of the arc.
-     * @return angular size of the arc
-     */
-    public double getSize() {
-        return upper - lower;
-    }
-
-    /** Get the barycenter of the arc.
-     * @return barycenter of the arc
-     */
-    public double getBarycenter() {
-        return middle;
-    }
-
-    /** Get the tolerance below which angles are considered identical.
-     * @return tolerance below which angles are considered identical
-     */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /** Check a point with respect to the arc.
-     * @param point point to check
-     * @return a code representing the point status: either {@link
-     * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY}
-     */
-    public Location checkPoint(final double point) {
-        final double normalizedPoint = MathUtils.normalizeAngle(point, middle);
-        if (normalizedPoint < lower - tolerance || normalizedPoint > upper + tolerance) {
-            return Location.OUTSIDE;
-        } else if (normalizedPoint > lower + tolerance && normalizedPoint < upper - tolerance) {
-            return Location.INSIDE;
-        } else {
-            return (getSize() >= MathUtils.TWO_PI - tolerance) ? Location.INSIDE : Location.BOUNDARY;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/oned/ArcsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/ArcsSet.java b/src/main/java/org/apache/commons/math3/geometry/spherical/oned/ArcsSet.java
deleted file mode 100644
index 5c03150..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/ArcsSet.java
+++ /dev/null
@@ -1,962 +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.geometry.spherical.oned;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BoundaryProjection;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-
-/** This class represents a region of a circle: a set of arcs.
- * <p>
- * Note that due to the wrapping around \(2 \pi\), barycenter is
- * ill-defined here. It was defined only in order to fulfill
- * the requirements of the {@link
- * org.apache.commons.math3.geometry.partitioning.Region Region}
- * interface, but its use is discouraged.
- * </p>
- * @since 3.3
- */
-public class ArcsSet extends AbstractRegion<Sphere1D, Sphere1D> implements Iterable<double[]> {
-
-    /** Build an arcs set representing the whole circle.
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     */
-    public ArcsSet(final double tolerance) {
-        super(tolerance);
-    }
-
-    /** Build an arcs set corresponding to a single arc.
-     * <p>
-     * If either {@code lower} is equals to {@code upper} or
-     * the interval exceeds \( 2 \pi \), the arc is considered
-     * to be the full circle and its initial defining boundaries
-     * will be forgotten. {@code lower} is not allowed to be greater
-     * than {@code upper} (an exception is thrown in this case).
-     * </p>
-     * @param lower lower bound of the arc
-     * @param upper upper bound of the arc
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     * @exception NumberIsTooLargeException if lower is greater than upper
-     */
-    public ArcsSet(final double lower, final double upper, final double tolerance)
-        throws NumberIsTooLargeException {
-        super(buildTree(lower, upper, tolerance), tolerance);
-    }
-
-    /** Build an arcs set from an inside/outside BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * @param tree inside/outside BSP tree representing the arcs set
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     * @exception InconsistentStateAt2PiWrapping if the tree leaf nodes are not
-     * consistent across the \( 0, 2 \pi \) crossing
-     */
-    public ArcsSet(final BSPTree<Sphere1D> tree, final double tolerance)
-        throws InconsistentStateAt2PiWrapping {
-        super(tree, tolerance);
-        check2PiConsistency();
-    }
-
-    /** Build an arcs set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polygons with holes
-     * or a set of disjoints polyhedrons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
-     * checkPoint} method will not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     * @exception InconsistentStateAt2PiWrapping if the tree leaf nodes are not
-     * consistent across the \( 0, 2 \pi \) crossing
-     */
-    public ArcsSet(final Collection<SubHyperplane<Sphere1D>> boundary, final double tolerance)
-        throws InconsistentStateAt2PiWrapping {
-        super(boundary, tolerance);
-        check2PiConsistency();
-    }
-
-    /** Build an inside/outside tree representing a single arc.
-     * @param lower lower angular bound of the arc
-     * @param upper upper angular bound of the arc
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     * @return the built tree
-     * @exception NumberIsTooLargeException if lower is greater than upper
-     */
-    private static BSPTree<Sphere1D> buildTree(final double lower, final double upper,
-                                               final double tolerance)
-        throws NumberIsTooLargeException {
-
-        if (Precision.equals(lower, upper, 0) || (upper - lower) >= MathUtils.TWO_PI) {
-            // the tree must cover the whole circle
-            return new BSPTree<Sphere1D>(Boolean.TRUE);
-        } else  if (lower > upper) {
-            throw new NumberIsTooLargeException(LocalizedFormats.ENDPOINTS_NOT_AN_INTERVAL,
-                                                lower, upper, true);
-        }
-
-        // this is a regular arc, covering only part of the circle
-        final double normalizedLower = MathUtils.normalizeAngle(lower, FastMath.PI);
-        final double normalizedUpper = normalizedLower + (upper - lower);
-        final SubHyperplane<Sphere1D> lowerCut =
-                new LimitAngle(new S1Point(normalizedLower), false, tolerance).wholeHyperplane();
-
-        if (normalizedUpper <= MathUtils.TWO_PI) {
-            // simple arc starting after 0 and ending before 2 \pi
-            final SubHyperplane<Sphere1D> upperCut =
-                    new LimitAngle(new S1Point(normalizedUpper), true, tolerance).wholeHyperplane();
-            return new BSPTree<Sphere1D>(lowerCut,
-                                         new BSPTree<Sphere1D>(Boolean.FALSE),
-                                         new BSPTree<Sphere1D>(upperCut,
-                                                               new BSPTree<Sphere1D>(Boolean.FALSE),
-                                                               new BSPTree<Sphere1D>(Boolean.TRUE),
-                                                               null),
-                                         null);
-        } else {
-            // arc wrapping around 2 \pi
-            final SubHyperplane<Sphere1D> upperCut =
-                    new LimitAngle(new S1Point(normalizedUpper - MathUtils.TWO_PI), true, tolerance).wholeHyperplane();
-            return new BSPTree<Sphere1D>(lowerCut,
-                                         new BSPTree<Sphere1D>(upperCut,
-                                                               new BSPTree<Sphere1D>(Boolean.FALSE),
-                                                               new BSPTree<Sphere1D>(Boolean.TRUE),
-                                                               null),
-                                         new BSPTree<Sphere1D>(Boolean.TRUE),
-                                         null);
-        }
-
-    }
-
-    /** Check consistency.
-    * @exception InconsistentStateAt2PiWrapping if the tree leaf nodes are not
-    * consistent across the \( 0, 2 \pi \) crossing
-    */
-    private void check2PiConsistency() throws InconsistentStateAt2PiWrapping {
-
-        // start search at the tree root
-        BSPTree<Sphere1D> root = getTree(false);
-        if (root.getCut() == null) {
-            return;
-        }
-
-        // find the inside/outside state before the smallest internal node
-        final Boolean stateBefore = (Boolean) getFirstLeaf(root).getAttribute();
-
-        // find the inside/outside state after the largest internal node
-        final Boolean stateAfter = (Boolean) getLastLeaf(root).getAttribute();
-
-        if (stateBefore ^ stateAfter) {
-            throw new InconsistentStateAt2PiWrapping();
-        }
-
-    }
-
-    /** Get the first leaf node of a tree.
-     * @param root tree root
-     * @return first leaf node (i.e. node corresponding to the region just after 0.0 radians)
-     */
-    private BSPTree<Sphere1D> getFirstLeaf(final BSPTree<Sphere1D> root) {
-
-        if (root.getCut() == null) {
-            return root;
-        }
-
-        // find the smallest internal node
-        BSPTree<Sphere1D> smallest = null;
-        for (BSPTree<Sphere1D> n = root; n != null; n = previousInternalNode(n)) {
-            smallest = n;
-        }
-
-        return leafBefore(smallest);
-
-    }
-
-    /** Get the last leaf node of a tree.
-     * @param root tree root
-     * @return last leaf node (i.e. node corresponding to the region just before \( 2 \pi \) radians)
-     */
-    private BSPTree<Sphere1D> getLastLeaf(final BSPTree<Sphere1D> root) {
-
-        if (root.getCut() == null) {
-            return root;
-        }
-
-        // find the largest internal node
-        BSPTree<Sphere1D> largest = null;
-        for (BSPTree<Sphere1D> n = root; n != null; n = nextInternalNode(n)) {
-            largest = n;
-        }
-
-        return leafAfter(largest);
-
-    }
-
-    /** Get the node corresponding to the first arc start.
-     * @return smallest internal node (i.e. first after 0.0 radians, in trigonometric direction),
-     * or null if there are no internal nodes (i.e. the set is either empty or covers the full circle)
-     */
-    private BSPTree<Sphere1D> getFirstArcStart() {
-
-        // start search at the tree root
-        BSPTree<Sphere1D> node = getTree(false);
-        if (node.getCut() == null) {
-            return null;
-        }
-
-        // walk tree until we find the smallest internal node
-        node = getFirstLeaf(node).getParent();
-
-        // walk tree until we find an arc start
-        while (node != null && !isArcStart(node)) {
-            node = nextInternalNode(node);
-        }
-
-        return node;
-
-    }
-
-    /** Check if an internal node corresponds to the start angle of an arc.
-     * @param node internal node to check
-     * @return true if the node corresponds to the start angle of an arc
-     */
-    private boolean isArcStart(final BSPTree<Sphere1D> node) {
-
-        if ((Boolean) leafBefore(node).getAttribute()) {
-            // it has an inside cell before it, it may end an arc but not start it
-            return false;
-        }
-
-        if (!(Boolean) leafAfter(node).getAttribute()) {
-            // it has an outside cell after it, it is a dummy cut away from real arcs
-            return false;
-        }
-
-        // the cell has an outside before and an inside after it
-        // it is the start of an arc
-        return true;
-
-    }
-
-    /** Check if an internal node corresponds to the end angle of an arc.
-     * @param node internal node to check
-     * @return true if the node corresponds to the end angle of an arc
-     */
-    private boolean isArcEnd(final BSPTree<Sphere1D> node) {
-
-        if (!(Boolean) leafBefore(node).getAttribute()) {
-            // it has an outside cell before it, it may start an arc but not end it
-            return false;
-        }
-
-        if ((Boolean) leafAfter(node).getAttribute()) {
-            // it has an inside cell after it, it is a dummy cut in the middle of an arc
-            return false;
-        }
-
-        // the cell has an inside before and an outside after it
-        // it is the end of an arc
-        return true;
-
-    }
-
-    /** Get the next internal node.
-     * @param node current internal node
-     * @return next internal node in trigonometric order, or null
-     * if this is the last internal node
-     */
-    private BSPTree<Sphere1D> nextInternalNode(BSPTree<Sphere1D> node) {
-
-        if (childAfter(node).getCut() != null) {
-            // the next node is in the sub-tree
-            return leafAfter(node).getParent();
-        }
-
-        // there is nothing left deeper in the tree, we backtrack
-        while (isAfterParent(node)) {
-            node = node.getParent();
-        }
-        return node.getParent();
-
-    }
-
-    /** Get the previous internal node.
-     * @param node current internal node
-     * @return previous internal node in trigonometric order, or null
-     * if this is the first internal node
-     */
-    private BSPTree<Sphere1D> previousInternalNode(BSPTree<Sphere1D> node) {
-
-        if (childBefore(node).getCut() != null) {
-            // the next node is in the sub-tree
-            return leafBefore(node).getParent();
-        }
-
-        // there is nothing left deeper in the tree, we backtrack
-        while (isBeforeParent(node)) {
-            node = node.getParent();
-        }
-        return node.getParent();
-
-    }
-
-    /** Find the leaf node just before an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return leaf node just before the internal node
-     */
-    private BSPTree<Sphere1D> leafBefore(BSPTree<Sphere1D> node) {
-
-        node = childBefore(node);
-        while (node.getCut() != null) {
-            node = childAfter(node);
-        }
-
-        return node;
-
-    }
-
-    /** Find the leaf node just after an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return leaf node just after the internal node
-     */
-    private BSPTree<Sphere1D> leafAfter(BSPTree<Sphere1D> node) {
-
-        node = childAfter(node);
-        while (node.getCut() != null) {
-            node = childBefore(node);
-        }
-
-        return node;
-
-    }
-
-    /** Check if a node is the child before its parent in trigonometric order.
-     * @param node child node considered
-     * @return true is the node has a parent end is before it in trigonometric order
-     */
-    private boolean isBeforeParent(final BSPTree<Sphere1D> node) {
-        final BSPTree<Sphere1D> parent = node.getParent();
-        if (parent == null) {
-            return false;
-        } else {
-            return node == childBefore(parent);
-        }
-    }
-
-    /** Check if a node is the child after its parent in trigonometric order.
-     * @param node child node considered
-     * @return true is the node has a parent end is after it in trigonometric order
-     */
-    private boolean isAfterParent(final BSPTree<Sphere1D> node) {
-        final BSPTree<Sphere1D> parent = node.getParent();
-        if (parent == null) {
-            return false;
-        } else {
-            return node == childAfter(parent);
-        }
-    }
-
-    /** Find the child node just before an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return child node just before the internal node
-     */
-    private BSPTree<Sphere1D> childBefore(BSPTree<Sphere1D> node) {
-        if (isDirect(node)) {
-            // smaller angles are on minus side, larger angles are on plus side
-            return node.getMinus();
-        } else {
-            // smaller angles are on plus side, larger angles are on minus side
-            return node.getPlus();
-        }
-    }
-
-    /** Find the child node just after an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return child node just after the internal node
-     */
-    private BSPTree<Sphere1D> childAfter(BSPTree<Sphere1D> node) {
-        if (isDirect(node)) {
-            // smaller angles are on minus side, larger angles are on plus side
-            return node.getPlus();
-        } else {
-            // smaller angles are on plus side, larger angles are on minus side
-            return node.getMinus();
-        }
-    }
-
-    /** Check if an internal node has a direct limit angle.
-     * @param node internal node to check
-     * @return true if the limit angle is direct
-     */
-    private boolean isDirect(final BSPTree<Sphere1D> node) {
-        return ((LimitAngle) node.getCut().getHyperplane()).isDirect();
-    }
-
-    /** Get the limit angle of an internal node.
-     * @param node internal node to check
-     * @return limit angle
-     */
-    private double getAngle(final BSPTree<Sphere1D> node) {
-        return ((LimitAngle) node.getCut().getHyperplane()).getLocation().getAlpha();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArcsSet buildNew(final BSPTree<Sphere1D> tree) {
-        return new ArcsSet(tree, getTolerance());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void computeGeometricalProperties() {
-        if (getTree(false).getCut() == null) {
-            setBarycenter(S1Point.NaN);
-            setSize(((Boolean) getTree(false).getAttribute()) ? MathUtils.TWO_PI : 0);
-        } else {
-            double size = 0.0;
-            double sum  = 0.0;
-            for (final double[] a : this) {
-                final double length = a[1] - a[0];
-                size += length;
-                sum  += length * (a[0] + a[1]);
-            }
-            setSize(size);
-            if (Precision.equals(size, MathUtils.TWO_PI, 0)) {
-                setBarycenter(S1Point.NaN);
-            } else if (size >= Precision.SAFE_MIN) {
-                setBarycenter(new S1Point(sum / (2 * size)));
-            } else {
-                final LimitAngle limit = (LimitAngle) getTree(false).getCut().getHyperplane();
-                setBarycenter(limit.getLocation());
-            }
-        }
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    @Override
-    public BoundaryProjection<Sphere1D> projectToBoundary(final Point<Sphere1D> point) {
-
-        // get position of test point
-        final double alpha = ((S1Point) point).getAlpha();
-
-        boolean wrapFirst = false;
-        double first      = Double.NaN;
-        double previous   = Double.NaN;
-        for (final double[] a : this) {
-
-            if (Double.isNaN(first)) {
-                // remember the first angle in case we need it later
-                first = a[0];
-            }
-
-            if (!wrapFirst) {
-                if (alpha < a[0]) {
-                    // the test point lies between the previous and the current arcs
-                    // offset will be positive
-                    if (Double.isNaN(previous)) {
-                        // we need to wrap around the circle
-                        wrapFirst = true;
-                    } else {
-                        final double previousOffset = alpha - previous;
-                        final double currentOffset  = a[0] - alpha;
-                        if (previousOffset < currentOffset) {
-                            return new BoundaryProjection<Sphere1D>(point, new S1Point(previous), previousOffset);
-                        } else {
-                            return new BoundaryProjection<Sphere1D>(point, new S1Point(a[0]), currentOffset);
-                        }
-                    }
-                } else if (alpha <= a[1]) {
-                    // the test point lies within the current arc
-                    // offset will be negative
-                    final double offset0 = a[0] - alpha;
-                    final double offset1 = alpha - a[1];
-                    if (offset0 < offset1) {
-                        return new BoundaryProjection<Sphere1D>(point, new S1Point(a[1]), offset1);
-                    } else {
-                        return new BoundaryProjection<Sphere1D>(point, new S1Point(a[0]), offset0);
-                    }
-                }
-            }
-            previous = a[1];
-        }
-
-        if (Double.isNaN(previous)) {
-
-            // there are no points at all in the arcs set
-            return new BoundaryProjection<Sphere1D>(point, null, MathUtils.TWO_PI);
-
-        } else {
-
-            // the test point if before first arc and after last arc,
-            // somewhere around the 0/2 \pi crossing
-            if (wrapFirst) {
-                // the test point is between 0 and first
-                final double previousOffset = alpha - (previous - MathUtils.TWO_PI);
-                final double currentOffset  = first - alpha;
-                if (previousOffset < currentOffset) {
-                    return new BoundaryProjection<Sphere1D>(point, new S1Point(previous), previousOffset);
-                } else {
-                    return new BoundaryProjection<Sphere1D>(point, new S1Point(first), currentOffset);
-                }
-            } else {
-                // the test point is between last and 2\pi
-                final double previousOffset = alpha - previous;
-                final double currentOffset  = first + MathUtils.TWO_PI - alpha;
-                if (previousOffset < currentOffset) {
-                    return new BoundaryProjection<Sphere1D>(point, new S1Point(previous), previousOffset);
-                } else {
-                    return new BoundaryProjection<Sphere1D>(point, new S1Point(first), currentOffset);
-                }
-            }
-
-        }
-
-    }
-
-    /** Build an ordered list of arcs representing the instance.
-     * <p>This method builds this arcs set as an ordered list of
-     * {@link Arc Arc} elements. An empty tree will build an empty list
-     * while a tree representing the whole circle will build a one
-     * element list with bounds set to \( 0 and 2 \pi \).</p>
-     * @return a new ordered list containing {@link Arc Arc} elements
-     */
-    public List<Arc> asList() {
-        final List<Arc> list = new ArrayList<Arc>();
-        for (final double[] a : this) {
-            list.add(new Arc(a[0], a[1], getTolerance()));
-        }
-        return list;
-    }
-
-    /** {@inheritDoc}
-     * <p>
-     * The iterator returns the limit angles pairs of sub-arcs in trigonometric order.
-     * </p>
-     * <p>
-     * The iterator does <em>not</em> support the optional {@code remove} operation.
-     * </p>
-     */
-    public Iterator<double[]> iterator() {
-        return new SubArcsIterator();
-    }
-
-    /** Local iterator for sub-arcs. */
-    private class SubArcsIterator implements Iterator<double[]> {
-
-        /** Start of the first arc. */
-        private final BSPTree<Sphere1D> firstStart;
-
-        /** Current node. */
-        private BSPTree<Sphere1D> current;
-
-        /** Sub-arc no yet returned. */
-        private double[] pending;
-
-        /** Simple constructor.
-         */
-        public SubArcsIterator() {
-
-            firstStart = getFirstArcStart();
-            current    = firstStart;
-
-            if (firstStart == null) {
-                // all the leaf tree nodes share the same inside/outside status
-                if ((Boolean) getFirstLeaf(getTree(false)).getAttribute()) {
-                    // it is an inside node, it represents the full circle
-                    pending = new double[] {
-                        0, MathUtils.TWO_PI
-                    };
-                } else {
-                    pending = null;
-                }
-            } else {
-                selectPending();
-            }
-        }
-
-        /** Walk the tree to select the pending sub-arc.
-         */
-        private void selectPending() {
-
-            // look for the start of the arc
-            BSPTree<Sphere1D> start = current;
-            while (start != null && !isArcStart(start)) {
-                start = nextInternalNode(start);
-            }
-
-            if (start == null) {
-                // we have exhausted the iterator
-                current = null;
-                pending = null;
-                return;
-            }
-
-            // look for the end of the arc
-            BSPTree<Sphere1D> end = start;
-            while (end != null && !isArcEnd(end)) {
-                end = nextInternalNode(end);
-            }
-
-            if (end != null) {
-
-                // we have identified the arc
-                pending = new double[] {
-                    getAngle(start), getAngle(end)
-                };
-
-                // prepare search for next arc
-                current = end;
-
-            } else {
-
-                // the final arc wraps around 2\pi, its end is before the first start
-                end = firstStart;
-                while (end != null && !isArcEnd(end)) {
-                    end = previousInternalNode(end);
-                }
-                if (end == null) {
-                    // this should never happen
-                    throw new MathInternalError();
-                }
-
-                // we have identified the last arc
-                pending = new double[] {
-                    getAngle(start), getAngle(end) + MathUtils.TWO_PI
-                };
-
-                // there won't be any other arcs
-                current = null;
-
-            }
-
-        }
-
-        /** {@inheritDoc} */
-        public boolean hasNext() {
-            return pending != null;
-        }
-
-        /** {@inheritDoc} */
-        public double[] next() {
-            if (pending == null) {
-                throw new NoSuchElementException();
-            }
-            final double[] next = pending;
-            selectPending();
-            return next;
-        }
-
-        /** {@inheritDoc} */
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
-
-    }
-
-    /** Compute the relative position of the instance with respect
-     * to an arc.
-     * <p>
-     * The {@link Side#MINUS} side of the arc is the one covered by the arc.
-     * </p>
-     * @param arc arc to check instance against
-     * @return one of {@link Side#PLUS}, {@link Side#MINUS}, {@link Side#BOTH}
-     * or {@link Side#HYPER}
-     */
-    public Side side(final Arc arc) {
-
-        final double reference = FastMath.PI + arc.getInf();
-        final double arcLength = arc.getSup() - arc.getInf();
-
-        boolean inMinus = false;
-        boolean inPlus  = false;
-        for (final double[] a : this) {
-            final double syncedStart = MathUtils.normalizeAngle(a[0], reference) - arc.getInf();
-            final double arcOffset   = a[0] - syncedStart;
-            final double syncedEnd   = a[1] - arcOffset;
-            if (syncedStart <= arcLength - getTolerance() || syncedEnd >= MathUtils.TWO_PI + getTolerance()) {
-                inMinus = true;
-            }
-            if (syncedEnd >= arcLength + getTolerance()) {
-                inPlus = true;
-            }
-        }
-
-        if (inMinus) {
-            if (inPlus) {
-                return Side.BOTH;
-            } else {
-                return Side.MINUS;
-            }
-        } else {
-            if (inPlus) {
-                return Side.PLUS;
-            } else {
-                return Side.HYPER;
-            }
-        }
-
-    }
-
-    /** Split the instance in two parts by an arc.
-     * @param arc splitting arc
-     * @return an object containing both the part of the instance
-     * on the plus side of the arc and the part of the
-     * instance on the minus side of the arc
-     */
-    public Split split(final Arc arc) {
-
-        final List<Double> minus = new ArrayList<Double>();
-        final List<Double>  plus = new ArrayList<Double>();
-
-        final double reference = FastMath.PI + arc.getInf();
-        final double arcLength = arc.getSup() - arc.getInf();
-
-        for (final double[] a : this) {
-            final double syncedStart = MathUtils.normalizeAngle(a[0], reference) - arc.getInf();
-            final double arcOffset   = a[0] - syncedStart;
-            final double syncedEnd   = a[1] - arcOffset;
-            if (syncedStart < arcLength) {
-                // the start point a[0] is in the minus part of the arc
-                minus.add(a[0]);
-                if (syncedEnd > arcLength) {
-                    // the end point a[1] is past the end of the arc
-                    // so we leave the minus part and enter the plus part
-                    final double minusToPlus = arcLength + arcOffset;
-                    minus.add(minusToPlus);
-                    plus.add(minusToPlus);
-                    if (syncedEnd > MathUtils.TWO_PI) {
-                        // in fact the end point a[1] goes far enough that we
-                        // leave the plus part of the arc and enter the minus part again
-                        final double plusToMinus = MathUtils.TWO_PI + arcOffset;
-                        plus.add(plusToMinus);
-                        minus.add(plusToMinus);
-                        minus.add(a[1]);
-                    } else {
-                        // the end point a[1] is in the plus part of the arc
-                        plus.add(a[1]);
-                    }
-                } else {
-                    // the end point a[1] is in the minus part of the arc
-                    minus.add(a[1]);
-                }
-            } else {
-                // the start point a[0] is in the plus part of the arc
-                plus.add(a[0]);
-                if (syncedEnd > MathUtils.TWO_PI) {
-                    // the end point a[1] wraps around to the start of the arc
-                    // so we leave the plus part and enter the minus part
-                    final double plusToMinus = MathUtils.TWO_PI + arcOffset;
-                    plus.add(plusToMinus);
-                    minus.add(plusToMinus);
-                    if (syncedEnd > MathUtils.TWO_PI + arcLength) {
-                        // in fact the end point a[1] goes far enough that we
-                        // leave the minus part of the arc and enter the plus part again
-                        final double minusToPlus = MathUtils.TWO_PI + arcLength + arcOffset;
-                        minus.add(minusToPlus);
-                        plus.add(minusToPlus);
-                        plus.add(a[1]);
-                    } else {
-                        // the end point a[1] is in the minus part of the arc
-                        minus.add(a[1]);
-                    }
-                } else {
-                    // the end point a[1] is in the plus part of the arc
-                    plus.add(a[1]);
-                }
-            }
-        }
-
-        return new Split(createSplitPart(plus), createSplitPart(minus));
-
-    }
-
-    /** Add an arc limit to a BSP tree under construction.
-     * @param tree BSP tree under construction
-     * @param alpha arc limit
-     * @param isStart if true, the limit is the start of an arc
-     */
-    private void addArcLimit(final BSPTree<Sphere1D> tree, final double alpha, final boolean isStart) {
-
-        final LimitAngle limit = new LimitAngle(new S1Point(alpha), !isStart, getTolerance());
-        final BSPTree<Sphere1D> node = tree.getCell(limit.getLocation(), getTolerance());
-        if (node.getCut() != null) {
-            // this should never happen
-            throw new MathInternalError();
-        }
-
-        node.insertCut(limit);
-        node.setAttribute(null);
-        node.getPlus().setAttribute(Boolean.FALSE);
-        node.getMinus().setAttribute(Boolean.TRUE);
-
-    }
-
-    /** Create a split part.
-     * <p>
-     * As per construction, the list of limit angles is known to have
-     * an even number of entries, with start angles at even indices and
-     * end angles at odd indices.
-     * </p>
-     * @param limits limit angles of the split part
-     * @return split part (may be null)
-     */
-    private ArcsSet createSplitPart(final List<Double> limits) {
-        if (limits.isEmpty()) {
-            return null;
-        } else {
-
-            // collapse close limit angles
-            for (int i = 0; i < limits.size(); ++i) {
-                final int    j  = (i + 1) % limits.size();
-                final double lA = limits.get(i);
-                final double lB = MathUtils.normalizeAngle(limits.get(j), lA);
-                if (FastMath.abs(lB - lA) <= getTolerance()) {
-                    // the two limits are too close to each other, we remove both of them
-                    if (j > 0) {
-                        // regular case, the two entries are consecutive ones
-                        limits.remove(j);
-                        limits.remove(i);
-                        i = i - 1;
-                    } else {
-                        // special case, i the the last entry and j is the first entry
-                        // we have wrapped around list end
-                        final double lEnd   = limits.remove(limits.size() - 1);
-                        final double lStart = limits.remove(0);
-                        if (limits.isEmpty()) {
-                            // the ends were the only limits, is it a full circle or an empty circle?
-                            if (lEnd - lStart > FastMath.PI) {
-                                // it was full circle
-                                return new ArcsSet(new BSPTree<Sphere1D>(Boolean.TRUE), getTolerance());
-                            } else {
-                                // it was an empty circle
-                                return null;
-                            }
-                        } else {
-                            // we have removed the first interval start, so our list
-                            // currently starts with an interval end, which is wrong
-                            // we need to move this interval end to the end of the list
-                            limits.add(limits.remove(0) + MathUtils.TWO_PI);
-                        }
-                    }
-                }
-            }
-
-            // build the tree by adding all angular sectors
-            BSPTree<Sphere1D> tree = new BSPTree<Sphere1D>(Boolean.FALSE);
-            for (int i = 0; i < limits.size() - 1; i += 2) {
-                addArcLimit(tree, limits.get(i),     true);
-                addArcLimit(tree, limits.get(i + 1), false);
-            }
-
-            if (tree.getCut() == null) {
-                // we did not insert anything
-                return null;
-            }
-
-            return new ArcsSet(tree, getTolerance());
-
-        }
-    }
-
-    /** Class holding the results of the {@link #split split} method.
-     */
-    public static class Split {
-
-        /** Part of the arcs set on the plus side of the splitting arc. */
-        private final ArcsSet plus;
-
-        /** Part of the arcs set on the minus side of the splitting arc. */
-        private final ArcsSet minus;
-
-        /** Build a Split from its parts.
-         * @param plus part of the arcs set on the plus side of the
-         * splitting arc
-         * @param minus part of the arcs set on the minus side of the
-         * splitting arc
-         */
-        private Split(final ArcsSet plus, final ArcsSet minus) {
-            this.plus  = plus;
-            this.minus = minus;
-        }
-
-        /** Get the part of the arcs set on the plus side of the splitting arc.
-         * @return part of the arcs set on the plus side of the splitting arc
-         */
-        public ArcsSet getPlus() {
-            return plus;
-        }
-
-        /** Get the part of the arcs set on the minus side of the splitting arc.
-         * @return part of the arcs set on the minus side of the splitting arc
-         */
-        public ArcsSet getMinus() {
-            return minus;
-        }
-
-    }
-
-    /** Specialized exception for inconsistent BSP tree state inconsistency.
-     * <p>
-     * This exception is thrown at {@link ArcsSet} construction time when the
-     * {@link org.apache.commons.math3.geometry.partitioning.Region.Location inside/outside}
-     * state is not consistent at the 0, \(2 \pi \) crossing.
-     * </p>
-     */
-    public static class InconsistentStateAt2PiWrapping extends MathIllegalArgumentException {
-
-        /** Serializable UID. */
-        private static final long serialVersionUID = 20140107L;
-
-        /** Simple constructor.
-         */
-        public InconsistentStateAt2PiWrapping() {
-            super(LocalizedFormats.INCONSISTENT_STATE_AT_2_PI_WRAPPING);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/oned/LimitAngle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/LimitAngle.java b/src/main/java/org/apache/commons/math3/geometry/spherical/oned/LimitAngle.java
deleted file mode 100644
index 748a142..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/LimitAngle.java
+++ /dev/null
@@ -1,127 +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.geometry.spherical.oned;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-
-/** This class represents a 1D oriented hyperplane on the circle.
- * <p>An hyperplane on the 1-sphere is an angle with an orientation.</p>
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.3
- */
-public class LimitAngle implements Hyperplane<Sphere1D> {
-
-    /** Angle location. */
-    private S1Point location;
-
-    /** Orientation. */
-    private boolean direct;
-
-    /** Tolerance below which angles are considered identical. */
-    private final double tolerance;
-
-    /** Simple constructor.
-     * @param location location of the hyperplane
-     * @param direct if true, the plus side of the hyperplane is towards
-     * angles greater than {@code location}
-     * @param tolerance tolerance below which angles are considered identical
-     */
-    public LimitAngle(final S1Point location, final boolean direct, final double tolerance) {
-        this.location  = location;
-        this.direct    = direct;
-        this.tolerance = tolerance;
-    }
-
-    /** Copy the instance.
-     * <p>Since instances are immutable, this method directly returns
-     * the instance.</p>
-     * @return the instance itself
-     */
-    public LimitAngle copySelf() {
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    public double getOffset(final Point<Sphere1D> point) {
-        final double delta = ((S1Point) point).getAlpha() - location.getAlpha();
-        return direct ? delta : -delta;
-    }
-
-    /** Check if the hyperplane orientation is direct.
-     * @return true if the plus side of the hyperplane is towards
-     * angles greater than hyperplane location
-     */
-    public boolean isDirect() {
-        return direct;
-    }
-
-    /** Get the reverse of the instance.
-     * <p>Get a limit angle with reversed orientation with respect to the
-     * instance. A new object is built, the instance is untouched.</p>
-     * @return a new limit angle, with orientation opposite to the instance orientation
-     */
-    public LimitAngle getReverse() {
-        return new LimitAngle(location, !direct, tolerance);
-    }
-
-    /** Build a region covering the whole hyperplane.
-     * <p>Since this class represent zero dimension spaces which does
-     * not have lower dimension sub-spaces, this method returns a dummy
-     * implementation of a {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane SubHyperplane}.
-     * This implementation is only used to allow the {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
-     * SubHyperplane} class implementation to work properly, it should
-     * <em>not</em> be used otherwise.</p>
-     * @return a dummy sub hyperplane
-     */
-    public SubLimitAngle wholeHyperplane() {
-        return new SubLimitAngle(this, null);
-    }
-
-    /** Build a region covering the whole space.
-     * @return a region containing the instance (really an {@link
-     * ArcsSet IntervalsSet} instance)
-     */
-    public ArcsSet wholeSpace() {
-        return new ArcsSet(tolerance);
-    }
-
-    /** {@inheritDoc} */
-    public boolean sameOrientationAs(final Hyperplane<Sphere1D> other) {
-        return !(direct ^ ((LimitAngle) other).direct);
-    }
-
-    /** Get the hyperplane location on the circle.
-     * @return the hyperplane location
-     */
-    public S1Point getLocation() {
-        return location;
-    }
-
-    /** {@inheritDoc} */
-    public Point<Sphere1D> project(Point<Sphere1D> point) {
-        return location;
-    }
-
-    /** {@inheritDoc} */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/oned/S1Point.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/S1Point.java b/src/main/java/org/apache/commons/math3/geometry/spherical/oned/S1Point.java
deleted file mode 100644
index 263a559..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/S1Point.java
+++ /dev/null
@@ -1,157 +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.geometry.spherical.oned;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/** This class represents a point on the 1-sphere.
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.3
- */
-public class S1Point implements Point<Sphere1D> {
-
-   // CHECKSTYLE: stop ConstantName
-    /** A vector with all coordinates set to NaN. */
-    public static final S1Point NaN = new S1Point(Double.NaN, Vector2D.NaN);
-    // CHECKSTYLE: resume ConstantName
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20131218L;
-
-    /** Azimuthal angle \( \alpha \). */
-    private final double alpha;
-
-    /** Corresponding 2D normalized vector. */
-    private final Vector2D vector;
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param alpha azimuthal angle \( \alpha \)
-     * @see #getAlpha()
-     */
-    public S1Point(final double alpha) {
-        this(MathUtils.normalizeAngle(alpha, FastMath.PI),
-             new Vector2D(FastMath.cos(alpha), FastMath.sin(alpha)));
-    }
-
-    /** Build a point from its internal components.
-     * @param alpha azimuthal angle \( \alpha \)
-     * @param vector corresponding vector
-     */
-    private S1Point(final double alpha, final Vector2D vector) {
-        this.alpha  = alpha;
-        this.vector = vector;
-    }
-
-    /** Get the azimuthal angle \( \alpha \).
-     * @return azimuthal angle \( \alpha \)
-     * @see #S1Point(double)
-     */
-    public double getAlpha() {
-        return alpha;
-    }
-
-    /** Get the corresponding normalized vector in the 2D euclidean space.
-     * @return normalized vector
-     */
-    public Vector2D getVector() {
-        return vector;
-    }
-
-    /** {@inheritDoc} */
-    public Space getSpace() {
-        return Sphere1D.getInstance();
-    }
-
-    /** {@inheritDoc} */
-    public boolean isNaN() {
-        return Double.isNaN(alpha);
-    }
-
-    /** {@inheritDoc} */
-    public double distance(final Point<Sphere1D> point) {
-        return distance(this, (S1Point) point);
-    }
-
-    /** Compute the distance (angular separation) between two points.
-     * @param p1 first vector
-     * @param p2 second vector
-     * @return the angular separation between p1 and p2
-     */
-    public static double distance(S1Point p1, S1Point p2) {
-        return Vector2D.angle(p1.vector, p2.vector);
-    }
-
-    /**
-     * Test for the equality of two points on the 2-sphere.
-     * <p>
-     * If all coordinates of two points are exactly the same, and none are
-     * <code>Double.NaN</code>, the two points are considered to be equal.
-     * </p>
-     * <p>
-     * <code>NaN</code> coordinates are considered to affect globally the vector
-     * and be equals to each other - i.e, if either (or all) coordinates of the
-     * 2D vector are equal to <code>Double.NaN</code>, the 2D vector is equal to
-     * {@link #NaN}.
-     * </p>
-     *
-     * @param other Object to test for equality to this
-     * @return true if two points on the 2-sphere objects are equal, false if
-     *         object is null, not an instance of S2Point, or
-     *         not equal to this S2Point instance
-     *
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof S1Point) {
-            final S1Point rhs = (S1Point) other;
-            if (rhs.isNaN()) {
-                return this.isNaN();
-            }
-
-            return alpha == rhs.alpha;
-        }
-
-        return false;
-
-    }
-
-    /**
-     * Get a hashCode for the 2D vector.
-     * <p>
-     * All NaN values have the same hash code.</p>
-     *
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN()) {
-            return 542;
-        }
-        return 1759 * MathUtils.hash(alpha);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Sphere1D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Sphere1D.java b/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Sphere1D.java
deleted file mode 100644
index ce5c7cd..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/Sphere1D.java
+++ /dev/null
@@ -1,106 +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.geometry.spherical.oned;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Space;
-
-/**
- * This class implements a one-dimensional sphere (i.e. a circle).
- * <p>
- * We use here the topologists definition of the 1-sphere (see
- * <a href="http://mathworld.wolfram.com/Sphere.html">Sphere</a> on
- * MathWorld), i.e. the 1-sphere is the one-dimensional closed curve
- * defined in 2D as x<sup>2</sup>+y<sup>2</sup>=1.
- * </p>
- * @since 3.3
- */
-public class Sphere1D implements Serializable, Space {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20131218L;
-
-    /** Private constructor for the singleton.
-     */
-    private Sphere1D() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static Sphere1D getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public int getDimension() {
-        return 1;
-    }
-
-    /** {@inheritDoc}
-     * <p>
-     * As the 1-dimension sphere does not have proper sub-spaces,
-     * this method always throws a {@link NoSubSpaceException}
-     * </p>
-     * @return nothing
-     * @throws NoSubSpaceException in all cases
-     */
-    public Space getSubSpace() throws NoSubSpaceException {
-        throw new NoSubSpaceException();
-    }
-
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final Sphere1D INSTANCE = new Sphere1D();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-    /** Specialized exception for inexistent sub-space.
-     * <p>
-     * This exception is thrown when attempting to get the sub-space of a one-dimensional space
-     * </p>
-     */
-    public static class NoSubSpaceException extends MathUnsupportedOperationException {
-
-        /** Serializable UID. */
-        private static final long serialVersionUID = 20140225L;
-
-        /** Simple constructor.
-         */
-        public NoSubSpaceException() {
-            super(LocalizedFormats.NOT_SUPPORTED_IN_DIMENSION_N, 1);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/oned/SubLimitAngle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/SubLimitAngle.java b/src/main/java/org/apache/commons/math3/geometry/spherical/oned/SubLimitAngle.java
deleted file mode 100644
index 880a7e8..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/SubLimitAngle.java
+++ /dev/null
@@ -1,74 +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.geometry.spherical.oned;
-
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.Side;
-
-/** This class represents sub-hyperplane for {@link LimitAngle}.
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.3
- */
-public class SubLimitAngle extends AbstractSubHyperplane<Sphere1D, Sphere1D> {
-
-    /** Simple constructor.
-     * @param hyperplane underlying hyperplane
-     * @param remainingRegion remaining region of the hyperplane
-     */
-    public SubLimitAngle(final Hyperplane<Sphere1D> hyperplane,
-                         final Region<Sphere1D> remainingRegion) {
-        super(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getSize() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean isEmpty() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected AbstractSubHyperplane<Sphere1D, Sphere1D> buildNew(final Hyperplane<Sphere1D> hyperplane,
-                                                                 final Region<Sphere1D> remainingRegion) {
-        return new SubLimitAngle(hyperplane, remainingRegion);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Side side(final Hyperplane<Sphere1D> hyperplane) {
-        final double global = hyperplane.getOffset(((LimitAngle) getHyperplane()).getLocation());
-        return (global < -1.0e-10) ? Side.MINUS : ((global > 1.0e-10) ? Side.PLUS : Side.HYPER);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public SplitSubHyperplane<Sphere1D> split(final Hyperplane<Sphere1D> hyperplane) {
-        final double global = hyperplane.getOffset(((LimitAngle) getHyperplane()).getLocation());
-        return (global < -1.0e-10) ?
-                                    new SplitSubHyperplane<Sphere1D>(null, this) :
-                                    new SplitSubHyperplane<Sphere1D>(this, null);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/oned/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/package-info.java b/src/main/java/org/apache/commons/math3/geometry/spherical/oned/package-info.java
deleted file mode 100644
index d54bc0b..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/oned/package-info.java
+++ /dev/null
@@ -1,30 +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.
- */
-/**
- *
- * <p>
- * This package provides basic geometry components on the 1-sphere.
- * </p>
- * <p>
- * We use here the topologists definition of the 1-sphere (see
- * <a href="http://mathworld.wolfram.com/Sphere.html">Sphere</a> on
- * MathWorld), i.e. the 1-sphere is the one-dimensional closed curve
- * defined in 2D as x<sup>2</sup>+y<sup>2</sup>=1.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.spherical.oned;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java
deleted file mode 100644
index d6d47de..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Circle.java
+++ /dev/null
@@ -1,326 +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.geometry.spherical.twod;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.S1Point;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.FastMath;
-
-/** This class represents an oriented great circle on the 2-sphere.
-
- * <p>An oriented circle can be defined by a center point. The circle
- * is the the set of points that are in the normal plan the center.</p>
-
- * <p>Since it is oriented the two spherical caps at its two sides are
- * unambiguously identified as a left cap and a right cap. This can be
- * used to identify the interior and the exterior in a simple way by
- * local properties only when part of a line is used to define part of
- * a spherical polygon boundary.</p>
-
- * @since 3.3
- */
-public class Circle implements Hyperplane<Sphere2D>, Embedding<Sphere2D, Sphere1D> {
-
-    /** Pole or circle center. */
-    private Vector3D pole;
-
-    /** First axis in the equator plane, origin of the phase angles. */
-    private Vector3D x;
-
-    /** Second axis in the equator plane, in quadrature with respect to x. */
-    private Vector3D y;
-
-    /** Tolerance below which close sub-arcs are merged together. */
-    private final double tolerance;
-
-    /** Build a great circle from its pole.
-     * <p>The circle is oriented in the trigonometric direction around pole.</p>
-     * @param pole circle pole
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     */
-    public Circle(final Vector3D pole, final double tolerance) {
-        reset(pole);
-        this.tolerance = tolerance;
-    }
-
-    /** Build a great circle from two non-aligned points.
-     * <p>The circle is oriented from first to second point using the path smaller than \( \pi \).</p>
-     * @param first first point contained in the great circle
-     * @param second second point contained in the great circle
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     */
-    public Circle(final S2Point first, final S2Point second, final double tolerance) {
-        reset(first.getVector().crossProduct(second.getVector()));
-        this.tolerance = tolerance;
-    }
-
-    /** Build a circle from its internal components.
-     * <p>The circle is oriented in the trigonometric direction around center.</p>
-     * @param pole circle pole
-     * @param x first axis in the equator plane
-     * @param y second axis in the equator plane
-     * @param tolerance tolerance below which close sub-arcs are merged together
-     */
-    private Circle(final Vector3D pole, final Vector3D x, final Vector3D y,
-                   final double tolerance) {
-        this.pole      = pole;
-        this.x         = x;
-        this.y         = y;
-        this.tolerance = tolerance;
-    }
-
-    /** Copy constructor.
-     * <p>The created instance is completely independent from the
-     * original instance, it is a deep copy.</p>
-     * @param circle circle to copy
-     */
-    public Circle(final Circle circle) {
-        this(circle.pole, circle.x, circle.y, circle.tolerance);
-    }
-
-    /** {@inheritDoc} */
-    public Circle copySelf() {
-        return new Circle(this);
-    }
-
-    /** Reset the instance as if built from a pole.
-     * <p>The circle is oriented in the trigonometric direction around pole.</p>
-     * @param newPole circle pole
-     */
-    public void reset(final Vector3D newPole) {
-        this.pole = newPole.normalize();
-        this.x    = newPole.orthogonal();
-        this.y    = Vector3D.crossProduct(newPole, x).normalize();
-    }
-
-    /** Revert the instance.
-     */
-    public void revertSelf() {
-        // x remains the same
-        y    = y.negate();
-        pole = pole.negate();
-    }
-
-    /** Get the reverse of the instance.
-     * <p>Get a circle with reversed orientation with respect to the
-     * instance. A new object is built, the instance is untouched.</p>
-     * @return a new circle, with orientation opposite to the instance orientation
-     */
-    public Circle getReverse() {
-        return new Circle(pole.negate(), x, y.negate(), tolerance);
-    }
-
-    /** {@inheritDoc} */
-    public Point<Sphere2D> project(Point<Sphere2D> point) {
-        return toSpace(toSubSpace(point));
-    }
-
-    /** {@inheritDoc} */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /** {@inheritDoc}
-     * @see #getPhase(Vector3D)
-     */
-    public S1Point toSubSpace(final Point<Sphere2D> point) {
-        return new S1Point(getPhase(((S2Point) point).getVector()));
-    }
-
-    /** Get the phase angle of a direction.
-     * <p>
-     * The direction may not belong to the circle as the
-     * phase is computed for the meridian plane between the circle
-     * pole and the direction.
-     * </p>
-     * @param direction direction for which phase is requested
-     * @return phase angle of the direction around the circle
-     * @see #toSubSpace(Point)
-     */
-    public double getPhase(final Vector3D direction) {
-        return FastMath.PI + FastMath.atan2(-direction.dotProduct(y), -direction.dotProduct(x));
-    }
-
-    /** {@inheritDoc}
-     * @see #getPointAt(double)
-     */
-    public S2Point toSpace(final Point<Sphere1D> point) {
-        return new S2Point(getPointAt(((S1Point) point).getAlpha()));
-    }
-
-    /** Get a circle point from its phase around the circle.
-     * @param alpha phase around the circle
-     * @return circle point on the sphere
-     * @see #toSpace(Point)
-     * @see #getXAxis()
-     * @see #getYAxis()
-     */
-    public Vector3D getPointAt(final double alpha) {
-        return new Vector3D(FastMath.cos(alpha), x, FastMath.sin(alpha), y);
-    }
-
-    /** Get the X axis of the circle.
-     * <p>
-     * This method returns the same value as {@link #getPointAt(double)
-     * getPointAt(0.0)} but it does not do any computation and always
-     * return the same instance.
-     * </p>
-     * @return an arbitrary x axis on the circle
-     * @see #getPointAt(double)
-     * @see #getYAxis()
-     * @see #getPole()
-     */
-    public Vector3D getXAxis() {
-        return x;
-    }
-
-    /** Get the Y axis of the circle.
-     * <p>
-     * This method returns the same value as {@link #getPointAt(double)
-     * getPointAt(0.5 * FastMath.PI)} but it does not do any computation and always
-     * return the same instance.
-     * </p>
-     * @return an arbitrary y axis point on the circle
-     * @see #getPointAt(double)
-     * @see #getXAxis()
-     * @see #getPole()
-     */
-    public Vector3D getYAxis() {
-        return y;
-    }
-
-    /** Get the pole of the circle.
-     * <p>
-     * As the circle is a great circle, the pole does <em>not</em>
-     * belong to it.
-     * </p>
-     * @return pole of the circle
-     * @see #getXAxis()
-     * @see #getYAxis()
-     */
-    public Vector3D getPole() {
-        return pole;
-    }
-
-    /** Get the arc of the instance that lies inside the other circle.
-     * @param other other circle
-     * @return arc of the instance that lies inside the other circle
-     */
-    public Arc getInsideArc(final Circle other) {
-        final double alpha  = getPhase(other.pole);
-        final double halfPi = 0.5 * FastMath.PI;
-        return new Arc(alpha - halfPi, alpha + halfPi, tolerance);
-    }
-
-    /** {@inheritDoc} */
-    public SubCircle wholeHyperplane() {
-        return new SubCircle(this, new ArcsSet(tolerance));
-    }
-
-    /** Build a region covering the whole space.
-     * @return a region containing the instance (really a {@link
-     * SphericalPolygonsSet SphericalPolygonsSet} instance)
-     */
-    public SphericalPolygonsSet wholeSpace() {
-        return new SphericalPolygonsSet(tolerance);
-    }
-
-    /** {@inheritDoc}
-     * @see #getOffset(Vector3D)
-     */
-    public double getOffset(final Point<Sphere2D> point) {
-        return getOffset(((S2Point) point).getVector());
-    }
-
-    /** Get the offset (oriented distance) of a direction.
-     * <p>The offset is defined as the angular distance between the
-     * circle center and the direction minus the circle radius. It
-     * is therefore 0 on the circle, positive for directions outside of
-     * the cone delimited by the circle, and negative inside the cone.</p>
-     * @param direction direction to check
-     * @return offset of the direction
-     * @see #getOffset(Point)
-     */
-    public double getOffset(final Vector3D direction) {
-        return Vector3D.angle(pole, direction) - 0.5 * FastMath.PI;
-    }
-
-    /** {@inheritDoc} */
-    public boolean sameOrientationAs(final Hyperplane<Sphere2D> other) {
-        final Circle otherC = (Circle) other;
-        return Vector3D.dotProduct(pole, otherC.pole) >= 0.0;
-    }
-
-    /** Get a {@link org.apache.commons.math3.geometry.partitioning.Transform
-     * Transform} embedding a 3D rotation.
-     * @param rotation rotation to use
-     * @return a new transform that can be applied to either {@link
-     * Point Point}, {@link Circle Line} or {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
-     * SubHyperplane} instances
-     */
-    public static Transform<Sphere2D, Sphere1D> getTransform(final Rotation rotation) {
-        return new CircleTransform(rotation);
-    }
-
-    /** Class embedding a 3D rotation. */
-    private static class CircleTransform implements Transform<Sphere2D, Sphere1D> {
-
-        /** Underlying rotation. */
-        private final Rotation rotation;
-
-        /** Build a transform from a {@code Rotation}.
-         * @param rotation rotation to use
-         */
-        public CircleTransform(final Rotation rotation) {
-            this.rotation = rotation;
-        }
-
-        /** {@inheritDoc} */
-        public S2Point apply(final Point<Sphere2D> point) {
-            return new S2Point(rotation.applyTo(((S2Point) point).getVector()));
-        }
-
-        /** {@inheritDoc} */
-        public Circle apply(final Hyperplane<Sphere2D> hyperplane) {
-            final Circle circle = (Circle) hyperplane;
-            return new Circle(rotation.applyTo(circle.pole),
-                              rotation.applyTo(circle.x),
-                              rotation.applyTo(circle.y),
-                              circle.tolerance);
-        }
-
-        /** {@inheritDoc} */
-        public SubHyperplane<Sphere1D> apply(final SubHyperplane<Sphere1D> sub,
-                                             final Hyperplane<Sphere2D> original,
-                                             final Hyperplane<Sphere2D> transformed) {
-            // as the circle is rotated, the limit angles are rotated too
-            return sub;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Edge.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Edge.java b/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Edge.java
deleted file mode 100644
index a9ccb08..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/spherical/twod/Edge.java
+++ /dev/null
@@ -1,222 +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.geometry.spherical.twod;
-
-import java.util.List;
-
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.spherical.oned.Arc;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/** Spherical polygons boundary edge.
- * @see SphericalPolygonsSet#getBoundaryLoops()
- * @see Vertex
- * @since 3.3
- */
-public class Edge {
-
-    /** Start vertex. */
-    private final Vertex start;
-
-    /** End vertex. */
-    private Vertex end;
-
-    /** Length of the arc. */
-    private final double length;
-
-    /** Circle supporting the edge. */
-    private final Circle circle;
-
-    /** Build an edge not contained in any node yet.
-     * @param start start vertex
-     * @param end end vertex
-     * @param length length of the arc (it can be greater than \( \pi \))
-     * @param circle circle supporting the edge
-     */
-    Edge(final Vertex start, final Vertex end, final double length, final Circle circle) {
-
-        this.start  = start;
-        this.end    = end;
-        this.length = length;
-        this.circle = circle;
-
-        // connect the vertices back to the edge
-        start.setOutgoing(this);
-        end.setIncoming(this);
-
-    }
-
-    /** Get start vertex.
-     * @return start vertex
-     */
-    public Vertex getStart() {
-        return start;
-    }
-
-    /** Get end vertex.
-     * @return end vertex
-     */
-    public Vertex getEnd() {
-        return end;
-    }
-
-    /** Get the length of the arc.
-     * @return length of the arc (can be greater than \( \pi \))
-     */
-    public double getLength() {
-        return length;
-    }
-
-    /** Get the circle supporting this edge.
-     * @return circle supporting this edge
-     */
-    public Circle getCircle() {
-        return circle;
-    }
-
-    /** Get an intermediate point.
-     * <p>
-     * The angle along the edge should normally be between 0 and {@link #getLength()}
-     * in order to remain within edge limits. However, there are no checks on the
-     * value of the angle, so user can rebuild the full circle on which an edge is
-     * defined if they want.
-     * </p>
-     * @param alpha angle along the edge, counted from {@link #getStart()}
-     * @return an intermediate point
-     */
-    public Vector3D getPointAt(final double alpha) {
-        return circle.getPointAt(alpha + circle.getPhase(start.getLocation().getVector()));
-    }
-
-    /** Connect the instance with a following edge.
-     * @param next edge following the instance
-     */
-    void setNextEdge(final Edge next) {
-        end = next.getStart();
-        end.setIncoming(this);
-        end.bindWith(getCircle());
-    }
-
-    /** Split the edge.
-     * <p>
-     * Once split, this edge is not referenced anymore by the vertices,
-     * it is replaced by the two or three sub-edges and intermediate splitting
-     * vertices are introduced to connect these sub-edges together.
-     * </p>
-     * @param splitCircle circle splitting the edge in several parts
-     * @param outsideList list where to put parts that are outside of the split circle
-     * @param insideList list where to put parts that are inside the split circle
-     */
-    void split(final Circle splitCircle,
-                       final List<Edge> outsideList, final List<Edge> insideList) {
-
-        // get the inside arc, synchronizing its phase with the edge itself
-        final double edgeStart        = circle.getPhase(start.getLocation().getVector());
-        final Arc    arc              = circle.getInsideArc(splitCircle);
-        final double arcRelativeStart = MathUtils.normalizeAngle(arc.getInf(), edgeStart + FastMath.PI) - edgeStart;
-        final double arcRelativeEnd   = arcRelativeStart + arc.getSize();
-        final double unwrappedEnd     = arcRelativeEnd - MathUtils.TWO_PI;
-
-        // build the sub-edges
-        final double tolerance = circle.getTolerance();
-        Vertex previousVertex = start;
-        if (unwrappedEnd >= length - tolerance) {
-
-            // the edge is entirely contained inside the circle
-            // we don't split anything
-            insideList.add(this);
-
-        } else {
-
-            // there are at least some parts of the edge that should be outside
-            // (even is they are later be filtered out as being too small)
-            double alreadyManagedLength = 0;
-            if (unwrappedEnd >= 0) {
-                // the start of the edge is inside the circle
-                previousVertex = addSubEdge(previousVertex,
-                                            new Vertex(new S2Point(circle.getPointAt(edgeStart + unwrappedEnd))),
-                                            unwrappedEnd, insideList, splitCircle);
-                alreadyManagedLength = unwrappedEnd;
-            }
-
-            if (arcRelativeStart >= length - tolerance) {
-                // the edge ends while still outside of the circle
-                if (unwrappedEnd >= 0) {
-                    previousVertex = addSubEdge(previousVertex, end,
-                                                length - alreadyManagedLength, outsideList, splitCircle);
-                } else {
-                    // the edge is entirely outside of the circle
-                    // we don't split anything
-                    outsideList.add(this);
-                }
-            } else {
-                // the edge is long enough to enter inside the circle
-                previousVertex = addSubEdge(previousVertex,
-                                            new Vertex(new S2Point(circle.getPointAt(edgeStart + arcRelativeStart))),
-                                            arcRelativeStart - alreadyManagedLength, outsideList, splitCircle);
-                alreadyManagedLength = arcRelativeStart;
-
-                if (arcRelativeEnd >= length - tolerance) {
-                    // the edge ends while still inside of the circle
-                    previousVertex = addSubEdge(previousVertex, end,
-                                                length - alreadyManagedLength, insideList, splitCircle);
-                } else {
-                    // the edge is long enough to exit outside of the circle
-                    previousVertex = addSubEdge(previousVertex,
-                                                new Vertex(new S2Point(circle.getPointAt(edgeStart + arcRelativeStart))),
-                                                arcRelativeStart - alreadyManagedLength, insideList, splitCircle);
-                    alreadyManagedLength = arcRelativeStart;
-                    previousVertex = addSubEdge(previousVertex, end,
-                                                length - alreadyManagedLength, outsideList, splitCircle);
-                }
-            }
-
-        }
-
-    }
-
-    /** Add a sub-edge to a list if long enough.
-     * <p>
-     * If the length of the sub-edge to add is smaller than the {@link Circle#getTolerance()}
-     * tolerance of the support circle, it will be ignored.
-     * </p>
-     * @param subStart start of the sub-edge
-     * @param subEnd end of the sub-edge
-     * @param subLength length of the sub-edge
-     * @param splitCircle circle splitting the edge in several parts
-     * @param list list where to put the sub-edge
-     * @return end vertex of the edge ({@code subEnd} if the edge was long enough and really
-     * added, {@code subStart} if the edge was too small and therefore ignored)
-     */
-    private Vertex addSubEdge(final Vertex subStart, final Vertex subEnd, final double subLength,
-                              final List<Edge> list, final Circle splitCircle) {
-
-        if (subLength <= circle.getTolerance()) {
-            // the edge is too short, we ignore it
-            return subStart;
-        }
-
-        // really add the edge
-        subEnd.bindWith(splitCircle);
-        final Edge edge = new Edge(subStart, subEnd, subLength, circle);
-        list.add(edge);
-        return subEnd;
-
-    }
-
-}


[73/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
index 4aa80ed..8c23ce6 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldLUDecomposition.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Calculates the LUP-decomposition of a square matrix.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
index 1048887..0db94b9 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldMatrix.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
-
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+package org.apache.commons.math4.linear;
+
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Interface defining field-valued matrix with basic algebraic operations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldMatrixChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/FieldMatrixChangingVisitor.java
index d510cd0..53c965f 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldMatrixChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldMatrixChangingVisitor.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Interface defining a visitor for matrix entries.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldMatrixPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/FieldMatrixPreservingVisitor.java
index 8db2e3a..3b46933 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldMatrixPreservingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldMatrixPreservingVisitor.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Interface defining a visitor for matrix entries.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldVector.java b/src/main/java/org/apache/commons/math4/linear/FieldVector.java
index 2161e81..1e74e55 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldVector.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Interface defining a field-valued vector with basic algebraic operations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldVectorChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldVectorChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/FieldVectorChangingVisitor.java
index b1589b1..2938d43 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldVectorChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldVectorChangingVisitor.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * This interface defines a visitor for the entries of a vector. Visitors

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/FieldVectorPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/FieldVectorPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/FieldVectorPreservingVisitor.java
index bc09bda..9ad4384 100644
--- a/src/main/java/org/apache/commons/math4/linear/FieldVectorPreservingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/FieldVectorPreservingVisitor.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * This interface defines a visitor for the entries of a vector. Visitors

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java b/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
index 8fefc09..a63c0ab 100644
--- a/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
+++ b/src/main/java/org/apache/commons/math4/linear/HessenbergTransformer.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Class transforming a general real matrix to Hessenberg form.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/IllConditionedOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/IllConditionedOperatorException.java b/src/main/java/org/apache/commons/math4/linear/IllConditionedOperatorException.java
index 3285f68..a90b3d1 100644
--- a/src/main/java/org/apache/commons/math4/linear/IllConditionedOperatorException.java
+++ b/src/main/java/org/apache/commons/math4/linear/IllConditionedOperatorException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * An exception to be thrown when the condition number of a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolver.java b/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolver.java
index 97bd8b7..877d48b 100644
--- a/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolver.java
+++ b/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolver.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.IterationManager;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.IterationManager;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * This abstract class defines an iterative solver for the linear system A
@@ -113,7 +113,7 @@ public abstract class IterativeLinearSolver {
      * inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(final RealLinearOperator a, final RealVector b)
@@ -139,7 +139,7 @@ public abstract class IterativeLinearSolver {
      * dimensions inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(RealLinearOperator a, RealVector b, RealVector x0)
@@ -164,7 +164,7 @@ public abstract class IterativeLinearSolver {
      * dimensions inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      */
     public abstract RealVector solveInPlace(RealLinearOperator a, RealVector b,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolverEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolverEvent.java b/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolverEvent.java
index 780068c..94b47ef 100644
--- a/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolverEvent.java
+++ b/src/main/java/org/apache/commons/math4/linear/IterativeLinearSolverEvent.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.util.IterationEvent;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.util.IterationEvent;
 
 /**
  * This is the base class for all events occurring during the iterations of a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/JacobiPreconditioner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/JacobiPreconditioner.java b/src/main/java/org/apache/commons/math4/linear/JacobiPreconditioner.java
index 1506fe5..63d70c3 100644
--- a/src/main/java/org/apache/commons/math4/linear/JacobiPreconditioner.java
+++ b/src/main/java/org/apache/commons/math4/linear/JacobiPreconditioner.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.analysis.function.Sqrt;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.function.Sqrt;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class implements the standard Jacobi (diagonal) preconditioner. For a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java b/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java
index 368bc30..6fbc57a 100644
--- a/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/LUDecomposition.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Calculates the LUP-decomposition of a square matrix.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/MatrixDimensionMismatchException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/MatrixDimensionMismatchException.java b/src/main/java/org/apache/commons/math4/linear/MatrixDimensionMismatchException.java
index effbf11..ff3928e 100644
--- a/src/main/java/org/apache/commons/math4/linear/MatrixDimensionMismatchException.java
+++ b/src/main/java/org/apache/commons/math4/linear/MatrixDimensionMismatchException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MultiDimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MultiDimensionMismatchException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when either the number of rows or the number of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
index 23c11e0..e95c4c8 100644
--- a/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
+++ b/src/main/java/org/apache/commons/math4/linear/MatrixUtils.java
@@ -15,29 +15,29 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Arrays;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * A collection of static methods that operate on or return matrices.
@@ -116,7 +116,7 @@ public class MatrixUtils {
      *
      * @param data input array
      * @return  RealMatrix containing the values of the array
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if {@code data} is not rectangular (not all rows have the same length).
      * @throws NoDataException if a row or column is empty.
      * @throws NullArgumentException if either {@code data} or {@code data[0]}
@@ -146,7 +146,7 @@ public class MatrixUtils {
      * @param <T> the type of the field elements
      * @param data input array
      * @return a matrix containing the values of the array.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if {@code data} is not rectangular (not all rows have the same length).
      * @throws NoDataException if a row or column is empty.
      * @throws NullArgumentException if either {@code data} or {@code data[0]}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteMatrixException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteMatrixException.java b/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteMatrixException.java
index a0fbf17..fffacc6 100644
--- a/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteMatrixException.java
+++ b/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteMatrixException.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a positive definite matrix is expected.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteOperatorException.java b/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteOperatorException.java
index f322218..4390d47 100644
--- a/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteOperatorException.java
+++ b/src/main/java/org/apache/commons/math4/linear/NonPositiveDefiniteOperatorException.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a symmetric, definite positive

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/NonSelfAdjointOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/NonSelfAdjointOperatorException.java b/src/main/java/org/apache/commons/math4/linear/NonSelfAdjointOperatorException.java
index ad436e2..4f9cc0d 100644
--- a/src/main/java/org/apache/commons/math4/linear/NonSelfAdjointOperatorException.java
+++ b/src/main/java/org/apache/commons/math4/linear/NonSelfAdjointOperatorException.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a self-adjoint {@link RealLinearOperator}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/NonSquareMatrixException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/NonSquareMatrixException.java b/src/main/java/org/apache/commons/math4/linear/NonSquareMatrixException.java
index a6679bf..6354391 100644
--- a/src/main/java/org/apache/commons/math4/linear/NonSquareMatrixException.java
+++ b/src/main/java/org/apache/commons/math4/linear/NonSquareMatrixException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a square matrix is expected.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/NonSquareOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/NonSquareOperatorException.java b/src/main/java/org/apache/commons/math4/linear/NonSquareOperatorException.java
index 7915b58..e325cf4 100644
--- a/src/main/java/org/apache/commons/math4/linear/NonSquareOperatorException.java
+++ b/src/main/java/org/apache/commons/math4/linear/NonSquareOperatorException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a square linear operator is expected.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/NonSymmetricMatrixException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/NonSymmetricMatrixException.java b/src/main/java/org/apache/commons/math4/linear/NonSymmetricMatrixException.java
index f14eec9..23280e9 100644
--- a/src/main/java/org/apache/commons/math4/linear/NonSymmetricMatrixException.java
+++ b/src/main/java/org/apache/commons/math4/linear/NonSymmetricMatrixException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a symmetric matrix is expected.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/OpenMapRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/OpenMapRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/OpenMapRealMatrix.java
index c26da52..a8382eb 100644
--- a/src/main/java/org/apache/commons/math4/linear/OpenMapRealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/OpenMapRealMatrix.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.OpenIntToDoubleHashMap;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.OpenIntToDoubleHashMap;
 
 /**
  * Sparse matrix implementation based on an open addressed map.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java b/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java
index bc70cae..4619835 100644
--- a/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/OpenMapRealVector.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.OpenIntToDoubleHashMap;
-import org.apache.commons.math3.util.OpenIntToDoubleHashMap.Iterator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.OpenIntToDoubleHashMap;
+import org.apache.commons.math4.util.OpenIntToDoubleHashMap.Iterator;
 
 /**
  * This class implements the {@link RealVector} interface with a

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/PreconditionedIterativeLinearSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/PreconditionedIterativeLinearSolver.java b/src/main/java/org/apache/commons/math4/linear/PreconditionedIterativeLinearSolver.java
index 7bc36f0..4110a0c 100644
--- a/src/main/java/org/apache/commons/math4/linear/PreconditionedIterativeLinearSolver.java
+++ b/src/main/java/org/apache/commons/math4/linear/PreconditionedIterativeLinearSolver.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.IterationManager;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.IterationManager;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>
@@ -86,7 +86,7 @@ public abstract class PreconditionedIterativeLinearSolver
      * {@code x0} have dimensions inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(final RealLinearOperator a,
@@ -167,7 +167,7 @@ public abstract class PreconditionedIterativeLinearSolver
      * dimensions inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      */
     public RealVector solve(RealLinearOperator a, RealLinearOperator m,
@@ -195,7 +195,7 @@ public abstract class PreconditionedIterativeLinearSolver
      * {@code x0} have dimensions inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      */
     public abstract RealVector solveInPlace(RealLinearOperator a,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/QRDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/QRDecomposition.java b/src/main/java/org/apache/commons/math4/linear/QRDecomposition.java
index 6db821a..02ac7e9 100644
--- a/src/main/java/org/apache/commons/math4/linear/QRDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/QRDecomposition.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java b/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java
index 33c3b44..857cce0 100644
--- a/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/RRQRDecomposition.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealLinearOperator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealLinearOperator.java b/src/main/java/org/apache/commons/math4/linear/RealLinearOperator.java
index 210984b..06ff43c 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealLinearOperator.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealLinearOperator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /**
  * This class defines a linear operator operating on real ({@code double})
@@ -84,7 +84,7 @@ public abstract class RealLinearOperator {
      * @param x the vector to operate on
      * @return the product of the transpose of {@code this} instance with
      * {@code x}
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the row dimension does not match the size of {@code x}
      * @throws UnsupportedOperationException if this operation is not supported
      * by {@code this} operator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealMatrix.java b/src/main/java/org/apache/commons/math4/linear/RealMatrix.java
index 94ed89e..1cafe3e 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealMatrix.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Interface defining a real-valued matrix with basic algebraic operations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealMatrixChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/RealMatrixChangingVisitor.java
index eea8aa2..7a672ef 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealMatrixChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealMatrixChangingVisitor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * Interface defining a visitor for matrix entries.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
index 446f33b..8601490 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
@@ -24,8 +24,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.util.CompositeFormat;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.util.CompositeFormat;
 
 /**
  * Formats a {@code nxm} matrix in components list format

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealMatrixPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/RealMatrixPreservingVisitor.java
index 4c580a0..17195d1 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealMatrixPreservingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealMatrixPreservingVisitor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * Interface defining a visitor for matrix entries.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealVector.java b/src/main/java/org/apache/commons/math4/linear/RealVector.java
index 98bf4a0..2d0a1b9 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealVector.java
@@ -15,24 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.function.Add;
-import org.apache.commons.math3.analysis.function.Multiply;
-import org.apache.commons.math3.analysis.function.Divide;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Add;
+import org.apache.commons.math4.analysis.function.Divide;
+import org.apache.commons.math4.analysis.function.Multiply;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Class defining a real-valued vector with basic algebraic operations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealVectorChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealVectorChangingVisitor.java b/src/main/java/org/apache/commons/math4/linear/RealVectorChangingVisitor.java
index 27536da..2aa9d0b 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealVectorChangingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealVectorChangingVisitor.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * This interface defines a visitor for the entries of a vector. Visitors

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java b/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
index 1169188..49de55d 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealVectorFormat.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;
@@ -24,8 +24,8 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.util.CompositeFormat;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.util.CompositeFormat;
 
 /**
  * Formats a vector in components list format "{v0; v1; ...; vk-1}".

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RealVectorPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RealVectorPreservingVisitor.java b/src/main/java/org/apache/commons/math4/linear/RealVectorPreservingVisitor.java
index 8e32cb2..60d5f9d 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealVectorPreservingVisitor.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealVectorPreservingVisitor.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * This interface defines a visitor for the entries of a vector. Visitors

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/RectangularCholeskyDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/RectangularCholeskyDecomposition.java b/src/main/java/org/apache/commons/math4/linear/RectangularCholeskyDecomposition.java
index 47394b3..b32a5da 100644
--- a/src/main/java/org/apache/commons/math4/linear/RectangularCholeskyDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/RectangularCholeskyDecomposition.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Calculates the rectangular Cholesky decomposition of a matrix.
@@ -29,7 +29,7 @@ import org.apache.commons.math3.util.FastMath;
  * is that rows/columns may be permuted (hence the rectangular shape instead
  * of the traditional triangular shape) and there is a threshold to ignore
  * small diagonal elements. This is used for example to generate {@link
- * org.apache.commons.math3.random.CorrelatedRandomVectorGenerator correlated
+ * org.apache.commons.math4.random.CorrelatedRandomVectorGenerator correlated
  * random n-dimensions vectors} in a p-dimension subspace (p < n).
  * In other words, it allows generating random vectors from a covariance
  * matrix that is only positive semidefinite, and not positive definite.</p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java b/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
index cd54ca4..5ad0757 100644
--- a/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
+++ b/src/main/java/org/apache/commons/math4/linear/SchurTransformer.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Class transforming a general real matrix to Schur form.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SingularMatrixException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SingularMatrixException.java b/src/main/java/org/apache/commons/math4/linear/SingularMatrixException.java
index 935d8f3..f1548ad 100644
--- a/src/main/java/org/apache/commons/math4/linear/SingularMatrixException.java
+++ b/src/main/java/org/apache/commons/math4/linear/SingularMatrixException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when a non-singular matrix is expected.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SingularOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SingularOperatorException.java b/src/main/java/org/apache/commons/math4/linear/SingularOperatorException.java
index 32fb1da..6352d7f 100644
--- a/src/main/java/org/apache/commons/math4/linear/SingularOperatorException.java
+++ b/src/main/java/org/apache/commons/math4/linear/SingularOperatorException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Exception to be thrown when trying to invert a singular operator.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java b/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
index 89c0afd..ab7e74b 100644
--- a/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
+++ b/src/main/java/org/apache/commons/math4/linear/SingularValueDecomposition.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Calculates the compact Singular Value Decomposition of a matrix.
@@ -696,7 +696,7 @@ public class SingularValueDecomposition {
          * </p>
          * @param b Right-hand side of the equation A &times; X = B
          * @return a vector X that minimizes the two norm of A &times; X - B
-         * @throws org.apache.commons.math3.exception.DimensionMismatchException
+         * @throws org.apache.commons.math4.exception.DimensionMismatchException
          * if the matrices dimensions do not match.
          */
         public RealVector solve(final RealVector b) {
@@ -712,7 +712,7 @@ public class SingularValueDecomposition {
          *
          * @param b Right-hand side of the equation A &times; X = B
          * @return a matrix X that minimizes the two norm of A &times; X - B
-         * @throws org.apache.commons.math3.exception.DimensionMismatchException
+         * @throws org.apache.commons.math4.exception.DimensionMismatchException
          * if the matrices dimensions do not match.
          */
         public RealMatrix solve(final RealMatrix b) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java b/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
index 853b0c7..b48970c 100644
--- a/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/SparseFieldMatrix.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.util.OpenIntToFieldHashMap;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.util.OpenIntToFieldHashMap;
 
 /**
  * Sparse matrix implementation based on an open addressed map.
@@ -61,7 +61,7 @@ public class SparseFieldMatrix<T extends FieldElement<T>> extends AbstractFieldM
      * @param field Field to which the elements belong.
      * @param rowDimension Number of rows in the new matrix.
      * @param columnDimension Number of columns in the new matrix.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if row or column dimension is not positive.
      */
     public SparseFieldMatrix(final Field<T> field,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
index 8f98e50..09bfb37 100644
--- a/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/SparseFieldVector.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.OpenIntToFieldHashMap;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.OpenIntToFieldHashMap;
 
 /**
  * This class implements the {@link FieldVector} interface with a {@link OpenIntToFieldHashMap} backing store.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SparseRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SparseRealMatrix.java b/src/main/java/org/apache/commons/math4/linear/SparseRealMatrix.java
index df61c9b..75a2ecb 100644
--- a/src/main/java/org/apache/commons/math4/linear/SparseRealMatrix.java
+++ b/src/main/java/org/apache/commons/math4/linear/SparseRealMatrix.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * Marker interface for {@link RealMatrix} implementations that require sparse backing storage

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SparseRealVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SparseRealVector.java b/src/main/java/org/apache/commons/math4/linear/SparseRealVector.java
index f005bc8..05ed3ef 100644
--- a/src/main/java/org/apache/commons/math4/linear/SparseRealVector.java
+++ b/src/main/java/org/apache/commons/math4/linear/SparseRealVector.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 /**
  * Marker class for RealVectors that require sparse backing storage

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/SymmLQ.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/SymmLQ.java b/src/main/java/org/apache/commons/math4/linear/SymmLQ.java
index e529a6a..990bcc5 100644
--- a/src/main/java/org/apache/commons/math4/linear/SymmLQ.java
+++ b/src/main/java/org/apache/commons/math4/linear/SymmLQ.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.IterationManager;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.ExceptionContext;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.IterationManager;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>
@@ -954,7 +954,7 @@ public class SymmLQ
      * inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      * @throws NonSelfAdjointOperatorException if {@link #getCheck()} is
      * {@code true}, and {@code a} or {@code m} is not self-adjoint
@@ -1042,7 +1042,7 @@ public class SymmLQ
      * inconsistent with {@code a}
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      * @throws NonSelfAdjointOperatorException if {@link #getCheck()} is
      * {@code true}, and {@code a} is not self-adjoint
@@ -1132,7 +1132,7 @@ public class SymmLQ
      * have dimensions inconsistent with {@code a}.
      * @throws MaxCountExceededException at exhaustion of the iteration count,
      * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
+     * {@link org.apache.commons.math4.util.Incrementor.MaxCountExceededCallback callback}
      * has been set at construction of the {@link IterationManager}
      * @throws NonSelfAdjointOperatorException if {@link #getCheck()} is
      * {@code true}, and {@code a} or {@code m} is not self-adjoint

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/TriDiagonalTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/TriDiagonalTransformer.java b/src/main/java/org/apache/commons/math4/linear/TriDiagonalTransformer.java
index 9d2f986..9e73b29 100644
--- a/src/main/java/org/apache/commons/math4/linear/TriDiagonalTransformer.java
+++ b/src/main/java/org/apache/commons/math4/linear/TriDiagonalTransformer.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/linear/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/linear/package-info.java b/src/main/java/org/apache/commons/math4/linear/package-info.java
index 4c989b8..a1a091e 100644
--- a/src/main/java/org/apache/commons/math4/linear/package-info.java
+++ b/src/main/java/org/apache/commons/math4/linear/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Linear algebra support.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java b/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java
index 5cfc7bc..ba08e23 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/CentroidCluster.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 /**
  * A Cluster used by centroid-based clustering algorithms.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java b/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
index fa6df94..bd264bb 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/Cluster.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.io.Serializable;
 import java.util.ArrayList;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/Clusterable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/Clusterable.java b/src/main/java/org/apache/commons/math4/ml/clustering/Clusterable.java
index e712eb7..afafdd1 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/Clusterable.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/Clusterable.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 /**
  * Interface for n-dimensional points that can be clustered together.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/Clusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/Clusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/Clusterer.java
index 30e38c6..0954264 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/Clusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/Clusterer.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
 
 /**
  * Base class for clustering algorithms.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
index ce3d5cd..1223be8 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/DBSCANClusterer.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -24,11 +24,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * DBSCAN (density-based spatial clustering of applications with noise) algorithm.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/DoublePoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/DoublePoint.java b/src/main/java/org/apache/commons/math4/ml/clustering/DoublePoint.java
index 4fb31f7..c1b7f41 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/DoublePoint.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/DoublePoint.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.io.Serializable;
 import java.util.Arrays;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
index 5f89934..e57697f 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClusterer.java
@@ -14,25 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Fuzzy K-Means clustering algorithm.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
index 2e68c2d..14e9a89 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClusterer.java
@@ -15,23 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Clustering algorithm based on David Arthur and Sergei Vassilvitski k-means++ algorithm.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClusterer.java b/src/main/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClusterer.java
index 796fc7a..61606c8 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClusterer.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClusterer.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.ml.clustering.evaluation.ClusterEvaluator;
-import org.apache.commons.math3.ml.clustering.evaluation.SumOfClusterVariances;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.ml.clustering.evaluation.ClusterEvaluator;
+import org.apache.commons.math4.ml.clustering.evaluation.SumOfClusterVariances;
 
 /**
  * A wrapper around a k-means++ clustering algorithm which performs multiple trials

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/ClusterEvaluator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/ClusterEvaluator.java b/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/ClusterEvaluator.java
index 2bb8ba3..5f364c0 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/ClusterEvaluator.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/ClusterEvaluator.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering.evaluation;
+package org.apache.commons.math4.ml.clustering.evaluation;
 
 import java.util.List;
 
-import org.apache.commons.math3.ml.clustering.CentroidCluster;
-import org.apache.commons.math3.ml.clustering.Cluster;
-import org.apache.commons.math3.ml.clustering.Clusterable;
-import org.apache.commons.math3.ml.clustering.DoublePoint;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.ml.clustering.CentroidCluster;
+import org.apache.commons.math4.ml.clustering.Cluster;
+import org.apache.commons.math4.ml.clustering.Clusterable;
+import org.apache.commons.math4.ml.clustering.DoublePoint;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
 
 /**
  * Base class for cluster evaluation methods.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariances.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariances.java b/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariances.java
index 4051c11..62aa6e7 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariances.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariances.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering.evaluation;
+package org.apache.commons.math4.ml.clustering.evaluation;
 
 import java.util.List;
 
-import org.apache.commons.math3.ml.clustering.Cluster;
-import org.apache.commons.math3.ml.clustering.Clusterable;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.ml.clustering.Cluster;
+import org.apache.commons.math4.ml.clustering.Clusterable;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
 
 /**
  * Computes the sum of intra-cluster distance variances according to the formula:

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/package-info.java b/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/package-info.java
index 700f566..2d02358 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/evaluation/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Cluster evaluation methods.
  */
-package org.apache.commons.math3.ml.clustering.evaluation;
+package org.apache.commons.math4.ml.clustering.evaluation;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/clustering/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/clustering/package-info.java b/src/main/java/org/apache/commons/math4/ml/clustering/package-info.java
index 02f1d20..d6bbe17 100644
--- a/src/main/java/org/apache/commons/math4/ml/clustering/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/clustering/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Clustering algorithms.
  */
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/distance/CanberraDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/distance/CanberraDistance.java b/src/main/java/org/apache/commons/math4/ml/distance/CanberraDistance.java
index d997352..36a6268 100644
--- a/src/main/java/org/apache/commons/math4/ml/distance/CanberraDistance.java
+++ b/src/main/java/org/apache/commons/math4/ml/distance/CanberraDistance.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Calculates the Canberra distance between two points.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/distance/ChebyshevDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/distance/ChebyshevDistance.java b/src/main/java/org/apache/commons/math4/ml/distance/ChebyshevDistance.java
index 9eecb15..0fb5145 100644
--- a/src/main/java/org/apache/commons/math4/ml/distance/ChebyshevDistance.java
+++ b/src/main/java/org/apache/commons/math4/ml/distance/ChebyshevDistance.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Calculates the L<sub>&infin;</sub> (max of abs) distance between two points.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/distance/DistanceMeasure.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/distance/DistanceMeasure.java b/src/main/java/org/apache/commons/math4/ml/distance/DistanceMeasure.java
index 98bfc89..89d4672 100644
--- a/src/main/java/org/apache/commons/math4/ml/distance/DistanceMeasure.java
+++ b/src/main/java/org/apache/commons/math4/ml/distance/DistanceMeasure.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/distance/EarthMoversDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/distance/EarthMoversDistance.java b/src/main/java/org/apache/commons/math4/ml/distance/EarthMoversDistance.java
index 13f2654..cce78bf 100644
--- a/src/main/java/org/apache/commons/math4/ml/distance/EarthMoversDistance.java
+++ b/src/main/java/org/apache/commons/math4/ml/distance/EarthMoversDistance.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Calculates the Earh Mover's distance (also known as Wasserstein metric) between two distributions.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/distance/EuclideanDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/distance/EuclideanDistance.java b/src/main/java/org/apache/commons/math4/ml/distance/EuclideanDistance.java
index 5d8029e..76de013 100644
--- a/src/main/java/org/apache/commons/math4/ml/distance/EuclideanDistance.java
+++ b/src/main/java/org/apache/commons/math4/ml/distance/EuclideanDistance.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Calculates the L<sub>2</sub> (Euclidean) distance between two points.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/distance/ManhattanDistance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/distance/ManhattanDistance.java b/src/main/java/org/apache/commons/math4/ml/distance/ManhattanDistance.java
index 9e898c1..6c54a9b 100644
--- a/src/main/java/org/apache/commons/math4/ml/distance/ManhattanDistance.java
+++ b/src/main/java/org/apache/commons/math4/ml/distance/ManhattanDistance.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Calculates the L<sub>1</sub> (sum of abs) distance between two points.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ml/distance/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ml/distance/package-info.java b/src/main/java/org/apache/commons/math4/ml/distance/package-info.java
index f6d124a..572dc2a 100644
--- a/src/main/java/org/apache/commons/math4/ml/distance/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ml/distance/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Common distance measures.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;


[07/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java b/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java
deleted file mode 100644
index 0e93a0f..0000000
--- a/src/main/java/org/apache/commons/math3/linear/ArrayFieldVector.java
+++ /dev/null
@@ -1,1147 +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.linear;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * This class implements the {@link FieldVector} interface with a {@link FieldElement} array.
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<T>, Serializable {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 7648186910365927050L;
-
-    /** Entries of the vector. */
-    private T[] data;
-
-    /** Field to which the elements belong. */
-    private final Field<T> field;
-
-    /**
-     * Build a 0-length vector.
-     * Zero-length vectors may be used to initialize construction of vectors
-     * by data gathering. We start with zero-length and use either the {@link
-     * #ArrayFieldVector(ArrayFieldVector, ArrayFieldVector)} constructor
-     * or one of the {@code append} methods ({@link #add(FieldVector)} or
-     * {@link #append(ArrayFieldVector)}) to gather data into this vector.
-     *
-     * @param field field to which the elements belong
-     */
-    public ArrayFieldVector(final Field<T> field) {
-        this(field, 0);
-    }
-
-    /**
-     * Construct a vector of zeroes.
-     *
-     * @param field Field to which the elements belong.
-     * @param size Size of the vector.
-     */
-    public ArrayFieldVector(Field<T> field, int size) {
-        this.field = field;
-        this.data  = MathArrays.buildArray(field, size);
-    }
-
-    /**
-     * Construct a vector with preset values.
-     *
-     * @param size Size of the vector.
-     * @param preset All entries will be set with this value.
-     */
-    public ArrayFieldVector(int size, T preset) {
-        this(preset.getField(), size);
-        Arrays.fill(data, preset);
-    }
-
-    /**
-     * Construct a vector from an array, copying the input array.
-     * This constructor needs a non-empty {@code d} array to retrieve
-     * the field from its first element. This implies it cannot build
-     * 0 length vectors. To build vectors from any size, one should
-     * use the {@link #ArrayFieldVector(Field, FieldElement[])} constructor.
-     *
-     * @param d Array.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws ZeroException if {@code d} is empty.
-     * @see #ArrayFieldVector(Field, FieldElement[])
-     */
-    public ArrayFieldVector(T[] d)
-            throws NullArgumentException, ZeroException {
-        MathUtils.checkNotNull(d);
-        try {
-            field = d[0].getField();
-            data = d.clone();
-        } catch (ArrayIndexOutOfBoundsException e) {
-            throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
-        }
-    }
-
-    /**
-     * Construct a vector from an array, copying the input array.
-     *
-     * @param field Field to which the elements belong.
-     * @param d Array.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @see #ArrayFieldVector(FieldElement[])
-     */
-    public ArrayFieldVector(Field<T> field, T[] d)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(d);
-        this.field = field;
-        data = d.clone();
-    }
-
-    /**
-     * Create a new ArrayFieldVector using the input array as the underlying
-     * data array.
-     * If an array is built specially in order to be embedded in a
-     * ArrayFieldVector and not used directly, the {@code copyArray} may be
-     * set to {@code false}. This will prevent the copying and improve
-     * performance as no new array will be built and no data will be copied.
-     * This constructor needs a non-empty {@code d} array to retrieve
-     * the field from its first element. This implies it cannot build
-     * 0 length vectors. To build vectors from any size, one should
-     * use the {@link #ArrayFieldVector(Field, FieldElement[], boolean)}
-     * constructor.
-     *
-     * @param d Data for the new vector.
-     * @param copyArray If {@code true}, the input array will be copied,
-     * otherwise it will be referenced.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws ZeroException if {@code d} is empty.
-     * @see #ArrayFieldVector(FieldElement[])
-     * @see #ArrayFieldVector(Field, FieldElement[], boolean)
-     */
-    public ArrayFieldVector(T[] d, boolean copyArray)
-            throws NullArgumentException, ZeroException {
-        MathUtils.checkNotNull(d);
-        if (d.length == 0) {
-            throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
-        }
-        field = d[0].getField();
-        data = copyArray ? d.clone() : d;
-    }
-
-    /**
-     * Create a new ArrayFieldVector using the input array as the underlying
-     * data array.
-     * If an array is built specially in order to be embedded in a
-     * ArrayFieldVector and not used directly, the {@code copyArray} may be
-     * set to {@code false}. This will prevent the copying and improve
-     * performance as no new array will be built and no data will be copied.
-     *
-     * @param field Field to which the elements belong.
-     * @param d Data for the new vector.
-     * @param copyArray If {@code true}, the input array will be copied,
-     * otherwise it will be referenced.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @see #ArrayFieldVector(FieldElement[], boolean)
-     */
-    public ArrayFieldVector(Field<T> field, T[] d, boolean copyArray)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(d);
-        this.field = field;
-        data = copyArray ? d.clone() :  d;
-    }
-
-    /**
-     * Construct a vector from part of a array.
-     *
-     * @param d Array.
-     * @param pos Position of the first entry.
-     * @param size Number of entries to copy.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws NumberIsTooLargeException if the size of {@code d} is less
-     * than {@code pos + size}.
-     */
-    public ArrayFieldVector(T[] d, int pos, int size)
-            throws NullArgumentException, NumberIsTooLargeException {
-        MathUtils.checkNotNull(d);
-        if (d.length < pos + size) {
-            throw new NumberIsTooLargeException(pos + size, d.length, true);
-        }
-        field = d[0].getField();
-        data = MathArrays.buildArray(field, size);
-        System.arraycopy(d, pos, data, 0, size);
-    }
-
-    /**
-     * Construct a vector from part of a array.
-     *
-     * @param field Field to which the elements belong.
-     * @param d Array.
-     * @param pos Position of the first entry.
-     * @param size Number of entries to copy.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws NumberIsTooLargeException if the size of {@code d} is less
-     * than {@code pos + size}.
-     */
-    public ArrayFieldVector(Field<T> field, T[] d, int pos, int size)
-            throws NullArgumentException, NumberIsTooLargeException {
-        MathUtils.checkNotNull(d);
-        if (d.length < pos + size) {
-            throw new NumberIsTooLargeException(pos + size, d.length, true);
-        }
-        this.field = field;
-        data = MathArrays.buildArray(field, size);
-        System.arraycopy(d, pos, data, 0, size);
-    }
-
-    /**
-     * Construct a vector from another vector, using a deep copy.
-     *
-     * @param v Vector to copy.
-     * @throws NullArgumentException if {@code v} is {@code null}.
-     */
-    public ArrayFieldVector(FieldVector<T> v)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(v);
-        field = v.getField();
-        data = MathArrays.buildArray(field, v.getDimension());
-        for (int i = 0; i < data.length; ++i) {
-            data[i] = v.getEntry(i);
-        }
-    }
-
-    /**
-     * Construct a vector from another vector, using a deep copy.
-     *
-     * @param v Vector to copy.
-     * @throws NullArgumentException if {@code v} is {@code null}.
-     */
-    public ArrayFieldVector(ArrayFieldVector<T> v)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(v);
-        field = v.getField();
-        data = v.data.clone();
-    }
-
-    /**
-     * Construct a vector from another vector.
-     *
-     * @param v Vector to copy.
-     * @param deep If {@code true} perform a deep copy, otherwise perform
-     * a shallow copy
-     * @throws NullArgumentException if {@code v} is {@code null}.
-     */
-    public ArrayFieldVector(ArrayFieldVector<T> v, boolean deep)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(v);
-        field = v.getField();
-        data = deep ? v.data.clone() : v.data;
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     *
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @deprecated as of 3.2, replaced by {@link #ArrayFieldVector(FieldVector, FieldVector)}
-     */
-    @Deprecated
-    public ArrayFieldVector(ArrayFieldVector<T> v1, ArrayFieldVector<T> v2)
-            throws NullArgumentException {
-        this((FieldVector<T>) v1, (FieldVector<T>) v2);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     *
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @since 3.2
-     */
-    public ArrayFieldVector(FieldVector<T> v1, FieldVector<T> v2)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(v1);
-        MathUtils.checkNotNull(v2);
-        field = v1.getField();
-        final T[] v1Data =
-                (v1 instanceof ArrayFieldVector) ? ((ArrayFieldVector<T>) v1).data : v1.toArray();
-        final T[] v2Data =
-                (v2 instanceof ArrayFieldVector) ? ((ArrayFieldVector<T>) v2).data : v2.toArray();
-        data = MathArrays.buildArray(field, v1Data.length + v2Data.length);
-        System.arraycopy(v1Data, 0, data, 0, v1Data.length);
-        System.arraycopy(v2Data, 0, data, v1Data.length, v2Data.length);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     *
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @deprecated as of 3.2, replaced by {@link #ArrayFieldVector(FieldVector, FieldElement[])}
-     */
-    @Deprecated
-    public ArrayFieldVector(ArrayFieldVector<T> v1, T[] v2)
-            throws NullArgumentException {
-        this((FieldVector<T>) v1, v2);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     *
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @since 3.2
-     */
-    public ArrayFieldVector(FieldVector<T> v1, T[] v2)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(v1);
-        MathUtils.checkNotNull(v2);
-        field = v1.getField();
-        final T[] v1Data =
-                (v1 instanceof ArrayFieldVector) ? ((ArrayFieldVector<T>) v1).data : v1.toArray();
-        data = MathArrays.buildArray(field, v1Data.length + v2.length);
-        System.arraycopy(v1Data, 0, data, 0, v1Data.length);
-        System.arraycopy(v2, 0, data, v1Data.length, v2.length);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     *
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @deprecated as of 3.2, replaced by {@link #ArrayFieldVector(FieldElement[], FieldVector)}
-     */
-    @Deprecated
-    public ArrayFieldVector(T[] v1, ArrayFieldVector<T> v2)
-            throws NullArgumentException {
-        this(v1, (FieldVector<T>) v2);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     *
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @since 3.2
-     */
-    public ArrayFieldVector(T[] v1, FieldVector<T> v2)
-            throws NullArgumentException {
-        MathUtils.checkNotNull(v1);
-        MathUtils.checkNotNull(v2);
-        field = v2.getField();
-        final T[] v2Data =
-                (v2 instanceof ArrayFieldVector) ? ((ArrayFieldVector<T>) v2).data : v2.toArray();
-        data = MathArrays.buildArray(field, v1.length + v2Data.length);
-        System.arraycopy(v1, 0, data, 0, v1.length);
-        System.arraycopy(v2Data, 0, data, v1.length, v2Data.length);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     * This constructor needs at least one non-empty array to retrieve
-     * the field from its first element. This implies it cannot build
-     * 0 length vectors. To build vectors from any size, one should
-     * use the {@link #ArrayFieldVector(Field, FieldElement[], FieldElement[])}
-     * constructor.
-     *
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @throws ZeroException if both arrays are empty.
-     * @see #ArrayFieldVector(Field, FieldElement[], FieldElement[])
-     */
-    public ArrayFieldVector(T[] v1, T[] v2)
-            throws NullArgumentException, ZeroException {
-        MathUtils.checkNotNull(v1);
-        MathUtils.checkNotNull(v2);
-        if (v1.length + v2.length == 0) {
-            throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
-        }
-        data = MathArrays.buildArray(v1[0].getField(), v1.length + v2.length);
-        System.arraycopy(v1, 0, data, 0, v1.length);
-        System.arraycopy(v2, 0, data, v1.length, v2.length);
-        field = data[0].getField();
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     *
-     * @param field Field to which the elements belong.
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     * @throws NullArgumentException if {@code v1} or {@code v2} is
-     * {@code null}.
-     * @throws ZeroException if both arrays are empty.
-     * @see #ArrayFieldVector(FieldElement[], FieldElement[])
-     */
-    public ArrayFieldVector(Field<T> field, T[] v1, T[] v2)
-            throws NullArgumentException, ZeroException {
-        MathUtils.checkNotNull(v1);
-        MathUtils.checkNotNull(v2);
-        if (v1.length + v2.length == 0) {
-            throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
-        }
-        data = MathArrays.buildArray(field, v1.length + v2.length);
-        System.arraycopy(v1, 0, data, 0, v1.length);
-        System.arraycopy(v2, 0, data, v1.length, v2.length);
-        this.field = field;
-    }
-
-    /** {@inheritDoc} */
-    public Field<T> getField() {
-        return field;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> copy() {
-        return new ArrayFieldVector<T>(this, true);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> add(FieldVector<T> v)
-        throws DimensionMismatchException {
-        try {
-            return add((ArrayFieldVector<T>) v);
-        } catch (ClassCastException cce) {
-            checkVectorDimensions(v);
-            T[] out = MathArrays.buildArray(field, data.length);
-            for (int i = 0; i < data.length; i++) {
-                out[i] = data[i].add(v.getEntry(i));
-            }
-            return new ArrayFieldVector<T>(field, out, false);
-        }
-    }
-
-    /**
-     * Compute the sum of {@code this} and {@code v}.
-     * @param v vector to be added
-     * @return {@code this + v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as
-     * {@code this}
-     */
-    public ArrayFieldVector<T> add(ArrayFieldVector<T> v)
-        throws DimensionMismatchException {
-        checkVectorDimensions(v.data.length);
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            out[i] = data[i].add(v.data[i]);
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> subtract(FieldVector<T> v)
-        throws DimensionMismatchException {
-        try {
-            return subtract((ArrayFieldVector<T>) v);
-        } catch (ClassCastException cce) {
-            checkVectorDimensions(v);
-            T[] out = MathArrays.buildArray(field, data.length);
-            for (int i = 0; i < data.length; i++) {
-                out[i] = data[i].subtract(v.getEntry(i));
-            }
-            return new ArrayFieldVector<T>(field, out, false);
-        }
-    }
-
-    /**
-     * Compute {@code this} minus {@code v}.
-     * @param v vector to be subtracted
-     * @return {@code this - v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as
-     * {@code this}
-     */
-    public ArrayFieldVector<T> subtract(ArrayFieldVector<T> v)
-        throws DimensionMismatchException {
-        checkVectorDimensions(v.data.length);
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            out[i] = data[i].subtract(v.data[i]);
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapAdd(T d) throws NullArgumentException {
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            out[i] = data[i].add(d);
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapAddToSelf(T d) throws NullArgumentException {
-        for (int i = 0; i < data.length; i++) {
-            data[i] = data[i].add(d);
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapSubtract(T d) throws NullArgumentException {
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            out[i] = data[i].subtract(d);
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException {
-        for (int i = 0; i < data.length; i++) {
-            data[i] = data[i].subtract(d);
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapMultiply(T d) throws NullArgumentException {
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            out[i] = data[i].multiply(d);
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException {
-        for (int i = 0; i < data.length; i++) {
-            data[i] = data[i].multiply(d);
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapDivide(T d)
-        throws NullArgumentException, MathArithmeticException {
-        MathUtils.checkNotNull(d);
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            out[i] = data[i].divide(d);
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapDivideToSelf(T d)
-        throws NullArgumentException, MathArithmeticException {
-        MathUtils.checkNotNull(d);
-        for (int i = 0; i < data.length; i++) {
-            data[i] = data[i].divide(d);
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapInv() throws MathArithmeticException {
-        T[] out = MathArrays.buildArray(field, data.length);
-        final T one = field.getOne();
-        for (int i = 0; i < data.length; i++) {
-            try {
-                out[i] = one.divide(data[i]);
-            } catch (final MathArithmeticException e) {
-                throw new MathArithmeticException(LocalizedFormats.INDEX, i);
-            }
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> mapInvToSelf() throws MathArithmeticException {
-        final T one = field.getOne();
-        for (int i = 0; i < data.length; i++) {
-            try {
-                data[i] = one.divide(data[i]);
-            } catch (final MathArithmeticException e) {
-                throw new MathArithmeticException(LocalizedFormats.INDEX, i);
-            }
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> ebeMultiply(FieldVector<T> v)
-        throws DimensionMismatchException {
-        try {
-            return ebeMultiply((ArrayFieldVector<T>) v);
-        } catch (ClassCastException cce) {
-            checkVectorDimensions(v);
-            T[] out = MathArrays.buildArray(field, data.length);
-            for (int i = 0; i < data.length; i++) {
-                out[i] = data[i].multiply(v.getEntry(i));
-            }
-            return new ArrayFieldVector<T>(field, out, false);
-        }
-    }
-
-    /**
-     * Element-by-element multiplication.
-     * @param v vector by which instance elements must be multiplied
-     * @return a vector containing {@code this[i] * v[i]} for all {@code i}
-     * @throws DimensionMismatchException if {@code v} is not the same size as
-     * {@code this}
-     */
-    public ArrayFieldVector<T> ebeMultiply(ArrayFieldVector<T> v)
-        throws DimensionMismatchException {
-        checkVectorDimensions(v.data.length);
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            out[i] = data[i].multiply(v.data[i]);
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> ebeDivide(FieldVector<T> v)
-        throws DimensionMismatchException, MathArithmeticException {
-        try {
-            return ebeDivide((ArrayFieldVector<T>) v);
-        } catch (ClassCastException cce) {
-            checkVectorDimensions(v);
-            T[] out = MathArrays.buildArray(field, data.length);
-            for (int i = 0; i < data.length; i++) {
-                try {
-                    out[i] = data[i].divide(v.getEntry(i));
-                } catch (final MathArithmeticException e) {
-                    throw new MathArithmeticException(LocalizedFormats.INDEX, i);
-                }
-            }
-            return new ArrayFieldVector<T>(field, out, false);
-        }
-    }
-
-    /**
-     * Element-by-element division.
-     * @param v vector by which instance elements must be divided
-     * @return a vector containing {@code this[i] / v[i]} for all {@code i}
-     * @throws DimensionMismatchException if {@code v} is not the same size as
-     * {@code this}
-     * @throws MathArithmeticException if one entry of {@code v} is zero.
-     */
-    public ArrayFieldVector<T> ebeDivide(ArrayFieldVector<T> v)
-        throws DimensionMismatchException, MathArithmeticException {
-        checkVectorDimensions(v.data.length);
-        T[] out = MathArrays.buildArray(field, data.length);
-        for (int i = 0; i < data.length; i++) {
-            try {
-                out[i] = data[i].divide(v.data[i]);
-            } catch (final MathArithmeticException e) {
-                throw new MathArithmeticException(LocalizedFormats.INDEX, i);
-            }
-        }
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public T[] getData() {
-        return data.clone();
-    }
-
-    /**
-     * Returns a reference to the underlying data array.
-     * <p>Does not make a fresh copy of the underlying data.</p>
-     * @return array of entries
-     */
-    public T[] getDataRef() {
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    public T dotProduct(FieldVector<T> v)
-        throws DimensionMismatchException {
-        try {
-            return dotProduct((ArrayFieldVector<T>) v);
-        } catch (ClassCastException cce) {
-            checkVectorDimensions(v);
-            T dot = field.getZero();
-            for (int i = 0; i < data.length; i++) {
-                dot = dot.add(data[i].multiply(v.getEntry(i)));
-            }
-            return dot;
-        }
-    }
-
-    /**
-     * Compute the dot product.
-     * @param v vector with which dot product should be computed
-     * @return the scalar dot product of {@code this} and {@code v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as
-     * {@code this}
-     */
-    public T dotProduct(ArrayFieldVector<T> v)
-        throws DimensionMismatchException {
-        checkVectorDimensions(v.data.length);
-        T dot = field.getZero();
-        for (int i = 0; i < data.length; i++) {
-            dot = dot.add(data[i].multiply(v.data[i]));
-        }
-        return dot;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> projection(FieldVector<T> v)
-        throws DimensionMismatchException, MathArithmeticException {
-        return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
-    }
-
-    /** Find the orthogonal projection of this vector onto another vector.
-     * @param v vector onto which {@code this} must be projected
-     * @return projection of {@code this} onto {@code v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as
-     * {@code this}
-     * @throws MathArithmeticException if {@code v} is the null vector.
-     */
-    public ArrayFieldVector<T> projection(ArrayFieldVector<T> v)
-        throws DimensionMismatchException, MathArithmeticException {
-        return (ArrayFieldVector<T>) v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> outerProduct(FieldVector<T> v) {
-        try {
-            return outerProduct((ArrayFieldVector<T>) v);
-        } catch (ClassCastException cce) {
-            final int m = data.length;
-            final int n = v.getDimension();
-            final FieldMatrix<T> out = new Array2DRowFieldMatrix<T>(field, m, n);
-            for (int i = 0; i < m; i++) {
-                for (int j = 0; j < n; j++) {
-                    out.setEntry(i, j, data[i].multiply(v.getEntry(j)));
-                }
-            }
-            return out;
-        }
-    }
-
-    /**
-     * Compute the outer product.
-     * @param v vector with which outer product should be computed
-     * @return the matrix outer product between instance and v
-     */
-    public FieldMatrix<T> outerProduct(ArrayFieldVector<T> v) {
-        final int m = data.length;
-        final int n = v.data.length;
-        final FieldMatrix<T> out = new Array2DRowFieldMatrix<T>(field, m, n);
-        for (int i = 0; i < m; i++) {
-            for (int j = 0; j < n; j++) {
-                out.setEntry(i, j, data[i].multiply(v.data[j]));
-            }
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public T getEntry(int index) {
-        return data[index];
-    }
-
-    /** {@inheritDoc} */
-    public int getDimension() {
-        return data.length;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> append(FieldVector<T> v) {
-        try {
-            return append((ArrayFieldVector<T>) v);
-        } catch (ClassCastException cce) {
-            return new ArrayFieldVector<T>(this,new ArrayFieldVector<T>(v));
-        }
-    }
-
-    /**
-     * Construct a vector by appending a vector to this vector.
-     * @param v vector to append to this one.
-     * @return a new vector
-     */
-    public ArrayFieldVector<T> append(ArrayFieldVector<T> v) {
-        return new ArrayFieldVector<T>(this, v);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> append(T in) {
-        final T[] out = MathArrays.buildArray(field, data.length + 1);
-        System.arraycopy(data, 0, out, 0, data.length);
-        out[data.length] = in;
-        return new ArrayFieldVector<T>(field, out, false);
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> getSubVector(int index, int n)
-        throws OutOfRangeException, NotPositiveException {
-        if (n < 0) {
-            throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n);
-        }
-        ArrayFieldVector<T> out = new ArrayFieldVector<T>(field, n);
-        try {
-            System.arraycopy(data, index, out.data, 0, n);
-        } catch (IndexOutOfBoundsException e) {
-            checkIndex(index);
-            checkIndex(index + n - 1);
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public void setEntry(int index, T value) {
-        try {
-            data[index] = value;
-        } catch (IndexOutOfBoundsException e) {
-            checkIndex(index);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException {
-        try {
-            try {
-                set(index, (ArrayFieldVector<T>) v);
-            } catch (ClassCastException cce) {
-                for (int i = index; i < index + v.getDimension(); ++i) {
-                    data[i] = v.getEntry(i-index);
-                }
-            }
-        } catch (IndexOutOfBoundsException e) {
-            checkIndex(index);
-            checkIndex(index + v.getDimension() - 1);
-        }
-    }
-
-    /**
-     * Set a set of consecutive elements.
-     *
-     * @param index index of first element to be set.
-     * @param v vector containing the values to set.
-     * @throws OutOfRangeException if the index is invalid.
-     */
-    public void set(int index, ArrayFieldVector<T> v) throws OutOfRangeException {
-        try {
-            System.arraycopy(v.data, 0, data, index, v.data.length);
-        } catch (IndexOutOfBoundsException e) {
-            checkIndex(index);
-            checkIndex(index + v.data.length - 1);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void set(T value) {
-        Arrays.fill(data, value);
-    }
-
-    /** {@inheritDoc} */
-    public T[] toArray(){
-        return data.clone();
-    }
-
-    /**
-     * Check if instance and specified vectors have the same dimension.
-     * @param v vector to compare instance with
-     * @exception DimensionMismatchException if the vectors do not
-     * have the same dimensions
-     */
-    protected void checkVectorDimensions(FieldVector<T> v)
-        throws DimensionMismatchException {
-        checkVectorDimensions(v.getDimension());
-    }
-
-    /**
-     * Check if instance dimension is equal to some expected value.
-     *
-     * @param n Expected dimension.
-     * @throws DimensionMismatchException if the dimension is not equal to the
-     * size of {@code this} vector.
-     */
-    protected void checkVectorDimensions(int n)
-        throws DimensionMismatchException {
-        if (data.length != n) {
-            throw new DimensionMismatchException(data.length, n);
-        }
-    }
-
-    /**
-     * Visits (but does not alter) all entries of this vector in default order
-     * (increasing index).
-     *
-     * @param visitor the visitor to be used to process the entries of this
-     * vector
-     * @return the value returned by {@link FieldVectorPreservingVisitor#end()}
-     * at the end of the walk
-     * @since 3.3
-     */
-    public T walkInDefaultOrder(final FieldVectorPreservingVisitor<T> visitor) {
-        final int dim = getDimension();
-        visitor.start(dim, 0, dim - 1);
-        for (int i = 0; i < dim; i++) {
-            visitor.visit(i, getEntry(i));
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Visits (but does not alter) some entries of this vector in default order
-     * (increasing index).
-     *
-     * @param visitor visitor to be used to process the entries of this vector
-     * @param start the index of the first entry to be visited
-     * @param end the index of the last entry to be visited (inclusive)
-     * @return the value returned by {@link FieldVectorPreservingVisitor#end()}
-     * at the end of the walk
-     * @throws NumberIsTooSmallException if {@code end < start}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @since 3.3
-     */
-    public T walkInDefaultOrder(final FieldVectorPreservingVisitor<T> visitor,
-                                final int start, final int end)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        checkIndices(start, end);
-        visitor.start(getDimension(), start, end);
-        for (int i = start; i <= end; i++) {
-            visitor.visit(i, getEntry(i));
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Visits (but does not alter) all entries of this vector in optimized
-     * order. The order in which the entries are visited is selected so as to
-     * lead to the most efficient implementation; it might depend on the
-     * concrete implementation of this abstract class.
-     *
-     * @param visitor the visitor to be used to process the entries of this
-     * vector
-     * @return the value returned by {@link FieldVectorPreservingVisitor#end()}
-     * at the end of the walk
-     * @since 3.3
-     */
-    public T walkInOptimizedOrder(final FieldVectorPreservingVisitor<T> visitor) {
-        return walkInDefaultOrder(visitor);
-    }
-
-    /**
-     * Visits (but does not alter) some entries of this vector in optimized
-     * order. The order in which the entries are visited is selected so as to
-     * lead to the most efficient implementation; it might depend on the
-     * concrete implementation of this abstract class.
-     *
-     * @param visitor visitor to be used to process the entries of this vector
-     * @param start the index of the first entry to be visited
-     * @param end the index of the last entry to be visited (inclusive)
-     * @return the value returned by {@link FieldVectorPreservingVisitor#end()}
-     * at the end of the walk
-     * @throws NumberIsTooSmallException if {@code end < start}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @since 3.3
-     */
-    public T walkInOptimizedOrder(final FieldVectorPreservingVisitor<T> visitor,
-                                  final int start, final int end)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        return walkInDefaultOrder(visitor, start, end);
-    }
-
-    /**
-     * Visits (and possibly alters) all entries of this vector in default order
-     * (increasing index).
-     *
-     * @param visitor the visitor to be used to process and modify the entries
-     * of this vector
-     * @return the value returned by {@link FieldVectorChangingVisitor#end()}
-     * at the end of the walk
-     * @since 3.3
-     */
-    public T walkInDefaultOrder(final FieldVectorChangingVisitor<T> visitor) {
-        final int dim = getDimension();
-        visitor.start(dim, 0, dim - 1);
-        for (int i = 0; i < dim; i++) {
-            setEntry(i, visitor.visit(i, getEntry(i)));
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Visits (and possibly alters) some entries of this vector in default order
-     * (increasing index).
-     *
-     * @param visitor visitor to be used to process the entries of this vector
-     * @param start the index of the first entry to be visited
-     * @param end the index of the last entry to be visited (inclusive)
-     * @return the value returned by {@link FieldVectorChangingVisitor#end()}
-     * at the end of the walk
-     * @throws NumberIsTooSmallException if {@code end < start}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @since 3.3
-     */
-    public T walkInDefaultOrder(final FieldVectorChangingVisitor<T> visitor,
-                                final int start, final int end)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        checkIndices(start, end);
-        visitor.start(getDimension(), start, end);
-        for (int i = start; i <= end; i++) {
-            setEntry(i, visitor.visit(i, getEntry(i)));
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Visits (and possibly alters) all entries of this vector in optimized
-     * order. The order in which the entries are visited is selected so as to
-     * lead to the most efficient implementation; it might depend on the
-     * concrete implementation of this abstract class.
-     *
-     * @param visitor the visitor to be used to process the entries of this
-     * vector
-     * @return the value returned by {@link FieldVectorChangingVisitor#end()}
-     * at the end of the walk
-     * @since 3.3
-     */
-    public T walkInOptimizedOrder(final FieldVectorChangingVisitor<T> visitor) {
-        return walkInDefaultOrder(visitor);
-    }
-
-    /**
-     * Visits (and possibly change) some entries of this vector in optimized
-     * order. The order in which the entries are visited is selected so as to
-     * lead to the most efficient implementation; it might depend on the
-     * concrete implementation of this abstract class.
-     *
-     * @param visitor visitor to be used to process the entries of this vector
-     * @param start the index of the first entry to be visited
-     * @param end the index of the last entry to be visited (inclusive)
-     * @return the value returned by {@link FieldVectorChangingVisitor#end()}
-     * at the end of the walk
-     * @throws NumberIsTooSmallException if {@code end < start}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @since 3.3
-     */
-    public T walkInOptimizedOrder(final FieldVectorChangingVisitor<T> visitor,
-                                  final int start, final int end)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        return walkInDefaultOrder(visitor, start, end);
-    }
-
-    /**
-     * Test for the equality of two vectors.
-     *
-     * @param other Object to test for equality.
-     * @return {@code true} if two vector objects are equal, {@code false}
-     * otherwise.
-     */
-    @Override
-    public boolean equals(Object other) {
-        if (this == other) {
-            return true;
-        }
-        if (other == null) {
-            return false;
-        }
-
-        try {
-            @SuppressWarnings("unchecked") // May fail, but we ignore ClassCastException
-                FieldVector<T> rhs = (FieldVector<T>) other;
-            if (data.length != rhs.getDimension()) {
-                return false;
-            }
-
-            for (int i = 0; i < data.length; ++i) {
-                if (!data[i].equals(rhs.getEntry(i))) {
-                    return false;
-                }
-            }
-            return true;
-        } catch (ClassCastException ex) {
-            // ignore exception
-            return false;
-        }
-    }
-
-    /**
-     * Get a hashCode for the real vector.
-     * <p>All NaN values have the same hash code.</p>
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        int h = 3542;
-        for (final T a : data) {
-            h ^= a.hashCode();
-        }
-        return h;
-    }
-
-    /**
-     * Check if an index is valid.
-     *
-     * @param index Index to check.
-     * @exception OutOfRangeException if the index is not valid.
-     */
-    private void checkIndex(final int index) throws OutOfRangeException {
-        if (index < 0 || index >= getDimension()) {
-            throw new OutOfRangeException(LocalizedFormats.INDEX,
-                                          index, 0, getDimension() - 1);
-        }
-    }
-
-    /**
-     * Checks that the indices of a subvector are valid.
-     *
-     * @param start the index of the first entry of the subvector
-     * @param end the index of the last entry of the subvector (inclusive)
-     * @throws OutOfRangeException if {@code start} of {@code end} are not valid
-     * @throws NumberIsTooSmallException if {@code end < start}
-     * @since 3.3
-     */
-    private void checkIndices(final int start, final int end)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        final int dim = getDimension();
-        if ((start < 0) || (start >= dim)) {
-            throw new OutOfRangeException(LocalizedFormats.INDEX, start, 0,
-                                          dim - 1);
-        }
-        if ((end < 0) || (end >= dim)) {
-            throw new OutOfRangeException(LocalizedFormats.INDEX, end, 0,
-                                          dim - 1);
-        }
-        if (end < start) {
-            throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
-                                                end, start, false);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java b/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
deleted file mode 100644
index 00b81d0..0000000
--- a/src/main/java/org/apache/commons/math3/linear/ArrayRealVector.java
+++ /dev/null
@@ -1,954 +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.linear;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * This class implements the {@link RealVector} interface with a double array.
- * @since 2.0
- */
-public class ArrayRealVector extends RealVector implements Serializable {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -1097961340710804027L;
-    /** Default format. */
-    private static final RealVectorFormat DEFAULT_FORMAT = RealVectorFormat.getInstance();
-
-    /** Entries of the vector. */
-    private double data[];
-
-    /**
-     * Build a 0-length vector.
-     * Zero-length vectors may be used to initialized construction of vectors
-     * by data gathering. We start with zero-length and use either the {@link
-     * #ArrayRealVector(ArrayRealVector, ArrayRealVector)} constructor
-     * or one of the {@code append} method ({@link #append(double)},
-     * {@link #append(ArrayRealVector)}) to gather data into this vector.
-     */
-    public ArrayRealVector() {
-        data = new double[0];
-    }
-
-    /**
-     * Construct a vector of zeroes.
-     *
-     * @param size Size of the vector.
-     */
-    public ArrayRealVector(int size) {
-        data = new double[size];
-    }
-
-    /**
-     * Construct a vector with preset values.
-     *
-     * @param size Size of the vector
-     * @param preset All entries will be set with this value.
-     */
-    public ArrayRealVector(int size, double preset) {
-        data = new double[size];
-        Arrays.fill(data, preset);
-    }
-
-    /**
-     * Construct a vector from an array, copying the input array.
-     *
-     * @param d Array.
-     */
-    public ArrayRealVector(double[] d) {
-        data = d.clone();
-    }
-
-    /**
-     * Create a new ArrayRealVector using the input array as the underlying
-     * data array.
-     * If an array is built specially in order to be embedded in a
-     * ArrayRealVector and not used directly, the {@code copyArray} may be
-     * set to {@code false}. This will prevent the copying and improve
-     * performance as no new array will be built and no data will be copied.
-     *
-     * @param d Data for the new vector.
-     * @param copyArray if {@code true}, the input array will be copied,
-     * otherwise it will be referenced.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @see #ArrayRealVector(double[])
-     */
-    public ArrayRealVector(double[] d, boolean copyArray)
-        throws NullArgumentException {
-        if (d == null) {
-            throw new NullArgumentException();
-        }
-        data = copyArray ? d.clone() :  d;
-    }
-
-    /**
-     * Construct a vector from part of a array.
-     *
-     * @param d Array.
-     * @param pos Position of first entry.
-     * @param size Number of entries to copy.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws NumberIsTooLargeException if the size of {@code d} is less
-     * than {@code pos + size}.
-     */
-    public ArrayRealVector(double[] d, int pos, int size)
-        throws NullArgumentException, NumberIsTooLargeException {
-        if (d == null) {
-            throw new NullArgumentException();
-        }
-        if (d.length < pos + size) {
-            throw new NumberIsTooLargeException(pos + size, d.length, true);
-        }
-        data = new double[size];
-        System.arraycopy(d, pos, data, 0, size);
-    }
-
-    /**
-     * Construct a vector from an array.
-     *
-     * @param d Array of {@code Double}s.
-     */
-    public ArrayRealVector(Double[] d) {
-        data = new double[d.length];
-        for (int i = 0; i < d.length; i++) {
-            data[i] = d[i].doubleValue();
-        }
-    }
-
-    /**
-     * Construct a vector from part of an array.
-     *
-     * @param d Array.
-     * @param pos Position of first entry.
-     * @param size Number of entries to copy.
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws NumberIsTooLargeException if the size of {@code d} is less
-     * than {@code pos + size}.
-     */
-    public ArrayRealVector(Double[] d, int pos, int size)
-        throws NullArgumentException, NumberIsTooLargeException {
-        if (d == null) {
-            throw new NullArgumentException();
-        }
-        if (d.length < pos + size) {
-            throw new NumberIsTooLargeException(pos + size, d.length, true);
-        }
-        data = new double[size];
-        for (int i = pos; i < pos + size; i++) {
-            data[i - pos] = d[i].doubleValue();
-        }
-    }
-
-    /**
-     * Construct a vector from another vector, using a deep copy.
-     *
-     * @param v vector to copy.
-     * @throws NullArgumentException if {@code v} is {@code null}.
-     */
-    public ArrayRealVector(RealVector v) throws NullArgumentException {
-        if (v == null) {
-            throw new NullArgumentException();
-        }
-        data = new double[v.getDimension()];
-        for (int i = 0; i < data.length; ++i) {
-            data[i] = v.getEntry(i);
-        }
-    }
-
-    /**
-     * Construct a vector from another vector, using a deep copy.
-     *
-     * @param v Vector to copy.
-     * @throws NullArgumentException if {@code v} is {@code null}.
-     */
-    public ArrayRealVector(ArrayRealVector v) throws NullArgumentException {
-        this(v, true);
-    }
-
-    /**
-     * Construct a vector from another vector.
-     *
-     * @param v Vector to copy.
-     * @param deep If {@code true} perform a deep copy, otherwise perform a
-     * shallow copy.
-     */
-    public ArrayRealVector(ArrayRealVector v, boolean deep) {
-        data = deep ? v.data.clone() : v.data;
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     */
-    public ArrayRealVector(ArrayRealVector v1, ArrayRealVector v2) {
-        data = new double[v1.data.length + v2.data.length];
-        System.arraycopy(v1.data, 0, data, 0, v1.data.length);
-        System.arraycopy(v2.data, 0, data, v1.data.length, v2.data.length);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     */
-    public ArrayRealVector(ArrayRealVector v1, RealVector v2) {
-        final int l1 = v1.data.length;
-        final int l2 = v2.getDimension();
-        data = new double[l1 + l2];
-        System.arraycopy(v1.data, 0, data, 0, l1);
-        for (int i = 0; i < l2; ++i) {
-            data[l1 + i] = v2.getEntry(i);
-        }
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     */
-    public ArrayRealVector(RealVector v1, ArrayRealVector v2) {
-        final int l1 = v1.getDimension();
-        final int l2 = v2.data.length;
-        data = new double[l1 + l2];
-        for (int i = 0; i < l1; ++i) {
-            data[i] = v1.getEntry(i);
-        }
-        System.arraycopy(v2.data, 0, data, l1, l2);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     */
-    public ArrayRealVector(ArrayRealVector v1, double[] v2) {
-        final int l1 = v1.getDimension();
-        final int l2 = v2.length;
-        data = new double[l1 + l2];
-        System.arraycopy(v1.data, 0, data, 0, l1);
-        System.arraycopy(v2, 0, data, l1, l2);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     * @param v1 First vector (will be put in front of the new vector).
-     * @param v2 Second vector (will be put at back of the new vector).
-     */
-    public ArrayRealVector(double[] v1, ArrayRealVector v2) {
-        final int l1 = v1.length;
-        final int l2 = v2.getDimension();
-        data = new double[l1 + l2];
-        System.arraycopy(v1, 0, data, 0, l1);
-        System.arraycopy(v2.data, 0, data, l1, l2);
-    }
-
-    /**
-     * Construct a vector by appending one vector to another vector.
-     * @param v1 first vector (will be put in front of the new vector)
-     * @param v2 second vector (will be put at back of the new vector)
-     */
-    public ArrayRealVector(double[] v1, double[] v2) {
-        final int l1 = v1.length;
-        final int l2 = v2.length;
-        data = new double[l1 + l2];
-        System.arraycopy(v1, 0, data, 0, l1);
-        System.arraycopy(v2, 0, data, l1, l2);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector copy() {
-        return new ArrayRealVector(this, true);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector add(RealVector v)
-        throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            final int dim = vData.length;
-            checkVectorDimensions(dim);
-            ArrayRealVector result = new ArrayRealVector(dim);
-            double[] resultData = result.data;
-            for (int i = 0; i < dim; i++) {
-                resultData[i] = data[i] + vData[i];
-            }
-            return result;
-        } else {
-            checkVectorDimensions(v);
-            double[] out = data.clone();
-            Iterator<Entry> it = v.iterator();
-            while (it.hasNext()) {
-                final Entry e = it.next();
-                out[e.getIndex()] += e.getValue();
-            }
-            return new ArrayRealVector(out, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector subtract(RealVector v)
-        throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            final int dim = vData.length;
-            checkVectorDimensions(dim);
-            ArrayRealVector result = new ArrayRealVector(dim);
-            double[] resultData = result.data;
-            for (int i = 0; i < dim; i++) {
-                resultData[i] = data[i] - vData[i];
-            }
-            return result;
-        } else {
-            checkVectorDimensions(v);
-            double[] out = data.clone();
-            Iterator<Entry> it = v.iterator();
-            while (it.hasNext()) {
-                final Entry e = it.next();
-                out[e.getIndex()] -= e.getValue();
-            }
-            return new ArrayRealVector(out, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector map(UnivariateFunction function) {
-        return copy().mapToSelf(function);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector mapToSelf(UnivariateFunction function) {
-        for (int i = 0; i < data.length; i++) {
-            data[i] = function.value(data[i]);
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector mapAddToSelf(double d) {
-        for (int i = 0; i < data.length; i++) {
-            data[i] += d;
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector mapSubtractToSelf(double d) {
-        for (int i = 0; i < data.length; i++) {
-            data[i] -= d;
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector mapMultiplyToSelf(double d) {
-        for (int i = 0; i < data.length; i++) {
-            data[i] *= d;
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector mapDivideToSelf(double d) {
-        for (int i = 0; i < data.length; i++) {
-            data[i] /= d;
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector ebeMultiply(RealVector v)
-        throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            final int dim = vData.length;
-            checkVectorDimensions(dim);
-            ArrayRealVector result = new ArrayRealVector(dim);
-            double[] resultData = result.data;
-            for (int i = 0; i < dim; i++) {
-                resultData[i] = data[i] * vData[i];
-            }
-            return result;
-        } else {
-            checkVectorDimensions(v);
-            double[] out = data.clone();
-            for (int i = 0; i < data.length; i++) {
-                out[i] *= v.getEntry(i);
-            }
-            return new ArrayRealVector(out, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector ebeDivide(RealVector v)
-        throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            final int dim = vData.length;
-            checkVectorDimensions(dim);
-            ArrayRealVector result = new ArrayRealVector(dim);
-            double[] resultData = result.data;
-            for (int i = 0; i < dim; i++) {
-                resultData[i] = data[i] / vData[i];
-            }
-            return result;
-        } else {
-            checkVectorDimensions(v);
-            double[] out = data.clone();
-            for (int i = 0; i < data.length; i++) {
-                out[i] /= v.getEntry(i);
-            }
-            return new ArrayRealVector(out, false);
-        }
-    }
-
-    /**
-     * Get a reference to the underlying data array.
-     * This method does not make a fresh copy of the underlying data.
-     *
-     * @return the array of entries.
-     */
-    public double[] getDataRef() {
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double dotProduct(RealVector v) throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            checkVectorDimensions(vData.length);
-            double dot = 0;
-            for (int i = 0; i < data.length; i++) {
-                dot += data[i] * vData[i];
-            }
-            return dot;
-        }
-        return super.dotProduct(v);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getNorm() {
-        double sum = 0;
-        for (double a : data) {
-            sum += a * a;
-        }
-        return FastMath.sqrt(sum);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getL1Norm() {
-        double sum = 0;
-        for (double a : data) {
-            sum += FastMath.abs(a);
-        }
-        return sum;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getLInfNorm() {
-        double max = 0;
-        for (double a : data) {
-            max = FastMath.max(max, FastMath.abs(a));
-        }
-        return max;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getDistance(RealVector v) throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            checkVectorDimensions(vData.length);
-            double sum = 0;
-            for (int i = 0; i < data.length; ++i) {
-                final double delta = data[i] - vData[i];
-                sum += delta * delta;
-            }
-            return FastMath.sqrt(sum);
-        } else {
-            checkVectorDimensions(v);
-            double sum = 0;
-            for (int i = 0; i < data.length; ++i) {
-                final double delta = data[i] - v.getEntry(i);
-                sum += delta * delta;
-            }
-            return FastMath.sqrt(sum);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getL1Distance(RealVector v)
-        throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            checkVectorDimensions(vData.length);
-            double sum = 0;
-            for (int i = 0; i < data.length; ++i) {
-                final double delta = data[i] - vData[i];
-                sum += FastMath.abs(delta);
-            }
-            return sum;
-        } else {
-            checkVectorDimensions(v);
-            double sum = 0;
-            for (int i = 0; i < data.length; ++i) {
-                final double delta = data[i] - v.getEntry(i);
-                sum += FastMath.abs(delta);
-            }
-            return sum;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getLInfDistance(RealVector v)
-        throws DimensionMismatchException {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            checkVectorDimensions(vData.length);
-            double max = 0;
-            for (int i = 0; i < data.length; ++i) {
-                final double delta = data[i] - vData[i];
-                max = FastMath.max(max, FastMath.abs(delta));
-            }
-            return max;
-        } else {
-            checkVectorDimensions(v);
-            double max = 0;
-            for (int i = 0; i < data.length; ++i) {
-                final double delta = data[i] - v.getEntry(i);
-                max = FastMath.max(max, FastMath.abs(delta));
-            }
-            return max;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealMatrix outerProduct(RealVector v) {
-        if (v instanceof ArrayRealVector) {
-            final double[] vData = ((ArrayRealVector) v).data;
-            final int m = data.length;
-            final int n = vData.length;
-            final RealMatrix out = MatrixUtils.createRealMatrix(m, n);
-            for (int i = 0; i < m; i++) {
-                for (int j = 0; j < n; j++) {
-                    out.setEntry(i, j, data[i] * vData[j]);
-                }
-            }
-            return out;
-        } else {
-            final int m = data.length;
-            final int n = v.getDimension();
-            final RealMatrix out = MatrixUtils.createRealMatrix(m, n);
-            for (int i = 0; i < m; i++) {
-                for (int j = 0; j < n; j++) {
-                    out.setEntry(i, j, data[i] * v.getEntry(j));
-                }
-            }
-            return out;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getEntry(int index) throws OutOfRangeException {
-        try {
-            return data[index];
-        } catch (IndexOutOfBoundsException e) {
-            throw new OutOfRangeException(LocalizedFormats.INDEX, index, 0,
-                getDimension() - 1);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getDimension() {
-        return data.length;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector append(RealVector v) {
-        try {
-            return new ArrayRealVector(this, (ArrayRealVector) v);
-        } catch (ClassCastException cce) {
-            return new ArrayRealVector(this, v);
-        }
-    }
-
-    /**
-     * Construct a vector by appending a vector to this vector.
-     *
-     * @param v Vector to append to this one.
-     * @return a new vector.
-     */
-    public ArrayRealVector append(ArrayRealVector v) {
-        return new ArrayRealVector(this, v);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector append(double in) {
-        final double[] out = new double[data.length + 1];
-        System.arraycopy(data, 0, out, 0, data.length);
-        out[data.length] = in;
-        return new ArrayRealVector(out, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector getSubVector(int index, int n)
-        throws OutOfRangeException, NotPositiveException {
-        if (n < 0) {
-            throw new NotPositiveException(LocalizedFormats.NUMBER_OF_ELEMENTS_SHOULD_BE_POSITIVE, n);
-        }
-        ArrayRealVector out = new ArrayRealVector(n);
-        try {
-            System.arraycopy(data, index, out.data, 0, n);
-        } catch (IndexOutOfBoundsException e) {
-            checkIndex(index);
-            checkIndex(index + n - 1);
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setEntry(int index, double value) throws OutOfRangeException {
-        try {
-            data[index] = value;
-        } catch (IndexOutOfBoundsException e) {
-            checkIndex(index);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void addToEntry(int index, double increment)
-        throws OutOfRangeException {
-        try {
-        data[index] += increment;
-        } catch(IndexOutOfBoundsException e){
-            throw new OutOfRangeException(LocalizedFormats.INDEX,
-                                          index, 0, data.length - 1);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSubVector(int index, RealVector v)
-        throws OutOfRangeException {
-        if (v instanceof ArrayRealVector) {
-            setSubVector(index, ((ArrayRealVector) v).data);
-        } else {
-            try {
-                for (int i = index; i < index + v.getDimension(); ++i) {
-                    data[i] = v.getEntry(i - index);
-                }
-            } catch (IndexOutOfBoundsException e) {
-                checkIndex(index);
-                checkIndex(index + v.getDimension() - 1);
-            }
-        }
-    }
-
-    /**
-     * Set a set of consecutive elements.
-     *
-     * @param index Index of first element to be set.
-     * @param v Vector containing the values to set.
-     * @throws OutOfRangeException if the index is inconsistent with the vector
-     * size.
-     */
-    public void setSubVector(int index, double[] v)
-        throws OutOfRangeException {
-        try {
-            System.arraycopy(v, 0, data, index, v.length);
-        } catch (IndexOutOfBoundsException e) {
-            checkIndex(index);
-            checkIndex(index + v.length - 1);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void set(double value) {
-        Arrays.fill(data, value);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] toArray(){
-        return data.clone();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String toString(){
-        return DEFAULT_FORMAT.format(this);
-    }
-
-    /**
-     * Check if instance and specified vectors have the same dimension.
-     *
-     * @param v Vector to compare instance with.
-     * @throws DimensionMismatchException if the vectors do not
-     * have the same dimension.
-     */
-    @Override
-    protected void checkVectorDimensions(RealVector v)
-        throws DimensionMismatchException {
-        checkVectorDimensions(v.getDimension());
-    }
-
-    /**
-     * Check if instance dimension is equal to some expected value.
-     *
-     * @param n Expected dimension.
-     * @throws DimensionMismatchException if the dimension is
-     * inconsistent with vector size.
-     */
-    @Override
-    protected void checkVectorDimensions(int n)
-        throws DimensionMismatchException {
-        if (data.length != n) {
-            throw new DimensionMismatchException(data.length, n);
-        }
-    }
-
-    /**
-     * Check if any coordinate of this vector is {@code NaN}.
-     *
-     * @return {@code true} if any coordinate of this vector is {@code NaN},
-     * {@code false} otherwise.
-     */
-    @Override
-    public boolean isNaN() {
-        for (double v : data) {
-            if (Double.isNaN(v)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Check whether any coordinate of this vector is infinite and none
-     * are {@code NaN}.
-     *
-     * @return {@code true} if any coordinate of this vector is infinite and
-     * none are {@code NaN}, {@code false} otherwise.
-     */
-    @Override
-    public boolean isInfinite() {
-        if (isNaN()) {
-            return false;
-        }
-
-        for (double v : data) {
-            if (Double.isInfinite(v)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean equals(Object other) {
-        if (this == other) {
-            return true;
-        }
-
-        if (!(other instanceof RealVector)) {
-            return false;
-        }
-
-        RealVector rhs = (RealVector) other;
-        if (data.length != rhs.getDimension()) {
-            return false;
-        }
-
-        if (rhs.isNaN()) {
-            return this.isNaN();
-        }
-
-        for (int i = 0; i < data.length; ++i) {
-            if (data[i] != rhs.getEntry(i)) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * {@inheritDoc} All {@code NaN} values have the same hash code.
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN()) {
-            return 9;
-        }
-        return MathUtils.hash(data);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector combine(double a, double b, RealVector y)
-        throws DimensionMismatchException {
-        return copy().combineToSelf(a, b, y);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public ArrayRealVector combineToSelf(double a, double b, RealVector y)
-        throws DimensionMismatchException {
-        if (y instanceof ArrayRealVector) {
-            final double[] yData = ((ArrayRealVector) y).data;
-            checkVectorDimensions(yData.length);
-            for (int i = 0; i < this.data.length; i++) {
-                data[i] = a * data[i] + b * yData[i];
-            }
-        } else {
-            checkVectorDimensions(y);
-            for (int i = 0; i < this.data.length; i++) {
-                data[i] = a * data[i] + b * y.getEntry(i);
-            }
-        }
-        return this;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor) {
-        visitor.start(data.length, 0, data.length - 1);
-        for (int i = 0; i < data.length; i++) {
-            visitor.visit(i, data[i]);
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor,
-        final int start, final int end) throws NumberIsTooSmallException,
-        OutOfRangeException {
-        checkIndices(start, end);
-        visitor.start(data.length, start, end);
-        for (int i = start; i <= end; i++) {
-            visitor.visit(i, data[i]);
-        }
-        return visitor.end();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * In this implementation, the optimized order is the default order.
-     */
-    @Override
-    public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor) {
-        return walkInDefaultOrder(visitor);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * In this implementation, the optimized order is the default order.
-     */
-    @Override
-    public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor,
-        final int start, final int end) throws NumberIsTooSmallException,
-        OutOfRangeException {
-        return walkInDefaultOrder(visitor, start, end);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInDefaultOrder(final RealVectorChangingVisitor visitor) {
-        visitor.start(data.length, 0, data.length - 1);
-        for (int i = 0; i < data.length; i++) {
-            data[i] = visitor.visit(i, data[i]);
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInDefaultOrder(final RealVectorChangingVisitor visitor,
-        final int start, final int end) throws NumberIsTooSmallException,
-        OutOfRangeException {
-        checkIndices(start, end);
-        visitor.start(data.length, start, end);
-        for (int i = start; i <= end; i++) {
-            data[i] = visitor.visit(i, data[i]);
-        }
-        return visitor.end();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * In this implementation, the optimized order is the default order.
-     */
-    @Override
-    public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor) {
-        return walkInDefaultOrder(visitor);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * In this implementation, the optimized order is the default order.
-     */
-    @Override
-    public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor,
-        final int start, final int end) throws NumberIsTooSmallException,
-        OutOfRangeException {
-        return walkInDefaultOrder(visitor, start, end);
-    }
-}


[46/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java b/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java
deleted file mode 100644
index 8c64c8b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Gaussian.java
+++ /dev/null
@@ -1,259 +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.analysis.function;
-
-import java.util.Arrays;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Gaussian_function">
- *  Gaussian</a> function.
- *
- * @since 3.0
- */
-public class Gaussian implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** Mean. */
-    private final double mean;
-    /** Inverse of the standard deviation. */
-    private final double is;
-    /** Inverse of twice the square of the standard deviation. */
-    private final double i2s2;
-    /** Normalization factor. */
-    private final double norm;
-
-    /**
-     * Gaussian with given normalization factor, mean and standard deviation.
-     *
-     * @param norm Normalization factor.
-     * @param mean Mean.
-     * @param sigma Standard deviation.
-     * @throws NotStrictlyPositiveException if {@code sigma <= 0}.
-     */
-    public Gaussian(double norm,
-                    double mean,
-                    double sigma)
-        throws NotStrictlyPositiveException {
-        if (sigma <= 0) {
-            throw new NotStrictlyPositiveException(sigma);
-        }
-
-        this.norm = norm;
-        this.mean = mean;
-        this.is   = 1 / sigma;
-        this.i2s2 = 0.5 * is * is;
-    }
-
-    /**
-     * Normalized gaussian with given mean and standard deviation.
-     *
-     * @param mean Mean.
-     * @param sigma Standard deviation.
-     * @throws NotStrictlyPositiveException if {@code sigma <= 0}.
-     */
-    public Gaussian(double mean,
-                    double sigma)
-        throws NotStrictlyPositiveException {
-        this(1 / (sigma * FastMath.sqrt(2 * Math.PI)), mean, sigma);
-    }
-
-    /**
-     * Normalized gaussian with zero mean and unit standard deviation.
-     */
-    public Gaussian() {
-        this(0, 1);
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return value(x - mean, norm, i2s2);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /**
-     * Parametric function where the input array contains the parameters of
-     * the Gaussian, ordered as follows:
-     * <ul>
-     *  <li>Norm</li>
-     *  <li>Mean</li>
-     *  <li>Standard deviation</li>
-     * </ul>
-     */
-    public static class Parametric implements ParametricUnivariateFunction {
-        /**
-         * Computes the value of the Gaussian at {@code x}.
-         *
-         * @param x Value for which the function must be computed.
-         * @param param Values of norm, mean and standard deviation.
-         * @return the value of the function.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 3.
-         * @throws NotStrictlyPositiveException if {@code param[2]} is negative.
-         */
-        public double value(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException,
-                   NotStrictlyPositiveException {
-            validateParameters(param);
-
-            final double diff = x - param[1];
-            final double i2s2 = 1 / (2 * param[2] * param[2]);
-            return Gaussian.value(diff, param[0], i2s2);
-        }
-
-        /**
-         * Computes the value of the gradient at {@code x}.
-         * The components of the gradient vector are the partial
-         * derivatives of the function with respect to each of the
-         * <em>parameters</em> (norm, mean and standard deviation).
-         *
-         * @param x Value at which the gradient must be computed.
-         * @param param Values of norm, mean and standard deviation.
-         * @return the gradient vector at {@code x}.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 3.
-         * @throws NotStrictlyPositiveException if {@code param[2]} is negative.
-         */
-        public double[] gradient(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException,
-                   NotStrictlyPositiveException {
-            validateParameters(param);
-
-            final double norm = param[0];
-            final double diff = x - param[1];
-            final double sigma = param[2];
-            final double i2s2 = 1 / (2 * sigma * sigma);
-
-            final double n = Gaussian.value(diff, 1, i2s2);
-            final double m = norm * n * 2 * i2s2 * diff;
-            final double s = m * diff / sigma;
-
-            return new double[] { n, m, s };
-        }
-
-        /**
-         * Validates parameters to ensure they are appropriate for the evaluation of
-         * the {@link #value(double,double[])} and {@link #gradient(double,double[])}
-         * methods.
-         *
-         * @param param Values of norm, mean and standard deviation.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 3.
-         * @throws NotStrictlyPositiveException if {@code param[2]} is negative.
-         */
-        private void validateParameters(double[] param)
-            throws NullArgumentException,
-                   DimensionMismatchException,
-                   NotStrictlyPositiveException {
-            if (param == null) {
-                throw new NullArgumentException();
-            }
-            if (param.length != 3) {
-                throw new DimensionMismatchException(param.length, 3);
-            }
-            if (param[2] <= 0) {
-                throw new NotStrictlyPositiveException(param[2]);
-            }
-        }
-    }
-
-    /**
-     * @param xMinusMean {@code x - mean}.
-     * @param norm Normalization factor.
-     * @param i2s2 Inverse of twice the square of the standard deviation.
-     * @return the value of the Gaussian at {@code x}.
-     */
-    private static double value(double xMinusMean,
-                                double norm,
-                                double i2s2) {
-        return norm * FastMath.exp(-xMinusMean * xMinusMean * i2s2);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t)
-        throws DimensionMismatchException {
-
-        final double u = is * (t.getValue() - mean);
-        double[] f = new double[t.getOrder() + 1];
-
-        // the nth order derivative of the Gaussian has the form:
-        // dn(g(x)/dxn = (norm / s^n) P_n(u) exp(-u^2/2) with u=(x-m)/s
-        // where P_n(u) is a degree n polynomial with same parity as n
-        // P_0(u) = 1, P_1(u) = -u, P_2(u) = u^2 - 1, P_3(u) = -u^3 + 3 u...
-        // the general recurrence relation for P_n is:
-        // P_n(u) = P_(n-1)'(u) - u P_(n-1)(u)
-        // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
-        final double[] p = new double[f.length];
-        p[0] = 1;
-        final double u2 = u * u;
-        double coeff = norm * FastMath.exp(-0.5 * u2);
-        if (coeff <= Precision.SAFE_MIN) {
-            Arrays.fill(f, 0.0);
-        } else {
-            f[0] = coeff;
-            for (int n = 1; n < f.length; ++n) {
-
-                // update and evaluate polynomial P_n(x)
-                double v = 0;
-                p[n] = -p[n - 1];
-                for (int k = n; k >= 0; k -= 2) {
-                    v = v * u2 + p[k];
-                    if (k > 2) {
-                        p[k - 2] = (k - 1) * p[k - 1] - p[k - 3];
-                    } else if (k == 2) {
-                        p[0] = p[1];
-                    }
-                }
-                if ((n & 0x1) == 1) {
-                    v *= u;
-                }
-
-                coeff *= is;
-                f[n] = coeff * v;
-
-            }
-        }
-
-        return t.compose(f);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java b/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java
deleted file mode 100644
index 0fbad9c..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/HarmonicOscillator.java
+++ /dev/null
@@ -1,183 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Harmonic_oscillator">
- *  simple harmonic oscillator</a> function.
- *
- * @since 3.0
- */
-public class HarmonicOscillator implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** Amplitude. */
-    private final double amplitude;
-    /** Angular frequency. */
-    private final double omega;
-    /** Phase. */
-    private final double phase;
-
-    /**
-     * Harmonic oscillator function.
-     *
-     * @param amplitude Amplitude.
-     * @param omega Angular frequency.
-     * @param phase Phase.
-     */
-    public HarmonicOscillator(double amplitude,
-                              double omega,
-                              double phase) {
-        this.amplitude = amplitude;
-        this.omega = omega;
-        this.phase = phase;
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return value(omega * x + phase, amplitude);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /**
-     * Parametric function where the input array contains the parameters of
-     * the harmonic oscillator function, ordered as follows:
-     * <ul>
-     *  <li>Amplitude</li>
-     *  <li>Angular frequency</li>
-     *  <li>Phase</li>
-     * </ul>
-     */
-    public static class Parametric implements ParametricUnivariateFunction {
-        /**
-         * Computes the value of the harmonic oscillator at {@code x}.
-         *
-         * @param x Value for which the function must be computed.
-         * @param param Values of norm, mean and standard deviation.
-         * @return the value of the function.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 3.
-         */
-        public double value(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            validateParameters(param);
-            return HarmonicOscillator.value(x * param[1] + param[2], param[0]);
-        }
-
-        /**
-         * Computes the value of the gradient at {@code x}.
-         * The components of the gradient vector are the partial
-         * derivatives of the function with respect to each of the
-         * <em>parameters</em> (amplitude, angular frequency and phase).
-         *
-         * @param x Value at which the gradient must be computed.
-         * @param param Values of amplitude, angular frequency and phase.
-         * @return the gradient vector at {@code x}.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 3.
-         */
-        public double[] gradient(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            validateParameters(param);
-
-            final double amplitude = param[0];
-            final double omega = param[1];
-            final double phase = param[2];
-
-            final double xTimesOmegaPlusPhase = omega * x + phase;
-            final double a = HarmonicOscillator.value(xTimesOmegaPlusPhase, 1);
-            final double p = -amplitude * FastMath.sin(xTimesOmegaPlusPhase);
-            final double w = p * x;
-
-            return new double[] { a, w, p };
-        }
-
-        /**
-         * Validates parameters to ensure they are appropriate for the evaluation of
-         * the {@link #value(double,double[])} and {@link #gradient(double,double[])}
-         * methods.
-         *
-         * @param param Values of norm, mean and standard deviation.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 3.
-         */
-        private void validateParameters(double[] param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            if (param == null) {
-                throw new NullArgumentException();
-            }
-            if (param.length != 3) {
-                throw new DimensionMismatchException(param.length, 3);
-            }
-        }
-    }
-
-    /**
-     * @param xTimesOmegaPlusPhase {@code omega * x + phase}.
-     * @param amplitude Amplitude.
-     * @return the value of the harmonic oscillator function at {@code x}.
-     */
-    private static double value(double xTimesOmegaPlusPhase,
-                                double amplitude) {
-        return amplitude * FastMath.cos(xTimesOmegaPlusPhase);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t)
-        throws DimensionMismatchException {
-        final double x = t.getValue();
-        double[] f = new double[t.getOrder() + 1];
-
-        final double alpha = omega * x + phase;
-        f[0] = amplitude * FastMath.cos(alpha);
-        if (f.length > 1) {
-            f[1] = -amplitude * omega * FastMath.sin(alpha);
-            final double mo2 = - omega * omega;
-            for (int i = 2; i < f.length; ++i) {
-                f[i] = mo2 * f[i - 2];
-            }
-        }
-
-        return t.compose(f);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Identity.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Identity.java b/src/main/java/org/apache/commons/math3/analysis/function/Identity.java
deleted file mode 100644
index d21f7e0..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Identity.java
+++ /dev/null
@@ -1,50 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-
-/**
- * Identity function.
- *
- * @since 3.0
- */
-public class Identity implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return x;
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public DifferentiableUnivariateFunction derivative() {
-        return new Constant(1);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Inverse.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Inverse.java b/src/main/java/org/apache/commons/math3/analysis/function/Inverse.java
deleted file mode 100644
index e38f689..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Inverse.java
+++ /dev/null
@@ -1,52 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-
-/**
- * Inverse function.
- *
- * @since 3.0
- */
-public class Inverse implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return 1 / x;
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.reciprocal();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Log.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Log.java b/src/main/java/org/apache/commons/math3/analysis/function/Log.java
deleted file mode 100644
index a1e12dc..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Log.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Natural logarithm function.
- *
- * @since 3.0
- */
-public class Log implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.log(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.log();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Log10.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Log10.java b/src/main/java/org/apache/commons/math3/analysis/function/Log10.java
deleted file mode 100644
index 66c03e1..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Log10.java
+++ /dev/null
@@ -1,54 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Base 10 logarithm function.
- *
- * @since 3.0
- */
-public class Log10 implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.log10(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.log10();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Log1p.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Log1p.java b/src/main/java/org/apache/commons/math3/analysis/function/Log1p.java
deleted file mode 100644
index 4966318..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Log1p.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <code>log(1 + p)</code> function.
- *
- * @since 3.0
- */
-public class Log1p implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.log1p(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.log1p();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java b/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java
deleted file mode 100644
index c90203c..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Logistic.java
+++ /dev/null
@@ -1,228 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Generalised_logistic_function">
- *  Generalised logistic</a> function.
- *
- * @since 3.0
- */
-public class Logistic implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** Lower asymptote. */
-    private final double a;
-    /** Upper asymptote. */
-    private final double k;
-    /** Growth rate. */
-    private final double b;
-    /** Parameter that affects near which asymptote maximum growth occurs. */
-    private final double oneOverN;
-    /** Parameter that affects the position of the curve along the ordinate axis. */
-    private final double q;
-    /** Abscissa of maximum growth. */
-    private final double m;
-
-    /**
-     * @param k If {@code b > 0}, value of the function for x going towards +&infin;.
-     * If {@code b < 0}, value of the function for x going towards -&infin;.
-     * @param m Abscissa of maximum growth.
-     * @param b Growth rate.
-     * @param q Parameter that affects the position of the curve along the
-     * ordinate axis.
-     * @param a If {@code b > 0}, value of the function for x going towards -&infin;.
-     * If {@code b < 0}, value of the function for x going towards +&infin;.
-     * @param n Parameter that affects near which asymptote the maximum
-     * growth occurs.
-     * @throws NotStrictlyPositiveException if {@code n <= 0}.
-     */
-    public Logistic(double k,
-                    double m,
-                    double b,
-                    double q,
-                    double a,
-                    double n)
-        throws NotStrictlyPositiveException {
-        if (n <= 0) {
-            throw new NotStrictlyPositiveException(n);
-        }
-
-        this.k = k;
-        this.m = m;
-        this.b = b;
-        this.q = q;
-        this.a = a;
-        oneOverN = 1 / n;
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return value(m - x, k, b, q, a, oneOverN);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /**
-     * Parametric function where the input array contains the parameters of
-     * the {@link Logistic#Logistic(double,double,double,double,double,double)
-     * logistic function}, ordered as follows:
-     * <ul>
-     *  <li>k</li>
-     *  <li>m</li>
-     *  <li>b</li>
-     *  <li>q</li>
-     *  <li>a</li>
-     *  <li>n</li>
-     * </ul>
-     */
-    public static class Parametric implements ParametricUnivariateFunction {
-        /**
-         * Computes the value of the sigmoid at {@code x}.
-         *
-         * @param x Value for which the function must be computed.
-         * @param param Values for {@code k}, {@code m}, {@code b}, {@code q},
-         * {@code a} and  {@code n}.
-         * @return the value of the function.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 6.
-         * @throws NotStrictlyPositiveException if {@code param[5] <= 0}.
-         */
-        public double value(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException,
-                   NotStrictlyPositiveException {
-            validateParameters(param);
-            return Logistic.value(param[1] - x, param[0],
-                                  param[2], param[3],
-                                  param[4], 1 / param[5]);
-        }
-
-        /**
-         * Computes the value of the gradient at {@code x}.
-         * The components of the gradient vector are the partial
-         * derivatives of the function with respect to each of the
-         * <em>parameters</em>.
-         *
-         * @param x Value at which the gradient must be computed.
-         * @param param Values for {@code k}, {@code m}, {@code b}, {@code q},
-         * {@code a} and  {@code n}.
-         * @return the gradient vector at {@code x}.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 6.
-         * @throws NotStrictlyPositiveException if {@code param[5] <= 0}.
-         */
-        public double[] gradient(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException,
-                   NotStrictlyPositiveException {
-            validateParameters(param);
-
-            final double b = param[2];
-            final double q = param[3];
-
-            final double mMinusX = param[1] - x;
-            final double oneOverN = 1 / param[5];
-            final double exp = FastMath.exp(b * mMinusX);
-            final double qExp = q * exp;
-            final double qExp1 = qExp + 1;
-            final double factor1 = (param[0] - param[4]) * oneOverN / FastMath.pow(qExp1, oneOverN);
-            final double factor2 = -factor1 / qExp1;
-
-            // Components of the gradient.
-            final double gk = Logistic.value(mMinusX, 1, b, q, 0, oneOverN);
-            final double gm = factor2 * b * qExp;
-            final double gb = factor2 * mMinusX * qExp;
-            final double gq = factor2 * exp;
-            final double ga = Logistic.value(mMinusX, 0, b, q, 1, oneOverN);
-            final double gn = factor1 * FastMath.log(qExp1) * oneOverN;
-
-            return new double[] { gk, gm, gb, gq, ga, gn };
-        }
-
-        /**
-         * Validates parameters to ensure they are appropriate for the evaluation of
-         * the {@link #value(double,double[])} and {@link #gradient(double,double[])}
-         * methods.
-         *
-         * @param param Values for {@code k}, {@code m}, {@code b}, {@code q},
-         * {@code a} and {@code n}.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 6.
-         * @throws NotStrictlyPositiveException if {@code param[5] <= 0}.
-         */
-        private void validateParameters(double[] param)
-            throws NullArgumentException,
-                   DimensionMismatchException,
-                   NotStrictlyPositiveException {
-            if (param == null) {
-                throw new NullArgumentException();
-            }
-            if (param.length != 6) {
-                throw new DimensionMismatchException(param.length, 6);
-            }
-            if (param[5] <= 0) {
-                throw new NotStrictlyPositiveException(param[5]);
-            }
-        }
-    }
-
-    /**
-     * @param mMinusX {@code m - x}.
-     * @param k {@code k}.
-     * @param b {@code b}.
-     * @param q {@code q}.
-     * @param a {@code a}.
-     * @param oneOverN {@code 1 / n}.
-     * @return the value of the function.
-     */
-    private static double value(double mMinusX,
-                                double k,
-                                double b,
-                                double q,
-                                double a,
-                                double oneOverN) {
-        return a + (k - a) / FastMath.pow(1 + q * FastMath.exp(b * mMinusX), oneOverN);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.negate().add(m).multiply(b).exp().multiply(q).add(1).pow(oneOverN).reciprocal().multiply(k - a).add(a);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Logit.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Logit.java b/src/main/java/org/apache/commons/math3/analysis/function/Logit.java
deleted file mode 100644
index 39abe4d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Logit.java
+++ /dev/null
@@ -1,212 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Logit">
- *  Logit</a> function.
- * It is the inverse of the {@link Sigmoid sigmoid} function.
- *
- * @since 3.0
- */
-public class Logit implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** Lower bound. */
-    private final double lo;
-    /** Higher bound. */
-    private final double hi;
-
-    /**
-     * Usual logit function, where the lower bound is 0 and the higher
-     * bound is 1.
-     */
-    public Logit() {
-        this(0, 1);
-    }
-
-    /**
-     * Logit function.
-     *
-     * @param lo Lower bound of the function domain.
-     * @param hi Higher bound of the function domain.
-     */
-    public Logit(double lo,
-                 double hi) {
-        this.lo = lo;
-        this.hi = hi;
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x)
-        throws OutOfRangeException {
-        return value(x, lo, hi);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /**
-     * Parametric function where the input array contains the parameters of
-     * the logit function, ordered as follows:
-     * <ul>
-     *  <li>Lower bound</li>
-     *  <li>Higher bound</li>
-     * </ul>
-     */
-    public static class Parametric implements ParametricUnivariateFunction {
-        /**
-         * Computes the value of the logit at {@code x}.
-         *
-         * @param x Value for which the function must be computed.
-         * @param param Values of lower bound and higher bounds.
-         * @return the value of the function.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 2.
-         */
-        public double value(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            validateParameters(param);
-            return Logit.value(x, param[0], param[1]);
-        }
-
-        /**
-         * Computes the value of the gradient at {@code x}.
-         * The components of the gradient vector are the partial
-         * derivatives of the function with respect to each of the
-         * <em>parameters</em> (lower bound and higher bound).
-         *
-         * @param x Value at which the gradient must be computed.
-         * @param param Values for lower and higher bounds.
-         * @return the gradient vector at {@code x}.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 2.
-         */
-        public double[] gradient(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            validateParameters(param);
-
-            final double lo = param[0];
-            final double hi = param[1];
-
-            return new double[] { 1 / (lo - x), 1 / (hi - x) };
-        }
-
-        /**
-         * Validates parameters to ensure they are appropriate for the evaluation of
-         * the {@link #value(double,double[])} and {@link #gradient(double,double[])}
-         * methods.
-         *
-         * @param param Values for lower and higher bounds.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 2.
-         */
-        private void validateParameters(double[] param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            if (param == null) {
-                throw new NullArgumentException();
-            }
-            if (param.length != 2) {
-                throw new DimensionMismatchException(param.length, 2);
-            }
-        }
-    }
-
-    /**
-     * @param x Value at which to compute the logit.
-     * @param lo Lower bound.
-     * @param hi Higher bound.
-     * @return the value of the logit function at {@code x}.
-     * @throws OutOfRangeException if {@code x < lo} or {@code x > hi}.
-     */
-    private static double value(double x,
-                                double lo,
-                                double hi)
-        throws OutOfRangeException {
-        if (x < lo || x > hi) {
-            throw new OutOfRangeException(x, lo, hi);
-        }
-        return FastMath.log((x - lo) / (hi - x));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     * @exception OutOfRangeException if parameter is outside of function domain
-     */
-    public DerivativeStructure value(final DerivativeStructure t)
-        throws OutOfRangeException {
-        final double x = t.getValue();
-        if (x < lo || x > hi) {
-            throw new OutOfRangeException(x, lo, hi);
-        }
-        double[] f = new double[t.getOrder() + 1];
-
-        // function value
-        f[0] = FastMath.log((x - lo) / (hi - x));
-
-        if (Double.isInfinite(f[0])) {
-
-            if (f.length > 1) {
-                f[1] = Double.POSITIVE_INFINITY;
-            }
-            // fill the array with infinities
-            // (for x close to lo the signs will flip between -inf and +inf,
-            //  for x close to hi the signs will always be +inf)
-            // this is probably overkill, since the call to compose at the end
-            // of the method will transform most infinities into NaN ...
-            for (int i = 2; i < f.length; ++i) {
-                f[i] = f[i - 2];
-            }
-
-        } else {
-
-            // function derivatives
-            final double invL = 1.0 / (x - lo);
-            double xL = invL;
-            final double invH = 1.0 / (hi - x);
-            double xH = invH;
-            for (int i = 1; i < f.length; ++i) {
-                f[i] = xL + xH;
-                xL  *= -i * invL;
-                xH  *=  i * invH;
-            }
-        }
-
-        return t.compose(f);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Max.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Max.java b/src/main/java/org/apache/commons/math3/analysis/function/Max.java
deleted file mode 100644
index 591ac55..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Max.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Maximum function.
- *
- * @since 3.0
- */
-public class Max implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return FastMath.max(x, y);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Min.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Min.java b/src/main/java/org/apache/commons/math3/analysis/function/Min.java
deleted file mode 100644
index a776b79..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Min.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Minimum function.
- *
- * @since 3.0
- */
-public class Min implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return FastMath.min(x, y);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Minus.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Minus.java b/src/main/java/org/apache/commons/math3/analysis/function/Minus.java
deleted file mode 100644
index e532779..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Minus.java
+++ /dev/null
@@ -1,50 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-
-/**
- * Minus function.
- *
- * @since 3.0
- */
-public class Minus implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return -x;
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public DifferentiableUnivariateFunction derivative() {
-        return new Constant(-1);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.negate();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Multiply.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Multiply.java b/src/main/java/org/apache/commons/math3/analysis/function/Multiply.java
deleted file mode 100644
index b7e771b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Multiply.java
+++ /dev/null
@@ -1,32 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-
-/**
- * Multiply the two operands.
- *
- * @since 3.0
- */
-public class Multiply implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return x * y;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Pow.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Pow.java b/src/main/java/org/apache/commons/math3/analysis/function/Pow.java
deleted file mode 100644
index 756dc42..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Pow.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Power function.
- *
- * @since 3.0
- */
-public class Pow implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return FastMath.pow(x, y);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Power.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Power.java b/src/main/java/org/apache/commons/math3/analysis/function/Power.java
deleted file mode 100644
index 953bcab..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Power.java
+++ /dev/null
@@ -1,63 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Power function.
- *
- * @since 3.0
- */
-public class Power implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** Power. */
-    private final double p;
-
-    /**
-     * @param p Power.
-     */
-    public Power(double p) {
-        this.p = p;
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.pow(x, p);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.pow(p);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Rint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Rint.java b/src/main/java/org/apache/commons/math3/analysis/function/Rint.java
deleted file mode 100644
index 4edde58..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Rint.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * {@code rint} function.
- *
- * @since 3.0
- */
-public class Rint implements UnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.rint(x);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java b/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java
deleted file mode 100644
index 54639f9..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Sigmoid.java
+++ /dev/null
@@ -1,218 +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.analysis.function;
-
-import java.util.Arrays;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Sigmoid_function">
- *  Sigmoid</a> function.
- * It is the inverse of the {@link Logit logit} function.
- * A more flexible version, the generalised logistic, is implemented
- * by the {@link Logistic} class.
- *
- * @since 3.0
- */
-public class Sigmoid implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** Lower asymptote. */
-    private final double lo;
-    /** Higher asymptote. */
-    private final double hi;
-
-    /**
-     * Usual sigmoid function, where the lower asymptote is 0 and the higher
-     * asymptote is 1.
-     */
-    public Sigmoid() {
-        this(0, 1);
-    }
-
-    /**
-     * Sigmoid function.
-     *
-     * @param lo Lower asymptote.
-     * @param hi Higher asymptote.
-     */
-    public Sigmoid(double lo,
-                   double hi) {
-        this.lo = lo;
-        this.hi = hi;
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return value(x, lo, hi);
-    }
-
-    /**
-     * Parametric function where the input array contains the parameters of
-     * the {@link Sigmoid#Sigmoid(double,double) sigmoid function}, ordered
-     * as follows:
-     * <ul>
-     *  <li>Lower asymptote</li>
-     *  <li>Higher asymptote</li>
-     * </ul>
-     */
-    public static class Parametric implements ParametricUnivariateFunction {
-        /**
-         * Computes the value of the sigmoid at {@code x}.
-         *
-         * @param x Value for which the function must be computed.
-         * @param param Values of lower asymptote and higher asymptote.
-         * @return the value of the function.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 2.
-         */
-        public double value(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            validateParameters(param);
-            return Sigmoid.value(x, param[0], param[1]);
-        }
-
-        /**
-         * Computes the value of the gradient at {@code x}.
-         * The components of the gradient vector are the partial
-         * derivatives of the function with respect to each of the
-         * <em>parameters</em> (lower asymptote and higher asymptote).
-         *
-         * @param x Value at which the gradient must be computed.
-         * @param param Values for lower asymptote and higher asymptote.
-         * @return the gradient vector at {@code x}.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 2.
-         */
-        public double[] gradient(double x, double ... param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            validateParameters(param);
-
-            final double invExp1 = 1 / (1 + FastMath.exp(-x));
-
-            return new double[] { 1 - invExp1, invExp1 };
-        }
-
-        /**
-         * Validates parameters to ensure they are appropriate for the evaluation of
-         * the {@link #value(double,double[])} and {@link #gradient(double,double[])}
-         * methods.
-         *
-         * @param param Values for lower and higher asymptotes.
-         * @throws NullArgumentException if {@code param} is {@code null}.
-         * @throws DimensionMismatchException if the size of {@code param} is
-         * not 2.
-         */
-        private void validateParameters(double[] param)
-            throws NullArgumentException,
-                   DimensionMismatchException {
-            if (param == null) {
-                throw new NullArgumentException();
-            }
-            if (param.length != 2) {
-                throw new DimensionMismatchException(param.length, 2);
-            }
-        }
-    }
-
-    /**
-     * @param x Value at which to compute the sigmoid.
-     * @param lo Lower asymptote.
-     * @param hi Higher asymptote.
-     * @return the value of the sigmoid function at {@code x}.
-     */
-    private static double value(double x,
-                                double lo,
-                                double hi) {
-        return lo + (hi - lo) / (1 + FastMath.exp(-x));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t)
-        throws DimensionMismatchException {
-
-        double[] f = new double[t.getOrder() + 1];
-        final double exp = FastMath.exp(-t.getValue());
-        if (Double.isInfinite(exp)) {
-
-            // special handling near lower boundary, to avoid NaN
-            f[0] = lo;
-            Arrays.fill(f, 1, f.length, 0.0);
-
-        } else {
-
-            // the nth order derivative of sigmoid has the form:
-            // dn(sigmoid(x)/dxn = P_n(exp(-x)) / (1+exp(-x))^(n+1)
-            // where P_n(t) is a degree n polynomial with normalized higher term
-            // P_0(t) = 1, P_1(t) = t, P_2(t) = t^2 - t, P_3(t) = t^3 - 4 t^2 + t...
-            // the general recurrence relation for P_n is:
-            // P_n(x) = n t P_(n-1)(t) - t (1 + t) P_(n-1)'(t)
-            final double[] p = new double[f.length];
-
-            final double inv   = 1 / (1 + exp);
-            double coeff = hi - lo;
-            for (int n = 0; n < f.length; ++n) {
-
-                // update and evaluate polynomial P_n(t)
-                double v = 0;
-                p[n] = 1;
-                for (int k = n; k >= 0; --k) {
-                    v = v * exp + p[k];
-                    if (k > 1) {
-                        p[k - 1] = (n - k + 2) * p[k - 2] - (k - 1) * p[k - 1];
-                    } else {
-                        p[0] = 0;
-                    }
-                }
-
-                coeff *= inv;
-                f[n]   = coeff * v;
-
-            }
-
-            // fix function value
-            f[0] += lo;
-
-        }
-
-        return t.compose(f);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Signum.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Signum.java b/src/main/java/org/apache/commons/math3/analysis/function/Signum.java
deleted file mode 100644
index ddde66e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Signum.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * {@code signum} function.
- *
- * @since 3.0
- */
-public class Signum implements UnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.signum(x);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Sin.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Sin.java b/src/main/java/org/apache/commons/math3/analysis/function/Sin.java
deleted file mode 100644
index 71c91e7..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Sin.java
+++ /dev/null
@@ -1,51 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Sine function.
- *
- * @since 3.0
- */
-public class Sin implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.sin(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public DifferentiableUnivariateFunction derivative() {
-        return new Cos();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.sin();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Sinc.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Sinc.java b/src/main/java/org/apache/commons/math3/analysis/function/Sinc.java
deleted file mode 100644
index 553cfff..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Sinc.java
+++ /dev/null
@@ -1,205 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Sinc_function">Sinc</a> function,
- * defined by
- * <pre><code>
- *   sinc(x) = 1            if x = 0,
- *             sin(x) / x   otherwise.
- * </code></pre>
- *
- * @since 3.0
- */
-public class Sinc implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /**
-     * Value below which the computations are done using Taylor series.
-     * <p>
-     * The Taylor series for sinc even order derivatives are:
-     * <pre>
-     * d^(2n)sinc/dx^(2n)     = Sum_(k>=0) (-1)^(n+k) / ((2k)!(2n+2k+1)) x^(2k)
-     *                        = (-1)^n     [ 1/(2n+1) - x^2/(4n+6) + x^4/(48n+120) - x^6/(1440n+5040) + O(x^8) ]
-     * </pre>
-     * </p>
-     * <p>
-     * The Taylor series for sinc odd order derivatives are:
-     * <pre>
-     * d^(2n+1)sinc/dx^(2n+1) = Sum_(k>=0) (-1)^(n+k+1) / ((2k+1)!(2n+2k+3)) x^(2k+1)
-     *                        = (-1)^(n+1) [ x/(2n+3) - x^3/(12n+30) + x^5/(240n+840) - x^7/(10080n+45360) + O(x^9) ]
-     * </pre>
-     * </p>
-     * <p>
-     * So the ratio of the fourth term with respect to the first term
-     * is always smaller than x^6/720, for all derivative orders.
-     * This implies that neglecting this term and using only the first three terms induces
-     * a relative error bounded by x^6/720. The SHORTCUT value is chosen such that this
-     * relative error is below double precision accuracy when |x| <= SHORTCUT.
-     * </p>
-     */
-    private static final double SHORTCUT = 6.0e-3;
-    /** For normalized sinc function. */
-    private final boolean normalized;
-
-    /**
-     * The sinc function, {@code sin(x) / x}.
-     */
-    public Sinc() {
-        this(false);
-    }
-
-    /**
-     * Instantiates the sinc function.
-     *
-     * @param normalized If {@code true}, the function is
-     * <code> sin(&pi;x) / &pi;x</code>, otherwise {@code sin(x) / x}.
-     */
-    public Sinc(boolean normalized) {
-        this.normalized = normalized;
-    }
-
-    /** {@inheritDoc} */
-    public double value(final double x) {
-        final double scaledX = normalized ? FastMath.PI * x : x;
-        if (FastMath.abs(scaledX) <= SHORTCUT) {
-            // use Taylor series
-            final double scaledX2 = scaledX * scaledX;
-            return ((scaledX2 - 20) * scaledX2 + 120) / 120;
-        } else {
-            // use definition expression
-            return FastMath.sin(scaledX) / scaledX;
-        }
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t)
-        throws DimensionMismatchException {
-
-        final double scaledX  = (normalized ? FastMath.PI : 1) * t.getValue();
-        final double scaledX2 = scaledX * scaledX;
-
-        double[] f = new double[t.getOrder() + 1];
-
-        if (FastMath.abs(scaledX) <= SHORTCUT) {
-
-            for (int i = 0; i < f.length; ++i) {
-                final int k = i / 2;
-                if ((i & 0x1) == 0) {
-                    // even derivation order
-                    f[i] = (((k & 0x1) == 0) ? 1 : -1) *
-                           (1.0 / (i + 1) - scaledX2 * (1.0 / (2 * i + 6) - scaledX2 / (24 * i + 120)));
-                } else {
-                    // odd derivation order
-                    f[i] = (((k & 0x1) == 0) ? -scaledX : scaledX) *
-                           (1.0 / (i + 2) - scaledX2 * (1.0 / (6 * i + 24) - scaledX2 / (120 * i + 720)));
-                }
-            }
-
-        } else {
-
-            final double inv = 1 / scaledX;
-            final double cos = FastMath.cos(scaledX);
-            final double sin = FastMath.sin(scaledX);
-
-            f[0] = inv * sin;
-
-            // the nth order derivative of sinc has the form:
-            // dn(sinc(x)/dxn = [S_n(x) sin(x) + C_n(x) cos(x)] / x^(n+1)
-            // where S_n(x) is an even polynomial with degree n-1 or n (depending on parity)
-            // and C_n(x) is an odd polynomial with degree n-1 or n (depending on parity)
-            // S_0(x) = 1, S_1(x) = -1, S_2(x) = -x^2 + 2, S_3(x) = 3x^2 - 6...
-            // C_0(x) = 0, C_1(x) = x, C_2(x) = -2x, C_3(x) = -x^3 + 6x...
-            // the general recurrence relations for S_n and C_n are:
-            // S_n(x) = x S_(n-1)'(x) - n S_(n-1)(x) - x C_(n-1)(x)
-            // C_n(x) = x C_(n-1)'(x) - n C_(n-1)(x) + x S_(n-1)(x)
-            // as per polynomials parity, we can store both S_n and C_n in the same array
-            final double[] sc = new double[f.length];
-            sc[0] = 1;
-
-            double coeff = inv;
-            for (int n = 1; n < f.length; ++n) {
-
-                double s = 0;
-                double c = 0;
-
-                // update and evaluate polynomials S_n(x) and C_n(x)
-                final int kStart;
-                if ((n & 0x1) == 0) {
-                    // even derivation order, S_n is degree n and C_n is degree n-1
-                    sc[n] = 0;
-                    kStart = n;
-                } else {
-                    // odd derivation order, S_n is degree n-1 and C_n is degree n
-                    sc[n] = sc[n - 1];
-                    c = sc[n];
-                    kStart = n - 1;
-                }
-
-                // in this loop, k is always even
-                for (int k = kStart; k > 1; k -= 2) {
-
-                    // sine part
-                    sc[k]     = (k - n) * sc[k] - sc[k - 1];
-                    s         = s * scaledX2 + sc[k];
-
-                    // cosine part
-                    sc[k - 1] = (k - 1 - n) * sc[k - 1] + sc[k -2];
-                    c         = c * scaledX2 + sc[k - 1];
-
-                }
-                sc[0] *= -n;
-                s      = s * scaledX2 + sc[0];
-
-                coeff *= inv;
-                f[n]   = coeff * (s * sin + c * scaledX * cos);
-
-            }
-
-        }
-
-        if (normalized) {
-            double scale = FastMath.PI;
-            for (int i = 1; i < f.length; ++i) {
-                f[i]  *= scale;
-                scale *= FastMath.PI;
-            }
-        }
-
-        return t.compose(f);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Sinh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Sinh.java b/src/main/java/org/apache/commons/math3/analysis/function/Sinh.java
deleted file mode 100644
index 1eac044..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Sinh.java
+++ /dev/null
@@ -1,51 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Hyperbolic sine function.
- *
- * @since 3.0
- */
-public class Sinh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.sinh(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public DifferentiableUnivariateFunction derivative() {
-        return new Cosh();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.sinh();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Sqrt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Sqrt.java b/src/main/java/org/apache/commons/math3/analysis/function/Sqrt.java
deleted file mode 100644
index 720d44d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Sqrt.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Square-root function.
- *
- * @since 3.0
- */
-public class Sqrt implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.sqrt(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.sqrt();
-    }
-
-}


[70/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
index e4f0c91..dae251f 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LineSearch.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.optim.univariate.UnivariateOptimizer;
-import org.apache.commons.math3.optim.univariate.BrentOptimizer;
-import org.apache.commons.math3.optim.univariate.BracketFinder;
-import org.apache.commons.math3.optim.univariate.UnivariatePointValuePair;
-import org.apache.commons.math3.optim.univariate.SimpleUnivariateValueChecker;
-import org.apache.commons.math3.optim.univariate.SearchInterval;
-import org.apache.commons.math3.optim.univariate.UnivariateObjectiveFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optim.MaxEval;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.univariate.BracketFinder;
+import org.apache.commons.math4.optim.univariate.BrentOptimizer;
+import org.apache.commons.math4.optim.univariate.SearchInterval;
+import org.apache.commons.math4.optim.univariate.SimpleUnivariateValueChecker;
+import org.apache.commons.math4.optim.univariate.UnivariateObjectiveFunction;
+import org.apache.commons.math4.optim.univariate.UnivariateOptimizer;
+import org.apache.commons.math4.optim.univariate.UnivariatePointValuePair;
 
 /**
  * Class for finding the minimum of the objective function along a given
@@ -105,7 +105,7 @@ public class LineSearch {
      * @param startPoint Starting point.
      * @param direction Search direction.
      * @return the optimum.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the number of evaluations is exceeded.
      */
     public UnivariatePointValuePair search(final double[] startPoint,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
index 704c9aa..11ec5df 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizer.java
@@ -14,17 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
 import java.util.Collections;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Comparator;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.optim.BaseMultiStartMultivariateOptimizer;
-import org.apache.commons.math3.optim.PointValuePair;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.optim.BaseMultiStartMultivariateOptimizer;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Multi-start optimizer.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
index 80daace..e2ac975 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapter.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Logit;
-import org.apache.commons.math3.analysis.function.Sigmoid;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Logit;
+import org.apache.commons.math4.analysis.function.Sigmoid;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>Adapter for mapping bounded {@link MultivariateFunction} to unbounded ones.</p>
@@ -52,19 +52,19 @@ import org.apache.commons.math3.util.MathUtils;
  * user is responsible for converting his bounded point to unbounded by calling
  * {@link #boundedToUnbounded(double[])} before providing them to the optimizer.
  * For the same reason, the point returned by the {@link
- * org.apache.commons.math3.optimization.BaseMultivariateOptimizer#optimize(int,
- * MultivariateFunction, org.apache.commons.math3.optimization.GoalType, double[])}
+ * org.apache.commons.math4.optimization.BaseMultivariateOptimizer#optimize(int,
+ * MultivariateFunction, org.apache.commons.math4.optimization.GoalType, double[])}
  * method is unbounded. So to convert this point to bounded, users must call
  * {@link #unboundedToBounded(double[])} by themselves!</p>
  * <p>
  * This adapter is only a poor man solution to simple bounds optimization constraints
  * that can be used with simple optimizers like
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.noderiv.SimplexOptimizer
  * SimplexOptimizer}.
  * A better solution is to use an optimizer that directly supports simple bounds like
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.noderiv.CMAESOptimizer
  * CMAESOptimizer} or
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer
  * BOBYQAOptimizer}.
  * One caveat of this poor-man's solution is that behavior near the bounds may be
  * numerically unstable as bounds are mapped from infinite values.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
index 931f17f..04ca7f5 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapter.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>Adapter extending bounded {@link MultivariateFunction} to an unbouded
@@ -48,12 +48,12 @@ import org.apache.commons.math3.util.MathUtils;
  * <p>
  * This adapter is only a poor-man's solution to simple bounds optimization
  * constraints that can be used with simple optimizers like
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.noderiv.SimplexOptimizer
  * SimplexOptimizer}.
  * A better solution is to use an optimizer that directly supports simple bounds like
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.noderiv.CMAESOptimizer
  * CMAESOptimizer} or
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer
  * BOBYQAOptimizer}.
  * One caveat of this poor-man's solution is that if start point or start simplex
  * is completely outside of the allowed range, only the penalty function is used,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateOptimizer.java
index bc0bec9..bf645f7 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateOptimizer.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optim.BaseMultivariateOptimizer;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.BaseMultivariateOptimizer;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
 
 /**
  * Base class for a multivariate scalar function optimizer.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunction.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunction.java
index 643cc03..70b7481 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunction.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Scalar function to be optimized.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunctionGradient.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunctionGradient.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunctionGradient.java
index 2fcf2ee..d6807f4 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunctionGradient.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/ObjectiveFunctionGradient.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Gradient of the scalar function to be optimized.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
index 3e6fa89..4d4e2ce 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizer.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.gradient;
-
-import org.apache.commons.math3.analysis.solvers.UnivariateSolver;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.nonlinear.scalar.GradientMultivariateOptimizer;
-import org.apache.commons.math3.optim.nonlinear.scalar.LineSearch;
+package org.apache.commons.math4.optim.nonlinear.scalar.gradient;
+
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.GradientMultivariateOptimizer;
+import org.apache.commons.math4.optim.nonlinear.scalar.LineSearch;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/Preconditioner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/Preconditioner.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/Preconditioner.java
index 3c0f8fb..b9de44d 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/Preconditioner.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/Preconditioner.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.gradient;
+package org.apache.commons.math4.optim.nonlinear.scalar.gradient;
 
 /**
  * This interface represents a preconditioner for differentiable scalar

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/package-info.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/package-info.java
index 9dd9c5a..7d8bfed 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/package-info.java
@@ -18,4 +18,4 @@
 /**
  * This package provides optimization algorithms that require derivatives.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.gradient;
+package org.apache.commons.math4.optim.nonlinear.scalar.gradient;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/AbstractSimplex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/AbstractSimplex.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/AbstractSimplex.java
index e959787..45da036 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/AbstractSimplex.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/AbstractSimplex.java
@@ -15,21 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
 
 /**
  * This class implements the simplex concept.
@@ -199,7 +199,7 @@ public abstract class AbstractSimplex implements OptimizationData {
      * @param evaluationFunction Evaluation function.
      * @param comparator Comparator to use to sort simplex vertices from best
      * to worst.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the algorithm fails to converge.
      */
     public abstract void iterate(final MultivariateFunction evaluationFunction,
@@ -237,7 +237,7 @@ public abstract class AbstractSimplex implements OptimizationData {
      *
      * @param evaluationFunction Evaluation function.
      * @param comparator Comparator to use to sort simplex vertices from best to worst.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
      */
     public void evaluate(final MultivariateFunction evaluationFunction,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizer.java
index 5d3d229..e8487b0 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizer.java
@@ -15,19 +15,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
-
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
+
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateOptimizer;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Powell's BOBYQA algorithm. This implementation is translated and

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java
index 82cc748..bc1e41e 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizer.java
@@ -15,29 +15,29 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateOptimizer;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * An implementation of the active Covariance Matrix Adaptation Evolution Strategy (CMA-ES)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/MultiDirectionalSimplex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/MultiDirectionalSimplex.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/MultiDirectionalSimplex.java
index 7ee3acf..804fe77 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/MultiDirectionalSimplex.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/MultiDirectionalSimplex.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optim.PointValuePair;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optim.PointValuePair;
 
 /**
  * This class implements the multi-directional direct search method.
@@ -135,9 +135,9 @@ public class MultiDirectionalSimplex extends AbstractSimplex {
      * {@link AbstractSimplex#AbstractSimplex(double[][])}.
      * @param khi Expansion coefficient.
      * @param gamma Contraction coefficient.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if the reference simplex does not contain at least one point.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if there is a dimension mismatch in the reference simplex.
      */
     public MultiDirectionalSimplex(final double[][] referenceSimplex,
@@ -186,7 +186,7 @@ public class MultiDirectionalSimplex extends AbstractSimplex {
      * @param comparator Comparator to use to sort simplex vertices from best
      * to poorest.
      * @return the best point in the transformed simplex.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
      */
     private PointValuePair evaluateNewSimplex(final MultivariateFunction evaluationFunction,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/NelderMeadSimplex.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/NelderMeadSimplex.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/NelderMeadSimplex.java
index f7015ed..4bfc2d3 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/NelderMeadSimplex.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/NelderMeadSimplex.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
 import java.util.Comparator;
 
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optim.PointValuePair;
 
 /**
  * This class implements the Nelder-Mead simplex algorithm.
@@ -164,9 +164,9 @@ public class NelderMeadSimplex extends AbstractSimplex {
      * @param khi Expansion coefficient.
      * @param gamma Contraction coefficient.
      * @param sigma Shrinkage coefficient.
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if the reference simplex does not contain at least one point.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if there is a dimension mismatch in the reference simplex.
      */
     public NelderMeadSimplex(final double[][] referenceSimplex,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizer.java
index afa8426..90d81de 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizer.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer;
-import org.apache.commons.math3.optim.nonlinear.scalar.LineSearch;
-import org.apache.commons.math3.optim.univariate.UnivariatePointValuePair;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.LineSearch;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateOptimizer;
+import org.apache.commons.math4.optim.univariate.UnivariatePointValuePair;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Powell's algorithm.
@@ -47,9 +47,9 @@ import org.apache.commons.math3.optim.univariate.UnivariatePointValuePair;
  * {@link MathUnsupportedOperationException} if bounds are passed to it.
  * In order to impose simple constraints, the objective function must be
  * wrapped in an adapter like
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.MultivariateFunctionMappingAdapter
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.MultivariateFunctionMappingAdapter
  * MultivariateFunctionMappingAdapter} or
- * {@link org.apache.commons.math3.optim.nonlinear.scalar.MultivariateFunctionPenaltyAdapter
+ * {@link org.apache.commons.math4.optim.nonlinear.scalar.MultivariateFunctionPenaltyAdapter
  * MultivariateFunctionPenaltyAdapter}.
  *
  * @since 2.2

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
index 3b44358..f6eee2f 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizer.java
@@ -14,19 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
 import java.util.Comparator;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.SimpleValueChecker;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleValueChecker;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateOptimizer;
 
 /**
  * This class implements simplex-based direct search optimization.
@@ -74,9 +75,9 @@ import org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer;
  *  dedicated algorithm must be used like
  *  {@link CMAESOptimizer} or {@link BOBYQAOptimizer}, or the objective
  *  function must be wrapped in an adapter like
- *  {@link org.apache.commons.math3.optim.nonlinear.scalar.MultivariateFunctionMappingAdapter
+ *  {@link org.apache.commons.math4.optim.nonlinear.scalar.MultivariateFunctionMappingAdapter
  *  MultivariateFunctionMappingAdapter} or
- *  {@link org.apache.commons.math3.optim.nonlinear.scalar.MultivariateFunctionPenaltyAdapter
+ *  {@link org.apache.commons.math4.optim.nonlinear.scalar.MultivariateFunctionPenaltyAdapter
  *  MultivariateFunctionPenaltyAdapter}.
  *  <br/>
  *  The call to {@link #optimize(OptimizationData[]) optimize} will throw

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/package-info.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/package-info.java
index 4afeb50..0796162 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/package-info.java
@@ -18,4 +18,4 @@
 /**
  * This package provides optimization algorithms that do not require derivatives.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/package-info.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/package-info.java
index d65533a..1653b4e 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/package-info.java
@@ -18,4 +18,4 @@
 /**
  * Algorithms for optimizing a scalar function.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java
index 52372c8..da9ad86 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/JacobianMultivariateVectorOptimizer.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;
 
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointVectorValuePair;
 
 /**
  * Base class for implementing optimizers for multivariate vector
@@ -31,12 +31,12 @@ import org.apache.commons.math3.exception.DimensionMismatchException;
  * functions while the columns iterate on the parameters; thus, the numbers
  * of rows is equal to the dimension of the {@link Target} while the
  * number of columns is equal to the dimension of the
- * {@link org.apache.commons.math3.optim.InitialGuess InitialGuess}.
+ * {@link org.apache.commons.math4.optim.InitialGuess InitialGuess}.
  *
  * @since 3.1
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java
index 73de7d6..b371f13 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Model (vector) function to be optimized.
@@ -25,7 +25,7 @@ import org.apache.commons.math3.optim.OptimizationData;
  * @since 3.1
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java
index 72ea4ae..69f7860 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/ModelFunctionJacobian.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;
 
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Jacobian of the model (vector) function to be optimized.
@@ -25,7 +25,7 @@ import org.apache.commons.math3.optim.OptimizationData;
  * @since 3.1
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java
index 1095057..2b17932 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizer.java
@@ -14,20 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;
 
 import java.util.Collections;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Comparator;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.optim.BaseMultiStartMultivariateOptimizer;
-import org.apache.commons.math3.optim.PointVectorValuePair;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.BaseMultiStartMultivariateOptimizer;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Multi-start optimizer for a (vector) model function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java
index c79defa..8485ef3 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/MultivariateVectorOptimizer.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;
 
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.BaseMultivariateOptimizer;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.BaseMultivariateOptimizer;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointVectorValuePair;
 
 /**
  * Base class for a multivariate vector function optimizer.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java
index cd387d5..2937888 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Target.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;
 
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Target of the optimization procedure.
@@ -28,7 +28,7 @@ import org.apache.commons.math3.optim.OptimizationData;
  * @since 3.1
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java
index 4d51cd7..a723ae2 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/Weight.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;
 
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Weight matrix of the residuals between model and observations.
@@ -29,7 +29,7 @@ import org.apache.commons.math3.linear.NonSquareMatrixException;
  * @since 3.1
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java
index 67682eb..6c4a2d9 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizer.java
@@ -14,23 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.DecompositionSolver;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
-import org.apache.commons.math3.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Base class for implementing least-squares optimizers.
@@ -39,7 +39,7 @@ import org.apache.commons.math3.util.FastMath;
  * @since 3.1
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated
@@ -137,7 +137,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * @param params Model parameters.
      * @param threshold Singularity threshold.
      * @return the covariance matrix.
-     * @throws org.apache.commons.math3.linear.SingularMatrixException
+     * @throws org.apache.commons.math4.linear.SingularMatrixException
      * if the covariance matrix cannot be computed (singular problem).
      */
     public double[][] computeCovariances(double[] params,
@@ -165,7 +165,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * @param covarianceSingularityThreshold Singularity threshold (see
      * {@link #computeCovariances(double[],double) computeCovariances}).
      * @return an estimate of the standard deviation of the optimized parameters
-     * @throws org.apache.commons.math3.linear.SingularMatrixException
+     * @throws org.apache.commons.math4.linear.SingularMatrixException
      * if the covariance matrix cannot be computed.
      */
     public double[] computeSigma(double[] params,
@@ -186,7 +186,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * {@link JacobianMultivariateVectorOptimizer#parseOptimizationData(OptimizationData[])
      * JacobianMultivariateVectorOptimizer}, this method will register the following data:
      * <ul>
-     *  <li>{@link org.apache.commons.math3.optim.nonlinear.vector.Weight}</li>
+     *  <li>{@link org.apache.commons.math4.optim.nonlinear.vector.Weight}</li>
      * </ul>
      * @return {@inheritDoc}
      * @throws TooManyEvaluationsException if the maximal number of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java
index 0668475..34fb988 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizer.java
@@ -14,22 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.DecompositionSolver;
-import org.apache.commons.math3.linear.LUDecomposition;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.PointVectorValuePair;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
+
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.PointVectorValuePair;
 
 /**
  * Gauss-Newton least-squares solver.
@@ -48,7 +48,7 @@ import org.apache.commons.math3.optim.PointVectorValuePair;
  * @since 2.0
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java
index 05be0d0..b0a2ca3 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizer.java
@@ -14,17 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.util.Arrays;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
+
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 
 /**
@@ -110,7 +111,7 @@ import org.apache.commons.math3.util.FastMath;
  * @since 2.0
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java
index 4c844ba..ab06a53 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/package-info.java
@@ -20,7 +20,7 @@
  *
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java
index 439fc3c..91ac3ff 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/vector/package-info.java
@@ -20,7 +20,7 @@
  *
  * @deprecated All classes and interfaces in this package are deprecated.
  * The optimizers that were provided here were moved to the
- * {@link org.apache.commons.math3.fitting.leastsquares} package
+ * {@link org.apache.commons.math4.fitting.leastsquares} package
  * (cf. MATH-1008).
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
+package org.apache.commons.math4.optim.nonlinear.vector;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/package-info.java b/src/main/java/org/apache/commons/math4/optim/package-info.java
index b6c9fd7..f49f3f9 100644
--- a/src/main/java/org/apache/commons/math4/optim/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/package-info.java
@@ -18,52 +18,52 @@
 /**
  * <p>
  *  Generally, optimizers are algorithms that will either
- *  {@link org.apache.commons.math3.optim.nonlinear.scalar.GoalType#MINIMIZE minimize} or
- *  {@link org.apache.commons.math3.optim.nonlinear.scalar.GoalType#MAXIMIZE maximize}
+ *  {@link org.apache.commons.math4.optim.nonlinear.scalar.GoalType#MINIMIZE minimize} or
+ *  {@link org.apache.commons.math4.optim.nonlinear.scalar.GoalType#MAXIMIZE maximize}
  *  a scalar function, called the
- *  {@link org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction <em>objective
+ *  {@link org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction <em>objective
  *  function</em>}.
  *  <br/>
  *  For some scalar objective functions the gradient can be computed (analytically
  *  or numerically). Algorithms that use this knowledge are defined in the
- *  {@link org.apache.commons.math3.optim.nonlinear.scalar.gradient} package.
+ *  {@link org.apache.commons.math4.optim.nonlinear.scalar.gradient} package.
  *  The algorithms that do not need this additional information are located in
- *  the {@link org.apache.commons.math3.optim.nonlinear.scalar.noderiv} package.
+ *  the {@link org.apache.commons.math4.optim.nonlinear.scalar.noderiv} package.
  * </p>
  *
  * <p>
  *  Some problems are solved more efficiently by algorithms that, instead of an
  *  objective function, need access to a
- *  {@link org.apache.commons.math3.optim.nonlinear.vector.ModelFunction
+ *  {@link org.apache.commons.math4.optim.nonlinear.vector.ModelFunction
  *  <em>model function</em>}: such a model predicts a set of values which the
  *  algorithm tries to match with a set of given
- *  {@link org.apache.commons.math3.optim.nonlinear.vector.Target target values}.
+ *  {@link org.apache.commons.math4.optim.nonlinear.vector.Target target values}.
  *  Those algorithms are located in the
- *  {@link org.apache.commons.math3.optim.nonlinear.vector} package.
+ *  {@link org.apache.commons.math4.optim.nonlinear.vector} package.
  *  <br/>
  *  Algorithms that also require the
- *  {@link org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian
+ *  {@link org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian
  *  Jacobian matrix of the model} are located in the
- *  {@link org.apache.commons.math3.optim.nonlinear.vector.jacobian} package.
+ *  {@link org.apache.commons.math4.optim.nonlinear.vector.jacobian} package.
  *  <br/>
- *  The {@link org.apache.commons.math3.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer
+ *  The {@link org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer
  *  non-linear least-squares optimizers} are a specialization of the the latter,
  *  that minimize the distance (called <em>cost</em> or <em>&chi;<sup>2</sup></em>)
  *  between model and observations.
  *  <br/>
  *  For cases where the Jacobian cannot be provided, a utility class will
- *  {@link org.apache.commons.math3.optim.nonlinear.scalar.LeastSquaresConverter
+ *  {@link org.apache.commons.math4.optim.nonlinear.scalar.LeastSquaresConverter
  *  convert} a (vector) model into a (scalar) objective function.
  * </p>
  *
  * <p>
  *  This package provides common functionality for the optimization algorithms.
- *  Abstract classes ({@link org.apache.commons.math3.optim.BaseOptimizer} and
- *  {@link org.apache.commons.math3.optim.BaseMultivariateOptimizer}) contain
- *  boiler-plate code for storing {@link org.apache.commons.math3.optim.MaxEval
- *  evaluations} and {@link org.apache.commons.math3.optim.MaxIter iterations}
+ *  Abstract classes ({@link org.apache.commons.math4.optim.BaseOptimizer} and
+ *  {@link org.apache.commons.math4.optim.BaseMultivariateOptimizer}) contain
+ *  boiler-plate code for storing {@link org.apache.commons.math4.optim.MaxEval
+ *  evaluations} and {@link org.apache.commons.math4.optim.MaxIter iterations}
  *  counters and a user-defined
- *  {@link org.apache.commons.math3.optim.ConvergenceChecker convergence checker}.
+ *  {@link org.apache.commons.math4.optim.ConvergenceChecker convergence checker}.
  * </p>
  *
  * <p>
@@ -74,4 +74,4 @@
  *  This could be useful to avoid being trapped in a local extremum.
  * </p>
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/BracketFinder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/BracketFinder.java b/src/main/java/org/apache/commons/math4/optim/univariate/BracketFinder.java
index 2653c12..cf05237 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/BracketFinder.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/BracketFinder.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Provide an interval that brackets a local optimum of a function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java b/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
index d783405..420a919 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/BrentOptimizer.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * For a function defined on some interval {@code (lo, hi)}, this class

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
index 07e7daf..cbfa268 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizer.java
@@ -15,17 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
 import java.util.Arrays;
 import java.util.Comparator;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.OptimizationData;
+
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * Special implementation of the {@link UnivariateOptimizer} interface

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/SearchInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/SearchInterval.java b/src/main/java/org/apache/commons/math4/optim/univariate/SearchInterval.java
index fa80e64..172cf80 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/SearchInterval.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/SearchInterval.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Search interval and (optional) start value.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueChecker.java b/src/main/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueChecker.java
index 58cc521..935e74b 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueChecker.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueChecker.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.optim.AbstractConvergenceChecker;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optim.AbstractConvergenceChecker;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Simple implementation of the
- * {@link org.apache.commons.math3.optimization.ConvergenceChecker} interface
+ * {@link org.apache.commons.math4.optimization.ConvergenceChecker} interface
  * that uses only objective function values.
  *
  * Convergence is considered to have been reached if either the relative

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateObjectiveFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateObjectiveFunction.java b/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateObjectiveFunction.java
index ad06d84..8190481 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateObjectiveFunction.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateObjectiveFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Scalar function to be optimized.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateOptimizer.java
index a7512c1..99e1cc4 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/UnivariateOptimizer.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optim.BaseOptimizer;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.BaseOptimizer;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
 
 /**
  * Base class for a univariate scalar function optimizer.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/UnivariatePointValuePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/UnivariatePointValuePair.java b/src/main/java/org/apache/commons/math4/optim/univariate/UnivariatePointValuePair.java
index 6b2b51a..2a02a86 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/UnivariatePointValuePair.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/UnivariatePointValuePair.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/univariate/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/univariate/package-info.java b/src/main/java/org/apache/commons/math4/optim/univariate/package-info.java
index 2273bab..de322c3 100644
--- a/src/main/java/org/apache/commons/math4/optim/univariate/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/univariate/package-info.java
@@ -18,4 +18,4 @@
 /**
  * One-dimensional optimization algorithms.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java b/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java
index 09cb1db..9f57533 100644
--- a/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java
+++ b/src/main/java/org/apache/commons/math4/optimization/AbstractConvergenceChecker.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Base class for all convergence checker implementations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java
index 53c2a7a..59b8277 100644
--- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateMultiStartOptimizer.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Base class for all implementations of a multi-start optimizer.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java
index 5120ec7..ce156a0 100644
--- a/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/BaseMultivariateOptimizer.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateFunction;
 
 /**
  * This interface is mainly intended to enforce the internal coherence of
  * Commons-FastMath. Users of the API are advised to base their code on
  * the following interfaces:
  * <ul>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer}</li>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateDifferentiableOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer}</li>
  * </ul>
  *
  * @param <FUNC> Type of the objective function to be optimized.
@@ -46,14 +46,14 @@ public interface BaseMultivariateOptimizer<FUNC extends MultivariateFunction>
      * @param maxEval Maximum number of function evaluations.
      * @return the point/value pair giving the optimal value for objective
      * function.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if
+     * @throws org.apache.commons.math4.exception.NullArgumentException if
      * any argument is {@code null}.
      * @deprecated As of 3.1. In 4.0, it will be replaced by the declaration
-     * corresponding to this {@link org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateOptimizer#optimize(int,MultivariateFunction,GoalType,OptimizationData[]) method}.
+     * corresponding to this {@link org.apache.commons.math4.optimization.direct.BaseAbstractMultivariateOptimizer#optimize(int,MultivariateFunction,GoalType,OptimizationData[]) method}.
      */
     @Deprecated
     PointValuePair optimize(int maxEval, FUNC f, GoalType goalType,


[43/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java
deleted file mode 100644
index 522c2a5..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolatingFunction.java
+++ /dev/null
@@ -1,637 +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.analysis.interpolation;
-
-import java.util.Arrays;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Function that implements the
- * <a href="http://en.wikipedia.org/wiki/Bicubic_interpolation">
- * bicubic spline interpolation</a>. Due to numerical accuracy issues this should not
- * be used.
- *
- * @since 2.1
- * @deprecated as of 3.4 replaced by
- * {@link org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction}
- */
-@Deprecated
-public class BicubicSplineInterpolatingFunction
-    implements BivariateFunction {
-    /** Number of coefficients. */
-    private static final int NUM_COEFF = 16;
-    /**
-     * Matrix to compute the spline coefficients from the function values
-     * and function derivatives values
-     */
-    private static final double[][] AINV = {
-        { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 },
-        { -3,3,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0 },
-        { 2,-2,0,0,1,1,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-3,3,0,0,-2,-1,0,0 },
-        { 0,0,0,0,0,0,0,0,2,-2,0,0,1,1,0,0 },
-        { -3,0,3,0,0,0,0,0,-2,0,-1,0,0,0,0,0 },
-        { 0,0,0,0,-3,0,3,0,0,0,0,0,-2,0,-1,0 },
-        { 9,-9,-9,9,6,3,-6,-3,6,-6,3,-3,4,2,2,1 },
-        { -6,6,6,-6,-3,-3,3,3,-4,4,-2,2,-2,-2,-1,-1 },
-        { 2,0,-2,0,0,0,0,0,1,0,1,0,0,0,0,0 },
-        { 0,0,0,0,2,0,-2,0,0,0,0,0,1,0,1,0 },
-        { -6,6,6,-6,-4,-2,4,2,-3,3,-3,3,-2,-1,-2,-1 },
-        { 4,-4,-4,4,2,2,-2,-2,2,-2,2,-2,1,1,1,1 }
-    };
-
-    /** Samples x-coordinates */
-    private final double[] xval;
-    /** Samples y-coordinates */
-    private final double[] yval;
-    /** Set of cubic splines patching the whole data grid */
-    private final BicubicSplineFunction[][] splines;
-    /**
-     * Partial derivatives.
-     * The value of the first index determines the kind of derivatives:
-     * 0 = first partial derivatives wrt x
-     * 1 = first partial derivatives wrt y
-     * 2 = second partial derivatives wrt x
-     * 3 = second partial derivatives wrt y
-     * 4 = cross partial derivatives
-     */
-    private final BivariateFunction[][][] partialDerivatives;
-
-    /**
-     * @param x Sample values of the x-coordinate, in increasing order.
-     * @param y Sample values of the y-coordinate, in increasing order.
-     * @param f Values of the function on every grid point.
-     * @param dFdX Values of the partial derivative of function with respect
-     * to x on every grid point.
-     * @param dFdY Values of the partial derivative of function with respect
-     * to y on every grid point.
-     * @param d2FdXdY Values of the cross partial derivative of function on
-     * every grid point.
-     * @throws DimensionMismatchException if the various arrays do not contain
-     * the expected number of elements.
-     * @throws NonMonotonicSequenceException if {@code x} or {@code y} are
-     * not strictly increasing.
-     * @throws NoDataException if any of the arrays has zero length.
-     */
-    public BicubicSplineInterpolatingFunction(double[] x,
-                                              double[] y,
-                                              double[][] f,
-                                              double[][] dFdX,
-                                              double[][] dFdY,
-                                              double[][] d2FdXdY)
-        throws DimensionMismatchException,
-               NoDataException,
-               NonMonotonicSequenceException {
-        this(x, y, f, dFdX, dFdY, d2FdXdY, false);
-    }
-
-    /**
-     * @param x Sample values of the x-coordinate, in increasing order.
-     * @param y Sample values of the y-coordinate, in increasing order.
-     * @param f Values of the function on every grid point.
-     * @param dFdX Values of the partial derivative of function with respect
-     * to x on every grid point.
-     * @param dFdY Values of the partial derivative of function with respect
-     * to y on every grid point.
-     * @param d2FdXdY Values of the cross partial derivative of function on
-     * every grid point.
-     * @param initializeDerivatives Whether to initialize the internal data
-     * needed for calling any of the methods that compute the partial derivatives
-     * this function.
-     * @throws DimensionMismatchException if the various arrays do not contain
-     * the expected number of elements.
-     * @throws NonMonotonicSequenceException if {@code x} or {@code y} are
-     * not strictly increasing.
-     * @throws NoDataException if any of the arrays has zero length.
-     *
-     * @see #partialDerivativeX(double,double)
-     * @see #partialDerivativeY(double,double)
-     * @see #partialDerivativeXX(double,double)
-     * @see #partialDerivativeYY(double,double)
-     * @see #partialDerivativeXY(double,double)
-     */
-    public BicubicSplineInterpolatingFunction(double[] x,
-                                              double[] y,
-                                              double[][] f,
-                                              double[][] dFdX,
-                                              double[][] dFdY,
-                                              double[][] d2FdXdY,
-                                              boolean initializeDerivatives)
-        throws DimensionMismatchException,
-               NoDataException,
-               NonMonotonicSequenceException {
-        final int xLen = x.length;
-        final int yLen = y.length;
-
-        if (xLen == 0 || yLen == 0 || f.length == 0 || f[0].length == 0) {
-            throw new NoDataException();
-        }
-        if (xLen != f.length) {
-            throw new DimensionMismatchException(xLen, f.length);
-        }
-        if (xLen != dFdX.length) {
-            throw new DimensionMismatchException(xLen, dFdX.length);
-        }
-        if (xLen != dFdY.length) {
-            throw new DimensionMismatchException(xLen, dFdY.length);
-        }
-        if (xLen != d2FdXdY.length) {
-            throw new DimensionMismatchException(xLen, d2FdXdY.length);
-        }
-
-        MathArrays.checkOrder(x);
-        MathArrays.checkOrder(y);
-
-        xval = x.clone();
-        yval = y.clone();
-
-        final int lastI = xLen - 1;
-        final int lastJ = yLen - 1;
-        splines = new BicubicSplineFunction[lastI][lastJ];
-
-        for (int i = 0; i < lastI; i++) {
-            if (f[i].length != yLen) {
-                throw new DimensionMismatchException(f[i].length, yLen);
-            }
-            if (dFdX[i].length != yLen) {
-                throw new DimensionMismatchException(dFdX[i].length, yLen);
-            }
-            if (dFdY[i].length != yLen) {
-                throw new DimensionMismatchException(dFdY[i].length, yLen);
-            }
-            if (d2FdXdY[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdXdY[i].length, yLen);
-            }
-            final int ip1 = i + 1;
-            for (int j = 0; j < lastJ; j++) {
-                final int jp1 = j + 1;
-                final double[] beta = new double[] {
-                    f[i][j], f[ip1][j], f[i][jp1], f[ip1][jp1],
-                    dFdX[i][j], dFdX[ip1][j], dFdX[i][jp1], dFdX[ip1][jp1],
-                    dFdY[i][j], dFdY[ip1][j], dFdY[i][jp1], dFdY[ip1][jp1],
-                    d2FdXdY[i][j], d2FdXdY[ip1][j], d2FdXdY[i][jp1], d2FdXdY[ip1][jp1]
-                };
-
-                splines[i][j] = new BicubicSplineFunction(computeSplineCoefficients(beta),
-                                                          initializeDerivatives);
-            }
-        }
-
-        if (initializeDerivatives) {
-            // Compute all partial derivatives.
-            partialDerivatives = new BivariateFunction[5][lastI][lastJ];
-
-            for (int i = 0; i < lastI; i++) {
-                for (int j = 0; j < lastJ; j++) {
-                    final BicubicSplineFunction bcs = splines[i][j];
-                    partialDerivatives[0][i][j] = bcs.partialDerivativeX();
-                    partialDerivatives[1][i][j] = bcs.partialDerivativeY();
-                    partialDerivatives[2][i][j] = bcs.partialDerivativeXX();
-                    partialDerivatives[3][i][j] = bcs.partialDerivativeYY();
-                    partialDerivatives[4][i][j] = bcs.partialDerivativeXY();
-                }
-            }
-        } else {
-            // Partial derivative methods cannot be used.
-            partialDerivatives = null;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double value(double x, double y)
-        throws OutOfRangeException {
-        final int i = searchIndex(x, xval);
-        final int j = searchIndex(y, yval);
-
-        final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]);
-        final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]);
-
-        return splines[i][j].value(xN, yN);
-    }
-
-    /**
-     * Indicates whether a point is within the interpolation range.
-     *
-     * @param x First coordinate.
-     * @param y Second coordinate.
-     * @return {@code true} if (x, y) is a valid point.
-     * @since 3.3
-     */
-    public boolean isValidPoint(double x, double y) {
-        if (x < xval[0] ||
-            x > xval[xval.length - 1] ||
-            y < yval[0] ||
-            y > yval[yval.length - 1]) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * @param x x-coordinate.
-     * @param y y-coordinate.
-     * @return the value at point (x, y) of the first partial derivative with
-     * respect to x.
-     * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
-     * the range defined by the boundary values of {@code xval} (resp.
-     * {@code yval}).
-     * @throws NullPointerException if the internal data were not initialized
-     * (cf. {@link #BicubicSplineInterpolatingFunction(double[],double[],double[][],
-     *             double[][],double[][],double[][],boolean) constructor}).
-     */
-    public double partialDerivativeX(double x, double y)
-        throws OutOfRangeException {
-        return partialDerivative(0, x, y);
-    }
-    /**
-     * @param x x-coordinate.
-     * @param y y-coordinate.
-     * @return the value at point (x, y) of the first partial derivative with
-     * respect to y.
-     * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
-     * the range defined by the boundary values of {@code xval} (resp.
-     * {@code yval}).
-     * @throws NullPointerException if the internal data were not initialized
-     * (cf. {@link #BicubicSplineInterpolatingFunction(double[],double[],double[][],
-     *             double[][],double[][],double[][],boolean) constructor}).
-     */
-    public double partialDerivativeY(double x, double y)
-        throws OutOfRangeException {
-        return partialDerivative(1, x, y);
-    }
-    /**
-     * @param x x-coordinate.
-     * @param y y-coordinate.
-     * @return the value at point (x, y) of the second partial derivative with
-     * respect to x.
-     * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
-     * the range defined by the boundary values of {@code xval} (resp.
-     * {@code yval}).
-     * @throws NullPointerException if the internal data were not initialized
-     * (cf. {@link #BicubicSplineInterpolatingFunction(double[],double[],double[][],
-     *             double[][],double[][],double[][],boolean) constructor}).
-     */
-    public double partialDerivativeXX(double x, double y)
-        throws OutOfRangeException {
-        return partialDerivative(2, x, y);
-    }
-    /**
-     * @param x x-coordinate.
-     * @param y y-coordinate.
-     * @return the value at point (x, y) of the second partial derivative with
-     * respect to y.
-     * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
-     * the range defined by the boundary values of {@code xval} (resp.
-     * {@code yval}).
-     * @throws NullPointerException if the internal data were not initialized
-     * (cf. {@link #BicubicSplineInterpolatingFunction(double[],double[],double[][],
-     *             double[][],double[][],double[][],boolean) constructor}).
-     */
-    public double partialDerivativeYY(double x, double y)
-        throws OutOfRangeException {
-        return partialDerivative(3, x, y);
-    }
-    /**
-     * @param x x-coordinate.
-     * @param y y-coordinate.
-     * @return the value at point (x, y) of the second partial cross-derivative.
-     * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
-     * the range defined by the boundary values of {@code xval} (resp.
-     * {@code yval}).
-     * @throws NullPointerException if the internal data were not initialized
-     * (cf. {@link #BicubicSplineInterpolatingFunction(double[],double[],double[][],
-     *             double[][],double[][],double[][],boolean) constructor}).
-     */
-    public double partialDerivativeXY(double x, double y)
-        throws OutOfRangeException {
-        return partialDerivative(4, x, y);
-    }
-
-    /**
-     * @param which First index in {@link #partialDerivatives}.
-     * @param x x-coordinate.
-     * @param y y-coordinate.
-     * @return the value at point (x, y) of the selected partial derivative.
-     * @throws OutOfRangeException if {@code x} (resp. {@code y}) is outside
-     * the range defined by the boundary values of {@code xval} (resp.
-     * {@code yval}).
-     * @throws NullPointerException if the internal data were not initialized
-     * (cf. {@link #BicubicSplineInterpolatingFunction(double[],double[],double[][],
-     *             double[][],double[][],double[][],boolean) constructor}).
-     */
-    private double partialDerivative(int which, double x, double y)
-        throws OutOfRangeException {
-        final int i = searchIndex(x, xval);
-        final int j = searchIndex(y, yval);
-
-        final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]);
-        final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]);
-
-        return partialDerivatives[which][i][j].value(xN, yN);
-    }
-
-    /**
-     * @param c Coordinate.
-     * @param val Coordinate samples.
-     * @return the index in {@code val} corresponding to the interval
-     * containing {@code c}.
-     * @throws OutOfRangeException if {@code c} is out of the
-     * range defined by the boundary values of {@code val}.
-     */
-    private int searchIndex(double c, double[] val) {
-        final int r = Arrays.binarySearch(val, c);
-
-        if (r == -1 ||
-            r == -val.length - 1) {
-            throw new OutOfRangeException(c, val[0], val[val.length - 1]);
-        }
-
-        if (r < 0) {
-            // "c" in within an interpolation sub-interval: Return the
-            // index of the sample at the lower end of the sub-interval.
-            return -r - 2;
-        }
-        final int last = val.length - 1;
-        if (r == last) {
-            // "c" is the last sample of the range: Return the index
-            // of the sample at the lower end of the last sub-interval.
-            return last - 1;
-        }
-
-        // "c" is another sample point.
-        return r;
-    }
-
-    /**
-     * Compute the spline coefficients from the list of function values and
-     * function partial derivatives values at the four corners of a grid
-     * element. They must be specified in the following order:
-     * <ul>
-     *  <li>f(0,0)</li>
-     *  <li>f(1,0)</li>
-     *  <li>f(0,1)</li>
-     *  <li>f(1,1)</li>
-     *  <li>f<sub>x</sub>(0,0)</li>
-     *  <li>f<sub>x</sub>(1,0)</li>
-     *  <li>f<sub>x</sub>(0,1)</li>
-     *  <li>f<sub>x</sub>(1,1)</li>
-     *  <li>f<sub>y</sub>(0,0)</li>
-     *  <li>f<sub>y</sub>(1,0)</li>
-     *  <li>f<sub>y</sub>(0,1)</li>
-     *  <li>f<sub>y</sub>(1,1)</li>
-     *  <li>f<sub>xy</sub>(0,0)</li>
-     *  <li>f<sub>xy</sub>(1,0)</li>
-     *  <li>f<sub>xy</sub>(0,1)</li>
-     *  <li>f<sub>xy</sub>(1,1)</li>
-     * </ul>
-     * where the subscripts indicate the partial derivative with respect to
-     * the corresponding variable(s).
-     *
-     * @param beta List of function values and function partial derivatives
-     * values.
-     * @return the spline coefficients.
-     */
-    private double[] computeSplineCoefficients(double[] beta) {
-        final double[] a = new double[NUM_COEFF];
-
-        for (int i = 0; i < NUM_COEFF; i++) {
-            double result = 0;
-            final double[] row = AINV[i];
-            for (int j = 0; j < NUM_COEFF; j++) {
-                result += row[j] * beta[j];
-            }
-            a[i] = result;
-        }
-
-        return a;
-    }
-}
-
-/**
- * 2D-spline function.
- *
- */
-class BicubicSplineFunction implements BivariateFunction {
-    /** Number of points. */
-    private static final short N = 4;
-    /** Coefficients */
-    private final double[][] a;
-    /** First partial derivative along x. */
-    private final BivariateFunction partialDerivativeX;
-    /** First partial derivative along y. */
-    private final BivariateFunction partialDerivativeY;
-    /** Second partial derivative along x. */
-    private final BivariateFunction partialDerivativeXX;
-    /** Second partial derivative along y. */
-    private final BivariateFunction partialDerivativeYY;
-    /** Second crossed partial derivative. */
-    private final BivariateFunction partialDerivativeXY;
-
-    /**
-     * Simple constructor.
-     *
-     * @param coeff Spline coefficients.
-     */
-    public BicubicSplineFunction(double[] coeff) {
-        this(coeff, false);
-    }
-
-    /**
-     * Simple constructor.
-     *
-     * @param coeff Spline coefficients.
-     * @param initializeDerivatives Whether to initialize the internal data
-     * needed for calling any of the methods that compute the partial derivatives
-     * this function.
-     */
-    public BicubicSplineFunction(double[] coeff,
-                                 boolean initializeDerivatives) {
-        a = new double[N][N];
-        for (int i = 0; i < N; i++) {
-            for (int j = 0; j < N; j++) {
-                a[i][j] = coeff[i * N + j];
-            }
-        }
-
-        if (initializeDerivatives) {
-            // Compute all partial derivatives functions.
-            final double[][] aX = new double[N][N];
-            final double[][] aY = new double[N][N];
-            final double[][] aXX = new double[N][N];
-            final double[][] aYY = new double[N][N];
-            final double[][] aXY = new double[N][N];
-
-            for (int i = 0; i < N; i++) {
-                for (int j = 0; j < N; j++) {
-                    final double c = a[i][j];
-                    aX[i][j] = i * c;
-                    aY[i][j] = j * c;
-                    aXX[i][j] = (i - 1) * aX[i][j];
-                    aYY[i][j] = (j - 1) * aY[i][j];
-                    aXY[i][j] = j * aX[i][j];
-                }
-            }
-
-            partialDerivativeX = new BivariateFunction() {
-                    public double value(double x, double y)  {
-                        final double x2 = x * x;
-                        final double[] pX = {0, 1, x, x2};
-
-                        final double y2 = y * y;
-                        final double y3 = y2 * y;
-                        final double[] pY = {1, y, y2, y3};
-
-                        return apply(pX, pY, aX);
-                    }
-                };
-            partialDerivativeY = new BivariateFunction() {
-                    public double value(double x, double y)  {
-                        final double x2 = x * x;
-                        final double x3 = x2 * x;
-                        final double[] pX = {1, x, x2, x3};
-
-                        final double y2 = y * y;
-                        final double[] pY = {0, 1, y, y2};
-
-                        return apply(pX, pY, aY);
-                    }
-                };
-            partialDerivativeXX = new BivariateFunction() {
-                    public double value(double x, double y)  {
-                        final double[] pX = {0, 0, 1, x};
-
-                        final double y2 = y * y;
-                        final double y3 = y2 * y;
-                        final double[] pY = {1, y, y2, y3};
-
-                        return apply(pX, pY, aXX);
-                    }
-                };
-            partialDerivativeYY = new BivariateFunction() {
-                    public double value(double x, double y)  {
-                        final double x2 = x * x;
-                        final double x3 = x2 * x;
-                        final double[] pX = {1, x, x2, x3};
-
-                        final double[] pY = {0, 0, 1, y};
-
-                        return apply(pX, pY, aYY);
-                    }
-                };
-            partialDerivativeXY = new BivariateFunction() {
-                    public double value(double x, double y)  {
-                        final double x2 = x * x;
-                        final double[] pX = {0, 1, x, x2};
-
-                        final double y2 = y * y;
-                        final double[] pY = {0, 1, y, y2};
-
-                        return apply(pX, pY, aXY);
-                    }
-                };
-        } else {
-            partialDerivativeX = null;
-            partialDerivativeY = null;
-            partialDerivativeXX = null;
-            partialDerivativeYY = null;
-            partialDerivativeXY = null;
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double value(double x, double y) {
-        if (x < 0 || x > 1) {
-            throw new OutOfRangeException(x, 0, 1);
-        }
-        if (y < 0 || y > 1) {
-            throw new OutOfRangeException(y, 0, 1);
-        }
-
-        final double x2 = x * x;
-        final double x3 = x2 * x;
-        final double[] pX = {1, x, x2, x3};
-
-        final double y2 = y * y;
-        final double y3 = y2 * y;
-        final double[] pY = {1, y, y2, y3};
-
-        return apply(pX, pY, a);
-    }
-
-    /**
-     * Compute the value of the bicubic polynomial.
-     *
-     * @param pX Powers of the x-coordinate.
-     * @param pY Powers of the y-coordinate.
-     * @param coeff Spline coefficients.
-     * @return the interpolated value.
-     */
-    private double apply(double[] pX, double[] pY, double[][] coeff) {
-        double result = 0;
-        for (int i = 0; i < N; i++) {
-            for (int j = 0; j < N; j++) {
-                result += coeff[i][j] * pX[i] * pY[j];
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * @return the partial derivative wrt {@code x}.
-     */
-    public BivariateFunction partialDerivativeX() {
-        return partialDerivativeX;
-    }
-    /**
-     * @return the partial derivative wrt {@code y}.
-     */
-    public BivariateFunction partialDerivativeY() {
-        return partialDerivativeY;
-    }
-    /**
-     * @return the second partial derivative wrt {@code x}.
-     */
-    public BivariateFunction partialDerivativeXX() {
-        return partialDerivativeXX;
-    }
-    /**
-     * @return the second partial derivative wrt {@code y}.
-     */
-    public BivariateFunction partialDerivativeYY() {
-        return partialDerivativeYY;
-    }
-    /**
-     * @return the second partial cross-derivative.
-     */
-    public BivariateFunction partialDerivativeXY() {
-        return partialDerivativeXY;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java
deleted file mode 100644
index 09acd07..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicSplineInterpolator.java
+++ /dev/null
@@ -1,176 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Generates a bicubic interpolating function. Due to numerical accuracy issues this should not
- * be used.
- *
- * @since 2.2
- * @deprecated as of 3.4 replaced by {@link org.apache.commons.math3.analysis.interpolation.PiecewiseBicubicSplineInterpolator}
- */
-@Deprecated
-public class BicubicSplineInterpolator
-    implements BivariateGridInterpolator {
-    /** Whether to initialize internal data used to compute the analytical
-        derivatives of the splines. */
-    private final boolean initializeDerivatives;
-
-    /**
-     * Default constructor.
-     * The argument {@link #BicubicSplineInterpolator(boolean) initializeDerivatives}
-     * is set to {@code false}.
-     */
-    public BicubicSplineInterpolator() {
-        this(false);
-    }
-
-    /**
-     * Creates an interpolator.
-     *
-     * @param initializeDerivatives Whether to initialize the internal data
-     * needed for calling any of the methods that compute the partial derivatives
-     * of the {@link BicubicSplineInterpolatingFunction function} returned from
-     * the call to {@link #interpolate(double[],double[],double[][]) interpolate}.
-     */
-    public BicubicSplineInterpolator(boolean initializeDerivatives) {
-        this.initializeDerivatives = initializeDerivatives;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public BicubicSplineInterpolatingFunction interpolate(final double[] xval,
-                                                          final double[] yval,
-                                                          final double[][] fval)
-        throws NoDataException, DimensionMismatchException,
-               NonMonotonicSequenceException, NumberIsTooSmallException {
-        if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
-            throw new NoDataException();
-        }
-        if (xval.length != fval.length) {
-            throw new DimensionMismatchException(xval.length, fval.length);
-        }
-
-        MathArrays.checkOrder(xval);
-        MathArrays.checkOrder(yval);
-
-        final int xLen = xval.length;
-        final int yLen = yval.length;
-
-        // Samples (first index is y-coordinate, i.e. subarray variable is x)
-        // 0 <= i < xval.length
-        // 0 <= j < yval.length
-        // fX[j][i] = f(xval[i], yval[j])
-        final double[][] fX = new double[yLen][xLen];
-        for (int i = 0; i < xLen; i++) {
-            if (fval[i].length != yLen) {
-                throw new DimensionMismatchException(fval[i].length, yLen);
-            }
-
-            for (int j = 0; j < yLen; j++) {
-                fX[j][i] = fval[i][j];
-            }
-        }
-
-        final SplineInterpolator spInterpolator = new SplineInterpolator();
-
-        // For each line y[j] (0 <= j < yLen), construct a 1D spline with
-        // respect to variable x
-        final PolynomialSplineFunction[] ySplineX = new PolynomialSplineFunction[yLen];
-        for (int j = 0; j < yLen; j++) {
-            ySplineX[j] = spInterpolator.interpolate(xval, fX[j]);
-        }
-
-        // For each line x[i] (0 <= i < xLen), construct a 1D spline with
-        // respect to variable y generated by array fY_1[i]
-        final PolynomialSplineFunction[] xSplineY = new PolynomialSplineFunction[xLen];
-        for (int i = 0; i < xLen; i++) {
-            xSplineY[i] = spInterpolator.interpolate(yval, fval[i]);
-        }
-
-        // Partial derivatives with respect to x at the grid knots
-        final double[][] dFdX = new double[xLen][yLen];
-        for (int j = 0; j < yLen; j++) {
-            final UnivariateFunction f = ySplineX[j].derivative();
-            for (int i = 0; i < xLen; i++) {
-                dFdX[i][j] = f.value(xval[i]);
-            }
-        }
-
-        // Partial derivatives with respect to y at the grid knots
-        final double[][] dFdY = new double[xLen][yLen];
-        for (int i = 0; i < xLen; i++) {
-            final UnivariateFunction f = xSplineY[i].derivative();
-            for (int j = 0; j < yLen; j++) {
-                dFdY[i][j] = f.value(yval[j]);
-            }
-        }
-
-        // Cross partial derivatives
-        final double[][] d2FdXdY = new double[xLen][yLen];
-        for (int i = 0; i < xLen ; i++) {
-            final int nI = nextIndex(i, xLen);
-            final int pI = previousIndex(i);
-            for (int j = 0; j < yLen; j++) {
-                final int nJ = nextIndex(j, yLen);
-                final int pJ = previousIndex(j);
-                d2FdXdY[i][j] = (fval[nI][nJ] - fval[nI][pJ] -
-                                 fval[pI][nJ] + fval[pI][pJ]) /
-                    ((xval[nI] - xval[pI]) * (yval[nJ] - yval[pJ]));
-            }
-        }
-
-        // Create the interpolating splines
-        return new BicubicSplineInterpolatingFunction(xval, yval, fval,
-                                                      dFdX, dFdY, d2FdXdY,
-                                                      initializeDerivatives);
-    }
-
-    /**
-     * Computes the next index of an array, clipping if necessary.
-     * It is assumed (but not checked) that {@code i >= 0}.
-     *
-     * @param i Index.
-     * @param max Upper limit of the array.
-     * @return the next index.
-     */
-    private int nextIndex(int i, int max) {
-        final int index = i + 1;
-        return index < max ? index : index - 1;
-    }
-    /**
-     * Computes the previous index of an array, clipping if necessary.
-     * It is assumed (but not checked) that {@code i} is smaller than the size
-     * of the array.
-     *
-     * @param i Index.
-     * @return the previous index.
-     */
-    private int previousIndex(int i) {
-        final int index = i - 1;
-        return index >= 0 ? index : 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java
deleted file mode 100644
index 94d75ad..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/BivariateGridInterpolator.java
+++ /dev/null
@@ -1,51 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-
-/**
- * Interface representing a bivariate real interpolating function where the
- * sample points must be specified on a regular grid.
- *
- */
-public interface BivariateGridInterpolator {
-    /**
-     * Compute an interpolating function for the dataset.
-     *
-     * @param xval All the x-coordinates of the interpolation points, sorted
-     * in increasing order.
-     * @param yval All the y-coordinates of the interpolation points, sorted
-     * in increasing order.
-     * @param fval The values of the interpolation points on all the grid knots:
-     * {@code fval[i][j] = f(xval[i], yval[j])}.
-     * @return a function which interpolates the dataset.
-     * @throws NoDataException if any of the arrays has zero length.
-     * @throws DimensionMismatchException if the array lengths are inconsistent.
-     * @throws NonMonotonicSequenceException if the array is not sorted.
-     * @throws NumberIsTooSmallException if the number of points is too small for
-     * the order of the interpolation
-     */
-    BivariateFunction interpolate(double[] xval, double[] yval,
-                                  double[][] fval)
-        throws NoDataException, DimensionMismatchException,
-               NonMonotonicSequenceException, NumberIsTooSmallException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java
deleted file mode 100644
index e308160..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/DividedDifferenceInterpolator.java
+++ /dev/null
@@ -1,119 +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.analysis.interpolation;
-
-import java.io.Serializable;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionNewtonForm;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-
-/**
- * Implements the <a href="
- * http://mathworld.wolfram.com/NewtonsDividedDifferenceInterpolationFormula.html">
- * Divided Difference Algorithm</a> for interpolation of real univariate
- * functions. For reference, see <b>Introduction to Numerical Analysis</b>,
- * ISBN 038795452X, chapter 2.
- * <p>
- * The actual code of Neville's evaluation is in PolynomialFunctionLagrangeForm,
- * this class provides an easy-to-use interface to it.</p>
- *
- * @since 1.2
- */
-public class DividedDifferenceInterpolator
-    implements UnivariateInterpolator, Serializable {
-    /** serializable version identifier */
-    private static final long serialVersionUID = 107049519551235069L;
-
-    /**
-     * Compute an interpolating function for the dataset.
-     *
-     * @param x Interpolating points array.
-     * @param y Interpolating values array.
-     * @return a function which interpolates the dataset.
-     * @throws DimensionMismatchException if the array lengths are different.
-     * @throws NumberIsTooSmallException if the number of points is less than 2.
-     * @throws NonMonotonicSequenceException if {@code x} is not sorted in
-     * strictly increasing order.
-     */
-    public PolynomialFunctionNewtonForm interpolate(double x[], double y[])
-        throws DimensionMismatchException,
-               NumberIsTooSmallException,
-               NonMonotonicSequenceException {
-        /**
-         * a[] and c[] are defined in the general formula of Newton form:
-         * p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... +
-         *        a[n](x-c[0])(x-c[1])...(x-c[n-1])
-         */
-        PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
-
-        /**
-         * When used for interpolation, the Newton form formula becomes
-         * p(x) = f[x0] + f[x0,x1](x-x0) + f[x0,x1,x2](x-x0)(x-x1) + ... +
-         *        f[x0,x1,...,x[n-1]](x-x0)(x-x1)...(x-x[n-2])
-         * Therefore, a[k] = f[x0,x1,...,xk], c[k] = x[k].
-         * <p>
-         * Note x[], y[], a[] have the same length but c[]'s size is one less.</p>
-         */
-        final double[] c = new double[x.length-1];
-        System.arraycopy(x, 0, c, 0, c.length);
-
-        final double[] a = computeDividedDifference(x, y);
-        return new PolynomialFunctionNewtonForm(a, c);
-    }
-
-    /**
-     * Return a copy of the divided difference array.
-     * <p>
-     * The divided difference array is defined recursively by <pre>
-     * f[x0] = f(x0)
-     * f[x0,x1,...,xk] = (f[x1,...,xk] - f[x0,...,x[k-1]]) / (xk - x0)
-     * </pre></p>
-     * <p>
-     * The computational complexity is O(N^2).</p>
-     *
-     * @param x Interpolating points array.
-     * @param y Interpolating values array.
-     * @return a fresh copy of the divided difference array.
-     * @throws DimensionMismatchException if the array lengths are different.
-     * @throws NumberIsTooSmallException if the number of points is less than 2.
-     * @throws NonMonotonicSequenceException
-     * if {@code x} is not sorted in strictly increasing order.
-     */
-    protected static double[] computeDividedDifference(final double x[], final double y[])
-        throws DimensionMismatchException,
-               NumberIsTooSmallException,
-               NonMonotonicSequenceException {
-        PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
-
-        final double[] divdiff = y.clone(); // initialization
-
-        final int n = x.length;
-        final double[] a = new double [n];
-        a[0] = divdiff[0];
-        for (int i = 1; i < n; i++) {
-            for (int j = 0; j < n-i; j++) {
-                final double denominator = x[j+i] - x[j];
-                divdiff[j] = (divdiff[j+1] - divdiff[j]) / denominator;
-            }
-            a[i] = divdiff[0];
-        }
-
-        return a;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/FieldHermiteInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/FieldHermiteInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/FieldHermiteInterpolator.java
deleted file mode 100644
index 9125b83..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/FieldHermiteInterpolator.java
+++ /dev/null
@@ -1,209 +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.analysis.interpolation;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-
-/** Polynomial interpolator using both sample values and sample derivatives.
- * <p>
- * The interpolation polynomials match all sample points, including both values
- * and provided derivatives. There is one polynomial for each component of
- * the values vector. All polynomials have the same degree. The degree of the
- * polynomials depends on the number of points and number of derivatives at each
- * point. For example the interpolation polynomials for n sample points without
- * any derivatives all have degree n-1. The interpolation polynomials for n
- * sample points with the two extreme points having value and first derivative
- * and the remaining points having value only all have degree n+1. The
- * interpolation polynomial for n sample points with value, first and second
- * derivative for all points all have degree 3n-1.
- * </p>
- *
- * @param <T> Type of the field elements.
- *
- * @since 3.2
- */
-public class FieldHermiteInterpolator<T extends FieldElement<T>> {
-
-    /** Sample abscissae. */
-    private final List<T> abscissae;
-
-    /** Top diagonal of the divided differences array. */
-    private final List<T[]> topDiagonal;
-
-    /** Bottom diagonal of the divided differences array. */
-    private final List<T[]> bottomDiagonal;
-
-    /** Create an empty interpolator.
-     */
-    public FieldHermiteInterpolator() {
-        this.abscissae      = new ArrayList<T>();
-        this.topDiagonal    = new ArrayList<T[]>();
-        this.bottomDiagonal = new ArrayList<T[]>();
-    }
-
-    /** Add a sample point.
-     * <p>
-     * This method must be called once for each sample point. It is allowed to
-     * mix some calls with values only with calls with values and first
-     * derivatives.
-     * </p>
-     * <p>
-     * The point abscissae for all calls <em>must</em> be different.
-     * </p>
-     * @param x abscissa of the sample point
-     * @param value value and derivatives of the sample point
-     * (if only one row is passed, it is the value, if two rows are
-     * passed the first one is the value and the second the derivative
-     * and so on)
-     * @exception ZeroException if the abscissa difference between added point
-     * and a previous point is zero (i.e. the two points are at same abscissa)
-     * @exception MathArithmeticException if the number of derivatives is larger
-     * than 20, which prevents computation of a factorial
-     * @throws DimensionMismatchException if derivative structures are inconsistent
-     * @throws NullArgumentException if x is null
-     */
-    public void addSamplePoint(final T x, final T[] ... value)
-        throws ZeroException, MathArithmeticException,
-               DimensionMismatchException, NullArgumentException {
-
-        MathUtils.checkNotNull(x);
-        T factorial = x.getField().getOne();
-        for (int i = 0; i < value.length; ++i) {
-
-            final T[] y = value[i].clone();
-            if (i > 1) {
-                factorial = factorial.multiply(i);
-                final T inv = factorial.reciprocal();
-                for (int j = 0; j < y.length; ++j) {
-                    y[j] = y[j].multiply(inv);
-                }
-            }
-
-            // update the bottom diagonal of the divided differences array
-            final int n = abscissae.size();
-            bottomDiagonal.add(n - i, y);
-            T[] bottom0 = y;
-            for (int j = i; j < n; ++j) {
-                final T[] bottom1 = bottomDiagonal.get(n - (j + 1));
-                if (x.equals(abscissae.get(n - (j + 1)))) {
-                    throw new ZeroException(LocalizedFormats.DUPLICATED_ABSCISSA_DIVISION_BY_ZERO, x);
-                }
-                final T inv = x.subtract(abscissae.get(n - (j + 1))).reciprocal();
-                for (int k = 0; k < y.length; ++k) {
-                    bottom1[k] = inv.multiply(bottom0[k].subtract(bottom1[k]));
-                }
-                bottom0 = bottom1;
-            }
-
-            // update the top diagonal of the divided differences array
-            topDiagonal.add(bottom0.clone());
-
-            // update the abscissae array
-            abscissae.add(x);
-
-        }
-
-    }
-
-    /** Interpolate value at a specified abscissa.
-     * @param x interpolation abscissa
-     * @return interpolated value
-     * @exception NoDataException if sample is empty
-     * @throws NullArgumentException if x is null
-     */
-    public T[] value(T x) throws NoDataException, NullArgumentException {
-
-        // safety check
-        MathUtils.checkNotNull(x);
-        if (abscissae.isEmpty()) {
-            throw new NoDataException(LocalizedFormats.EMPTY_INTERPOLATION_SAMPLE);
-        }
-
-        final T[] value = MathArrays.buildArray(x.getField(), topDiagonal.get(0).length);
-        T valueCoeff = x.getField().getOne();
-        for (int i = 0; i < topDiagonal.size(); ++i) {
-            T[] dividedDifference = topDiagonal.get(i);
-            for (int k = 0; k < value.length; ++k) {
-                value[k] = value[k].add(dividedDifference[k].multiply(valueCoeff));
-            }
-            final T deltaX = x.subtract(abscissae.get(i));
-            valueCoeff = valueCoeff.multiply(deltaX);
-        }
-
-        return value;
-
-    }
-
-    /** Interpolate value and first derivatives at a specified abscissa.
-     * @param x interpolation abscissa
-     * @param order maximum derivation order
-     * @return interpolated value and derivatives (value in row 0,
-     * 1<sup>st</sup> derivative in row 1, ... n<sup>th</sup> derivative in row n)
-     * @exception NoDataException if sample is empty
-     * @throws NullArgumentException if x is null
-     */
-    public T[][] derivatives(T x, int order) throws NoDataException, NullArgumentException {
-
-        // safety check
-        MathUtils.checkNotNull(x);
-        if (abscissae.isEmpty()) {
-            throw new NoDataException(LocalizedFormats.EMPTY_INTERPOLATION_SAMPLE);
-        }
-
-        final T zero = x.getField().getZero();
-        final T one  = x.getField().getOne();
-        final T[] tj = MathArrays.buildArray(x.getField(), order + 1);
-        tj[0] = zero;
-        for (int i = 0; i < order; ++i) {
-            tj[i + 1] = tj[i].add(one);
-        }
-
-        final T[][] derivatives =
-                MathArrays.buildArray(x.getField(), order + 1, topDiagonal.get(0).length);
-        final T[] valueCoeff = MathArrays.buildArray(x.getField(), order + 1);
-        valueCoeff[0] = x.getField().getOne();
-        for (int i = 0; i < topDiagonal.size(); ++i) {
-            T[] dividedDifference = topDiagonal.get(i);
-            final T deltaX = x.subtract(abscissae.get(i));
-            for (int j = order; j >= 0; --j) {
-                for (int k = 0; k < derivatives[j].length; ++k) {
-                    derivatives[j][k] =
-                            derivatives[j][k].add(dividedDifference[k].multiply(valueCoeff[j]));
-                }
-                valueCoeff[j] = valueCoeff[j].multiply(deltaX);
-                if (j > 0) {
-                    valueCoeff[j] = valueCoeff[j].add(tj[j].multiply(valueCoeff[j - 1]));
-                }
-            }
-        }
-
-        return derivatives;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/HermiteInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/HermiteInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/HermiteInterpolator.java
deleted file mode 100644
index 15ed322..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/HermiteInterpolator.java
+++ /dev/null
@@ -1,239 +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.analysis.interpolation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-
-/** Polynomial interpolator using both sample values and sample derivatives.
- * <p>
- * The interpolation polynomials match all sample points, including both values
- * and provided derivatives. There is one polynomial for each component of
- * the values vector. All polynomials have the same degree. The degree of the
- * polynomials depends on the number of points and number of derivatives at each
- * point. For example the interpolation polynomials for n sample points without
- * any derivatives all have degree n-1. The interpolation polynomials for n
- * sample points with the two extreme points having value and first derivative
- * and the remaining points having value only all have degree n+1. The
- * interpolation polynomial for n sample points with value, first and second
- * derivative for all points all have degree 3n-1.
- * </p>
- *
- * @since 3.1
- */
-public class HermiteInterpolator implements UnivariateDifferentiableVectorFunction {
-
-    /** Sample abscissae. */
-    private final List<Double> abscissae;
-
-    /** Top diagonal of the divided differences array. */
-    private final List<double[]> topDiagonal;
-
-    /** Bottom diagonal of the divided differences array. */
-    private final List<double[]> bottomDiagonal;
-
-    /** Create an empty interpolator.
-     */
-    public HermiteInterpolator() {
-        this.abscissae      = new ArrayList<Double>();
-        this.topDiagonal    = new ArrayList<double[]>();
-        this.bottomDiagonal = new ArrayList<double[]>();
-    }
-
-    /** Add a sample point.
-     * <p>
-     * This method must be called once for each sample point. It is allowed to
-     * mix some calls with values only with calls with values and first
-     * derivatives.
-     * </p>
-     * <p>
-     * The point abscissae for all calls <em>must</em> be different.
-     * </p>
-     * @param x abscissa of the sample point
-     * @param value value and derivatives of the sample point
-     * (if only one row is passed, it is the value, if two rows are
-     * passed the first one is the value and the second the derivative
-     * and so on)
-     * @exception ZeroException if the abscissa difference between added point
-     * and a previous point is zero (i.e. the two points are at same abscissa)
-     * @exception MathArithmeticException if the number of derivatives is larger
-     * than 20, which prevents computation of a factorial
-     */
-    public void addSamplePoint(final double x, final double[] ... value)
-        throws ZeroException, MathArithmeticException {
-
-        for (int i = 0; i < value.length; ++i) {
-
-            final double[] y = value[i].clone();
-            if (i > 1) {
-                double inv = 1.0 / CombinatoricsUtils.factorial(i);
-                for (int j = 0; j < y.length; ++j) {
-                    y[j] *= inv;
-                }
-            }
-
-            // update the bottom diagonal of the divided differences array
-            final int n = abscissae.size();
-            bottomDiagonal.add(n - i, y);
-            double[] bottom0 = y;
-            for (int j = i; j < n; ++j) {
-                final double[] bottom1 = bottomDiagonal.get(n - (j + 1));
-                final double inv = 1.0 / (x - abscissae.get(n - (j + 1)));
-                if (Double.isInfinite(inv)) {
-                    throw new ZeroException(LocalizedFormats.DUPLICATED_ABSCISSA_DIVISION_BY_ZERO, x);
-                }
-                for (int k = 0; k < y.length; ++k) {
-                    bottom1[k] = inv * (bottom0[k] - bottom1[k]);
-                }
-                bottom0 = bottom1;
-            }
-
-            // update the top diagonal of the divided differences array
-            topDiagonal.add(bottom0.clone());
-
-            // update the abscissae array
-            abscissae.add(x);
-
-        }
-
-    }
-
-    /** Compute the interpolation polynomials.
-     * @return interpolation polynomials array
-     * @exception NoDataException if sample is empty
-     */
-    public PolynomialFunction[] getPolynomials()
-        throws NoDataException {
-
-        // safety check
-        checkInterpolation();
-
-        // iteration initialization
-        final PolynomialFunction zero = polynomial(0);
-        PolynomialFunction[] polynomials = new PolynomialFunction[topDiagonal.get(0).length];
-        for (int i = 0; i < polynomials.length; ++i) {
-            polynomials[i] = zero;
-        }
-        PolynomialFunction coeff = polynomial(1);
-
-        // build the polynomials by iterating on the top diagonal of the divided differences array
-        for (int i = 0; i < topDiagonal.size(); ++i) {
-            double[] tdi = topDiagonal.get(i);
-            for (int k = 0; k < polynomials.length; ++k) {
-                polynomials[k] = polynomials[k].add(coeff.multiply(polynomial(tdi[k])));
-            }
-            coeff = coeff.multiply(polynomial(-abscissae.get(i), 1.0));
-        }
-
-        return polynomials;
-
-    }
-
-    /** Interpolate value at a specified abscissa.
-     * <p>
-     * Calling this method is equivalent to call the {@link PolynomialFunction#value(double)
-     * value} methods of all polynomials returned by {@link #getPolynomials() getPolynomials},
-     * except it does not build the intermediate polynomials, so this method is faster and
-     * numerically more stable.
-     * </p>
-     * @param x interpolation abscissa
-     * @return interpolated value
-     * @exception NoDataException if sample is empty
-     */
-    public double[] value(double x)
-        throws NoDataException {
-
-        // safety check
-        checkInterpolation();
-
-        final double[] value = new double[topDiagonal.get(0).length];
-        double valueCoeff = 1;
-        for (int i = 0; i < topDiagonal.size(); ++i) {
-            double[] dividedDifference = topDiagonal.get(i);
-            for (int k = 0; k < value.length; ++k) {
-                value[k] += dividedDifference[k] * valueCoeff;
-            }
-            final double deltaX = x - abscissae.get(i);
-            valueCoeff *= deltaX;
-        }
-
-        return value;
-
-    }
-
-    /** Interpolate value at a specified abscissa.
-     * <p>
-     * Calling this method is equivalent to call the {@link
-     * PolynomialFunction#value(DerivativeStructure) value} methods of all polynomials
-     * returned by {@link #getPolynomials() getPolynomials}, except it does not build the
-     * intermediate polynomials, so this method is faster and numerically more stable.
-     * </p>
-     * @param x interpolation abscissa
-     * @return interpolated value
-     * @exception NoDataException if sample is empty
-     */
-    public DerivativeStructure[] value(final DerivativeStructure x)
-        throws NoDataException {
-
-        // safety check
-        checkInterpolation();
-
-        final DerivativeStructure[] value = new DerivativeStructure[topDiagonal.get(0).length];
-        Arrays.fill(value, x.getField().getZero());
-        DerivativeStructure valueCoeff = x.getField().getOne();
-        for (int i = 0; i < topDiagonal.size(); ++i) {
-            double[] dividedDifference = topDiagonal.get(i);
-            for (int k = 0; k < value.length; ++k) {
-                value[k] = value[k].add(valueCoeff.multiply(dividedDifference[k]));
-            }
-            final DerivativeStructure deltaX = x.subtract(abscissae.get(i));
-            valueCoeff = valueCoeff.multiply(deltaX);
-        }
-
-        return value;
-
-    }
-
-    /** Check interpolation can be performed.
-     * @exception NoDataException if interpolation cannot be performed
-     * because sample is empty
-     */
-    private void checkInterpolation() throws NoDataException {
-        if (abscissae.isEmpty()) {
-            throw new NoDataException(LocalizedFormats.EMPTY_INTERPOLATION_SAMPLE);
-        }
-    }
-
-    /** Create a polynomial from its coefficients.
-     * @param c polynomials coefficients
-     * @return polynomial
-     */
-    private PolynomialFunction polynomial(double ... c) {
-        return new PolynomialFunction(c);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java
deleted file mode 100644
index 7e0e69b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/LinearInterpolator.java
+++ /dev/null
@@ -1,79 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Implements a linear function for interpolation of real univariate functions.
- *
- */
-public class LinearInterpolator implements UnivariateInterpolator {
-    /**
-     * Computes a linear interpolating function for the data set.
-     *
-     * @param x the arguments for the interpolation points
-     * @param y the values for the interpolation points
-     * @return a function which interpolates the data set
-     * @throws DimensionMismatchException if {@code x} and {@code y}
-     * have different sizes.
-     * @throws NonMonotonicSequenceException if {@code x} is not sorted in
-     * strict increasing order.
-     * @throws NumberIsTooSmallException if the size of {@code x} is smaller
-     * than 2.
-     */
-    public PolynomialSplineFunction interpolate(double x[], double y[])
-        throws DimensionMismatchException,
-               NumberIsTooSmallException,
-               NonMonotonicSequenceException {
-        if (x.length != y.length) {
-            throw new DimensionMismatchException(x.length, y.length);
-        }
-
-        if (x.length < 2) {
-            throw new NumberIsTooSmallException(LocalizedFormats.NUMBER_OF_POINTS,
-                                                x.length, 2, true);
-        }
-
-        // Number of intervals.  The number of data points is n + 1.
-        int n = x.length - 1;
-
-        MathArrays.checkOrder(x);
-
-        // Slope of the lines between the datapoints.
-        final double m[] = new double[n];
-        for (int i = 0; i < n; i++) {
-            m[i] = (y[i + 1] - y[i]) / (x[i + 1] - x[i]);
-        }
-
-        final PolynomialFunction polynomials[] = new PolynomialFunction[n];
-        final double coefficients[] = new double[2];
-        for (int i = 0; i < n; i++) {
-            coefficients[0] = y[i];
-            coefficients[1] = m[i];
-            polynomials[i] = new PolynomialFunction(coefficients);
-        }
-
-        return new PolynomialSplineFunction(x, polynomials);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java
deleted file mode 100644
index 7f0788d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/LoessInterpolator.java
+++ /dev/null
@@ -1,473 +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.analysis.interpolation;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotFiniteNumberException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Implements the <a href="http://en.wikipedia.org/wiki/Local_regression">
- * Local Regression Algorithm</a> (also Loess, Lowess) for interpolation of
- * real univariate functions.
- * <p/>
- * For reference, see
- * <a href="http://www.math.tau.ac.il/~yekutiel/MA seminar/Cleveland 1979.pdf">
- * William S. Cleveland - Robust Locally Weighted Regression and Smoothing
- * Scatterplots</a>
- * <p/>
- * This class implements both the loess method and serves as an interpolation
- * adapter to it, allowing one to build a spline on the obtained loess fit.
- *
- * @since 2.0
- */
-public class LoessInterpolator
-    implements UnivariateInterpolator, Serializable {
-    /** Default value of the bandwidth parameter. */
-    public static final double DEFAULT_BANDWIDTH = 0.3;
-    /** Default value of the number of robustness iterations. */
-    public static final int DEFAULT_ROBUSTNESS_ITERS = 2;
-    /**
-     * Default value for accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_ACCURACY = 1e-12;
-    /** serializable version identifier. */
-    private static final long serialVersionUID = 5204927143605193821L;
-    /**
-     * The bandwidth parameter: when computing the loess fit at
-     * a particular point, this fraction of source points closest
-     * to the current point is taken into account for computing
-     * a least-squares regression.
-     * <p/>
-     * A sensible value is usually 0.25 to 0.5.
-     */
-    private final double bandwidth;
-    /**
-     * The number of robustness iterations parameter: this many
-     * robustness iterations are done.
-     * <p/>
-     * A sensible value is usually 0 (just the initial fit without any
-     * robustness iterations) to 4.
-     */
-    private final int robustnessIters;
-    /**
-     * If the median residual at a certain robustness iteration
-     * is less than this amount, no more iterations are done.
-     */
-    private final double accuracy;
-
-    /**
-     * Constructs a new {@link LoessInterpolator}
-     * with a bandwidth of {@link #DEFAULT_BANDWIDTH},
-     * {@link #DEFAULT_ROBUSTNESS_ITERS} robustness iterations
-     * and an accuracy of {#link #DEFAULT_ACCURACY}.
-     * See {@link #LoessInterpolator(double, int, double)} for an explanation of
-     * the parameters.
-     */
-    public LoessInterpolator() {
-        this.bandwidth = DEFAULT_BANDWIDTH;
-        this.robustnessIters = DEFAULT_ROBUSTNESS_ITERS;
-        this.accuracy = DEFAULT_ACCURACY;
-    }
-
-    /**
-     * Construct a new {@link LoessInterpolator}
-     * with given bandwidth and number of robustness iterations.
-     * <p>
-     * Calling this constructor is equivalent to calling {link {@link
-     * #LoessInterpolator(double, int, double) LoessInterpolator(bandwidth,
-     * robustnessIters, LoessInterpolator.DEFAULT_ACCURACY)}
-     * </p>
-     *
-     * @param bandwidth  when computing the loess fit at
-     * a particular point, this fraction of source points closest
-     * to the current point is taken into account for computing
-     * a least-squares regression.</br>
-     * A sensible value is usually 0.25 to 0.5, the default value is
-     * {@link #DEFAULT_BANDWIDTH}.
-     * @param robustnessIters This many robustness iterations are done.</br>
-     * A sensible value is usually 0 (just the initial fit without any
-     * robustness iterations) to 4, the default value is
-     * {@link #DEFAULT_ROBUSTNESS_ITERS}.
-
-     * @see #LoessInterpolator(double, int, double)
-     */
-    public LoessInterpolator(double bandwidth, int robustnessIters) {
-        this(bandwidth, robustnessIters, DEFAULT_ACCURACY);
-    }
-
-    /**
-     * Construct a new {@link LoessInterpolator}
-     * with given bandwidth, number of robustness iterations and accuracy.
-     *
-     * @param bandwidth  when computing the loess fit at
-     * a particular point, this fraction of source points closest
-     * to the current point is taken into account for computing
-     * a least-squares regression.</br>
-     * A sensible value is usually 0.25 to 0.5, the default value is
-     * {@link #DEFAULT_BANDWIDTH}.
-     * @param robustnessIters This many robustness iterations are done.</br>
-     * A sensible value is usually 0 (just the initial fit without any
-     * robustness iterations) to 4, the default value is
-     * {@link #DEFAULT_ROBUSTNESS_ITERS}.
-     * @param accuracy If the median residual at a certain robustness iteration
-     * is less than this amount, no more iterations are done.
-     * @throws OutOfRangeException if bandwidth does not lie in the interval [0,1].
-     * @throws NotPositiveException if {@code robustnessIters} is negative.
-     * @see #LoessInterpolator(double, int)
-     * @since 2.1
-     */
-    public LoessInterpolator(double bandwidth, int robustnessIters, double accuracy)
-        throws OutOfRangeException,
-               NotPositiveException {
-        if (bandwidth < 0 ||
-            bandwidth > 1) {
-            throw new OutOfRangeException(LocalizedFormats.BANDWIDTH, bandwidth, 0, 1);
-        }
-        this.bandwidth = bandwidth;
-        if (robustnessIters < 0) {
-            throw new NotPositiveException(LocalizedFormats.ROBUSTNESS_ITERATIONS, robustnessIters);
-        }
-        this.robustnessIters = robustnessIters;
-        this.accuracy = accuracy;
-    }
-
-    /**
-     * Compute an interpolating function by performing a loess fit
-     * on the data at the original abscissae and then building a cubic spline
-     * with a
-     * {@link org.apache.commons.math3.analysis.interpolation.SplineInterpolator}
-     * on the resulting fit.
-     *
-     * @param xval the arguments for the interpolation points
-     * @param yval the values for the interpolation points
-     * @return A cubic spline built upon a loess fit to the data at the original abscissae
-     * @throws NonMonotonicSequenceException if {@code xval} not sorted in
-     * strictly increasing order.
-     * @throws DimensionMismatchException if {@code xval} and {@code yval} have
-     * different sizes.
-     * @throws NoDataException if {@code xval} or {@code yval} has zero size.
-     * @throws NotFiniteNumberException if any of the arguments and values are
-     * not finite real numbers.
-     * @throws NumberIsTooSmallException if the bandwidth is too small to
-     * accomodate the size of the input data (i.e. the bandwidth must be
-     * larger than 2/n).
-     */
-    public final PolynomialSplineFunction interpolate(final double[] xval,
-                                                      final double[] yval)
-        throws NonMonotonicSequenceException,
-               DimensionMismatchException,
-               NoDataException,
-               NotFiniteNumberException,
-               NumberIsTooSmallException {
-        return new SplineInterpolator().interpolate(xval, smooth(xval, yval));
-    }
-
-    /**
-     * Compute a weighted loess fit on the data at the original abscissae.
-     *
-     * @param xval Arguments for the interpolation points.
-     * @param yval Values for the interpolation points.
-     * @param weights point weights: coefficients by which the robustness weight
-     * of a point is multiplied.
-     * @return the values of the loess fit at corresponding original abscissae.
-     * @throws NonMonotonicSequenceException if {@code xval} not sorted in
-     * strictly increasing order.
-     * @throws DimensionMismatchException if {@code xval} and {@code yval} have
-     * different sizes.
-     * @throws NoDataException if {@code xval} or {@code yval} has zero size.
-     * @throws NotFiniteNumberException if any of the arguments and values are
-     not finite real numbers.
-     * @throws NumberIsTooSmallException if the bandwidth is too small to
-     * accomodate the size of the input data (i.e. the bandwidth must be
-     * larger than 2/n).
-     * @since 2.1
-     */
-    public final double[] smooth(final double[] xval, final double[] yval,
-                                 final double[] weights)
-        throws NonMonotonicSequenceException,
-               DimensionMismatchException,
-               NoDataException,
-               NotFiniteNumberException,
-               NumberIsTooSmallException {
-        if (xval.length != yval.length) {
-            throw new DimensionMismatchException(xval.length, yval.length);
-        }
-
-        final int n = xval.length;
-
-        if (n == 0) {
-            throw new NoDataException();
-        }
-
-        checkAllFiniteReal(xval);
-        checkAllFiniteReal(yval);
-        checkAllFiniteReal(weights);
-
-        MathArrays.checkOrder(xval);
-
-        if (n == 1) {
-            return new double[]{yval[0]};
-        }
-
-        if (n == 2) {
-            return new double[]{yval[0], yval[1]};
-        }
-
-        int bandwidthInPoints = (int) (bandwidth * n);
-
-        if (bandwidthInPoints < 2) {
-            throw new NumberIsTooSmallException(LocalizedFormats.BANDWIDTH,
-                                                bandwidthInPoints, 2, true);
-        }
-
-        final double[] res = new double[n];
-
-        final double[] residuals = new double[n];
-        final double[] sortedResiduals = new double[n];
-
-        final double[] robustnessWeights = new double[n];
-
-        // Do an initial fit and 'robustnessIters' robustness iterations.
-        // This is equivalent to doing 'robustnessIters+1' robustness iterations
-        // starting with all robustness weights set to 1.
-        Arrays.fill(robustnessWeights, 1);
-
-        for (int iter = 0; iter <= robustnessIters; ++iter) {
-            final int[] bandwidthInterval = {0, bandwidthInPoints - 1};
-            // At each x, compute a local weighted linear regression
-            for (int i = 0; i < n; ++i) {
-                final double x = xval[i];
-
-                // Find out the interval of source points on which
-                // a regression is to be made.
-                if (i > 0) {
-                    updateBandwidthInterval(xval, weights, i, bandwidthInterval);
-                }
-
-                final int ileft = bandwidthInterval[0];
-                final int iright = bandwidthInterval[1];
-
-                // Compute the point of the bandwidth interval that is
-                // farthest from x
-                final int edge;
-                if (xval[i] - xval[ileft] > xval[iright] - xval[i]) {
-                    edge = ileft;
-                } else {
-                    edge = iright;
-                }
-
-                // Compute a least-squares linear fit weighted by
-                // the product of robustness weights and the tricube
-                // weight function.
-                // See http://en.wikipedia.org/wiki/Linear_regression
-                // (section "Univariate linear case")
-                // and http://en.wikipedia.org/wiki/Weighted_least_squares
-                // (section "Weighted least squares")
-                double sumWeights = 0;
-                double sumX = 0;
-                double sumXSquared = 0;
-                double sumY = 0;
-                double sumXY = 0;
-                double denom = FastMath.abs(1.0 / (xval[edge] - x));
-                for (int k = ileft; k <= iright; ++k) {
-                    final double xk   = xval[k];
-                    final double yk   = yval[k];
-                    final double dist = (k < i) ? x - xk : xk - x;
-                    final double w    = tricube(dist * denom) * robustnessWeights[k] * weights[k];
-                    final double xkw  = xk * w;
-                    sumWeights += w;
-                    sumX += xkw;
-                    sumXSquared += xk * xkw;
-                    sumY += yk * w;
-                    sumXY += yk * xkw;
-                }
-
-                final double meanX = sumX / sumWeights;
-                final double meanY = sumY / sumWeights;
-                final double meanXY = sumXY / sumWeights;
-                final double meanXSquared = sumXSquared / sumWeights;
-
-                final double beta;
-                if (FastMath.sqrt(FastMath.abs(meanXSquared - meanX * meanX)) < accuracy) {
-                    beta = 0;
-                } else {
-                    beta = (meanXY - meanX * meanY) / (meanXSquared - meanX * meanX);
-                }
-
-                final double alpha = meanY - beta * meanX;
-
-                res[i] = beta * x + alpha;
-                residuals[i] = FastMath.abs(yval[i] - res[i]);
-            }
-
-            // No need to recompute the robustness weights at the last
-            // iteration, they won't be needed anymore
-            if (iter == robustnessIters) {
-                break;
-            }
-
-            // Recompute the robustness weights.
-
-            // Find the median residual.
-            // An arraycopy and a sort are completely tractable here,
-            // because the preceding loop is a lot more expensive
-            System.arraycopy(residuals, 0, sortedResiduals, 0, n);
-            Arrays.sort(sortedResiduals);
-            final double medianResidual = sortedResiduals[n / 2];
-
-            if (FastMath.abs(medianResidual) < accuracy) {
-                break;
-            }
-
-            for (int i = 0; i < n; ++i) {
-                final double arg = residuals[i] / (6 * medianResidual);
-                if (arg >= 1) {
-                    robustnessWeights[i] = 0;
-                } else {
-                    final double w = 1 - arg * arg;
-                    robustnessWeights[i] = w * w;
-                }
-            }
-        }
-
-        return res;
-    }
-
-    /**
-     * Compute a loess fit on the data at the original abscissae.
-     *
-     * @param xval the arguments for the interpolation points
-     * @param yval the values for the interpolation points
-     * @return values of the loess fit at corresponding original abscissae
-     * @throws NonMonotonicSequenceException if {@code xval} not sorted in
-     * strictly increasing order.
-     * @throws DimensionMismatchException if {@code xval} and {@code yval} have
-     * different sizes.
-     * @throws NoDataException if {@code xval} or {@code yval} has zero size.
-     * @throws NotFiniteNumberException if any of the arguments and values are
-     * not finite real numbers.
-     * @throws NumberIsTooSmallException if the bandwidth is too small to
-     * accomodate the size of the input data (i.e. the bandwidth must be
-     * larger than 2/n).
-     */
-    public final double[] smooth(final double[] xval, final double[] yval)
-        throws NonMonotonicSequenceException,
-               DimensionMismatchException,
-               NoDataException,
-               NotFiniteNumberException,
-               NumberIsTooSmallException {
-        if (xval.length != yval.length) {
-            throw new DimensionMismatchException(xval.length, yval.length);
-        }
-
-        final double[] unitWeights = new double[xval.length];
-        Arrays.fill(unitWeights, 1.0);
-
-        return smooth(xval, yval, unitWeights);
-    }
-
-    /**
-     * Given an index interval into xval that embraces a certain number of
-     * points closest to {@code xval[i-1]}, update the interval so that it
-     * embraces the same number of points closest to {@code xval[i]},
-     * ignoring zero weights.
-     *
-     * @param xval Arguments array.
-     * @param weights Weights array.
-     * @param i Index around which the new interval should be computed.
-     * @param bandwidthInterval a two-element array {left, right} such that:
-     * {@code (left==0 or xval[i] - xval[left-1] > xval[right] - xval[i])}
-     * and
-     * {@code (right==xval.length-1 or xval[right+1] - xval[i] > xval[i] - xval[left])}.
-     * The array will be updated.
-     */
-    private static void updateBandwidthInterval(final double[] xval, final double[] weights,
-                                                final int i,
-                                                final int[] bandwidthInterval) {
-        final int left = bandwidthInterval[0];
-        final int right = bandwidthInterval[1];
-
-        // The right edge should be adjusted if the next point to the right
-        // is closer to xval[i] than the leftmost point of the current interval
-        int nextRight = nextNonzero(weights, right);
-        if (nextRight < xval.length && xval[nextRight] - xval[i] < xval[i] - xval[left]) {
-            int nextLeft = nextNonzero(weights, bandwidthInterval[0]);
-            bandwidthInterval[0] = nextLeft;
-            bandwidthInterval[1] = nextRight;
-        }
-    }
-
-    /**
-     * Return the smallest index {@code j} such that
-     * {@code j > i && (j == weights.length || weights[j] != 0)}.
-     *
-     * @param weights Weights array.
-     * @param i Index from which to start search.
-     * @return the smallest compliant index.
-     */
-    private static int nextNonzero(final double[] weights, final int i) {
-        int j = i + 1;
-        while(j < weights.length && weights[j] == 0) {
-            ++j;
-        }
-        return j;
-    }
-
-    /**
-     * Compute the
-     * <a href="http://en.wikipedia.org/wiki/Local_regression#Weight_function">tricube</a>
-     * weight function
-     *
-     * @param x Argument.
-     * @return <code>(1 - |x|<sup>3</sup>)<sup>3</sup></code> for |x| &lt; 1, 0 otherwise.
-     */
-    private static double tricube(final double x) {
-        final double absX = FastMath.abs(x);
-        if (absX >= 1.0) {
-            return 0.0;
-        }
-        final double tmp = 1 - absX * absX * absX;
-        return tmp * tmp * tmp;
-    }
-
-    /**
-     * Check that all elements of an array are finite real numbers.
-     *
-     * @param values Values array.
-     * @throws org.apache.commons.math3.exception.NotFiniteNumberException
-     * if one of the values is not a finite real number.
-     */
-    private static void checkAllFiniteReal(final double[] values) {
-        for (int i = 0; i < values.length; i++) {
-            MathUtils.checkFinite(values[i]);
-        }
-    }
-}


[47/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java
deleted file mode 100644
index 59fcea5..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java
+++ /dev/null
@@ -1,877 +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.analysis.differentiation;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * First derivative computation with large number of variables.
- * <p>
- * This class plays a similar role to {@link DerivativeStructure}, with
- * a focus on efficiency when dealing with large number of independent variables
- * and most computation depend only on a few of them, and when only first derivative
- * is desired. When these conditions are met, this class should be much faster than
- * {@link DerivativeStructure} and use less memory.
- * </p>
- *
- * @since 3.3
- */
-public class SparseGradient implements RealFieldElement<SparseGradient>, Serializable {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20131025L;
-
-    /** Value of the calculation. */
-    private double value;
-
-    /** Stored derivative, each key representing a different independent variable. */
-    private final Map<Integer, Double> derivatives;
-
-    /** Internal constructor.
-     * @param value value of the function
-     * @param derivatives derivatives map, a deep copy will be performed,
-     * so the map given here will remain safe from changes in the new instance,
-     * may be null to create an empty derivatives map, i.e. a constant value
-     */
-    private SparseGradient(final double value, final Map<Integer, Double> derivatives) {
-        this.value = value;
-        this.derivatives = new HashMap<Integer, Double>();
-        if (derivatives != null) {
-            this.derivatives.putAll(derivatives);
-        }
-    }
-
-    /** Internal constructor.
-     * @param value value of the function
-     * @param scale scaling factor to apply to all derivatives
-     * @param derivatives derivatives map, a deep copy will be performed,
-     * so the map given here will remain safe from changes in the new instance,
-     * may be null to create an empty derivatives map, i.e. a constant value
-     */
-    private SparseGradient(final double value, final double scale,
-                             final Map<Integer, Double> derivatives) {
-        this.value = value;
-        this.derivatives = new HashMap<Integer, Double>();
-        if (derivatives != null) {
-            for (final Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
-                this.derivatives.put(entry.getKey(), scale * entry.getValue());
-            }
-        }
-    }
-
-    /** Factory method creating a constant.
-     * @param value value of the constant
-     * @return a new instance
-     */
-    public static SparseGradient createConstant(final double value) {
-        return new SparseGradient(value, Collections.<Integer, Double> emptyMap());
-    }
-
-    /** Factory method creating an independent variable.
-     * @param idx index of the variable
-     * @param value value of the variable
-     * @return a new instance
-     */
-    public static SparseGradient createVariable(final int idx, final double value) {
-        return new SparseGradient(value, Collections.singletonMap(idx, 1.0));
-    }
-
-    /**
-     * Find the number of variables.
-     * @return number of variables
-     */
-    public int numVars() {
-        return derivatives.size();
-    }
-
-    /**
-     * Get the derivative with respect to a particular index variable.
-     *
-     * @param index index to differentiate with.
-     * @return derivative with respect to a particular index variable
-     */
-    public double getDerivative(final int index) {
-        final Double out = derivatives.get(index);
-        return (out == null) ? 0.0 : out;
-    }
-
-    /**
-     * Get the value of the function.
-     * @return value of the function.
-     */
-    public double getValue() {
-        return value;
-    }
-
-    /** {@inheritDoc} */
-    public double getReal() {
-        return value;
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient add(final SparseGradient a) {
-        final SparseGradient out = new SparseGradient(value + a.value, derivatives);
-        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
-            final int id = entry.getKey();
-            final Double old = out.derivatives.get(id);
-            if (old == null) {
-                out.derivatives.put(id, entry.getValue());
-            } else {
-                out.derivatives.put(id, old + entry.getValue());
-            }
-        }
-
-        return out;
-    }
-
-    /**
-     * Add in place.
-     * <p>
-     * This method is designed to be faster when used multiple times in a loop.
-     * </p>
-     * <p>
-     * The instance is changed here, in order to not change the
-     * instance the {@link #add(SparseGradient)} method should
-     * be used.
-     * </p>
-     * @param a instance to add
-     */
-    public void addInPlace(final SparseGradient a) {
-        value += a.value;
-        for (final Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
-            final int id = entry.getKey();
-            final Double old = derivatives.get(id);
-            if (old == null) {
-                derivatives.put(id, entry.getValue());
-            } else {
-                derivatives.put(id, old + entry.getValue());
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient add(final double c) {
-        final SparseGradient out = new SparseGradient(value + c, derivatives);
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient subtract(final SparseGradient a) {
-        final SparseGradient out = new SparseGradient(value - a.value, derivatives);
-        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
-            final int id = entry.getKey();
-            final Double old = out.derivatives.get(id);
-            if (old == null) {
-                out.derivatives.put(id, -entry.getValue());
-            } else {
-                out.derivatives.put(id, old - entry.getValue());
-            }
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient subtract(double c) {
-        return new SparseGradient(value - c, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient multiply(final SparseGradient a) {
-        final SparseGradient out =
-            new SparseGradient(value * a.value, Collections.<Integer, Double> emptyMap());
-
-        // Derivatives.
-        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
-            out.derivatives.put(entry.getKey(), a.value * entry.getValue());
-        }
-        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
-            final int id = entry.getKey();
-            final Double old = out.derivatives.get(id);
-            if (old == null) {
-                out.derivatives.put(id, value * entry.getValue());
-            } else {
-                out.derivatives.put(id, old + value * entry.getValue());
-            }
-        }
-        return out;
-    }
-
-    /**
-     * Multiply in place.
-     * <p>
-     * This method is designed to be faster when used multiple times in a loop.
-     * </p>
-     * <p>
-     * The instance is changed here, in order to not change the
-     * instance the {@link #add(SparseGradient)} method should
-     * be used.
-     * </p>
-     * @param a instance to multiply
-     */
-    public void multiplyInPlace(final SparseGradient a) {
-        // Derivatives.
-        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
-            derivatives.put(entry.getKey(), a.value * entry.getValue());
-        }
-        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
-            final int id = entry.getKey();
-            final Double old = derivatives.get(id);
-            if (old == null) {
-                derivatives.put(id, value * entry.getValue());
-            } else {
-                derivatives.put(id, old + value * entry.getValue());
-            }
-        }
-        value *= a.value;
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient multiply(final double c) {
-        return new SparseGradient(value * c, c, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient multiply(final int n) {
-        return new SparseGradient(value * n, n, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient divide(final SparseGradient a) {
-        final SparseGradient out = new SparseGradient(value / a.value, Collections.<Integer, Double> emptyMap());
-
-        // Derivatives.
-        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
-            out.derivatives.put(entry.getKey(), entry.getValue() / a.value);
-        }
-        for (Map.Entry<Integer, Double> entry : a.derivatives.entrySet()) {
-            final int id = entry.getKey();
-            final Double old = out.derivatives.get(id);
-            if (old == null) {
-                out.derivatives.put(id, -out.value / a.value * entry.getValue());
-            } else {
-                out.derivatives.put(id, old - out.value / a.value * entry.getValue());
-            }
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient divide(final double c) {
-        return new SparseGradient(value / c, 1.0 / c, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient negate() {
-        return new SparseGradient(-value, -1.0, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public Field<SparseGradient> getField() {
-        return new Field<SparseGradient>() {
-
-            /** {@inheritDoc} */
-            public SparseGradient getZero() {
-                return createConstant(0);
-            }
-
-            /** {@inheritDoc} */
-            public SparseGradient getOne() {
-                return createConstant(1);
-            }
-
-            /** {@inheritDoc} */
-            public Class<? extends FieldElement<SparseGradient>> getRuntimeClass() {
-                return SparseGradient.class;
-            }
-
-        };
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient remainder(final double a) {
-        return new SparseGradient(FastMath.IEEEremainder(value, a), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient remainder(final SparseGradient a) {
-
-        // compute k such that lhs % rhs = lhs - k rhs
-        final double rem = FastMath.IEEEremainder(value, a.value);
-        final double k   = FastMath.rint((value - rem) / a.value);
-
-        return subtract(a.multiply(k));
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient abs() {
-        if (Double.doubleToLongBits(value) < 0) {
-            // we use the bits representation to also handle -0.0
-            return negate();
-        } else {
-            return this;
-        }
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient ceil() {
-        return createConstant(FastMath.ceil(value));
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient floor() {
-        return createConstant(FastMath.floor(value));
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient rint() {
-        return createConstant(FastMath.rint(value));
-    }
-
-    /** {@inheritDoc} */
-    public long round() {
-        return FastMath.round(value);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient signum() {
-        return createConstant(FastMath.signum(value));
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient copySign(final SparseGradient sign) {
-        final long m = Double.doubleToLongBits(value);
-        final long s = Double.doubleToLongBits(sign.value);
-        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
-            return this;
-        }
-        return negate(); // flip sign
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient copySign(final double sign) {
-        final long m = Double.doubleToLongBits(value);
-        final long s = Double.doubleToLongBits(sign);
-        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
-            return this;
-        }
-        return negate(); // flip sign
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient scalb(final int n) {
-        final SparseGradient out = new SparseGradient(FastMath.scalb(value, n), Collections.<Integer, Double> emptyMap());
-        for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
-            out.derivatives.put(entry.getKey(), FastMath.scalb(entry.getValue(), n));
-        }
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient hypot(final SparseGradient y) {
-        if (Double.isInfinite(value) || Double.isInfinite(y.value)) {
-            return createConstant(Double.POSITIVE_INFINITY);
-        } else if (Double.isNaN(value) || Double.isNaN(y.value)) {
-            return createConstant(Double.NaN);
-        } else {
-
-            final int expX = FastMath.getExponent(value);
-            final int expY = FastMath.getExponent(y.value);
-            if (expX > expY + 27) {
-                // y is negligible with respect to x
-                return abs();
-            } else if (expY > expX + 27) {
-                // x is negligible with respect to y
-                return y.abs();
-            } else {
-
-                // find an intermediate scale to avoid both overflow and underflow
-                final int middleExp = (expX + expY) / 2;
-
-                // scale parameters without losing precision
-                final SparseGradient scaledX = scalb(-middleExp);
-                final SparseGradient scaledY = y.scalb(-middleExp);
-
-                // compute scaled hypotenuse
-                final SparseGradient scaledH =
-                        scaledX.multiply(scaledX).add(scaledY.multiply(scaledY)).sqrt();
-
-                // remove scaling
-                return scaledH.scalb(middleExp);
-
-            }
-
-        }
-    }
-
-    /**
-     * Returns the hypotenuse of a triangle with sides {@code x} and {@code y}
-     * - sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)<br/>
-     * avoiding intermediate overflow or underflow.
-     *
-     * <ul>
-     * <li> If either argument is infinite, then the result is positive infinity.</li>
-     * <li> else, if either argument is NaN then the result is NaN.</li>
-     * </ul>
-     *
-     * @param x a value
-     * @param y a value
-     * @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
-     */
-    public static SparseGradient hypot(final SparseGradient x, final SparseGradient y) {
-        return x.hypot(y);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient reciprocal() {
-        return new SparseGradient(1.0 / value, -1.0 / (value * value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient sqrt() {
-        final double sqrt = FastMath.sqrt(value);
-        return new SparseGradient(sqrt, 0.5 / sqrt, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient cbrt() {
-        final double cbrt = FastMath.cbrt(value);
-        return new SparseGradient(cbrt, 1.0 / (3 * cbrt * cbrt), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient rootN(final int n) {
-        if (n == 2) {
-            return sqrt();
-        } else if (n == 3) {
-            return cbrt();
-        } else {
-            final double root = FastMath.pow(value, 1.0 / n);
-            return new SparseGradient(root, 1.0 / (n * FastMath.pow(root, n - 1)), derivatives);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient pow(final double p) {
-        return new SparseGradient(FastMath.pow(value,  p), p * FastMath.pow(value,  p - 1), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient pow(final int n) {
-        if (n == 0) {
-            return getField().getOne();
-        } else {
-            final double valueNm1 = FastMath.pow(value,  n - 1);
-            return new SparseGradient(value * valueNm1, n * valueNm1, derivatives);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient pow(final SparseGradient e) {
-        return log().multiply(e).exp();
-    }
-
-    /** Compute a<sup>x</sup> where a is a double and x a {@link SparseGradient}
-     * @param a number to exponentiate
-     * @param x power to apply
-     * @return a<sup>x</sup>
-     */
-    public static SparseGradient pow(final double a, final SparseGradient x) {
-        if (a == 0) {
-            if (x.value == 0) {
-                return x.compose(1.0, Double.NEGATIVE_INFINITY);
-            } else if (x.value < 0) {
-                return x.compose(Double.NaN, Double.NaN);
-            } else {
-                return x.getField().getZero();
-            }
-        } else {
-            final double ax = FastMath.pow(a, x.value);
-            return new SparseGradient(ax, ax * FastMath.log(a), x.derivatives);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient exp() {
-        final double e = FastMath.exp(value);
-        return new SparseGradient(e, e, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient expm1() {
-        return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient log() {
-        return new SparseGradient(FastMath.log(value), 1.0 / value, derivatives);
-    }
-
-    /** Base 10 logarithm.
-     * @return base 10 logarithm of the instance
-     */
-    public SparseGradient log10() {
-        return new SparseGradient(FastMath.log10(value), 1.0 / (FastMath.log(10.0) * value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient log1p() {
-        return new SparseGradient(FastMath.log1p(value), 1.0 / (1.0 + value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient cos() {
-        return new SparseGradient(FastMath.cos(value), -FastMath.sin(value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient sin() {
-        return new SparseGradient(FastMath.sin(value), FastMath.cos(value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient tan() {
-        final double t = FastMath.tan(value);
-        return new SparseGradient(t, 1 + t * t, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient acos() {
-        return new SparseGradient(FastMath.acos(value), -1.0 / FastMath.sqrt(1 - value * value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient asin() {
-        return new SparseGradient(FastMath.asin(value), 1.0 / FastMath.sqrt(1 - value * value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient atan() {
-        return new SparseGradient(FastMath.atan(value), 1.0 / (1 + value * value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient atan2(final SparseGradient x) {
-
-        // compute r = sqrt(x^2+y^2)
-        final SparseGradient r = multiply(this).add(x.multiply(x)).sqrt();
-
-        final SparseGradient a;
-        if (x.value >= 0) {
-
-            // compute atan2(y, x) = 2 atan(y / (r + x))
-            a = divide(r.add(x)).atan().multiply(2);
-
-        } else {
-
-            // compute atan2(y, x) = +/- pi - 2 atan(y / (r - x))
-            final SparseGradient tmp = divide(r.subtract(x)).atan().multiply(-2);
-            a = tmp.add(tmp.value <= 0 ? -FastMath.PI : FastMath.PI);
-
-        }
-
-        // fix value to take special cases (+0/+0, +0/-0, -0/+0, -0/-0, +/-infinity) correctly
-        a.value = FastMath.atan2(value, x.value);
-
-        return a;
-
-    }
-
-    /** Two arguments arc tangent operation.
-     * @param y first argument of the arc tangent
-     * @param x second argument of the arc tangent
-     * @return atan2(y, x)
-     */
-    public static SparseGradient atan2(final SparseGradient y, final SparseGradient x) {
-        return y.atan2(x);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient cosh() {
-        return new SparseGradient(FastMath.cosh(value), FastMath.sinh(value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient sinh() {
-        return new SparseGradient(FastMath.sinh(value), FastMath.cosh(value), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient tanh() {
-        final double t = FastMath.tanh(value);
-        return new SparseGradient(t, 1 - t * t, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient acosh() {
-        return new SparseGradient(FastMath.acosh(value), 1.0 / FastMath.sqrt(value * value - 1.0), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient asinh() {
-        return new SparseGradient(FastMath.asinh(value), 1.0 / FastMath.sqrt(value * value + 1.0), derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient atanh() {
-        return new SparseGradient(FastMath.atanh(value), 1.0 / (1.0 - value * value), derivatives);
-    }
-
-    /** Convert radians to degrees, with error of less than 0.5 ULP
-     *  @return instance converted into degrees
-     */
-    public SparseGradient toDegrees() {
-        return new SparseGradient(FastMath.toDegrees(value), FastMath.toDegrees(1.0), derivatives);
-    }
-
-    /** Convert degrees to radians, with error of less than 0.5 ULP
-     *  @return instance converted into radians
-     */
-    public SparseGradient toRadians() {
-        return new SparseGradient(FastMath.toRadians(value), FastMath.toRadians(1.0), derivatives);
-    }
-
-    /** Evaluate Taylor expansion of a sparse gradient.
-     * @param delta parameters offsets (&Delta;x, &Delta;y, ...)
-     * @return value of the Taylor expansion at x + &Delta;x, y + &Delta;y, ...
-     */
-    public double taylor(final double ... delta) {
-        double y = value;
-        for (int i = 0; i < delta.length; ++i) {
-            y += delta[i] * getDerivative(i);
-        }
-        return y;
-    }
-
-    /** Compute composition of the instance by a univariate function.
-     * @param f0 value of the function at (i.e. f({@link #getValue()}))
-     * @param f1 first derivative of the function at
-     * the current point (i.e. f'({@link #getValue()}))
-     * @return f(this)
-    */
-    public SparseGradient compose(final double f0, final double f1) {
-        return new SparseGradient(f0, f1, derivatives);
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final SparseGradient[] a,
-                                              final SparseGradient[] b)
-        throws DimensionMismatchException {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = a[0].getField().getZero();
-        for (int i = 0; i < a.length; ++i) {
-            out = out.add(a[i].multiply(b[i]));
-        }
-
-        // recompute an accurate value, taking care of cancellations
-        final double[] aDouble = new double[a.length];
-        for (int i = 0; i < a.length; ++i) {
-            aDouble[i] = a[i].getValue();
-        }
-        final double[] bDouble = new double[b.length];
-        for (int i = 0; i < b.length; ++i) {
-            bDouble[i] = b[i].getValue();
-        }
-        out.value = MathArrays.linearCombination(aDouble, bDouble);
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final double[] a, final SparseGradient[] b) {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = b[0].getField().getZero();
-        for (int i = 0; i < a.length; ++i) {
-            out = out.add(b[i].multiply(a[i]));
-        }
-
-        // recompute an accurate value, taking care of cancellations
-        final double[] bDouble = new double[b.length];
-        for (int i = 0; i < b.length; ++i) {
-            bDouble[i] = b[i].getValue();
-        }
-        out.value = MathArrays.linearCombination(a, bDouble);
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
-                                              final SparseGradient a2, final SparseGradient b2) {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = a1.multiply(b1).add(a2.multiply(b2));
-
-        // recompute an accurate value, taking care of cancellations
-        out.value = MathArrays.linearCombination(a1.value, b1.value, a2.value, b2.value);
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final double a1, final SparseGradient b1,
-                                              final double a2, final SparseGradient b2) {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = b1.multiply(a1).add(b2.multiply(a2));
-
-        // recompute an accurate value, taking care of cancellations
-        out.value = MathArrays.linearCombination(a1, b1.value, a2, b2.value);
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
-                                              final SparseGradient a2, final SparseGradient b2,
-                                              final SparseGradient a3, final SparseGradient b3) {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3));
-
-        // recompute an accurate value, taking care of cancellations
-        out.value = MathArrays.linearCombination(a1.value, b1.value,
-                                                 a2.value, b2.value,
-                                                 a3.value, b3.value);
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final double a1, final SparseGradient b1,
-                                              final double a2, final SparseGradient b2,
-                                              final double a3, final SparseGradient b3) {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3));
-
-        // recompute an accurate value, taking care of cancellations
-        out.value = MathArrays.linearCombination(a1, b1.value,
-                                                 a2, b2.value,
-                                                 a3, b3.value);
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
-                                              final SparseGradient a2, final SparseGradient b2,
-                                              final SparseGradient a3, final SparseGradient b3,
-                                              final SparseGradient a4, final SparseGradient b4) {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3)).add(a4.multiply(b4));
-
-        // recompute an accurate value, taking care of cancellations
-        out.value = MathArrays.linearCombination(a1.value, b1.value,
-                                                 a2.value, b2.value,
-                                                 a3.value, b3.value,
-                                                 a4.value, b4.value);
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public SparseGradient linearCombination(final double a1, final SparseGradient b1,
-                                              final double a2, final SparseGradient b2,
-                                              final double a3, final SparseGradient b3,
-                                              final double a4, final SparseGradient b4) {
-
-        // compute a simple value, with all partial derivatives
-        SparseGradient out = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3)).add(b4.multiply(a4));
-
-        // recompute an accurate value, taking care of cancellations
-        out.value = MathArrays.linearCombination(a1, b1.value,
-                                                 a2, b2.value,
-                                                 a3, b3.value,
-                                                 a4, b4.value);
-
-        return out;
-
-    }
-
-    /**
-     * Test for the equality of two sparse gradients.
-     * <p>
-     * Sparse gradients are considered equal if they have the same value
-     * and the same derivatives.
-     * </p>
-     * @param other Object to test for equality to this
-     * @return true if two sparse gradients are equal
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof SparseGradient) {
-            final SparseGradient rhs = (SparseGradient)other;
-            if (!Precision.equals(value, rhs.value, 1)) {
-                return false;
-            }
-            if (derivatives.size() != rhs.derivatives.size()) {
-                return false;
-            }
-            for (final Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
-                if (!rhs.derivatives.containsKey(entry.getKey())) {
-                    return false;
-                }
-                if (!Precision.equals(entry.getValue(), rhs.derivatives.get(entry.getKey()), 1)) {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        return false;
-
-    }
-
-    /**
-     * Get a hashCode for the derivative structure.
-     * @return a hash code value for this object
-     * @since 3.2
-     */
-    @Override
-    public int hashCode() {
-        return 743 + 809 * MathUtils.hash(value) + 167 * derivatives.hashCode();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.java
deleted file mode 100644
index 097b4e0..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableFunction.java
+++ /dev/null
@@ -1,43 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-
-/** Interface for univariate functions derivatives.
- * <p>This interface represents a simple function which computes
- * both the value and the first derivative of a mathematical function.
- * The derivative is computed with respect to the input variable.</p>
- * @see UnivariateDifferentiableFunction
- * @see UnivariateFunctionDifferentiator
- * @since 3.1
- */
-public interface UnivariateDifferentiableFunction extends UnivariateFunction {
-
-    /** Simple mathematical function.
-     * <p>{@link UnivariateDifferentiableFunction} classes compute both the
-     * value and the first derivative of the function.</p>
-     * @param t function input value
-     * @return function result
-     * @exception DimensionMismatchException if t is inconsistent with the
-     * function's free parameters or order
-     */
-    DerivativeStructure value(DerivativeStructure t)
-        throws DimensionMismatchException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
deleted file mode 100644
index b31771b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableMatrixFunction.java
+++ /dev/null
@@ -1,40 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-/**
- * Extension of {@link UnivariateMatrixFunction} representing a univariate differentiable matrix function.
- *
- * @since 3.1
- */
-public interface UnivariateDifferentiableMatrixFunction
-    extends UnivariateMatrixFunction {
-
-    /**
-     * Compute the value for the function.
-     * @param x the point for which the function value should be computed
-     * @return the value
-     * @exception MathIllegalArgumentException if {@code x} does not
-     * satisfy the function's constraints (argument out of bound, or unsupported
-     * derivative order for example)
-     */
-    DerivativeStructure[][] value(DerivativeStructure x) throws MathIllegalArgumentException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
deleted file mode 100644
index 7e79eef..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateDifferentiableVectorFunction.java
+++ /dev/null
@@ -1,40 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.UnivariateVectorFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-/**
- * Extension of {@link UnivariateVectorFunction} representing a univariate differentiable vectorial function.
- *
- * @since 3.1
- */
-public interface UnivariateDifferentiableVectorFunction
-    extends UnivariateVectorFunction {
-
-    /**
-     * Compute the value for the function.
-     * @param x the point for which the function value should be computed
-     * @return the value
-     * @exception MathIllegalArgumentException if {@code x} does not
-     * satisfy the function's constraints (argument out of bound, or unsupported
-     * derivative order for example)
-     */
-    DerivativeStructure[] value(DerivativeStructure x) throws MathIllegalArgumentException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.java
deleted file mode 100644
index f19ce20..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateFunctionDifferentiator.java
+++ /dev/null
@@ -1,33 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-
-/** Interface defining the function differentiation operation.
- * @since 3.1
- */
-public interface UnivariateFunctionDifferentiator {
-
-    /** Create an implementation of a {@link UnivariateDifferentiableFunction
-     * differential} from a regular {@link UnivariateFunction function}.
-     * @param function function to differentiate
-     * @return differential function
-     */
-    UnivariateDifferentiableFunction differentiate(UnivariateFunction function);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
deleted file mode 100644
index bc0ccf3..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateMatrixFunctionDifferentiator.java
+++ /dev/null
@@ -1,33 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
-
-/** Interface defining the function differentiation operation.
- * @since 3.1
- */
-public interface UnivariateMatrixFunctionDifferentiator {
-
-    /** Create an implementation of a {@link UnivariateDifferentiableMatrixFunction
-     * differential} from a regular {@link UnivariateMatrixFunction matrix function}.
-     * @param function function to differentiate
-     * @return differential function
-     */
-    UnivariateDifferentiableMatrixFunction differentiate(UnivariateMatrixFunction function);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
deleted file mode 100644
index 5500c50..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/UnivariateVectorFunctionDifferentiator.java
+++ /dev/null
@@ -1,33 +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.analysis.differentiation;
-
-import org.apache.commons.math3.analysis.UnivariateVectorFunction;
-
-/** Interface defining the function differentiation operation.
- * @since 3.1
- */
-public interface UnivariateVectorFunctionDifferentiator {
-
-    /** Create an implementation of a {@link UnivariateDifferentiableVectorFunction
-     * differential} from a regular {@link UnivariateVectorFunction vector function}.
-     * @param function function to differentiate
-     * @return differential function
-     */
-    UnivariateDifferentiableVectorFunction differentiate(UnivariateVectorFunction function);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java
deleted file mode 100644
index b828981..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/package-info.java
+++ /dev/null
@@ -1,42 +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.
- */
-/**
- *
- * <p>
- *   This package holds the main interfaces and basic building block classes
- *   dealing with differentiation.
- *   The core class is {@link org.apache.commons.math3.analysis.differentiation.DerivativeStructure
- *   DerivativeStructure} which holds the value and the differentials of a function. This class
- *   handles some arbitrary number of free parameters and arbitrary differentiation order. It is used
- *   both as the input and the output type for the {@link
- *   org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
- *   UnivariateDifferentiableFunction} interface. Any differentiable function should implement this
- *   interface.
- * </p>
- * <p>
- *   The {@link org.apache.commons.math3.analysis.differentiation.UnivariateFunctionDifferentiator
- *   UnivariateFunctionDifferentiator} interface defines a way to differentiate a simple {@link
- *   org.apache.commons.math3.analysis.UnivariateFunction UnivariateFunction} and get a {@link
- *   org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction
- *   UnivariateDifferentiableFunction}.
- * </p>
- * <p>
- *   Similar interfaces also exist for multivariate functions and for vector or matrix valued functions.
- * </p>
- *
- */
-package org.apache.commons.math3.analysis.differentiation;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Abs.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Abs.java b/src/main/java/org/apache/commons/math3/analysis/function/Abs.java
deleted file mode 100644
index 9db01fd..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Abs.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Absolute value function.
- *
- * @since 3.0
- */
-public class Abs implements UnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.abs(x);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Acos.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Acos.java b/src/main/java/org/apache/commons/math3/analysis/function/Acos.java
deleted file mode 100644
index a9df4b7..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Acos.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Arc-cosine function.
- *
- * @since 3.0
- */
-public class Acos implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.acos(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.acos();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Acosh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Acosh.java b/src/main/java/org/apache/commons/math3/analysis/function/Acosh.java
deleted file mode 100644
index 58fb19f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Acosh.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Hyperbolic arc-cosine function.
- *
- * @since 3.0
- */
-public class Acosh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.acosh(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.acosh();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Add.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Add.java b/src/main/java/org/apache/commons/math3/analysis/function/Add.java
deleted file mode 100644
index 366a303..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Add.java
+++ /dev/null
@@ -1,32 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-
-/**
- * Add the two operands.
- *
- * @since 3.0
- */
-public class Add implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return x + y;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Asin.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Asin.java b/src/main/java/org/apache/commons/math3/analysis/function/Asin.java
deleted file mode 100644
index 8fa9bdf..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Asin.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Arc-sine function.
- *
- * @since 3.0
- */
-public class Asin implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.asin(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.asin();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Asinh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Asinh.java b/src/main/java/org/apache/commons/math3/analysis/function/Asinh.java
deleted file mode 100644
index b5b9fd2..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Asinh.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Hyperbolic arc-sine function.
- *
- * @since 3.0
- */
-public class Asinh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.asinh(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.asinh();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Atan.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Atan.java b/src/main/java/org/apache/commons/math3/analysis/function/Atan.java
deleted file mode 100644
index 36b1265..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Atan.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Arc-tangent function.
- *
- * @since 3.0
- */
-public class Atan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.atan(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.atan();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Atan2.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Atan2.java b/src/main/java/org/apache/commons/math3/analysis/function/Atan2.java
deleted file mode 100644
index d5f385f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Atan2.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Arc-tangent function.
- *
- * @since 3.0
- */
-public class Atan2 implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return FastMath.atan2(x, y);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Atanh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Atanh.java b/src/main/java/org/apache/commons/math3/analysis/function/Atanh.java
deleted file mode 100644
index 5c04599..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Atanh.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Hyperbolic arc-tangent function.
- *
- * @since 3.0
- */
-public class Atanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.atanh(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.atanh();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Cbrt.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Cbrt.java b/src/main/java/org/apache/commons/math3/analysis/function/Cbrt.java
deleted file mode 100644
index f26ef71..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Cbrt.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Cube root function.
- *
- * @since 3.0
- */
-public class Cbrt implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.cbrt(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.cbrt();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Ceil.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Ceil.java b/src/main/java/org/apache/commons/math3/analysis/function/Ceil.java
deleted file mode 100644
index 2b9867e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Ceil.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * {@code ceil} function.
- *
- * @since 3.0
- */
-public class Ceil implements UnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.ceil(x);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Constant.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Constant.java b/src/main/java/org/apache/commons/math3/analysis/function/Constant.java
deleted file mode 100644
index 4027e59..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Constant.java
+++ /dev/null
@@ -1,60 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-
-/**
- * Constant function.
- *
- * @since 3.0
- */
-public class Constant implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** Constant. */
-    private final double c;
-
-    /**
-     * @param c Constant.
-     */
-    public Constant(double c) {
-        this.c = c;
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return c;
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public DifferentiableUnivariateFunction derivative() {
-        return new Constant(0);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return new DerivativeStructure(t.getFreeParameters(), t.getOrder(), c);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Cos.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Cos.java b/src/main/java/org/apache/commons/math3/analysis/function/Cos.java
deleted file mode 100644
index 73a5e6e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Cos.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Cosine function.
- *
- * @since 3.0
- */
-public class Cos implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.cos(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.cos();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Cosh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Cosh.java b/src/main/java/org/apache/commons/math3/analysis/function/Cosh.java
deleted file mode 100644
index 185698b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Cosh.java
+++ /dev/null
@@ -1,51 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Hyperbolic cosine function.
- *
- * @since 3.0
- */
-public class Cosh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.cosh(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public DifferentiableUnivariateFunction derivative() {
-        return new Sinh();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.cosh();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Divide.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Divide.java b/src/main/java/org/apache/commons/math3/analysis/function/Divide.java
deleted file mode 100644
index 73413a2..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Divide.java
+++ /dev/null
@@ -1,32 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-
-/**
- * Divide the first operand by the second.
- *
- * @since 3.0
- */
-public class Divide implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return x / y;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Exp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Exp.java b/src/main/java/org/apache/commons/math3/analysis/function/Exp.java
deleted file mode 100644
index f656712..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Exp.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Exponential function.
- *
- * @since 3.0
- */
-public class Exp implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.exp(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.exp();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Expm1.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Expm1.java b/src/main/java/org/apache/commons/math3/analysis/function/Expm1.java
deleted file mode 100644
index 46b0b2f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Expm1.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <code>e<sup>x</sup>-1</code> function.
- *
- * @since 3.0
- */
-public class Expm1 implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.expm1(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.expm1();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Floor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Floor.java b/src/main/java/org/apache/commons/math3/analysis/function/Floor.java
deleted file mode 100644
index 8d70627..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Floor.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * {@code floor} function.
- *
- * @since 3.0
- */
-public class Floor implements UnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.floor(x);
-    }
-}


[56/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolatorTest.java
index 7962e94..78e90df 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,16 +25,17 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
-import org.apache.commons.math3.util.FastMath;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.HighamHall54Integrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherIntegratorTest.java
index e3c5fe2..3c40b74 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherIntegratorTest.java
@@ -15,25 +15,27 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemFactory;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemFactory;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.LutherIntegrator;
+import org.apache.commons.math4.ode.nonstiff.RungeKuttaIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolatorTest.java
index d29fe20..a5a9db5 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,14 +25,15 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.LutherIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegratorTest.java
index 0b01ddf..179574d 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegratorTest.java
@@ -15,24 +15,25 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemFactory;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemFactory;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.MidpointIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolatorTest.java
index 0f32602..690ac6c 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,15 +25,16 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.MidpointIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/StepProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/StepProblem.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/StepProblem.java
index b4c8235..5a52597 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/StepProblem.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/StepProblem.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.events.EventHandler;
+import org.apache.commons.math4.ode.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.events.EventHandler;
 
 
 public class StepProblem

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegratorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegratorTest.java
index ffc33c4..9de0fbe 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegratorTest.java
@@ -15,25 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.TestProblem5;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.ode.TestProblemFactory;
-import org.apache.commons.math3.ode.TestProblemHandler;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.TestProblem5;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.TestProblemFactory;
+import org.apache.commons.math4.ode.TestProblemHandler;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.nonstiff.ThreeEighthesIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java
index 965bf6b..879ad96 100644
--- a/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,14 +25,15 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.ode.sampling.StepInterpolatorTestUtils;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.ThreeEighthesIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolatorTestUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolator.java b/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolator.java
index a7f1aa7..f2953fc 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolator.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolator.java
@@ -15,13 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.apache.commons.math3.ode.EquationsMapper;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /** This class is a step interpolator that does nothing.
  *
@@ -51,7 +54,7 @@ public class DummyStepInterpolator
    * should be called before using the instance in order to initialize
    * the internal arrays. This constructor is used only in order to delay
    * the initialization in some cases. As an example, the {@link
-   * org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator} uses
+   * org.apache.commons.math4.ode.nonstiff.EmbeddedRungeKuttaIntegrator} uses
    * the prototyping design pattern to create the step interpolators by
    * cloning an uninitialized model and latter initializing the copy.
    */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolatorTest.java
index 3f4ad37..69a1d55 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/DummyStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 
 import java.io.ByteArrayInputStream;
@@ -24,8 +24,9 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolatorTest.java b/src/test/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolatorTest.java
index f11df71..57a3466 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolatorTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 
 import java.io.ByteArrayInputStream;
@@ -25,14 +25,15 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Random;
 
-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.ContinuousOutputModel;
-import org.apache.commons.math3.ode.TestProblem1;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator;
+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.ContinuousOutputModel;
+import org.apache.commons.math4.ode.TestProblem1;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.AdamsBashforthIntegrator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java b/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java
index 9a98a59..1738961 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/StepInterpolatorTestUtils.java
@@ -14,16 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ode.sampling;
-
-
-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.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblemAbstract;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.sampling;
+
+
+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.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblemAbstract;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 
 public class StepInterpolatorTestUtils {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputOverlapTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputOverlapTest.java b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputOverlapTest.java
index a1a7da3..0497423 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputOverlapTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputOverlapTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 /** Step normalizer output tests, for problems where the first and last points
  * are overlap fixed points.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTest.java b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTest.java
index 8063e99..2518185 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 /** Step normalizer output tests, for problems where the first and last points
  * are not fixed points.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java
index f862dad..0013052 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerOutputTestBase.java
@@ -15,20 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 import org.junit.Assert;
 
 import java.util.ArrayList;
 import java.util.List;
 
-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.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.ode.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.nonstiff.GraggBulirschStoerIntegrator;
+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.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.ode.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.nonstiff.GraggBulirschStoerIntegrator;
+import org.apache.commons.math4.ode.sampling.FixedStepHandler;
+import org.apache.commons.math4.ode.sampling.StepNormalizer;
+import org.apache.commons.math4.ode.sampling.StepNormalizerBounds;
+import org.apache.commons.math4.ode.sampling.StepNormalizerMode;
 import org.junit.Test;
 
 /** Base class for step normalizer output tests. */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerTest.java b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerTest.java
index 08096fe..3a8ba4b 100644
--- a/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerTest.java
+++ b/src/test/java/org/apache/commons/math4/ode/sampling/StepNormalizerTest.java
@@ -15,16 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
-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.FirstOrderIntegrator;
-import org.apache.commons.math3.ode.TestProblem3;
-import org.apache.commons.math3.ode.nonstiff.DormandPrince54Integrator;
-import org.apache.commons.math3.util.FastMath;
+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.FirstOrderIntegrator;
+import org.apache.commons.math4.ode.TestProblem3;
+import org.apache.commons.math4.ode.nonstiff.DormandPrince54Integrator;
+import org.apache.commons.math4.ode.sampling.FixedStepHandler;
+import org.apache.commons.math4.ode.sampling.StepNormalizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/PointValuePairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/PointValuePairTest.java b/src/test/java/org/apache/commons/math4/optim/PointValuePairTest.java
index 7146d15..c070d00 100644
--- a/src/test/java/org/apache/commons/math4/optim/PointValuePairTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/PointValuePairTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.optim.PointValuePair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/PointVectorValuePairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/PointVectorValuePairTest.java b/src/test/java/org/apache/commons/math4/optim/PointVectorValuePairTest.java
index 427bac0..534ce07 100644
--- a/src/test/java/org/apache/commons/math4/optim/PointVectorValuePairTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/PointVectorValuePairTest.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.optim.PointVectorValuePair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java
index f5b057a..e363214 100644
--- a/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/SimplePointCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimplePointChecker;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/SimpleValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math4/optim/SimpleValueCheckerTest.java
index f4b7f2f..64ff78c 100644
--- a/src/test/java/org/apache/commons/math4/optim/SimpleValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/SimpleValueCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleValueChecker;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/SimpleVectorValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/SimpleVectorValueCheckerTest.java b/src/test/java/org/apache/commons/math4/optim/SimpleVectorValueCheckerTest.java
index c9dcedc..3704da7 100644
--- a/src/test/java/org/apache/commons/math4/optim/SimpleVectorValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/SimpleVectorValueCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
index 0728be1..b112ac7 100644
--- a/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/linear/SimplexSolverTest.java
@@ -14,17 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.exception.TooManyIterationsException;
-import org.apache.commons.math3.optim.MaxIter;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.TooManyIterationsException;
+import org.apache.commons.math4.optim.MaxIter;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.linear.LinearConstraint;
+import org.apache.commons.math4.optim.linear.LinearConstraintSet;
+import org.apache.commons.math4.optim.linear.LinearObjectiveFunction;
+import org.apache.commons.math4.optim.linear.NoFeasibleSolutionException;
+import org.apache.commons.math4.optim.linear.NonNegativeConstraint;
+import org.apache.commons.math4.optim.linear.PivotSelectionRule;
+import org.apache.commons.math4.optim.linear.Relationship;
+import org.apache.commons.math4.optim.linear.SimplexSolver;
+import org.apache.commons.math4.optim.linear.SolutionCallback;
+import org.apache.commons.math4.optim.linear.UnboundedSolutionException;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java b/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java
index 358416a..e0c99da 100644
--- a/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/linear/SimplexTableauTest.java
@@ -14,12 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.util.ArrayList;
 import java.util.Collection;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.optim.linear.LinearConstraint;
+import org.apache.commons.math4.optim.linear.LinearObjectiveFunction;
+import org.apache.commons.math4.optim.linear.Relationship;
+import org.apache.commons.math4.optim.linear.SimplexTableau;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java
index ba03ef1..cdaf3b9 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultiStartMultivariateOptimizerTest.java
@@ -14,22 +14,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.SimpleValueChecker;
-import org.apache.commons.math3.optim.nonlinear.scalar.gradient.CircleScalar;
-import org.apache.commons.math3.optim.nonlinear.scalar.gradient.NonLinearConjugateGradientOptimizer;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
-import org.apache.commons.math3.random.GaussianRandomGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleValueChecker;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.GradientMultivariateOptimizer;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultiStartMultivariateOptimizer;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.gradient.CircleScalar;
+import org.apache.commons.math4.optim.nonlinear.scalar.gradient.NonLinearConjugateGradientOptimizer;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomVectorGenerator;
+import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapterTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapterTest.java
index 932f362..ed67a63 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapterTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionMappingAdapterTest.java
@@ -14,15 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
+package org.apache.commons.math4.optim.nonlinear.scalar;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateFunctionMappingAdapter;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.AbstractSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapterTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapterTest.java
index 5b14f5e..0c02844 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapterTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/MultivariateFunctionPenaltyAdapterTest.java
@@ -14,16 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.SimplePointChecker;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.AbstractSimplex;
-import org.apache.commons.math3.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
+package org.apache.commons.math4.optim.nonlinear.scalar;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimplePointChecker;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateFunctionPenaltyAdapter;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.AbstractSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java
index 1b55014..4c2acaa 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/CircleScalar.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.gradient;
+package org.apache.commons.math4.optim.nonlinear.scalar.gradient;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunctionGradient;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunctionGradient;
 
 /**
  * Class used in the tests.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java
index bf22542..1298778 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/gradient/NonLinearConjugateGradientOptimizerTest.java
@@ -15,22 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.gradient;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.SimpleValueChecker;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunctionGradient;
+package org.apache.commons.math4.optim.nonlinear.scalar.gradient;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.SimpleValueChecker;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunctionGradient;
+import org.apache.commons.math4.optim.nonlinear.scalar.gradient.NonLinearConjugateGradientOptimizer;
+import org.apache.commons.math4.optim.nonlinear.scalar.gradient.Preconditioner;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
index f2f36e9..2bb5cb6 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/BOBYQAOptimizerTest.java
@@ -14,23 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
 import java.util.Arrays;
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.BOBYQAOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
index aade822..b6c5622 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/CMAESOptimizerTest.java
@@ -14,27 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
 import java.util.Arrays;
 import java.util.Random;
 
-import org.apache.commons.math3.Retry;
-import org.apache.commons.math3.RetryRunner;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.Retry;
+import org.apache.commons.math4.RetryRunner;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.CMAESOptimizer;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizerTest.java
index 708f77b..4d0be63 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/PowellOptimizerTest.java
@@ -14,18 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.SumSincFunction;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.SumSincFunction;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.PowellOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerMultiDirectionalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerMultiDirectionalTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerMultiDirectionalTest.java
index 931c226..8f5c726 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerMultiDirectionalTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerMultiDirectionalTest.java
@@ -15,18 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.SimpleValueChecker;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.SimpleValueChecker;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.MultiDirectionalSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerNelderMeadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerNelderMeadTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerNelderMeadTest.java
index d51025d..4f01d75 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerNelderMeadTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/scalar/noderiv/SimplexOptimizerNelderMeadTest.java
@@ -15,23 +15,25 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar.noderiv;
-
-
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;
-import org.apache.commons.math3.optim.nonlinear.scalar.LeastSquaresConverter;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optim.nonlinear.scalar.noderiv;
+
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.nonlinear.scalar.LeastSquaresConverter;
+import org.apache.commons.math4.optim.nonlinear.scalar.ObjectiveFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.NelderMeadSimplex;
+import org.apache.commons.math4.optim.nonlinear.scalar.noderiv.SimplexOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java
index af565e5..70b3f95 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/MultiStartMultivariateVectorOptimizerTest.java
@@ -14,23 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector;
-
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
-import org.apache.commons.math3.random.GaussianRandomGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator;
+package org.apache.commons.math4.optim.nonlinear.vector;
+
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.optim.nonlinear.vector.JacobianMultivariateVectorOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.optim.nonlinear.vector.MultiStartMultivariateVectorOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomVectorGenerator;
+import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
index 7a9c9eb..e2814fc 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -14,26 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.io.IOException;
 import java.util.Arrays;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java
index 92ad195..aad5e43 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTest.java
@@ -11,17 +11,18 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.io.IOException;
 import java.util.Arrays;
 
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java
index 575b95c..9235e6b 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/AbstractLeastSquaresOptimizerTestValidation.java
@@ -11,21 +11,22 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 import java.awt.geom.Point2D;
 
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 
@@ -33,7 +34,7 @@ import org.junit.Assert;
  * This class demonstrates the main functionality of the
  * {@link AbstractLeastSquaresOptimizer}, common to the
  * optimizer implementations in package
- * {@link org.apache.commons.math3.optimization.general}.
+ * {@link org.apache.commons.math4.optimization.general}.
  * <br/>
  * Not enabled by default, as the class name does not end with "Test".
  * <br/>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java
index fe2c3bc..9458fe8 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleProblem.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Class that models a circle.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java
index 2f63547..7b6a310 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/CircleVectorial.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
 
 /**
  * Class used in the tests.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java
index ee3d00f..7e73a9a 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/GaussNewtonOptimizerTest.java
@@ -15,19 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.io.IOException;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.SimpleVectorValueChecker;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java
index 9a27089..641f4d4 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/LevenbergMarquardtOptimizerTest.java
@@ -15,28 +15,30 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.SimpleBounds;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.SimpleBounds;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java
index 898dbdd..c3486c0 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/MinpackTest.java
@@ -15,21 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.optim.PointVectorValuePair;
-import org.apache.commons.math3.optim.InitialGuess;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.optim.nonlinear.vector.Target;
-import org.apache.commons.math3.optim.nonlinear.vector.Weight;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.InitialGuess;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.PointVectorValuePair;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.optim.nonlinear.vector.Target;
+import org.apache.commons.math4.optim.nonlinear.vector.Weight;
+import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 


[09/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/AbstractFieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/AbstractFieldMatrix.java b/src/main/java/org/apache/commons/math3/linear/AbstractFieldMatrix.java
deleted file mode 100644
index 686ffbb..0000000
--- a/src/main/java/org/apache/commons/math3/linear/AbstractFieldMatrix.java
+++ /dev/null
@@ -1,1156 +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.linear;
-
-import java.util.ArrayList;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Basic implementation of {@link FieldMatrix} methods regardless of the underlying storage.
- * <p>All the methods implemented here use {@link #getEntry(int, int)} to access
- * matrix elements. Derived class can provide faster implementations. </p>
- *
- * @param <T> Type of the field elements.
- *
- * @since 2.0
- */
-public abstract class AbstractFieldMatrix<T extends FieldElement<T>>
-    implements FieldMatrix<T> {
-    /** Field to which the elements belong. */
-    private final Field<T> field;
-
-    /**
-     * Constructor for use with Serializable
-     */
-    protected AbstractFieldMatrix() {
-        field = null;
-    }
-
-    /**
-     * Creates a matrix with no data
-     * @param field field to which the elements belong
-     */
-    protected AbstractFieldMatrix(final Field<T> field) {
-        this.field = field;
-    }
-
-    /**
-     * Create a new FieldMatrix<T> with the supplied row and column dimensions.
-     *
-     * @param field Field to which the elements belong.
-     * @param rowDimension Number of rows in the new matrix.
-     * @param columnDimension Number of columns in the new matrix.
-     * @throws NotStrictlyPositiveException if row or column dimension is not
-     * positive.
-     */
-    protected AbstractFieldMatrix(final Field<T> field,
-                                  final int rowDimension,
-                                  final int columnDimension)
-        throws NotStrictlyPositiveException {
-        if (rowDimension <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.DIMENSION,
-                                                   rowDimension);
-        }
-        if (columnDimension <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.DIMENSION,
-                                                   columnDimension);
-        }
-        this.field = field;
-    }
-
-    /**
-     * Get the elements type from an array.
-     *
-     * @param <T> Type of the field elements.
-     * @param d Data array.
-     * @return the field to which the array elements belong.
-     * @throws NullArgumentException if the array is {@code null}.
-     * @throws NoDataException if the array is empty.
-     */
-    protected static <T extends FieldElement<T>> Field<T> extractField(final T[][] d)
-        throws NoDataException, NullArgumentException {
-        if (d == null) {
-            throw new NullArgumentException();
-        }
-        if (d.length == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-        }
-        if (d[0].length == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-        }
-        return d[0][0].getField();
-    }
-
-    /**
-     * Get the elements type from an array.
-     *
-     * @param <T> Type of the field elements.
-     * @param d Data array.
-     * @return the field to which the array elements belong.
-     * @throws NoDataException if array is empty.
-     */
-    protected static <T extends FieldElement<T>> Field<T> extractField(final T[] d)
-        throws NoDataException {
-        if (d.length == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-        }
-        return d[0].getField();
-    }
-
-    /** Build an array of elements.
-     * <p>
-     * Complete arrays are filled with field.getZero()
-     * </p>
-     * @param <T> Type of the field elements
-     * @param field field to which array elements belong
-     * @param rows number of rows
-     * @param columns number of columns (may be negative to build partial
-     * arrays in the same way <code>new Field[rows][]</code> works)
-     * @return a new array
-     * @deprecated as of 3.2, replaced by {@link MathArrays#buildArray(Field, int, int)}
-     */
-    @Deprecated
-    protected static <T extends FieldElement<T>> T[][] buildArray(final Field<T> field,
-                                                                  final int rows,
-                                                                  final int columns) {
-        return MathArrays.buildArray(field, rows, columns);
-    }
-
-    /** Build an array of elements.
-     * <p>
-     * Arrays are filled with field.getZero()
-     * </p>
-     * @param <T> the type of the field elements
-     * @param field field to which array elements belong
-     * @param length of the array
-     * @return a new array
-     * @deprecated as of 3.2, replaced by {@link MathArrays#buildArray(Field, int)}
-     */
-    @Deprecated
-    protected static <T extends FieldElement<T>> T[] buildArray(final Field<T> field,
-                                                                final int length) {
-        return MathArrays.buildArray(field, length);
-    }
-
-    /** {@inheritDoc} */
-    public Field<T> getField() {
-        return field;
-    }
-
-    /** {@inheritDoc} */
-    public abstract FieldMatrix<T> createMatrix(final int rowDimension,
-                                                final int columnDimension)
-        throws NotStrictlyPositiveException;
-
-    /** {@inheritDoc} */
-    public abstract FieldMatrix<T> copy();
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> add(FieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        // safety check
-        checkAdditionCompatible(m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final FieldMatrix<T> out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col).add(m.getEntry(row, col)));
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> subtract(final FieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        // safety check
-        checkSubtractionCompatible(m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final FieldMatrix<T> out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col).subtract(m.getEntry(row, col)));
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> scalarAdd(final T d) {
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final FieldMatrix<T> out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col).add(d));
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> scalarMultiply(final T d) {
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final FieldMatrix<T> out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col).multiply(d));
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> multiply(final FieldMatrix<T> m)
-        throws DimensionMismatchException {
-        // safety check
-        checkMultiplicationCompatible(m);
-
-        final int nRows = getRowDimension();
-        final int nCols = m.getColumnDimension();
-        final int nSum  = getColumnDimension();
-        final FieldMatrix<T> out = createMatrix(nRows, nCols);
-        for (int row = 0; row < nRows; ++row) {
-            for (int col = 0; col < nCols; ++col) {
-                T sum = field.getZero();
-                for (int i = 0; i < nSum; ++i) {
-                    sum = sum.add(getEntry(row, i).multiply(m.getEntry(i, col)));
-                }
-                out.setEntry(row, col, sum);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> preMultiply(final FieldMatrix<T> m)
-        throws DimensionMismatchException {
-        return m.multiply(this);
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> power(final int p) throws NonSquareMatrixException,
-    NotPositiveException {
-        if (p < 0) {
-            throw new NotPositiveException(p);
-        }
-
-        if (!isSquare()) {
-            throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());
-        }
-
-        if (p == 0) {
-            return MatrixUtils.createFieldIdentityMatrix(this.getField(), this.getRowDimension());
-        }
-
-        if (p == 1) {
-            return this.copy();
-        }
-
-        final int power = p - 1;
-
-        /*
-         * Only log_2(p) operations is used by doing as follows:
-         * 5^214 = 5^128 * 5^64 * 5^16 * 5^4 * 5^2
-         *
-         * In general, the same approach is used for A^p.
-         */
-
-        final char[] binaryRepresentation = Integer.toBinaryString(power)
-                .toCharArray();
-        final ArrayList<Integer> nonZeroPositions = new ArrayList<Integer>();
-
-        for (int i = 0; i < binaryRepresentation.length; ++i) {
-            if (binaryRepresentation[i] == '1') {
-                final int pos = binaryRepresentation.length - i - 1;
-                nonZeroPositions.add(pos);
-            }
-        }
-
-        ArrayList<FieldMatrix<T>> results = new ArrayList<FieldMatrix<T>>(
-                binaryRepresentation.length);
-
-        results.add(0, this.copy());
-
-        for (int i = 1; i < binaryRepresentation.length; ++i) {
-            final FieldMatrix<T> s = results.get(i - 1);
-            final FieldMatrix<T> r = s.multiply(s);
-            results.add(i, r);
-        }
-
-        FieldMatrix<T> result = this.copy();
-
-        for (Integer i : nonZeroPositions) {
-            result = result.multiply(results.get(i));
-        }
-
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    public T[][] getData() {
-        final T[][] data = MathArrays.buildArray(field, getRowDimension(), getColumnDimension());
-
-        for (int i = 0; i < data.length; ++i) {
-            final T[] dataI = data[i];
-            for (int j = 0; j < dataI.length; ++j) {
-                dataI[j] = getEntry(i, j);
-            }
-        }
-
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> getSubMatrix(final int startRow, final int endRow,
-                                       final int startColumn, final int endColumn)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-
-        final FieldMatrix<T> subMatrix =
-            createMatrix(endRow - startRow + 1, endColumn - startColumn + 1);
-        for (int i = startRow; i <= endRow; ++i) {
-            for (int j = startColumn; j <= endColumn; ++j) {
-                subMatrix.setEntry(i - startRow, j - startColumn, getEntry(i, j));
-            }
-        }
-
-        return subMatrix;
-
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> getSubMatrix(final int[] selectedRows,
-                                       final int[] selectedColumns)
-    throws NoDataException, NullArgumentException, OutOfRangeException {
-
-        // safety checks
-        checkSubMatrixIndex(selectedRows, selectedColumns);
-
-        // copy entries
-        final FieldMatrix<T> subMatrix =
-            createMatrix(selectedRows.length, selectedColumns.length);
-        subMatrix.walkInOptimizedOrder(new DefaultFieldMatrixChangingVisitor<T>(field.getZero()) {
-
-            /** {@inheritDoc} */
-            @Override
-            public T visit(final int row, final int column, final T value) {
-                return getEntry(selectedRows[row], selectedColumns[column]);
-            }
-
-        });
-
-        return subMatrix;
-
-    }
-
-    /** {@inheritDoc} */
-    public void copySubMatrix(final int startRow, final int endRow,
-                              final int startColumn, final int endColumn,
-                              final T[][] destination)
-    throws MatrixDimensionMismatchException, NumberIsTooSmallException,
-    OutOfRangeException{
-        // safety checks
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        final int rowsCount    = endRow + 1 - startRow;
-        final int columnsCount = endColumn + 1 - startColumn;
-        if ((destination.length < rowsCount) || (destination[0].length < columnsCount)) {
-            throw new MatrixDimensionMismatchException(destination.length,
-                                                       destination[0].length,
-                                                       rowsCount,
-                                                       columnsCount);
-        }
-
-        // copy entries
-        walkInOptimizedOrder(new DefaultFieldMatrixPreservingVisitor<T>(field.getZero()) {
-
-            /** Initial row index. */
-            private int startRow;
-
-            /** Initial column index. */
-            private int startColumn;
-
-            /** {@inheritDoc} */
-            @Override
-            public void start(final int rows, final int columns,
-                              final int startRow, final int endRow,
-                              final int startColumn, final int endColumn) {
-                this.startRow    = startRow;
-                this.startColumn = startColumn;
-            }
-
-            /** {@inheritDoc} */
-            @Override
-            public void visit(final int row, final int column, final T value) {
-                destination[row - startRow][column - startColumn] = value;
-            }
-
-        }, startRow, endRow, startColumn, endColumn);
-
-    }
-
-    /** {@inheritDoc} */
-    public void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination)
-        throws MatrixDimensionMismatchException, NoDataException,
-        NullArgumentException, OutOfRangeException {
-        // safety checks
-        checkSubMatrixIndex(selectedRows, selectedColumns);
-        if ((destination.length < selectedRows.length) ||
-            (destination[0].length < selectedColumns.length)) {
-            throw new MatrixDimensionMismatchException(destination.length,
-                                                       destination[0].length,
-                                                       selectedRows.length,
-                                                       selectedColumns.length);
-        }
-
-        // copy entries
-        for (int i = 0; i < selectedRows.length; i++) {
-            final T[] destinationI = destination[i];
-            for (int j = 0; j < selectedColumns.length; j++) {
-                destinationI[j] = getEntry(selectedRows[i], selectedColumns[j]);
-            }
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public void setSubMatrix(final T[][] subMatrix, final int row,
-                             final int column)
-        throws DimensionMismatchException, OutOfRangeException,
-        NoDataException, NullArgumentException {
-        if (subMatrix == null) {
-            throw new NullArgumentException();
-        }
-        final int nRows = subMatrix.length;
-        if (nRows == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-        }
-
-        final int nCols = subMatrix[0].length;
-        if (nCols == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-        }
-
-        for (int r = 1; r < nRows; ++r) {
-            if (subMatrix[r].length != nCols) {
-                throw new DimensionMismatchException(nCols, subMatrix[r].length);
-            }
-        }
-
-        checkRowIndex(row);
-        checkColumnIndex(column);
-        checkRowIndex(nRows + row - 1);
-        checkColumnIndex(nCols + column - 1);
-
-        for (int i = 0; i < nRows; ++i) {
-            for (int j = 0; j < nCols; ++j) {
-                setEntry(row + i, column + j, subMatrix[i][j]);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> getRowMatrix(final int row) throws OutOfRangeException {
-        checkRowIndex(row);
-        final int nCols = getColumnDimension();
-        final FieldMatrix<T> out = createMatrix(1, nCols);
-        for (int i = 0; i < nCols; ++i) {
-            out.setEntry(0, i, getEntry(row, i));
-        }
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public void setRowMatrix(final int row, final FieldMatrix<T> matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        checkRowIndex(row);
-        final int nCols = getColumnDimension();
-        if ((matrix.getRowDimension() != 1) ||
-            (matrix.getColumnDimension() != nCols)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       1, nCols);
-        }
-        for (int i = 0; i < nCols; ++i) {
-            setEntry(row, i, matrix.getEntry(0, i));
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> getColumnMatrix(final int column)
-    throws OutOfRangeException {
-
-        checkColumnIndex(column);
-        final int nRows = getRowDimension();
-        final FieldMatrix<T> out = createMatrix(nRows, 1);
-        for (int i = 0; i < nRows; ++i) {
-            out.setEntry(i, 0, getEntry(i, column));
-        }
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public void setColumnMatrix(final int column, final FieldMatrix<T> matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        checkColumnIndex(column);
-        final int nRows = getRowDimension();
-        if ((matrix.getRowDimension() != nRows) ||
-            (matrix.getColumnDimension() != 1)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       nRows, 1);
-        }
-        for (int i = 0; i < nRows; ++i) {
-            setEntry(i, column, matrix.getEntry(i, 0));
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> getRowVector(final int row)
-        throws OutOfRangeException {
-        return new ArrayFieldVector<T>(field, getRow(row), false);
-    }
-
-    /** {@inheritDoc} */
-    public void setRowVector(final int row, final FieldVector<T> vector)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        checkRowIndex(row);
-        final int nCols = getColumnDimension();
-        if (vector.getDimension() != nCols) {
-            throw new MatrixDimensionMismatchException(1, vector.getDimension(),
-                                                       1, nCols);
-        }
-        for (int i = 0; i < nCols; ++i) {
-            setEntry(row, i, vector.getEntry(i));
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> getColumnVector(final int column)
-        throws OutOfRangeException {
-        return new ArrayFieldVector<T>(field, getColumn(column), false);
-    }
-
-    /** {@inheritDoc} */
-    public void setColumnVector(final int column, final FieldVector<T> vector)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-
-        checkColumnIndex(column);
-        final int nRows = getRowDimension();
-        if (vector.getDimension() != nRows) {
-            throw new MatrixDimensionMismatchException(vector.getDimension(), 1,
-                                                       nRows, 1);
-        }
-        for (int i = 0; i < nRows; ++i) {
-            setEntry(i, column, vector.getEntry(i));
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public T[] getRow(final int row) throws OutOfRangeException {
-        checkRowIndex(row);
-        final int nCols = getColumnDimension();
-        final T[] out = MathArrays.buildArray(field, nCols);
-        for (int i = 0; i < nCols; ++i) {
-            out[i] = getEntry(row, i);
-        }
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public void setRow(final int row, final T[] array)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        checkRowIndex(row);
-        final int nCols = getColumnDimension();
-        if (array.length != nCols) {
-            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
-        }
-        for (int i = 0; i < nCols; ++i) {
-            setEntry(row, i, array[i]);
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public T[] getColumn(final int column) throws OutOfRangeException {
-        checkColumnIndex(column);
-        final int nRows = getRowDimension();
-        final T[] out = MathArrays.buildArray(field, nRows);
-        for (int i = 0; i < nRows; ++i) {
-            out[i] = getEntry(i, column);
-        }
-
-        return out;
-
-    }
-
-    /** {@inheritDoc} */
-    public void setColumn(final int column, final T[] array)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        checkColumnIndex(column);
-        final int nRows = getRowDimension();
-        if (array.length != nRows) {
-            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
-        }
-        for (int i = 0; i < nRows; ++i) {
-            setEntry(i, column, array[i]);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public abstract T getEntry(int row, int column) throws OutOfRangeException;
-
-    /** {@inheritDoc} */
-    public abstract void setEntry(int row, int column, T value) throws OutOfRangeException;
-
-    /** {@inheritDoc} */
-    public abstract void addToEntry(int row, int column, T increment) throws OutOfRangeException;
-
-    /** {@inheritDoc} */
-    public abstract void multiplyEntry(int row, int column, T factor) throws OutOfRangeException;
-
-    /** {@inheritDoc} */
-    public FieldMatrix<T> transpose() {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        final FieldMatrix<T> out = createMatrix(nCols, nRows);
-        walkInOptimizedOrder(new DefaultFieldMatrixPreservingVisitor<T>(field.getZero()) {
-            /** {@inheritDoc} */
-            @Override
-            public void visit(final int row, final int column, final T value) {
-                out.setEntry(column, row, value);
-            }
-        });
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSquare() {
-        return getColumnDimension() == getRowDimension();
-    }
-
-    /** {@inheritDoc} */
-    public abstract int getRowDimension();
-
-    /** {@inheritDoc} */
-    public abstract int getColumnDimension();
-
-    /** {@inheritDoc} */
-    public T getTrace() throws NonSquareMatrixException {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (nRows != nCols) {
-            throw new NonSquareMatrixException(nRows, nCols);
-       }
-        T trace = field.getZero();
-        for (int i = 0; i < nRows; ++i) {
-            trace = trace.add(getEntry(i, i));
-        }
-        return trace;
-    }
-
-    /** {@inheritDoc} */
-    public T[] operate(final T[] v) throws DimensionMismatchException {
-
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (v.length != nCols) {
-            throw new DimensionMismatchException(v.length, nCols);
-        }
-
-        final T[] out = MathArrays.buildArray(field, nRows);
-        for (int row = 0; row < nRows; ++row) {
-            T sum = field.getZero();
-            for (int i = 0; i < nCols; ++i) {
-                sum = sum.add(getEntry(row, i).multiply(v[i]));
-            }
-            out[row] = sum;
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> operate(final FieldVector<T> v)
-        throws DimensionMismatchException {
-        try {
-            return new ArrayFieldVector<T>(field, operate(((ArrayFieldVector<T>) v).getDataRef()), false);
-        } catch (ClassCastException cce) {
-            final int nRows = getRowDimension();
-            final int nCols = getColumnDimension();
-            if (v.getDimension() != nCols) {
-                throw new DimensionMismatchException(v.getDimension(), nCols);
-            }
-
-            final T[] out = MathArrays.buildArray(field, nRows);
-            for (int row = 0; row < nRows; ++row) {
-                T sum = field.getZero();
-                for (int i = 0; i < nCols; ++i) {
-                    sum = sum.add(getEntry(row, i).multiply(v.getEntry(i)));
-                }
-                out[row] = sum;
-            }
-
-            return new ArrayFieldVector<T>(field, out, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public T[] preMultiply(final T[] v) throws DimensionMismatchException {
-
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (v.length != nRows) {
-            throw new DimensionMismatchException(v.length, nRows);
-        }
-
-        final T[] out = MathArrays.buildArray(field, nCols);
-        for (int col = 0; col < nCols; ++col) {
-            T sum = field.getZero();
-            for (int i = 0; i < nRows; ++i) {
-                sum = sum.add(getEntry(i, col).multiply(v[i]));
-            }
-            out[col] = sum;
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public FieldVector<T> preMultiply(final FieldVector<T> v)
-        throws DimensionMismatchException {
-        try {
-            return new ArrayFieldVector<T>(field, preMultiply(((ArrayFieldVector<T>) v).getDataRef()), false);
-        } catch (ClassCastException cce) {
-            final int nRows = getRowDimension();
-            final int nCols = getColumnDimension();
-            if (v.getDimension() != nRows) {
-                throw new DimensionMismatchException(v.getDimension(), nRows);
-            }
-
-            final T[] out = MathArrays.buildArray(field, nCols);
-            for (int col = 0; col < nCols; ++col) {
-                T sum = field.getZero();
-                for (int i = 0; i < nRows; ++i) {
-                    sum = sum.add(getEntry(i, col).multiply(v.getEntry(i)));
-                }
-                out[col] = sum;
-            }
-
-            return new ArrayFieldVector<T>(field, out, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int row = 0; row < rows; ++row) {
-            for (int column = 0; column < columns; ++column) {
-                final T oldValue = getEntry(row, column);
-                final T newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int row = 0; row < rows; ++row) {
-            for (int column = 0; column < columns; ++column) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInRowOrder(final FieldMatrixChangingVisitor<T> visitor,
-                            final int startRow, final int endRow,
-                            final int startColumn, final int endColumn)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int row = startRow; row <= endRow; ++row) {
-            for (int column = startColumn; column <= endColumn; ++column) {
-                final T oldValue = getEntry(row, column);
-                final T newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInRowOrder(final FieldMatrixPreservingVisitor<T> visitor,
-                            final int startRow, final int endRow,
-                            final int startColumn, final int endColumn)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int row = startRow; row <= endRow; ++row) {
-            for (int column = startColumn; column <= endColumn; ++column) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInColumnOrder(final FieldMatrixChangingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int column = 0; column < columns; ++column) {
-            for (int row = 0; row < rows; ++row) {
-                final T oldValue = getEntry(row, column);
-                final T newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInColumnOrder(final FieldMatrixPreservingVisitor<T> visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int column = 0; column < columns; ++column) {
-            for (int row = 0; row < rows; ++row) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInColumnOrder(final FieldMatrixChangingVisitor<T> visitor,
-                               final int startRow, final int endRow,
-                               final int startColumn, final int endColumn)
-    throws NumberIsTooSmallException, OutOfRangeException {
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int column = startColumn; column <= endColumn; ++column) {
-            for (int row = startRow; row <= endRow; ++row) {
-                final T oldValue = getEntry(row, column);
-                final T newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInColumnOrder(final FieldMatrixPreservingVisitor<T> visitor,
-                               final int startRow, final int endRow,
-                               final int startColumn, final int endColumn)
-    throws NumberIsTooSmallException, OutOfRangeException{
-        checkSubMatrixIndex(startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int column = startColumn; column <= endColumn; ++column) {
-            for (int row = startRow; row <= endRow; ++row) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public T walkInOptimizedOrder(final FieldMatrixChangingVisitor<T> visitor) {
-        return walkInRowOrder(visitor);
-    }
-
-    /** {@inheritDoc} */
-    public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor<T> visitor) {
-        return walkInRowOrder(visitor);
-    }
-
-    /** {@inheritDoc} */
-    public T walkInOptimizedOrder(final FieldMatrixChangingVisitor<T> visitor,
-                                  final int startRow, final int endRow,
-                                  final int startColumn, final int endColumn)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);
-    }
-
-    /** {@inheritDoc} */
-    public T walkInOptimizedOrder(final FieldMatrixPreservingVisitor<T> visitor,
-                                  final int startRow, final int endRow,
-                                  final int startColumn, final int endColumn)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);
-    }
-
-    /**
-     * Get a string representation for this matrix.
-     * @return a string representation for this matrix
-     */
-    @Override
-    public String toString() {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        final StringBuffer res = new StringBuffer();
-        String fullClassName = getClass().getName();
-        String shortClassName = fullClassName.substring(fullClassName.lastIndexOf('.') + 1);
-        res.append(shortClassName).append("{");
-
-        for (int i = 0; i < nRows; ++i) {
-            if (i > 0) {
-                res.append(",");
-            }
-            res.append("{");
-            for (int j = 0; j < nCols; ++j) {
-                if (j > 0) {
-                    res.append(",");
-                }
-                res.append(getEntry(i, j));
-            }
-            res.append("}");
-        }
-
-        res.append("}");
-        return res.toString();
-    }
-
-    /**
-     * Returns true iff <code>object</code> is a
-     * <code>FieldMatrix</code> instance with the same dimensions as this
-     * and all corresponding matrix entries are equal.
-     *
-     * @param object the object to test equality against.
-     * @return true if object equals this
-     */
-    @Override
-    public boolean equals(final Object object) {
-        if (object == this ) {
-            return true;
-        }
-        if (object instanceof FieldMatrix<?> == false) {
-            return false;
-        }
-        FieldMatrix<?> m = (FieldMatrix<?>) object;
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (m.getColumnDimension() != nCols || m.getRowDimension() != nRows) {
-            return false;
-        }
-        for (int row = 0; row < nRows; ++row) {
-            for (int col = 0; col < nCols; ++col) {
-                if (!getEntry(row, col).equals(m.getEntry(row, col))) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Computes a hashcode for the matrix.
-     *
-     * @return hashcode for matrix
-     */
-    @Override
-    public int hashCode() {
-        int ret = 322562;
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        ret = ret * 31 + nRows;
-        ret = ret * 31 + nCols;
-        for (int row = 0; row < nRows; ++row) {
-            for (int col = 0; col < nCols; ++col) {
-               ret = ret * 31 + (11 * (row+1) + 17 * (col+1)) * getEntry(row, col).hashCode();
-           }
-        }
-        return ret;
-    }
-
-    /**
-     * Check if a row index is valid.
-     *
-     * @param row Row index to check.
-     * @throws OutOfRangeException if {@code index} is not valid.
-     */
-    protected void checkRowIndex(final int row) throws OutOfRangeException {
-        if (row < 0 || row >= getRowDimension()) {
-            throw new OutOfRangeException(LocalizedFormats.ROW_INDEX,
-                                          row, 0, getRowDimension() - 1);
-        }
-    }
-
-    /**
-     * Check if a column index is valid.
-     *
-     * @param column Column index to check.
-     * @throws OutOfRangeException if {@code index} is not valid.
-     */
-    protected void checkColumnIndex(final int column)
-        throws OutOfRangeException {
-        if (column < 0 || column >= getColumnDimension()) {
-            throw new OutOfRangeException(LocalizedFormats.COLUMN_INDEX,
-                                          column, 0, getColumnDimension() - 1);
-        }
-    }
-
-    /**
-     * Check if submatrix ranges indices are valid.
-     * Rows and columns are indicated counting from 0 to n-1.
-     *
-     * @param startRow Initial row index.
-     * @param endRow Final row index.
-     * @param startColumn Initial column index.
-     * @param endColumn Final column index.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     */
-    protected void checkSubMatrixIndex(final int startRow, final int endRow,
-                                       final int startColumn, final int endColumn)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        checkRowIndex(startRow);
-        checkRowIndex(endRow);
-        if (endRow < startRow) {
-            throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
-                                                endRow, startRow, true);
-        }
-
-        checkColumnIndex(startColumn);
-        checkColumnIndex(endColumn);
-        if (endColumn < startColumn) {
-            throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
-                                                endColumn, startColumn, true);
-        }
-    }
-
-    /**
-     * Check if submatrix ranges indices are valid.
-     * Rows and columns are indicated counting from 0 to n-1.
-     *
-     * @param selectedRows Array of row indices.
-     * @param selectedColumns Array of column indices.
-     * @throws NullArgumentException if the arrays are {@code null}.
-     * @throws NoDataException if the arrays have zero length.
-     * @throws OutOfRangeException if row or column selections are not valid.
-     */
-    protected void checkSubMatrixIndex(final int[] selectedRows, final int[] selectedColumns)
-        throws NoDataException, NullArgumentException, OutOfRangeException {
-        if (selectedRows == null ||
-            selectedColumns == null) {
-            throw new NullArgumentException();
-        }
-        if (selectedRows.length == 0 ||
-            selectedColumns.length == 0) {
-            throw new NoDataException();
-        }
-
-        for (final int row : selectedRows) {
-            checkRowIndex(row);
-        }
-        for (final int column : selectedColumns) {
-            checkColumnIndex(column);
-        }
-    }
-
-    /**
-     * Check if a matrix is addition compatible with the instance.
-     *
-     * @param m Matrix to check.
-     * @throws MatrixDimensionMismatchException if the matrix is not
-     * addition-compatible with instance.
-     */
-    protected void checkAdditionCompatible(final FieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        if ((getRowDimension() != m.getRowDimension()) ||
-            (getColumnDimension() != m.getColumnDimension())) {
-            throw new MatrixDimensionMismatchException(m.getRowDimension(), m.getColumnDimension(),
-                                                       getRowDimension(), getColumnDimension());
-        }
-    }
-
-    /**
-     * Check if a matrix is subtraction compatible with the instance.
-     *
-     * @param m Matrix to check.
-     * @throws MatrixDimensionMismatchException if the matrix is not
-     * subtraction-compatible with instance.
-     */
-    protected void checkSubtractionCompatible(final FieldMatrix<T> m)
-        throws MatrixDimensionMismatchException {
-        if ((getRowDimension() != m.getRowDimension()) ||
-            (getColumnDimension() != m.getColumnDimension())) {
-            throw new MatrixDimensionMismatchException(m.getRowDimension(), m.getColumnDimension(),
-                                                       getRowDimension(), getColumnDimension());
-        }
-    }
-
-    /**
-     * Check if a matrix is multiplication compatible with the instance.
-     *
-     * @param m Matrix to check.
-     * @throws DimensionMismatchException if the matrix is not
-     * multiplication-compatible with instance.
-     */
-    protected void checkMultiplicationCompatible(final FieldMatrix<T> m)
-        throws DimensionMismatchException {
-        if (getColumnDimension() != m.getRowDimension()) {
-            throw new DimensionMismatchException(m.getRowDimension(), getColumnDimension());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/AbstractRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/AbstractRealMatrix.java b/src/main/java/org/apache/commons/math3/linear/AbstractRealMatrix.java
deleted file mode 100644
index e0fc945..0000000
--- a/src/main/java/org/apache/commons/math3/linear/AbstractRealMatrix.java
+++ /dev/null
@@ -1,992 +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.linear;
-
-import java.util.ArrayList;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Basic implementation of RealMatrix methods regardless of the underlying storage.
- * <p>All the methods implemented here use {@link #getEntry(int, int)} to access
- * matrix elements. Derived class can provide faster implementations.</p>
- *
- * @since 2.0
- */
-public abstract class AbstractRealMatrix
-    extends RealLinearOperator
-    implements RealMatrix {
-
-    /** Default format. */
-    private static final RealMatrixFormat DEFAULT_FORMAT = RealMatrixFormat.getInstance(Locale.US);
-    static {
-        // set the minimum fraction digits to 1 to keep compatibility
-        DEFAULT_FORMAT.getFormat().setMinimumFractionDigits(1);
-    }
-
-    /**
-     * Creates a matrix with no data
-     */
-    protected AbstractRealMatrix() {}
-
-    /**
-     * Create a new RealMatrix with the supplied row and column dimensions.
-     *
-     * @param rowDimension  the number of rows in the new matrix
-     * @param columnDimension  the number of columns in the new matrix
-     * @throws NotStrictlyPositiveException if row or column dimension is not positive
-     */
-    protected AbstractRealMatrix(final int rowDimension,
-        final int columnDimension)
-        throws NotStrictlyPositiveException {
-        if (rowDimension < 1) {
-            throw new NotStrictlyPositiveException(rowDimension);
-        }
-        if (columnDimension < 1) {
-            throw new NotStrictlyPositiveException(columnDimension);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix add(RealMatrix m)
-        throws MatrixDimensionMismatchException {
-        MatrixUtils.checkAdditionCompatible(this, m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final RealMatrix out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col) + m.getEntry(row, col));
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix subtract(final RealMatrix m)
-        throws MatrixDimensionMismatchException {
-        MatrixUtils.checkSubtractionCompatible(this, m);
-
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final RealMatrix out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col) - m.getEntry(row, col));
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix scalarAdd(final double d) {
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final RealMatrix out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col) + d);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix scalarMultiply(final double d) {
-        final int rowCount    = getRowDimension();
-        final int columnCount = getColumnDimension();
-        final RealMatrix out = createMatrix(rowCount, columnCount);
-        for (int row = 0; row < rowCount; ++row) {
-            for (int col = 0; col < columnCount; ++col) {
-                out.setEntry(row, col, getEntry(row, col) * d);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix multiply(final RealMatrix m)
-        throws DimensionMismatchException {
-        MatrixUtils.checkMultiplicationCompatible(this, m);
-
-        final int nRows = getRowDimension();
-        final int nCols = m.getColumnDimension();
-        final int nSum  = getColumnDimension();
-        final RealMatrix out = createMatrix(nRows, nCols);
-        for (int row = 0; row < nRows; ++row) {
-            for (int col = 0; col < nCols; ++col) {
-                double sum = 0;
-                for (int i = 0; i < nSum; ++i) {
-                    sum += getEntry(row, i) * m.getEntry(i, col);
-                }
-                out.setEntry(row, col, sum);
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix preMultiply(final RealMatrix m)
-        throws DimensionMismatchException {
-        return m.multiply(this);
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix power(final int p)
-        throws NotPositiveException, NonSquareMatrixException {
-        if (p < 0) {
-            throw new NotPositiveException(LocalizedFormats.NOT_POSITIVE_EXPONENT, p);
-        }
-
-        if (!isSquare()) {
-            throw new NonSquareMatrixException(getRowDimension(), getColumnDimension());
-        }
-
-        if (p == 0) {
-            return MatrixUtils.createRealIdentityMatrix(this.getRowDimension());
-        }
-
-        if (p == 1) {
-            return this.copy();
-        }
-
-        final int power = p - 1;
-
-        /*
-         * Only log_2(p) operations is used by doing as follows:
-         * 5^214 = 5^128 * 5^64 * 5^16 * 5^4 * 5^2
-         *
-         * In general, the same approach is used for A^p.
-         */
-
-        final char[] binaryRepresentation = Integer.toBinaryString(power).toCharArray();
-        final ArrayList<Integer> nonZeroPositions = new ArrayList<Integer>();
-        int maxI = -1;
-
-        for (int i = 0; i < binaryRepresentation.length; ++i) {
-            if (binaryRepresentation[i] == '1') {
-                final int pos = binaryRepresentation.length - i - 1;
-                nonZeroPositions.add(pos);
-
-                // The positions are taken in turn, so maxI is only changed once
-                if (maxI == -1) {
-                    maxI = pos;
-                }
-            }
-        }
-
-        RealMatrix[] results = new RealMatrix[maxI + 1];
-        results[0] = this.copy();
-
-        for (int i = 1; i <= maxI; ++i) {
-            results[i] = results[i-1].multiply(results[i-1]);
-        }
-
-        RealMatrix result = this.copy();
-
-        for (Integer i : nonZeroPositions) {
-            result = result.multiply(results[i]);
-        }
-
-        return result;
-    }
-
-    /** {@inheritDoc} */
-    public double[][] getData() {
-        final double[][] data = new double[getRowDimension()][getColumnDimension()];
-
-        for (int i = 0; i < data.length; ++i) {
-            final double[] dataI = data[i];
-            for (int j = 0; j < dataI.length; ++j) {
-                dataI[j] = getEntry(i, j);
-            }
-        }
-
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    public double getNorm() {
-        return walkInColumnOrder(new RealMatrixPreservingVisitor() {
-
-            /** Last row index. */
-            private double endRow;
-
-            /** Sum of absolute values on one column. */
-            private double columnSum;
-
-            /** Maximal sum across all columns. */
-            private double maxColSum;
-
-            /** {@inheritDoc} */
-            public void start(final int rows, final int columns,
-                              final int startRow, final int endRow,
-                              final int startColumn, final int endColumn) {
-                this.endRow = endRow;
-                columnSum   = 0;
-                maxColSum   = 0;
-            }
-
-            /** {@inheritDoc} */
-            public void visit(final int row, final int column, final double value) {
-                columnSum += FastMath.abs(value);
-                if (row == endRow) {
-                    maxColSum = FastMath.max(maxColSum, columnSum);
-                    columnSum = 0;
-                }
-            }
-
-            /** {@inheritDoc} */
-            public double end() {
-                return maxColSum;
-            }
-        });
-    }
-
-    /** {@inheritDoc} */
-    public double getFrobeniusNorm() {
-        return walkInOptimizedOrder(new RealMatrixPreservingVisitor() {
-
-            /** Sum of squared entries. */
-            private double sum;
-
-            /** {@inheritDoc} */
-            public void start(final int rows, final int columns,
-                              final int startRow, final int endRow,
-                              final int startColumn, final int endColumn) {
-                sum = 0;
-            }
-
-            /** {@inheritDoc} */
-            public void visit(final int row, final int column, final double value) {
-                sum += value * value;
-            }
-
-            /** {@inheritDoc} */
-            public double end() {
-                return FastMath.sqrt(sum);
-            }
-        });
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getSubMatrix(final int startRow, final int endRow,
-                                   final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-
-        final RealMatrix subMatrix =
-            createMatrix(endRow - startRow + 1, endColumn - startColumn + 1);
-        for (int i = startRow; i <= endRow; ++i) {
-            for (int j = startColumn; j <= endColumn; ++j) {
-                subMatrix.setEntry(i - startRow, j - startColumn, getEntry(i, j));
-            }
-        }
-
-        return subMatrix;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getSubMatrix(final int[] selectedRows,
-                                   final int[] selectedColumns)
-        throws NullArgumentException, NoDataException, OutOfRangeException {
-        MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns);
-
-        final RealMatrix subMatrix =
-            createMatrix(selectedRows.length, selectedColumns.length);
-        subMatrix.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor() {
-
-            /** {@inheritDoc} */
-            @Override
-            public double visit(final int row, final int column, final double value) {
-                return getEntry(selectedRows[row], selectedColumns[column]);
-            }
-
-        });
-
-        return subMatrix;
-    }
-
-    /** {@inheritDoc} */
-    public void copySubMatrix(final int startRow, final int endRow,
-                              final int startColumn, final int endColumn,
-                              final double[][] destination)
-        throws OutOfRangeException, NumberIsTooSmallException,
-        MatrixDimensionMismatchException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        final int rowsCount    = endRow + 1 - startRow;
-        final int columnsCount = endColumn + 1 - startColumn;
-        if ((destination.length < rowsCount) || (destination[0].length < columnsCount)) {
-            throw new MatrixDimensionMismatchException(destination.length, destination[0].length,
-                                                       rowsCount, columnsCount);
-        }
-
-        for (int i = 1; i < rowsCount; i++) {
-            if (destination[i].length < columnsCount) {
-                throw new MatrixDimensionMismatchException(destination.length, destination[i].length,
-                                                           rowsCount, columnsCount);
-            }
-        }
-
-        walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {
-
-            /** Initial row index. */
-            private int startRow;
-
-            /** Initial column index. */
-            private int startColumn;
-
-            /** {@inheritDoc} */
-            @Override
-            public void start(final int rows, final int columns,
-                              final int startRow, final int endRow,
-                              final int startColumn, final int endColumn) {
-                this.startRow    = startRow;
-                this.startColumn = startColumn;
-            }
-
-            /** {@inheritDoc} */
-            @Override
-            public void visit(final int row, final int column, final double value) {
-                destination[row - startRow][column - startColumn] = value;
-            }
-
-        }, startRow, endRow, startColumn, endColumn);
-    }
-
-    /** {@inheritDoc} */
-    public void copySubMatrix(int[] selectedRows, int[] selectedColumns,
-                              double[][] destination)
-        throws OutOfRangeException, NullArgumentException, NoDataException,
-        MatrixDimensionMismatchException {
-        MatrixUtils.checkSubMatrixIndex(this, selectedRows, selectedColumns);
-        final int nCols = selectedColumns.length;
-        if ((destination.length < selectedRows.length) ||
-            (destination[0].length < nCols)) {
-            throw new MatrixDimensionMismatchException(destination.length, destination[0].length,
-                                                       selectedRows.length, selectedColumns.length);
-        }
-
-        for (int i = 0; i < selectedRows.length; i++) {
-            final double[] destinationI = destination[i];
-            if (destinationI.length < nCols) {
-                throw new MatrixDimensionMismatchException(destination.length, destinationI.length,
-                                                           selectedRows.length, selectedColumns.length);
-            }
-            for (int j = 0; j < selectedColumns.length; j++) {
-                destinationI[j] = getEntry(selectedRows[i], selectedColumns[j]);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void setSubMatrix(final double[][] subMatrix, final int row, final int column)
-        throws NoDataException, OutOfRangeException,
-        DimensionMismatchException, NullArgumentException {
-        MathUtils.checkNotNull(subMatrix);
-        final int nRows = subMatrix.length;
-        if (nRows == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-        }
-
-        final int nCols = subMatrix[0].length;
-        if (nCols == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-        }
-
-        for (int r = 1; r < nRows; ++r) {
-            if (subMatrix[r].length != nCols) {
-                throw new DimensionMismatchException(nCols, subMatrix[r].length);
-            }
-        }
-
-        MatrixUtils.checkRowIndex(this, row);
-        MatrixUtils.checkColumnIndex(this, column);
-        MatrixUtils.checkRowIndex(this, nRows + row - 1);
-        MatrixUtils.checkColumnIndex(this, nCols + column - 1);
-
-        for (int i = 0; i < nRows; ++i) {
-            for (int j = 0; j < nCols; ++j) {
-                setEntry(row + i, column + j, subMatrix[i][j]);
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getRowMatrix(final int row) throws OutOfRangeException {
-        MatrixUtils.checkRowIndex(this, row);
-        final int nCols = getColumnDimension();
-        final RealMatrix out = createMatrix(1, nCols);
-        for (int i = 0; i < nCols; ++i) {
-            out.setEntry(0, i, getEntry(row, i));
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public void setRowMatrix(final int row, final RealMatrix matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkRowIndex(this, row);
-        final int nCols = getColumnDimension();
-        if ((matrix.getRowDimension() != 1) ||
-            (matrix.getColumnDimension() != nCols)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       1, nCols);
-        }
-        for (int i = 0; i < nCols; ++i) {
-            setEntry(row, i, matrix.getEntry(0, i));
-        }
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getColumnMatrix(final int column)
-        throws OutOfRangeException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final int nRows = getRowDimension();
-        final RealMatrix out = createMatrix(nRows, 1);
-        for (int i = 0; i < nRows; ++i) {
-            out.setEntry(i, 0, getEntry(i, column));
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public void setColumnMatrix(final int column, final RealMatrix matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final int nRows = getRowDimension();
-        if ((matrix.getRowDimension() != nRows) ||
-            (matrix.getColumnDimension() != 1)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       nRows, 1);
-        }
-        for (int i = 0; i < nRows; ++i) {
-            setEntry(i, column, matrix.getEntry(i, 0));
-        }
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getRowVector(final int row)
-        throws OutOfRangeException {
-        return new ArrayRealVector(getRow(row), false);
-    }
-
-    /** {@inheritDoc} */
-    public void setRowVector(final int row, final RealVector vector)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkRowIndex(this, row);
-        final int nCols = getColumnDimension();
-        if (vector.getDimension() != nCols) {
-            throw new MatrixDimensionMismatchException(1, vector.getDimension(),
-                                                       1, nCols);
-        }
-        for (int i = 0; i < nCols; ++i) {
-            setEntry(row, i, vector.getEntry(i));
-        }
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getColumnVector(final int column)
-        throws OutOfRangeException {
-        return new ArrayRealVector(getColumn(column), false);
-    }
-
-    /** {@inheritDoc} */
-    public void setColumnVector(final int column, final RealVector vector)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final int nRows = getRowDimension();
-        if (vector.getDimension() != nRows) {
-            throw new MatrixDimensionMismatchException(vector.getDimension(), 1,
-                                                       nRows, 1);
-        }
-        for (int i = 0; i < nRows; ++i) {
-            setEntry(i, column, vector.getEntry(i));
-        }
-    }
-
-    /** {@inheritDoc} */
-    public double[] getRow(final int row) throws OutOfRangeException {
-        MatrixUtils.checkRowIndex(this, row);
-        final int nCols = getColumnDimension();
-        final double[] out = new double[nCols];
-        for (int i = 0; i < nCols; ++i) {
-            out[i] = getEntry(row, i);
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public void setRow(final int row, final double[] array)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkRowIndex(this, row);
-        final int nCols = getColumnDimension();
-        if (array.length != nCols) {
-            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
-        }
-        for (int i = 0; i < nCols; ++i) {
-            setEntry(row, i, array[i]);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public double[] getColumn(final int column) throws OutOfRangeException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final int nRows = getRowDimension();
-        final double[] out = new double[nRows];
-        for (int i = 0; i < nRows; ++i) {
-            out[i] = getEntry(i, column);
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public void setColumn(final int column, final double[] array)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final int nRows = getRowDimension();
-        if (array.length != nRows) {
-            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
-        }
-        for (int i = 0; i < nRows; ++i) {
-            setEntry(i, column, array[i]);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public void addToEntry(int row, int column, double increment)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        setEntry(row, column, getEntry(row, column) + increment);
-    }
-
-    /** {@inheritDoc} */
-    public void multiplyEntry(int row, int column, double factor)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        setEntry(row, column, getEntry(row, column) * factor);
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix transpose() {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        final RealMatrix out = createMatrix(nCols, nRows);
-        walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {
-
-            /** {@inheritDoc} */
-            @Override
-            public void visit(final int row, final int column, final double value) {
-                out.setEntry(column, row, value);
-            }
-
-        });
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSquare() {
-        return getColumnDimension() == getRowDimension();
-    }
-
-    /**
-     * Returns the number of rows of this matrix.
-     *
-     * @return the number of rows.
-     */
-    @Override
-    public abstract int getRowDimension();
-
-    /**
-     * Returns the number of columns of this matrix.
-     *
-     * @return the number of columns.
-     */
-    @Override
-    public abstract int getColumnDimension();
-
-    /** {@inheritDoc} */
-    public double getTrace() throws NonSquareMatrixException {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (nRows != nCols) {
-            throw new NonSquareMatrixException(nRows, nCols);
-       }
-        double trace = 0;
-        for (int i = 0; i < nRows; ++i) {
-            trace += getEntry(i, i);
-        }
-        return trace;
-    }
-
-    /** {@inheritDoc} */
-    public double[] operate(final double[] v)
-        throws DimensionMismatchException {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (v.length != nCols) {
-            throw new DimensionMismatchException(v.length, nCols);
-        }
-
-        final double[] out = new double[nRows];
-        for (int row = 0; row < nRows; ++row) {
-            double sum = 0;
-            for (int i = 0; i < nCols; ++i) {
-                sum += getEntry(row, i) * v[i];
-            }
-            out[row] = sum;
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector operate(final RealVector v)
-        throws DimensionMismatchException {
-        try {
-            return new ArrayRealVector(operate(((ArrayRealVector) v).getDataRef()), false);
-        } catch (ClassCastException cce) {
-            final int nRows = getRowDimension();
-            final int nCols = getColumnDimension();
-            if (v.getDimension() != nCols) {
-                throw new DimensionMismatchException(v.getDimension(), nCols);
-            }
-
-            final double[] out = new double[nRows];
-            for (int row = 0; row < nRows; ++row) {
-                double sum = 0;
-                for (int i = 0; i < nCols; ++i) {
-                    sum += getEntry(row, i) * v.getEntry(i);
-                }
-                out[row] = sum;
-            }
-
-            return new ArrayRealVector(out, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public double[] preMultiply(final double[] v) throws DimensionMismatchException {
-
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (v.length != nRows) {
-            throw new DimensionMismatchException(v.length, nRows);
-        }
-
-        final double[] out = new double[nCols];
-        for (int col = 0; col < nCols; ++col) {
-            double sum = 0;
-            for (int i = 0; i < nRows; ++i) {
-                sum += getEntry(i, col) * v[i];
-            }
-            out[col] = sum;
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    public RealVector preMultiply(final RealVector v) throws DimensionMismatchException {
-        try {
-            return new ArrayRealVector(preMultiply(((ArrayRealVector) v).getDataRef()), false);
-        } catch (ClassCastException cce) {
-
-            final int nRows = getRowDimension();
-            final int nCols = getColumnDimension();
-            if (v.getDimension() != nRows) {
-                throw new DimensionMismatchException(v.getDimension(), nRows);
-            }
-
-            final double[] out = new double[nCols];
-            for (int col = 0; col < nCols; ++col) {
-                double sum = 0;
-                for (int i = 0; i < nRows; ++i) {
-                    sum += getEntry(i, col) * v.getEntry(i);
-                }
-                out[col] = sum;
-            }
-
-            return new ArrayRealVector(out, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public double walkInRowOrder(final RealMatrixChangingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int row = 0; row < rows; ++row) {
-            for (int column = 0; column < columns; ++column) {
-                final double oldValue = getEntry(row, column);
-                final double newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInRowOrder(final RealMatrixPreservingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int row = 0; row < rows; ++row) {
-            for (int column = 0; column < columns; ++column) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInRowOrder(final RealMatrixChangingVisitor visitor,
-                                 final int startRow, final int endRow,
-                                 final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int row = startRow; row <= endRow; ++row) {
-            for (int column = startColumn; column <= endColumn; ++column) {
-                final double oldValue = getEntry(row, column);
-                final double newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInRowOrder(final RealMatrixPreservingVisitor visitor,
-                                 final int startRow, final int endRow,
-                                 final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int row = startRow; row <= endRow; ++row) {
-            for (int column = startColumn; column <= endColumn; ++column) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInColumnOrder(final RealMatrixChangingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int column = 0; column < columns; ++column) {
-            for (int row = 0; row < rows; ++row) {
-                final double oldValue = getEntry(row, column);
-                final double newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor) {
-        final int rows    = getRowDimension();
-        final int columns = getColumnDimension();
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int column = 0; column < columns; ++column) {
-            for (int row = 0; row < rows; ++row) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInColumnOrder(final RealMatrixChangingVisitor visitor,
-                                    final int startRow, final int endRow,
-                                    final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int column = startColumn; column <= endColumn; ++column) {
-            for (int row = startRow; row <= endRow; ++row) {
-                final double oldValue = getEntry(row, column);
-                final double newValue = visitor.visit(row, column, oldValue);
-                setEntry(row, column, newValue);
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInColumnOrder(final RealMatrixPreservingVisitor visitor,
-                                    final int startRow, final int endRow,
-                                    final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(getRowDimension(), getColumnDimension(),
-                      startRow, endRow, startColumn, endColumn);
-        for (int column = startColumn; column <= endColumn; ++column) {
-            for (int row = startRow; row <= endRow; ++row) {
-                visitor.visit(row, column, getEntry(row, column));
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor) {
-        return walkInRowOrder(visitor);
-    }
-
-    /** {@inheritDoc} */
-    public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor) {
-        return walkInRowOrder(visitor);
-    }
-
-    /** {@inheritDoc} */
-    public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor,
-                                       final int startRow, final int endRow,
-                                       final int startColumn,
-                                       final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);
-    }
-
-    /** {@inheritDoc} */
-    public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor,
-                                       final int startRow, final int endRow,
-                                       final int startColumn,
-                                       final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        return walkInRowOrder(visitor, startRow, endRow, startColumn, endColumn);
-    }
-
-    /**
-     * Get a string representation for this matrix.
-     * @return a string representation for this matrix
-     */
-    @Override
-    public String toString() {
-        final StringBuilder res = new StringBuilder();
-        String fullClassName = getClass().getName();
-        String shortClassName = fullClassName.substring(fullClassName.lastIndexOf('.') + 1);
-        res.append(shortClassName);
-        res.append(DEFAULT_FORMAT.format(this));
-        return res.toString();
-    }
-
-    /**
-     * Returns true iff <code>object</code> is a
-     * <code>RealMatrix</code> instance with the same dimensions as this
-     * and all corresponding matrix entries are equal.
-     *
-     * @param object the object to test equality against.
-     * @return true if object equals this
-     */
-    @Override
-    public boolean equals(final Object object) {
-        if (object == this ) {
-            return true;
-        }
-        if (object instanceof RealMatrix == false) {
-            return false;
-        }
-        RealMatrix m = (RealMatrix) object;
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        if (m.getColumnDimension() != nCols || m.getRowDimension() != nRows) {
-            return false;
-        }
-        for (int row = 0; row < nRows; ++row) {
-            for (int col = 0; col < nCols; ++col) {
-                if (getEntry(row, col) != m.getEntry(row, col)) {
-                    return false;
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Computes a hashcode for the matrix.
-     *
-     * @return hashcode for matrix
-     */
-    @Override
-    public int hashCode() {
-        int ret = 7;
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        ret = ret * 31 + nRows;
-        ret = ret * 31 + nCols;
-        for (int row = 0; row < nRows; ++row) {
-            for (int col = 0; col < nCols; ++col) {
-               ret = ret * 31 + (11 * (row+1) + 17 * (col+1)) *
-                   MathUtils.hash(getEntry(row, col));
-           }
-        }
-        return ret;
-    }
-
-
-    /*
-     * Empty implementations of these methods are provided in order to allow for
-     * the use of the @Override tag with Java 1.5.
-     */
-
-    /** {@inheritDoc} */
-    public abstract RealMatrix createMatrix(int rowDimension, int columnDimension)
-        throws NotStrictlyPositiveException;
-
-    /** {@inheritDoc} */
-    public abstract RealMatrix copy();
-
-    /** {@inheritDoc} */
-    public abstract double getEntry(int row, int column)
-        throws OutOfRangeException;
-
-    /** {@inheritDoc} */
-    public abstract void setEntry(int row, int column, double value)
-        throws OutOfRangeException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/AnyMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/AnyMatrix.java b/src/main/java/org/apache/commons/math3/linear/AnyMatrix.java
deleted file mode 100644
index 736819a..0000000
--- a/src/main/java/org/apache/commons/math3/linear/AnyMatrix.java
+++ /dev/null
@@ -1,47 +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.linear;
-
-
-/**
- * Interface defining very basic matrix operations.
- * @since 2.0
- */
-public interface AnyMatrix {
-
-    /**
-     * Is this a square matrix?
-     * @return true if the matrix is square (rowDimension = columnDimension)
-     */
-    boolean isSquare();
-
-    /**
-     * Returns the number of rows in the matrix.
-     *
-     * @return rowDimension
-     */
-    int getRowDimension();
-
-    /**
-     * Returns the number of columns in the matrix.
-     *
-     * @return columnDimension
-     */
-    int getColumnDimension();
-
-}


[20/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldRotation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldRotation.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldRotation.java
deleted file mode 100644
index dd6f3e4..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldRotation.java
+++ /dev/null
@@ -1,1183 +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.geometry.euclidean.threed;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * This class is a re-implementation of {@link Rotation} using {@link RealFieldElement}.
- * <p>Instance of this class are guaranteed to be immutable.</p>
- *
- * @param <T> the type of the field elements
- * @see FieldVector3D
- * @see RotationOrder
- * @since 3.2
- */
-
-public class FieldRotation<T extends RealFieldElement<T>> implements Serializable {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 20130224l;
-
-    /** Scalar coordinate of the quaternion. */
-    private final T q0;
-
-    /** First coordinate of the vectorial part of the quaternion. */
-    private final T q1;
-
-    /** Second coordinate of the vectorial part of the quaternion. */
-    private final T q2;
-
-    /** Third coordinate of the vectorial part of the quaternion. */
-    private final T q3;
-
-    /** Build a rotation from the quaternion coordinates.
-     * <p>A rotation can be built from a <em>normalized</em> quaternion,
-     * i.e. a quaternion for which q<sub>0</sub><sup>2</sup> +
-     * q<sub>1</sub><sup>2</sup> + q<sub>2</sub><sup>2</sup> +
-     * q<sub>3</sub><sup>2</sup> = 1. If the quaternion is not normalized,
-     * the constructor can normalize it in a preprocessing step.</p>
-     * <p>Note that some conventions put the scalar part of the quaternion
-     * as the 4<sup>th</sup> component and the vector part as the first three
-     * components. This is <em>not</em> our convention. We put the scalar part
-     * as the first component.</p>
-     * @param q0 scalar part of the quaternion
-     * @param q1 first coordinate of the vectorial part of the quaternion
-     * @param q2 second coordinate of the vectorial part of the quaternion
-     * @param q3 third coordinate of the vectorial part of the quaternion
-     * @param needsNormalization if true, the coordinates are considered
-     * not to be normalized, a normalization preprocessing step is performed
-     * before using them
-     */
-    public FieldRotation(final T q0, final T q1, final T q2, final T q3, final boolean needsNormalization) {
-
-        if (needsNormalization) {
-            // normalization preprocessing
-            final T inv =
-                    q0.multiply(q0).add(q1.multiply(q1)).add(q2.multiply(q2)).add(q3.multiply(q3)).sqrt().reciprocal();
-            this.q0 = inv.multiply(q0);
-            this.q1 = inv.multiply(q1);
-            this.q2 = inv.multiply(q2);
-            this.q3 = inv.multiply(q3);
-        } else {
-            this.q0 = q0;
-            this.q1 = q1;
-            this.q2 = q2;
-            this.q3 = q3;
-        }
-
-    }
-
-    /** Build a rotation from an axis and an angle.
-     * <p>We use the convention that angles are oriented according to
-     * the effect of the rotation on vectors around the axis. That means
-     * that if (i, j, k) is a direct frame and if we first provide +k as
-     * the axis and &pi;/2 as the angle to this constructor, and then
-     * {@link #applyTo(FieldVector3D) apply} the instance to +i, we will get
-     * +j.</p>
-     * <p>Another way to represent our convention is to say that a rotation
-     * of angle &theta; about the unit vector (x, y, z) is the same as the
-     * rotation build from quaternion components { cos(-&theta;/2),
-     * x * sin(-&theta;/2), y * sin(-&theta;/2), z * sin(-&theta;/2) }.
-     * Note the minus sign on the angle!</p>
-     * <p>On the one hand this convention is consistent with a vectorial
-     * perspective (moving vectors in fixed frames), on the other hand it
-     * is different from conventions with a frame perspective (fixed vectors
-     * viewed from different frames) like the ones used for example in spacecraft
-     * attitude community or in the graphics community.</p>
-     * @param axis axis around which to rotate
-     * @param angle rotation angle.
-     * @exception MathIllegalArgumentException if the axis norm is zero
-     */
-    public FieldRotation(final FieldVector3D<T> axis, final T angle)
-        throws MathIllegalArgumentException {
-
-        final T norm = axis.getNorm();
-        if (norm.getReal() == 0) {
-            throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_AXIS);
-        }
-
-        final T halfAngle = angle.multiply(-0.5);
-        final T coeff = halfAngle.sin().divide(norm);
-
-        q0 = halfAngle.cos();
-        q1 = coeff.multiply(axis.getX());
-        q2 = coeff.multiply(axis.getY());
-        q3 = coeff.multiply(axis.getZ());
-
-    }
-
-    /** Build a rotation from a 3X3 matrix.
-
-     * <p>Rotation matrices are orthogonal matrices, i.e. unit matrices
-     * (which are matrices for which m.m<sup>T</sup> = I) with real
-     * coefficients. The module of the determinant of unit matrices is
-     * 1, among the orthogonal 3X3 matrices, only the ones having a
-     * positive determinant (+1) are rotation matrices.</p>
-
-     * <p>When a rotation is defined by a matrix with truncated values
-     * (typically when it is extracted from a technical sheet where only
-     * four to five significant digits are available), the matrix is not
-     * orthogonal anymore. This constructor handles this case
-     * transparently by using a copy of the given matrix and applying a
-     * correction to the copy in order to perfect its orthogonality. If
-     * the Frobenius norm of the correction needed is above the given
-     * threshold, then the matrix is considered to be too far from a
-     * true rotation matrix and an exception is thrown.<p>
-
-     * @param m rotation matrix
-     * @param threshold convergence threshold for the iterative
-     * orthogonality correction (convergence is reached when the
-     * difference between two steps of the Frobenius norm of the
-     * correction is below this threshold)
-
-     * @exception NotARotationMatrixException if the matrix is not a 3X3
-     * matrix, or if it cannot be transformed into an orthogonal matrix
-     * with the given threshold, or if the determinant of the resulting
-     * orthogonal matrix is negative
-
-     */
-    public FieldRotation(final T[][] m, final double threshold)
-        throws NotARotationMatrixException {
-
-        // dimension check
-        if ((m.length != 3) || (m[0].length != 3) ||
-                (m[1].length != 3) || (m[2].length != 3)) {
-            throw new NotARotationMatrixException(
-                                                  LocalizedFormats.ROTATION_MATRIX_DIMENSIONS,
-                                                  m.length, m[0].length);
-        }
-
-        // compute a "close" orthogonal matrix
-        final T[][] ort = orthogonalizeMatrix(m, threshold);
-
-        // check the sign of the determinant
-        final T d0 = ort[1][1].multiply(ort[2][2]).subtract(ort[2][1].multiply(ort[1][2]));
-        final T d1 = ort[0][1].multiply(ort[2][2]).subtract(ort[2][1].multiply(ort[0][2]));
-        final T d2 = ort[0][1].multiply(ort[1][2]).subtract(ort[1][1].multiply(ort[0][2]));
-        final T det =
-                ort[0][0].multiply(d0).subtract(ort[1][0].multiply(d1)).add(ort[2][0].multiply(d2));
-        if (det.getReal() < 0.0) {
-            throw new NotARotationMatrixException(
-                                                  LocalizedFormats.CLOSEST_ORTHOGONAL_MATRIX_HAS_NEGATIVE_DETERMINANT,
-                                                  det);
-        }
-
-        final T[] quat = mat2quat(ort);
-        q0 = quat[0];
-        q1 = quat[1];
-        q2 = quat[2];
-        q3 = quat[3];
-
-    }
-
-    /** Build the rotation that transforms a pair of vector into another pair.
-
-     * <p>Except for possible scale factors, if the instance were applied to
-     * the pair (u<sub>1</sub>, u<sub>2</sub>) it will produce the pair
-     * (v<sub>1</sub>, v<sub>2</sub>).</p>
-
-     * <p>If the angular separation between u<sub>1</sub> and u<sub>2</sub> is
-     * not the same as the angular separation between v<sub>1</sub> and
-     * v<sub>2</sub>, then a corrected v'<sub>2</sub> will be used rather than
-     * v<sub>2</sub>, the corrected vector will be in the (v<sub>1</sub>,
-     * v<sub>2</sub>) plane.</p>
-
-     * @param u1 first vector of the origin pair
-     * @param u2 second vector of the origin pair
-     * @param v1 desired image of u1 by the rotation
-     * @param v2 desired image of u2 by the rotation
-     * @exception MathArithmeticException if the norm of one of the vectors is zero,
-     * or if one of the pair is degenerated (i.e. the vectors of the pair are colinear)
-     */
-    public FieldRotation(FieldVector3D<T> u1, FieldVector3D<T> u2, FieldVector3D<T> v1, FieldVector3D<T> v2)
-        throws MathArithmeticException {
-
-        // build orthonormalized base from u1, u2
-        // this fails when vectors are null or colinear, which is forbidden to define a rotation
-        final FieldVector3D<T> u3 = FieldVector3D.crossProduct(u1, u2).normalize();
-        u2 = FieldVector3D.crossProduct(u3, u1).normalize();
-        u1 = u1.normalize();
-
-        // build an orthonormalized base from v1, v2
-        // this fails when vectors are null or colinear, which is forbidden to define a rotation
-        final FieldVector3D<T> v3 = FieldVector3D.crossProduct(v1, v2).normalize();
-        v2 = FieldVector3D.crossProduct(v3, v1).normalize();
-        v1 = v1.normalize();
-
-        // buid a matrix transforming the first base into the second one
-        final T[][] array = MathArrays.buildArray(u1.getX().getField(), 3, 3);
-        array[0][0] = u1.getX().multiply(v1.getX()).add(u2.getX().multiply(v2.getX())).add(u3.getX().multiply(v3.getX()));
-        array[0][1] = u1.getY().multiply(v1.getX()).add(u2.getY().multiply(v2.getX())).add(u3.getY().multiply(v3.getX()));
-        array[0][2] = u1.getZ().multiply(v1.getX()).add(u2.getZ().multiply(v2.getX())).add(u3.getZ().multiply(v3.getX()));
-        array[1][0] = u1.getX().multiply(v1.getY()).add(u2.getX().multiply(v2.getY())).add(u3.getX().multiply(v3.getY()));
-        array[1][1] = u1.getY().multiply(v1.getY()).add(u2.getY().multiply(v2.getY())).add(u3.getY().multiply(v3.getY()));
-        array[1][2] = u1.getZ().multiply(v1.getY()).add(u2.getZ().multiply(v2.getY())).add(u3.getZ().multiply(v3.getY()));
-        array[2][0] = u1.getX().multiply(v1.getZ()).add(u2.getX().multiply(v2.getZ())).add(u3.getX().multiply(v3.getZ()));
-        array[2][1] = u1.getY().multiply(v1.getZ()).add(u2.getY().multiply(v2.getZ())).add(u3.getY().multiply(v3.getZ()));
-        array[2][2] = u1.getZ().multiply(v1.getZ()).add(u2.getZ().multiply(v2.getZ())).add(u3.getZ().multiply(v3.getZ()));
-
-        T[] quat = mat2quat(array);
-        q0 = quat[0];
-        q1 = quat[1];
-        q2 = quat[2];
-        q3 = quat[3];
-
-    }
-
-    /** Build one of the rotations that transform one vector into another one.
-
-     * <p>Except for a possible scale factor, if the instance were
-     * applied to the vector u it will produce the vector v. There is an
-     * infinite number of such rotations, this constructor choose the
-     * one with the smallest associated angle (i.e. the one whose axis
-     * is orthogonal to the (u, v) plane). If u and v are colinear, an
-     * arbitrary rotation axis is chosen.</p>
-
-     * @param u origin vector
-     * @param v desired image of u by the rotation
-     * @exception MathArithmeticException if the norm of one of the vectors is zero
-     */
-    public FieldRotation(final FieldVector3D<T> u, final FieldVector3D<T> v) throws MathArithmeticException {
-
-        final T normProduct = u.getNorm().multiply(v.getNorm());
-        if (normProduct.getReal() == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM_FOR_ROTATION_DEFINING_VECTOR);
-        }
-
-        final T dot = FieldVector3D.dotProduct(u, v);
-
-        if (dot.getReal() < ((2.0e-15 - 1.0) * normProduct.getReal())) {
-            // special case u = -v: we select a PI angle rotation around
-            // an arbitrary vector orthogonal to u
-            final FieldVector3D<T> w = u.orthogonal();
-            q0 = normProduct.getField().getZero();
-            q1 = w.getX().negate();
-            q2 = w.getY().negate();
-            q3 = w.getZ().negate();
-        } else {
-            // general case: (u, v) defines a plane, we select
-            // the shortest possible rotation: axis orthogonal to this plane
-            q0 = dot.divide(normProduct).add(1.0).multiply(0.5).sqrt();
-            final T coeff = q0.multiply(normProduct).multiply(2.0).reciprocal();
-            final FieldVector3D<T> q = FieldVector3D.crossProduct(v, u);
-            q1 = coeff.multiply(q.getX());
-            q2 = coeff.multiply(q.getY());
-            q3 = coeff.multiply(q.getZ());
-        }
-
-    }
-
-    /** Build a rotation from three Cardan or Euler elementary rotations.
-
-     * <p>Cardan rotations are three successive rotations around the
-     * canonical axes X, Y and Z, each axis being used once. There are
-     * 6 such sets of rotations (XYZ, XZY, YXZ, YZX, ZXY and ZYX). Euler
-     * rotations are three successive rotations around the canonical
-     * axes X, Y and Z, the first and last rotations being around the
-     * same axis. There are 6 such sets of rotations (XYX, XZX, YXY,
-     * YZY, ZXZ and ZYZ), the most popular one being ZXZ.</p>
-     * <p>Beware that many people routinely use the term Euler angles even
-     * for what really are Cardan angles (this confusion is especially
-     * widespread in the aerospace business where Roll, Pitch and Yaw angles
-     * are often wrongly tagged as Euler angles).</p>
-
-     * @param order order of rotations to use
-     * @param alpha1 angle of the first elementary rotation
-     * @param alpha2 angle of the second elementary rotation
-     * @param alpha3 angle of the third elementary rotation
-     */
-    public FieldRotation(final RotationOrder order, final T alpha1, final T alpha2, final T alpha3) {
-        final T one = alpha1.getField().getOne();
-        final FieldRotation<T> r1 = new FieldRotation<T>(new FieldVector3D<T>(one, order.getA1()), alpha1);
-        final FieldRotation<T> r2 = new FieldRotation<T>(new FieldVector3D<T>(one, order.getA2()), alpha2);
-        final FieldRotation<T> r3 = new FieldRotation<T>(new FieldVector3D<T>(one, order.getA3()), alpha3);
-        final FieldRotation<T> composed = r1.applyTo(r2.applyTo(r3));
-        q0 = composed.q0;
-        q1 = composed.q1;
-        q2 = composed.q2;
-        q3 = composed.q3;
-    }
-
-    /** Convert an orthogonal rotation matrix to a quaternion.
-     * @param ort orthogonal rotation matrix
-     * @return quaternion corresponding to the matrix
-     */
-    private T[] mat2quat(final T[][] ort) {
-
-        final T[] quat = MathArrays.buildArray(ort[0][0].getField(), 4);
-
-        // There are different ways to compute the quaternions elements
-        // from the matrix. They all involve computing one element from
-        // the diagonal of the matrix, and computing the three other ones
-        // using a formula involving a division by the first element,
-        // which unfortunately can be zero. Since the norm of the
-        // quaternion is 1, we know at least one element has an absolute
-        // value greater or equal to 0.5, so it is always possible to
-        // select the right formula and avoid division by zero and even
-        // numerical inaccuracy. Checking the elements in turn and using
-        // the first one greater than 0.45 is safe (this leads to a simple
-        // test since qi = 0.45 implies 4 qi^2 - 1 = -0.19)
-        T s = ort[0][0].add(ort[1][1]).add(ort[2][2]);
-        if (s.getReal() > -0.19) {
-            // compute q0 and deduce q1, q2 and q3
-            quat[0] = s.add(1.0).sqrt().multiply(0.5);
-            T inv = quat[0].reciprocal().multiply(0.25);
-            quat[1] = inv.multiply(ort[1][2].subtract(ort[2][1]));
-            quat[2] = inv.multiply(ort[2][0].subtract(ort[0][2]));
-            quat[3] = inv.multiply(ort[0][1].subtract(ort[1][0]));
-        } else {
-            s = ort[0][0].subtract(ort[1][1]).subtract(ort[2][2]);
-            if (s.getReal() > -0.19) {
-                // compute q1 and deduce q0, q2 and q3
-                quat[1] = s.add(1.0).sqrt().multiply(0.5);
-                T inv = quat[1].reciprocal().multiply(0.25);
-                quat[0] = inv.multiply(ort[1][2].subtract(ort[2][1]));
-                quat[2] = inv.multiply(ort[0][1].add(ort[1][0]));
-                quat[3] = inv.multiply(ort[0][2].add(ort[2][0]));
-            } else {
-                s = ort[1][1].subtract(ort[0][0]).subtract(ort[2][2]);
-                if (s.getReal() > -0.19) {
-                    // compute q2 and deduce q0, q1 and q3
-                    quat[2] = s.add(1.0).sqrt().multiply(0.5);
-                    T inv = quat[2].reciprocal().multiply(0.25);
-                    quat[0] = inv.multiply(ort[2][0].subtract(ort[0][2]));
-                    quat[1] = inv.multiply(ort[0][1].add(ort[1][0]));
-                    quat[3] = inv.multiply(ort[2][1].add(ort[1][2]));
-                } else {
-                    // compute q3 and deduce q0, q1 and q2
-                    s = ort[2][2].subtract(ort[0][0]).subtract(ort[1][1]);
-                    quat[3] = s.add(1.0).sqrt().multiply(0.5);
-                    T inv = quat[3].reciprocal().multiply(0.25);
-                    quat[0] = inv.multiply(ort[0][1].subtract(ort[1][0]));
-                    quat[1] = inv.multiply(ort[0][2].add(ort[2][0]));
-                    quat[2] = inv.multiply(ort[2][1].add(ort[1][2]));
-                }
-            }
-        }
-
-        return quat;
-
-    }
-
-    /** Revert a rotation.
-     * Build a rotation which reverse the effect of another
-     * rotation. This means that if r(u) = v, then r.revert(v) = u. The
-     * instance is not changed.
-     * @return a new rotation whose effect is the reverse of the effect
-     * of the instance
-     */
-    public FieldRotation<T> revert() {
-        return new FieldRotation<T>(q0.negate(), q1, q2, q3, false);
-    }
-
-    /** Get the scalar coordinate of the quaternion.
-     * @return scalar coordinate of the quaternion
-     */
-    public T getQ0() {
-        return q0;
-    }
-
-    /** Get the first coordinate of the vectorial part of the quaternion.
-     * @return first coordinate of the vectorial part of the quaternion
-     */
-    public T getQ1() {
-        return q1;
-    }
-
-    /** Get the second coordinate of the vectorial part of the quaternion.
-     * @return second coordinate of the vectorial part of the quaternion
-     */
-    public T getQ2() {
-        return q2;
-    }
-
-    /** Get the third coordinate of the vectorial part of the quaternion.
-     * @return third coordinate of the vectorial part of the quaternion
-     */
-    public T getQ3() {
-        return q3;
-    }
-
-    /** Get the normalized axis of the rotation.
-     * @return normalized axis of the rotation
-     * @see #FieldRotation(FieldVector3D, RealFieldElement)
-     */
-    public FieldVector3D<T> getAxis() {
-        final T squaredSine = q1.multiply(q1).add(q2.multiply(q2)).add(q3.multiply(q3));
-        if (squaredSine.getReal() == 0) {
-            final Field<T> field = squaredSine.getField();
-            return new FieldVector3D<T>(field.getOne(), field.getZero(), field.getZero());
-        } else if (q0.getReal() < 0) {
-            T inverse = squaredSine.sqrt().reciprocal();
-            return new FieldVector3D<T>(q1.multiply(inverse), q2.multiply(inverse), q3.multiply(inverse));
-        }
-        final T inverse = squaredSine.sqrt().reciprocal().negate();
-        return new FieldVector3D<T>(q1.multiply(inverse), q2.multiply(inverse), q3.multiply(inverse));
-    }
-
-    /** Get the angle of the rotation.
-     * @return angle of the rotation (between 0 and &pi;)
-     * @see #FieldRotation(FieldVector3D, RealFieldElement)
-     */
-    public T getAngle() {
-        if ((q0.getReal() < -0.1) || (q0.getReal() > 0.1)) {
-            return q1.multiply(q1).add(q2.multiply(q2)).add(q3.multiply(q3)).sqrt().asin().multiply(2);
-        } else if (q0.getReal() < 0) {
-            return q0.negate().acos().multiply(2);
-        }
-        return q0.acos().multiply(2);
-    }
-
-    /** Get the Cardan or Euler angles corresponding to the instance.
-
-     * <p>The equations show that each rotation can be defined by two
-     * different values of the Cardan or Euler angles set. For example
-     * if Cardan angles are used, the rotation defined by the angles
-     * a<sub>1</sub>, a<sub>2</sub> and a<sub>3</sub> is the same as
-     * the rotation defined by the angles &pi; + a<sub>1</sub>, &pi;
-     * - a<sub>2</sub> and &pi; + a<sub>3</sub>. This method implements
-     * the following arbitrary choices:</p>
-     * <ul>
-     *   <li>for Cardan angles, the chosen set is the one for which the
-     *   second angle is between -&pi;/2 and &pi;/2 (i.e its cosine is
-     *   positive),</li>
-     *   <li>for Euler angles, the chosen set is the one for which the
-     *   second angle is between 0 and &pi; (i.e its sine is positive).</li>
-     * </ul>
-
-     * <p>Cardan and Euler angle have a very disappointing drawback: all
-     * of them have singularities. This means that if the instance is
-     * too close to the singularities corresponding to the given
-     * rotation order, it will be impossible to retrieve the angles. For
-     * Cardan angles, this is often called gimbal lock. There is
-     * <em>nothing</em> to do to prevent this, it is an intrinsic problem
-     * with Cardan and Euler representation (but not a problem with the
-     * rotation itself, which is perfectly well defined). For Cardan
-     * angles, singularities occur when the second angle is close to
-     * -&pi;/2 or +&pi;/2, for Euler angle singularities occur when the
-     * second angle is close to 0 or &pi;, this implies that the identity
-     * rotation is always singular for Euler angles!</p>
-
-     * @param order rotation order to use
-     * @return an array of three angles, in the order specified by the set
-     * @exception CardanEulerSingularityException if the rotation is
-     * singular with respect to the angles set specified
-     */
-    public T[] getAngles(final RotationOrder order)
-        throws CardanEulerSingularityException {
-
-        if (order == RotationOrder.XYZ) {
-
-            // r (+K) coordinates are :
-            //  sin (theta), -cos (theta) sin (phi), cos (theta) cos (phi)
-            // (-r) (+I) coordinates are :
-            // cos (psi) cos (theta), -sin (psi) cos (theta), sin (theta)
-            final // and we can choose to have theta in the interval [-PI/2 ; +PI/2]
-            FieldVector3D<T> v1 = applyTo(vector(0, 0, 1));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(1, 0, 0));
-            if  ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(true);
-            }
-            return buildArray(v1.getY().negate().atan2(v1.getZ()),
-                              v2.getZ().asin(),
-                              v2.getY().negate().atan2(v2.getX()));
-
-        } else if (order == RotationOrder.XZY) {
-
-            // r (+J) coordinates are :
-            // -sin (psi), cos (psi) cos (phi), cos (psi) sin (phi)
-            // (-r) (+I) coordinates are :
-            // cos (theta) cos (psi), -sin (psi), sin (theta) cos (psi)
-            // and we can choose to have psi in the interval [-PI/2 ; +PI/2]
-            final FieldVector3D<T> v1 = applyTo(vector(0, 1, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(1, 0, 0));
-            if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(true);
-            }
-            return buildArray(v1.getZ().atan2(v1.getY()),
-                              v2.getY().asin().negate(),
-                              v2.getZ().atan2(v2.getX()));
-
-        } else if (order == RotationOrder.YXZ) {
-
-            // r (+K) coordinates are :
-            //  cos (phi) sin (theta), -sin (phi), cos (phi) cos (theta)
-            // (-r) (+J) coordinates are :
-            // sin (psi) cos (phi), cos (psi) cos (phi), -sin (phi)
-            // and we can choose to have phi in the interval [-PI/2 ; +PI/2]
-            final FieldVector3D<T> v1 = applyTo(vector(0, 0, 1));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 1, 0));
-            if ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(true);
-            }
-            return buildArray(v1.getX().atan2(v1.getZ()),
-                              v2.getZ().asin().negate(),
-                              v2.getX().atan2(v2.getY()));
-
-        } else if (order == RotationOrder.YZX) {
-
-            // r (+I) coordinates are :
-            // cos (psi) cos (theta), sin (psi), -cos (psi) sin (theta)
-            // (-r) (+J) coordinates are :
-            // sin (psi), cos (phi) cos (psi), -sin (phi) cos (psi)
-            // and we can choose to have psi in the interval [-PI/2 ; +PI/2]
-            final FieldVector3D<T> v1 = applyTo(vector(1, 0, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 1, 0));
-            if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(true);
-            }
-            return buildArray(v1.getZ().negate().atan2(v1.getX()),
-                              v2.getX().asin(),
-                              v2.getZ().negate().atan2(v2.getY()));
-
-        } else if (order == RotationOrder.ZXY) {
-
-            // r (+J) coordinates are :
-            // -cos (phi) sin (psi), cos (phi) cos (psi), sin (phi)
-            // (-r) (+K) coordinates are :
-            // -sin (theta) cos (phi), sin (phi), cos (theta) cos (phi)
-            // and we can choose to have phi in the interval [-PI/2 ; +PI/2]
-            final FieldVector3D<T> v1 = applyTo(vector(0, 1, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 0, 1));
-            if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(true);
-            }
-            return buildArray(v1.getX().negate().atan2(v1.getY()),
-                              v2.getY().asin(),
-                              v2.getX().negate().atan2(v2.getZ()));
-
-        } else if (order == RotationOrder.ZYX) {
-
-            // r (+I) coordinates are :
-            //  cos (theta) cos (psi), cos (theta) sin (psi), -sin (theta)
-            // (-r) (+K) coordinates are :
-            // -sin (theta), sin (phi) cos (theta), cos (phi) cos (theta)
-            // and we can choose to have theta in the interval [-PI/2 ; +PI/2]
-            final FieldVector3D<T> v1 = applyTo(vector(1, 0, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 0, 1));
-            if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(true);
-            }
-            return buildArray(v1.getY().atan2(v1.getX()),
-                              v2.getX().asin().negate(),
-                              v2.getY().atan2(v2.getZ()));
-
-        } else if (order == RotationOrder.XYX) {
-
-            // r (+I) coordinates are :
-            //  cos (theta), sin (phi1) sin (theta), -cos (phi1) sin (theta)
-            // (-r) (+I) coordinates are :
-            // cos (theta), sin (theta) sin (phi2), sin (theta) cos (phi2)
-            // and we can choose to have theta in the interval [0 ; PI]
-            final FieldVector3D<T> v1 = applyTo(vector(1, 0, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(1, 0, 0));
-            if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(false);
-            }
-            return buildArray(v1.getY().atan2(v1.getZ().negate()),
-                              v2.getX().acos(),
-                              v2.getY().atan2(v2.getZ()));
-
-        } else if (order == RotationOrder.XZX) {
-
-            // r (+I) coordinates are :
-            //  cos (psi), cos (phi1) sin (psi), sin (phi1) sin (psi)
-            // (-r) (+I) coordinates are :
-            // cos (psi), -sin (psi) cos (phi2), sin (psi) sin (phi2)
-            // and we can choose to have psi in the interval [0 ; PI]
-            final FieldVector3D<T> v1 = applyTo(vector(1, 0, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(1, 0, 0));
-            if ((v2.getX().getReal() < -0.9999999999) || (v2.getX().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(false);
-            }
-            return buildArray(v1.getZ().atan2(v1.getY()),
-                              v2.getX().acos(),
-                              v2.getZ().atan2(v2.getY().negate()));
-
-        } else if (order == RotationOrder.YXY) {
-
-            // r (+J) coordinates are :
-            //  sin (theta1) sin (phi), cos (phi), cos (theta1) sin (phi)
-            // (-r) (+J) coordinates are :
-            // sin (phi) sin (theta2), cos (phi), -sin (phi) cos (theta2)
-            // and we can choose to have phi in the interval [0 ; PI]
-            final FieldVector3D<T> v1 = applyTo(vector(0, 1, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 1, 0));
-            if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(false);
-            }
-            return buildArray(v1.getX().atan2(v1.getZ()),
-                              v2.getY().acos(),
-                              v2.getX().atan2(v2.getZ().negate()));
-
-        } else if (order == RotationOrder.YZY) {
-
-            // r (+J) coordinates are :
-            //  -cos (theta1) sin (psi), cos (psi), sin (theta1) sin (psi)
-            // (-r) (+J) coordinates are :
-            // sin (psi) cos (theta2), cos (psi), sin (psi) sin (theta2)
-            // and we can choose to have psi in the interval [0 ; PI]
-            final FieldVector3D<T> v1 = applyTo(vector(0, 1, 0));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 1, 0));
-            if ((v2.getY().getReal() < -0.9999999999) || (v2.getY().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(false);
-            }
-            return buildArray(v1.getZ().atan2(v1.getX().negate()),
-                              v2.getY().acos(),
-                              v2.getZ().atan2(v2.getX()));
-
-        } else if (order == RotationOrder.ZXZ) {
-
-            // r (+K) coordinates are :
-            //  sin (psi1) sin (phi), -cos (psi1) sin (phi), cos (phi)
-            // (-r) (+K) coordinates are :
-            // sin (phi) sin (psi2), sin (phi) cos (psi2), cos (phi)
-            // and we can choose to have phi in the interval [0 ; PI]
-            final FieldVector3D<T> v1 = applyTo(vector(0, 0, 1));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 0, 1));
-            if ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(false);
-            }
-            return buildArray(v1.getX().atan2(v1.getY().negate()),
-                              v2.getZ().acos(),
-                              v2.getX().atan2(v2.getY()));
-
-        } else { // last possibility is ZYZ
-
-            // r (+K) coordinates are :
-            //  cos (psi1) sin (theta), sin (psi1) sin (theta), cos (theta)
-            // (-r) (+K) coordinates are :
-            // -sin (theta) cos (psi2), sin (theta) sin (psi2), cos (theta)
-            // and we can choose to have theta in the interval [0 ; PI]
-            final FieldVector3D<T> v1 = applyTo(vector(0, 0, 1));
-            final FieldVector3D<T> v2 = applyInverseTo(vector(0, 0, 1));
-            if ((v2.getZ().getReal() < -0.9999999999) || (v2.getZ().getReal() > 0.9999999999)) {
-                throw new CardanEulerSingularityException(false);
-            }
-            return buildArray(v1.getY().atan2(v1.getX()),
-                              v2.getZ().acos(),
-                              v2.getY().atan2(v2.getX().negate()));
-
-        }
-
-    }
-
-    /** Create a dimension 3 array.
-     * @param a0 first array element
-     * @param a1 second array element
-     * @param a2 third array element
-     * @return new array
-     */
-    private T[] buildArray(final T a0, final T a1, final T a2) {
-        final T[] array = MathArrays.buildArray(a0.getField(), 3);
-        array[0] = a0;
-        array[1] = a1;
-        array[2] = a2;
-        return array;
-    }
-
-    /** Create a constant vector.
-     * @param x abscissa
-     * @param y ordinate
-     * @param z height
-     * @return a constant vector
-     */
-    private FieldVector3D<T> vector(final double x, final double y, final double z) {
-        final T zero = q0.getField().getZero();
-        return new FieldVector3D<T>(zero.add(x), zero.add(y), zero.add(z));
-    }
-
-    /** Get the 3X3 matrix corresponding to the instance
-     * @return the matrix corresponding to the instance
-     */
-    public T[][] getMatrix() {
-
-        // products
-        final T q0q0  = q0.multiply(q0);
-        final T q0q1  = q0.multiply(q1);
-        final T q0q2  = q0.multiply(q2);
-        final T q0q3  = q0.multiply(q3);
-        final T q1q1  = q1.multiply(q1);
-        final T q1q2  = q1.multiply(q2);
-        final T q1q3  = q1.multiply(q3);
-        final T q2q2  = q2.multiply(q2);
-        final T q2q3  = q2.multiply(q3);
-        final T q3q3  = q3.multiply(q3);
-
-        // create the matrix
-        final T[][] m = MathArrays.buildArray(q0.getField(), 3, 3);
-
-        m [0][0] = q0q0.add(q1q1).multiply(2).subtract(1);
-        m [1][0] = q1q2.subtract(q0q3).multiply(2);
-        m [2][0] = q1q3.add(q0q2).multiply(2);
-
-        m [0][1] = q1q2.add(q0q3).multiply(2);
-        m [1][1] = q0q0.add(q2q2).multiply(2).subtract(1);
-        m [2][1] = q2q3.subtract(q0q1).multiply(2);
-
-        m [0][2] = q1q3.subtract(q0q2).multiply(2);
-        m [1][2] = q2q3.add(q0q1).multiply(2);
-        m [2][2] = q0q0.add(q3q3).multiply(2).subtract(1);
-
-        return m;
-
-    }
-
-    /** Convert to a constant vector without derivatives.
-     * @return a constant vector
-     */
-    public Rotation toRotation() {
-        return new Rotation(q0.getReal(), q1.getReal(), q2.getReal(), q3.getReal(), false);
-    }
-
-    /** Apply the rotation to a vector.
-     * @param u vector to apply the rotation to
-     * @return a new vector which is the image of u by the rotation
-     */
-    public FieldVector3D<T> applyTo(final FieldVector3D<T> u) {
-
-        final T x = u.getX();
-        final T y = u.getY();
-        final T z = u.getZ();
-
-        final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-
-        return new FieldVector3D<T>(q0.multiply(x.multiply(q0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x),
-                                    q0.multiply(y.multiply(q0).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y),
-                                    q0.multiply(z.multiply(q0).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z));
-
-    }
-
-    /** Apply the rotation to a vector.
-     * @param u vector to apply the rotation to
-     * @return a new vector which is the image of u by the rotation
-     */
-    public FieldVector3D<T> applyTo(final Vector3D u) {
-
-        final double x = u.getX();
-        final double y = u.getY();
-        final double z = u.getZ();
-
-        final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-
-        return new FieldVector3D<T>(q0.multiply(q0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x),
-                                    q0.multiply(q0.multiply(y).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y),
-                                    q0.multiply(q0.multiply(z).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z));
-
-    }
-
-    /** Apply the rotation to a vector stored in an array.
-     * @param in an array with three items which stores vector to rotate
-     * @param out an array with three items to put result to (it can be the same
-     * array as in)
-     */
-    public void applyTo(final T[] in, final T[] out) {
-
-        final T x = in[0];
-        final T y = in[1];
-        final T z = in[2];
-
-        final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-
-        out[0] = q0.multiply(x.multiply(q0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x);
-        out[1] = q0.multiply(y.multiply(q0).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y);
-        out[2] = q0.multiply(z.multiply(q0).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z);
-
-    }
-
-    /** Apply the rotation to a vector stored in an array.
-     * @param in an array with three items which stores vector to rotate
-     * @param out an array with three items to put result to
-     */
-    public void applyTo(final double[] in, final T[] out) {
-
-        final double x = in[0];
-        final double y = in[1];
-        final double z = in[2];
-
-        final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-
-        out[0] = q0.multiply(q0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x);
-        out[1] = q0.multiply(q0.multiply(y).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y);
-        out[2] = q0.multiply(q0.multiply(z).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z);
-
-    }
-
-    /** Apply a rotation to a vector.
-     * @param r rotation to apply
-     * @param u vector to apply the rotation to
-     * @param <T> the type of the field elements
-     * @return a new vector which is the image of u by the rotation
-     */
-    public static <T extends RealFieldElement<T>> FieldVector3D<T> applyTo(final Rotation r, final FieldVector3D<T> u) {
-
-        final T x = u.getX();
-        final T y = u.getY();
-        final T z = u.getZ();
-
-        final T s = x.multiply(r.getQ1()).add(y.multiply(r.getQ2())).add(z.multiply(r.getQ3()));
-
-        return new FieldVector3D<T>(x.multiply(r.getQ0()).subtract(z.multiply(r.getQ2()).subtract(y.multiply(r.getQ3()))).multiply(r.getQ0()).add(s.multiply(r.getQ1())).multiply(2).subtract(x),
-                                    y.multiply(r.getQ0()).subtract(x.multiply(r.getQ3()).subtract(z.multiply(r.getQ1()))).multiply(r.getQ0()).add(s.multiply(r.getQ2())).multiply(2).subtract(y),
-                                    z.multiply(r.getQ0()).subtract(y.multiply(r.getQ1()).subtract(x.multiply(r.getQ2()))).multiply(r.getQ0()).add(s.multiply(r.getQ3())).multiply(2).subtract(z));
-
-    }
-
-    /** Apply the inverse of the rotation to a vector.
-     * @param u vector to apply the inverse of the rotation to
-     * @return a new vector which such that u is its image by the rotation
-     */
-    public FieldVector3D<T> applyInverseTo(final FieldVector3D<T> u) {
-
-        final T x = u.getX();
-        final T y = u.getY();
-        final T z = u.getZ();
-
-        final T s  = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-        final T m0 = q0.negate();
-
-        return new FieldVector3D<T>(m0.multiply(x.multiply(m0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x),
-                                    m0.multiply(y.multiply(m0).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y),
-                                    m0.multiply(z.multiply(m0).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z));
-
-    }
-
-    /** Apply the inverse of the rotation to a vector.
-     * @param u vector to apply the inverse of the rotation to
-     * @return a new vector which such that u is its image by the rotation
-     */
-    public FieldVector3D<T> applyInverseTo(final Vector3D u) {
-
-        final double x = u.getX();
-        final double y = u.getY();
-        final double z = u.getZ();
-
-        final T s  = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-        final T m0 = q0.negate();
-
-        return new FieldVector3D<T>(m0.multiply(m0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x),
-                                    m0.multiply(m0.multiply(y).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y),
-                                    m0.multiply(m0.multiply(z).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z));
-
-    }
-
-    /** Apply the inverse of the rotation to a vector stored in an array.
-     * @param in an array with three items which stores vector to rotate
-     * @param out an array with three items to put result to (it can be the same
-     * array as in)
-     */
-    public void applyInverseTo(final T[] in, final T[] out) {
-
-        final T x = in[0];
-        final T y = in[1];
-        final T z = in[2];
-
-        final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-        final T m0 = q0.negate();
-
-        out[0] = m0.multiply(x.multiply(m0).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x);
-        out[1] = m0.multiply(y.multiply(m0).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y);
-        out[2] = m0.multiply(z.multiply(m0).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z);
-
-    }
-
-    /** Apply the inverse of the rotation to a vector stored in an array.
-     * @param in an array with three items which stores vector to rotate
-     * @param out an array with three items to put result to
-     */
-    public void applyInverseTo(final double[] in, final T[] out) {
-
-        final double x = in[0];
-        final double y = in[1];
-        final double z = in[2];
-
-        final T s = q1.multiply(x).add(q2.multiply(y)).add(q3.multiply(z));
-        final T m0 = q0.negate();
-
-        out[0] = m0.multiply(m0.multiply(x).subtract(q2.multiply(z).subtract(q3.multiply(y)))).add(s.multiply(q1)).multiply(2).subtract(x);
-        out[1] = m0.multiply(m0.multiply(y).subtract(q3.multiply(x).subtract(q1.multiply(z)))).add(s.multiply(q2)).multiply(2).subtract(y);
-        out[2] = m0.multiply(m0.multiply(z).subtract(q1.multiply(y).subtract(q2.multiply(x)))).add(s.multiply(q3)).multiply(2).subtract(z);
-
-    }
-
-    /** Apply the inverse of a rotation to a vector.
-     * @param r rotation to apply
-     * @param u vector to apply the inverse of the rotation to
-     * @param <T> the type of the field elements
-     * @return a new vector which such that u is its image by the rotation
-     */
-    public static <T extends RealFieldElement<T>> FieldVector3D<T> applyInverseTo(final Rotation r, final FieldVector3D<T> u) {
-
-        final T x = u.getX();
-        final T y = u.getY();
-        final T z = u.getZ();
-
-        final T s  = x.multiply(r.getQ1()).add(y.multiply(r.getQ2())).add(z.multiply(r.getQ3()));
-        final double m0 = -r.getQ0();
-
-        return new FieldVector3D<T>(x.multiply(m0).subtract(z.multiply(r.getQ2()).subtract(y.multiply(r.getQ3()))).multiply(m0).add(s.multiply(r.getQ1())).multiply(2).subtract(x),
-                                    y.multiply(m0).subtract(x.multiply(r.getQ3()).subtract(z.multiply(r.getQ1()))).multiply(m0).add(s.multiply(r.getQ2())).multiply(2).subtract(y),
-                                    z.multiply(m0).subtract(y.multiply(r.getQ1()).subtract(x.multiply(r.getQ2()))).multiply(m0).add(s.multiply(r.getQ3())).multiply(2).subtract(z));
-
-    }
-
-    /** Apply the instance to another rotation.
-     * Applying the instance to a rotation is computing the composition
-     * in an order compliant with the following rule : let u be any
-     * vector and v its image by r (i.e. r.applyTo(u) = v), let w be the image
-     * of v by the instance (i.e. applyTo(v) = w), then w = comp.applyTo(u),
-     * where comp = applyTo(r).
-     * @param r rotation to apply the rotation to
-     * @return a new rotation which is the composition of r by the instance
-     */
-    public FieldRotation<T> applyTo(final FieldRotation<T> r) {
-        return new FieldRotation<T>(r.q0.multiply(q0).subtract(r.q1.multiply(q1).add(r.q2.multiply(q2)).add(r.q3.multiply(q3))),
-                                    r.q1.multiply(q0).add(r.q0.multiply(q1)).add(r.q2.multiply(q3).subtract(r.q3.multiply(q2))),
-                                    r.q2.multiply(q0).add(r.q0.multiply(q2)).add(r.q3.multiply(q1).subtract(r.q1.multiply(q3))),
-                                    r.q3.multiply(q0).add(r.q0.multiply(q3)).add(r.q1.multiply(q2).subtract(r.q2.multiply(q1))),
-                                    false);
-    }
-
-    /** Apply the instance to another rotation.
-     * Applying the instance to a rotation is computing the composition
-     * in an order compliant with the following rule : let u be any
-     * vector and v its image by r (i.e. r.applyTo(u) = v), let w be the image
-     * of v by the instance (i.e. applyTo(v) = w), then w = comp.applyTo(u),
-     * where comp = applyTo(r).
-     * @param r rotation to apply the rotation to
-     * @return a new rotation which is the composition of r by the instance
-     */
-    public FieldRotation<T> applyTo(final Rotation r) {
-        return new FieldRotation<T>(q0.multiply(r.getQ0()).subtract(q1.multiply(r.getQ1()).add(q2.multiply(r.getQ2())).add(q3.multiply(r.getQ3()))),
-                                    q0.multiply(r.getQ1()).add(q1.multiply(r.getQ0())).add(q3.multiply(r.getQ2()).subtract(q2.multiply(r.getQ3()))),
-                                    q0.multiply(r.getQ2()).add(q2.multiply(r.getQ0())).add(q1.multiply(r.getQ3()).subtract(q3.multiply(r.getQ1()))),
-                                    q0.multiply(r.getQ3()).add(q3.multiply(r.getQ0())).add(q2.multiply(r.getQ1()).subtract(q1.multiply(r.getQ2()))),
-                                    false);
-    }
-
-    /** Apply a rotation to another rotation.
-     * Applying a rotation to another rotation is computing the composition
-     * in an order compliant with the following rule : let u be any
-     * vector and v its image by rInner (i.e. rInner.applyTo(u) = v), let w be the image
-     * of v by rOuter (i.e. rOuter.applyTo(v) = w), then w = comp.applyTo(u),
-     * where comp = applyTo(rOuter, rInner).
-     * @param r1 rotation to apply
-     * @param rInner rotation to apply the rotation to
-     * @param <T> the type of the field elements
-     * @return a new rotation which is the composition of r by the instance
-     */
-    public static <T extends RealFieldElement<T>> FieldRotation<T> applyTo(final Rotation r1, final FieldRotation<T> rInner) {
-        return new FieldRotation<T>(rInner.q0.multiply(r1.getQ0()).subtract(rInner.q1.multiply(r1.getQ1()).add(rInner.q2.multiply(r1.getQ2())).add(rInner.q3.multiply(r1.getQ3()))),
-                                    rInner.q1.multiply(r1.getQ0()).add(rInner.q0.multiply(r1.getQ1())).add(rInner.q2.multiply(r1.getQ3()).subtract(rInner.q3.multiply(r1.getQ2()))),
-                                    rInner.q2.multiply(r1.getQ0()).add(rInner.q0.multiply(r1.getQ2())).add(rInner.q3.multiply(r1.getQ1()).subtract(rInner.q1.multiply(r1.getQ3()))),
-                                    rInner.q3.multiply(r1.getQ0()).add(rInner.q0.multiply(r1.getQ3())).add(rInner.q1.multiply(r1.getQ2()).subtract(rInner.q2.multiply(r1.getQ1()))),
-                                    false);
-    }
-
-    /** Apply the inverse of the instance to another rotation.
-     * Applying the inverse of the instance to a rotation is computing
-     * the composition in an order compliant with the following rule :
-     * let u be any vector and v its image by r (i.e. r.applyTo(u) = v),
-     * let w be the inverse image of v by the instance
-     * (i.e. applyInverseTo(v) = w), then w = comp.applyTo(u), where
-     * comp = applyInverseTo(r).
-     * @param r rotation to apply the rotation to
-     * @return a new rotation which is the composition of r by the inverse
-     * of the instance
-     */
-    public FieldRotation<T> applyInverseTo(final FieldRotation<T> r) {
-        return new FieldRotation<T>(r.q0.multiply(q0).add(r.q1.multiply(q1).add(r.q2.multiply(q2)).add(r.q3.multiply(q3))).negate(),
-                                    r.q0.multiply(q1).add(r.q2.multiply(q3).subtract(r.q3.multiply(q2))).subtract(r.q1.multiply(q0)),
-                                    r.q0.multiply(q2).add(r.q3.multiply(q1).subtract(r.q1.multiply(q3))).subtract(r.q2.multiply(q0)),
-                                    r.q0.multiply(q3).add(r.q1.multiply(q2).subtract(r.q2.multiply(q1))).subtract(r.q3.multiply(q0)),
-                                    false);
-    }
-
-    /** Apply the inverse of the instance to another rotation.
-     * Applying the inverse of the instance to a rotation is computing
-     * the composition in an order compliant with the following rule :
-     * let u be any vector and v its image by r (i.e. r.applyTo(u) = v),
-     * let w be the inverse image of v by the instance
-     * (i.e. applyInverseTo(v) = w), then w = comp.applyTo(u), where
-     * comp = applyInverseTo(r).
-     * @param r rotation to apply the rotation to
-     * @return a new rotation which is the composition of r by the inverse
-     * of the instance
-     */
-    public FieldRotation<T> applyInverseTo(final Rotation r) {
-        return new FieldRotation<T>(q0.multiply(r.getQ0()).add(q1.multiply(r.getQ1()).add(q2.multiply(r.getQ2())).add(q3.multiply(r.getQ3()))).negate(),
-                                    q1.multiply(r.getQ0()).add(q3.multiply(r.getQ2()).subtract(q2.multiply(r.getQ3()))).subtract(q0.multiply(r.getQ1())),
-                                    q2.multiply(r.getQ0()).add(q1.multiply(r.getQ3()).subtract(q3.multiply(r.getQ1()))).subtract(q0.multiply(r.getQ2())),
-                                    q3.multiply(r.getQ0()).add(q2.multiply(r.getQ1()).subtract(q1.multiply(r.getQ2()))).subtract(q0.multiply(r.getQ3())),
-                                    false);
-    }
-
-    /** Apply the inverse of a rotation to another rotation.
-     * Applying the inverse of a rotation to another rotation is computing
-     * the composition in an order compliant with the following rule :
-     * let u be any vector and v its image by rInner (i.e. rInner.applyTo(u) = v),
-     * let w be the inverse image of v by rOuter
-     * (i.e. rOuter.applyInverseTo(v) = w), then w = comp.applyTo(u), where
-     * comp = applyInverseTo(rOuter, rInner).
-     * @param rOuter rotation to apply the rotation to
-     * @param rInner rotation to apply the rotation to
-     * @param <T> the type of the field elements
-     * @return a new rotation which is the composition of r by the inverse
-     * of the instance
-     */
-    public static <T extends RealFieldElement<T>> FieldRotation<T> applyInverseTo(final Rotation rOuter, final FieldRotation<T> rInner) {
-        return new FieldRotation<T>(rInner.q0.multiply(rOuter.getQ0()).add(rInner.q1.multiply(rOuter.getQ1()).add(rInner.q2.multiply(rOuter.getQ2())).add(rInner.q3.multiply(rOuter.getQ3()))).negate(),
-                                    rInner.q0.multiply(rOuter.getQ1()).add(rInner.q2.multiply(rOuter.getQ3()).subtract(rInner.q3.multiply(rOuter.getQ2()))).subtract(rInner.q1.multiply(rOuter.getQ0())),
-                                    rInner.q0.multiply(rOuter.getQ2()).add(rInner.q3.multiply(rOuter.getQ1()).subtract(rInner.q1.multiply(rOuter.getQ3()))).subtract(rInner.q2.multiply(rOuter.getQ0())),
-                                    rInner.q0.multiply(rOuter.getQ3()).add(rInner.q1.multiply(rOuter.getQ2()).subtract(rInner.q2.multiply(rOuter.getQ1()))).subtract(rInner.q3.multiply(rOuter.getQ0())),
-                                    false);
-    }
-
-    /** Perfect orthogonality on a 3X3 matrix.
-     * @param m initial matrix (not exactly orthogonal)
-     * @param threshold convergence threshold for the iterative
-     * orthogonality correction (convergence is reached when the
-     * difference between two steps of the Frobenius norm of the
-     * correction is below this threshold)
-     * @return an orthogonal matrix close to m
-     * @exception NotARotationMatrixException if the matrix cannot be
-     * orthogonalized with the given threshold after 10 iterations
-     */
-    private T[][] orthogonalizeMatrix(final T[][] m, final double threshold)
-        throws NotARotationMatrixException {
-
-        T x00 = m[0][0];
-        T x01 = m[0][1];
-        T x02 = m[0][2];
-        T x10 = m[1][0];
-        T x11 = m[1][1];
-        T x12 = m[1][2];
-        T x20 = m[2][0];
-        T x21 = m[2][1];
-        T x22 = m[2][2];
-        double fn = 0;
-        double fn1;
-
-        final T[][] o = MathArrays.buildArray(m[0][0].getField(), 3, 3);
-
-        // iterative correction: Xn+1 = Xn - 0.5 * (Xn.Mt.Xn - M)
-        int i = 0;
-        while (++i < 11) {
-
-            // Mt.Xn
-            final T mx00 = m[0][0].multiply(x00).add(m[1][0].multiply(x10)).add(m[2][0].multiply(x20));
-            final T mx10 = m[0][1].multiply(x00).add(m[1][1].multiply(x10)).add(m[2][1].multiply(x20));
-            final T mx20 = m[0][2].multiply(x00).add(m[1][2].multiply(x10)).add(m[2][2].multiply(x20));
-            final T mx01 = m[0][0].multiply(x01).add(m[1][0].multiply(x11)).add(m[2][0].multiply(x21));
-            final T mx11 = m[0][1].multiply(x01).add(m[1][1].multiply(x11)).add(m[2][1].multiply(x21));
-            final T mx21 = m[0][2].multiply(x01).add(m[1][2].multiply(x11)).add(m[2][2].multiply(x21));
-            final T mx02 = m[0][0].multiply(x02).add(m[1][0].multiply(x12)).add(m[2][0].multiply(x22));
-            final T mx12 = m[0][1].multiply(x02).add(m[1][1].multiply(x12)).add(m[2][1].multiply(x22));
-            final T mx22 = m[0][2].multiply(x02).add(m[1][2].multiply(x12)).add(m[2][2].multiply(x22));
-
-            // Xn+1
-            o[0][0] = x00.subtract(x00.multiply(mx00).add(x01.multiply(mx10)).add(x02.multiply(mx20)).subtract(m[0][0]).multiply(0.5));
-            o[0][1] = x01.subtract(x00.multiply(mx01).add(x01.multiply(mx11)).add(x02.multiply(mx21)).subtract(m[0][1]).multiply(0.5));
-            o[0][2] = x02.subtract(x00.multiply(mx02).add(x01.multiply(mx12)).add(x02.multiply(mx22)).subtract(m[0][2]).multiply(0.5));
-            o[1][0] = x10.subtract(x10.multiply(mx00).add(x11.multiply(mx10)).add(x12.multiply(mx20)).subtract(m[1][0]).multiply(0.5));
-            o[1][1] = x11.subtract(x10.multiply(mx01).add(x11.multiply(mx11)).add(x12.multiply(mx21)).subtract(m[1][1]).multiply(0.5));
-            o[1][2] = x12.subtract(x10.multiply(mx02).add(x11.multiply(mx12)).add(x12.multiply(mx22)).subtract(m[1][2]).multiply(0.5));
-            o[2][0] = x20.subtract(x20.multiply(mx00).add(x21.multiply(mx10)).add(x22.multiply(mx20)).subtract(m[2][0]).multiply(0.5));
-            o[2][1] = x21.subtract(x20.multiply(mx01).add(x21.multiply(mx11)).add(x22.multiply(mx21)).subtract(m[2][1]).multiply(0.5));
-            o[2][2] = x22.subtract(x20.multiply(mx02).add(x21.multiply(mx12)).add(x22.multiply(mx22)).subtract(m[2][2]).multiply(0.5));
-
-            // correction on each elements
-            final double corr00 = o[0][0].getReal() - m[0][0].getReal();
-            final double corr01 = o[0][1].getReal() - m[0][1].getReal();
-            final double corr02 = o[0][2].getReal() - m[0][2].getReal();
-            final double corr10 = o[1][0].getReal() - m[1][0].getReal();
-            final double corr11 = o[1][1].getReal() - m[1][1].getReal();
-            final double corr12 = o[1][2].getReal() - m[1][2].getReal();
-            final double corr20 = o[2][0].getReal() - m[2][0].getReal();
-            final double corr21 = o[2][1].getReal() - m[2][1].getReal();
-            final double corr22 = o[2][2].getReal() - m[2][2].getReal();
-
-            // Frobenius norm of the correction
-            fn1 = corr00 * corr00 + corr01 * corr01 + corr02 * corr02 +
-                  corr10 * corr10 + corr11 * corr11 + corr12 * corr12 +
-                  corr20 * corr20 + corr21 * corr21 + corr22 * corr22;
-
-            // convergence test
-            if (FastMath.abs(fn1 - fn) <= threshold) {
-                return o;
-            }
-
-            // prepare next iteration
-            x00 = o[0][0];
-            x01 = o[0][1];
-            x02 = o[0][2];
-            x10 = o[1][0];
-            x11 = o[1][1];
-            x12 = o[1][2];
-            x20 = o[2][0];
-            x21 = o[2][1];
-            x22 = o[2][2];
-            fn  = fn1;
-
-        }
-
-        // the algorithm did not converge after 10 iterations
-        throw new NotARotationMatrixException(LocalizedFormats.UNABLE_TO_ORTHOGONOLIZE_MATRIX,
-                                              i - 1);
-
-    }
-
-    /** Compute the <i>distance</i> between two rotations.
-     * <p>The <i>distance</i> is intended here as a way to check if two
-     * rotations are almost similar (i.e. they transform vectors the same way)
-     * or very different. It is mathematically defined as the angle of
-     * the rotation r that prepended to one of the rotations gives the other
-     * one:</p>
-     * <pre>
-     *        r<sub>1</sub>(r) = r<sub>2</sub>
-     * </pre>
-     * <p>This distance is an angle between 0 and &pi;. Its value is the smallest
-     * possible upper bound of the angle in radians between r<sub>1</sub>(v)
-     * and r<sub>2</sub>(v) for all possible vectors v. This upper bound is
-     * reached for some v. The distance is equal to 0 if and only if the two
-     * rotations are identical.</p>
-     * <p>Comparing two rotations should always be done using this value rather
-     * than for example comparing the components of the quaternions. It is much
-     * more stable, and has a geometric meaning. Also comparing quaternions
-     * components is error prone since for example quaternions (0.36, 0.48, -0.48, -0.64)
-     * and (-0.36, -0.48, 0.48, 0.64) represent exactly the same rotation despite
-     * their components are different (they are exact opposites).</p>
-     * @param r1 first rotation
-     * @param r2 second rotation
-     * @param <T> the type of the field elements
-     * @return <i>distance</i> between r1 and r2
-     */
-    public static <T extends RealFieldElement<T>> T distance(final FieldRotation<T> r1, final FieldRotation<T> r2) {
-        return r1.applyInverseTo(r2).getAngle();
-    }
-
-}


[44/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java
deleted file mode 100644
index 5c7b37f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegrator.java
+++ /dev/null
@@ -1,129 +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.analysis.integration.gauss;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Class that implements the Gaussian rule for
- * {@link #integrate(UnivariateFunction) integrating} a weighted
- * function.
- *
- * @since 3.1
- */
-public class GaussIntegrator {
-    /** Nodes. */
-    private final double[] points;
-    /** Nodes weights. */
-    private final double[] weights;
-
-    /**
-     * Creates an integrator from the given {@code points} and {@code weights}.
-     * The integration interval is defined by the first and last value of
-     * {@code points} which must be sorted in increasing order.
-     *
-     * @param points Integration points.
-     * @param weights Weights of the corresponding integration nodes.
-     * @throws NonMonotonicSequenceException if the {@code points} are not
-     * sorted in increasing order.
-     * @throws DimensionMismatchException if points and weights don't have the same length
-     */
-    public GaussIntegrator(double[] points,
-                           double[] weights)
-        throws NonMonotonicSequenceException, DimensionMismatchException {
-        if (points.length != weights.length) {
-            throw new DimensionMismatchException(points.length,
-                                                 weights.length);
-        }
-
-        MathArrays.checkOrder(points, MathArrays.OrderDirection.INCREASING, true, true);
-
-        this.points = points.clone();
-        this.weights = weights.clone();
-    }
-
-    /**
-     * Creates an integrator from the given pair of points (first element of
-     * the pair) and weights (second element of the pair.
-     *
-     * @param pointsAndWeights Integration points and corresponding weights.
-     * @throws NonMonotonicSequenceException if the {@code points} are not
-     * sorted in increasing order.
-     *
-     * @see #GaussIntegrator(double[], double[])
-     */
-    public GaussIntegrator(Pair<double[], double[]> pointsAndWeights)
-        throws NonMonotonicSequenceException {
-        this(pointsAndWeights.getFirst(), pointsAndWeights.getSecond());
-    }
-
-    /**
-     * Returns an estimate of the integral of {@code f(x) * w(x)},
-     * where {@code w} is a weight function that depends on the actual
-     * flavor of the Gauss integration scheme.
-     * The algorithm uses the points and associated weights, as passed
-     * to the {@link #GaussIntegrator(double[],double[]) constructor}.
-     *
-     * @param f Function to integrate.
-     * @return the integral of the weighted function.
-     */
-    public double integrate(UnivariateFunction f) {
-        double s = 0;
-        double c = 0;
-        for (int i = 0; i < points.length; i++) {
-            final double x = points[i];
-            final double w = weights[i];
-            final double y = w * f.value(x) - c;
-            final double t = s + y;
-            c = (t - s) - y;
-            s = t;
-        }
-        return s;
-    }
-
-    /**
-     * @return the order of the integration rule (the number of integration
-     * points).
-     */
-    public int getNumberOfPoints() {
-        return points.length;
-    }
-
-    /**
-     * Gets the integration point at the given index.
-     * The index must be in the valid range but no check is performed.
-     * @param index index of the integration point
-     * @return the integration point.
-     */
-    public double getPoint(int index) {
-        return points[index];
-    }
-
-    /**
-     * Gets the weight of the integration point at the given index.
-     * The index must be in the valid range but no check is performed.
-     * @param index index of the integration point
-     * @return the weight.
-     */
-    public double getWeight(int index) {
-        return weights[index];
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegratorFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegratorFactory.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegratorFactory.java
deleted file mode 100644
index ebe9a5b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/GaussIntegratorFactory.java
+++ /dev/null
@@ -1,169 +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.analysis.integration.gauss;
-
-import java.math.BigDecimal;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Class that provides different ways to compute the nodes and weights to be
- * used by the {@link GaussIntegrator Gaussian integration rule}.
- *
- * @since 3.1
- */
-public class GaussIntegratorFactory {
-    /** Generator of Gauss-Legendre integrators. */
-    private final BaseRuleFactory<Double> legendre = new LegendreRuleFactory();
-    /** Generator of Gauss-Legendre integrators. */
-    private final BaseRuleFactory<BigDecimal> legendreHighPrecision = new LegendreHighPrecisionRuleFactory();
-    /** Generator of Gauss-Hermite integrators. */
-    private final BaseRuleFactory<Double> hermite = new HermiteRuleFactory();
-
-    /**
-     * Creates a Gauss-Legendre integrator of the given order.
-     * The call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
-     * integrate} method will perform an integration on the natural interval
-     * {@code [-1 , 1]}.
-     *
-     * @param numberOfPoints Order of the integration rule.
-     * @return a Gauss-Legendre integrator.
-     */
-    public GaussIntegrator legendre(int numberOfPoints) {
-        return new GaussIntegrator(getRule(legendre, numberOfPoints));
-    }
-
-    /**
-     * Creates a Gauss-Legendre integrator of the given order.
-     * The call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
-     * integrate} method will perform an integration on the given interval.
-     *
-     * @param numberOfPoints Order of the integration rule.
-     * @param lowerBound Lower bound of the integration interval.
-     * @param upperBound Upper bound of the integration interval.
-     * @return a Gauss-Legendre integrator.
-     * @throws NotStrictlyPositiveException if number of points is not positive
-     */
-    public GaussIntegrator legendre(int numberOfPoints,
-                                    double lowerBound,
-                                    double upperBound)
-        throws NotStrictlyPositiveException {
-        return new GaussIntegrator(transform(getRule(legendre, numberOfPoints),
-                                             lowerBound, upperBound));
-    }
-
-    /**
-     * Creates a Gauss-Legendre integrator of the given order.
-     * The call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
-     * integrate} method will perform an integration on the natural interval
-     * {@code [-1 , 1]}.
-     *
-     * @param numberOfPoints Order of the integration rule.
-     * @return a Gauss-Legendre integrator.
-     * @throws NotStrictlyPositiveException if number of points is not positive
-     */
-    public GaussIntegrator legendreHighPrecision(int numberOfPoints)
-        throws NotStrictlyPositiveException {
-        return new GaussIntegrator(getRule(legendreHighPrecision, numberOfPoints));
-    }
-
-    /**
-     * Creates an integrator of the given order, and whose call to the
-     * {@link GaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
-     * integrate} method will perform an integration on the given interval.
-     *
-     * @param numberOfPoints Order of the integration rule.
-     * @param lowerBound Lower bound of the integration interval.
-     * @param upperBound Upper bound of the integration interval.
-     * @return a Gauss-Legendre integrator.
-     * @throws NotStrictlyPositiveException if number of points is not positive
-     */
-    public GaussIntegrator legendreHighPrecision(int numberOfPoints,
-                                                 double lowerBound,
-                                                 double upperBound)
-        throws NotStrictlyPositiveException {
-        return new GaussIntegrator(transform(getRule(legendreHighPrecision, numberOfPoints),
-                                             lowerBound, upperBound));
-    }
-
-    /**
-     * Creates a Gauss-Hermite integrator of the given order.
-     * The call to the
-     * {@link SymmetricGaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
-     * integrate} method will perform a weighted integration on the interval
-     * {@code [-&inf;, +&inf;]}: the computed value is the improper integral of
-     * <code>
-     *  e<sup>-x<sup>2</sup></sup> f(x)
-     * </code>
-     * where {@code f(x)} is the function passed to the
-     * {@link SymmetricGaussIntegrator#integrate(org.apache.commons.math3.analysis.UnivariateFunction)
-     * integrate} method.
-     *
-     * @param numberOfPoints Order of the integration rule.
-     * @return a Gauss-Hermite integrator.
-     */
-    public SymmetricGaussIntegrator hermite(int numberOfPoints) {
-        return new SymmetricGaussIntegrator(getRule(hermite, numberOfPoints));
-    }
-
-    /**
-     * @param factory Integration rule factory.
-     * @param numberOfPoints Order of the integration rule.
-     * @return the integration nodes and weights.
-     * @throws NotStrictlyPositiveException if number of points is not positive
-     * @throws DimensionMismatchException if the elements of the rule pair do not
-     * have the same length.
-     */
-    private static Pair<double[], double[]> getRule(BaseRuleFactory<? extends Number> factory,
-                                                    int numberOfPoints)
-        throws NotStrictlyPositiveException, DimensionMismatchException {
-        return factory.getRule(numberOfPoints);
-    }
-
-    /**
-     * Performs a change of variable so that the integration can be performed
-     * on an arbitrary interval {@code [a, b]}.
-     * It is assumed that the natural interval is {@code [-1, 1]}.
-     *
-     * @param rule Original points and weights.
-     * @param a Lower bound of the integration interval.
-     * @param b Lower bound of the integration interval.
-     * @return the points and weights adapted to the new interval.
-     */
-    private static Pair<double[], double[]> transform(Pair<double[], double[]> rule,
-                                                      double a,
-                                                      double b) {
-        final double[] points = rule.getFirst();
-        final double[] weights = rule.getSecond();
-
-        // Scaling
-        final double scale = (b - a) / 2;
-        final double shift = a + scale;
-
-        for (int i = 0; i < points.length; i++) {
-            points[i] = points[i] * scale + shift;
-            weights[i] *= scale;
-        }
-
-        return new Pair<double[], double[]>(points, weights);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/HermiteRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/HermiteRuleFactory.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/HermiteRuleFactory.java
deleted file mode 100644
index 3d873ab..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/HermiteRuleFactory.java
+++ /dev/null
@@ -1,178 +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.analysis.integration.gauss;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Factory that creates a
- * <a href="http://en.wikipedia.org/wiki/Gauss-Hermite_quadrature">
- *  Gauss-type quadrature rule using Hermite polynomials</a>
- * of the first kind.
- * Such a quadrature rule allows the calculation of improper integrals
- * of a function
- * <code>
- *  f(x) e<sup>-x<sup>2</sup></sup>
- * </code>
- * <br/>
- * Recurrence relation and weights computation follow
- * <a href="http://en.wikipedia.org/wiki/Abramowitz_and_Stegun">
- * Abramowitz and Stegun, 1964</a>.
- * <br/>
- * The coefficients of the standard Hermite polynomials grow very rapidly;
- * in order to avoid overflows, each Hermite polynomial is normalized with
- * respect to the underlying scalar product.
- * The initial interval for the application of the bisection method is
- * based on the roots of the previous Hermite polynomial (interlacing).
- * Upper and lower bounds of these roots are provided by
- * <blockquote>
- *  I. Krasikov,<br>
- *  <em>Nonnegative quadratic forms and bounds on orthogonal polynomials</em>,<br>
- *  Journal of Approximation theory <b>111</b>, 31-49<br>
- * </blockquote>
- *
- * @since 3.3
- */
-public class HermiteRuleFactory extends BaseRuleFactory<Double> {
-    /** &pi;<sup>1/2</sup> */
-    private static final double SQRT_PI = 1.77245385090551602729;
-    /** &pi;<sup>-1/4</sup> */
-    private static final double H0 = 7.5112554446494248286e-1;
-    /** &pi;<sup>-1/4</sup> &radic;2 */
-    private static final double H1 = 1.0622519320271969145;
-
-    /** {@inheritDoc} */
-    @Override
-    protected Pair<Double[], Double[]> computeRule(int numberOfPoints)
-        throws DimensionMismatchException {
-
-        if (numberOfPoints == 1) {
-            // Break recursion.
-            return new Pair<Double[], Double[]>(new Double[] { 0d },
-                                                new Double[] { SQRT_PI });
-        }
-
-        // Get previous rule.
-        // If it has not been computed yet it will trigger a recursive call
-        // to this method.
-        final int lastNumPoints = numberOfPoints - 1;
-        final Double[] previousPoints = getRuleInternal(lastNumPoints).getFirst();
-
-        // Compute next rule.
-        final Double[] points = new Double[numberOfPoints];
-        final Double[] weights = new Double[numberOfPoints];
-
-        final double sqrtTwoTimesLastNumPoints = FastMath.sqrt(2 * lastNumPoints);
-        final double sqrtTwoTimesNumPoints = FastMath.sqrt(2 * numberOfPoints);
-
-        // Find i-th root of H[n+1] by bracketing.
-        final int iMax = numberOfPoints / 2;
-        for (int i = 0; i < iMax; i++) {
-            // Lower-bound of the interval.
-            double a = (i == 0) ? -sqrtTwoTimesLastNumPoints : previousPoints[i - 1].doubleValue();
-            // Upper-bound of the interval.
-            double b = (iMax == 1) ? -0.5 : previousPoints[i].doubleValue();
-
-            // H[j-1](a)
-            double hma = H0;
-            // H[j](a)
-            double ha = H1 * a;
-            // H[j-1](b)
-            double hmb = H0;
-            // H[j](b)
-            double hb = H1 * b;
-            for (int j = 1; j < numberOfPoints; j++) {
-                // Compute H[j+1](a) and H[j+1](b)
-                final double jp1 = j + 1;
-                final double s = FastMath.sqrt(2 / jp1);
-                final double sm = FastMath.sqrt(j / jp1);
-                final double hpa = s * a * ha - sm * hma;
-                final double hpb = s * b * hb - sm * hmb;
-                hma = ha;
-                ha = hpa;
-                hmb = hb;
-                hb = hpb;
-            }
-
-            // Now ha = H[n+1](a), and hma = H[n](a) (same holds for b).
-            // Middle of the interval.
-            double c = 0.5 * (a + b);
-            // P[j-1](c)
-            double hmc = H0;
-            // P[j](c)
-            double hc = H1 * c;
-            boolean done = false;
-            while (!done) {
-                done = b - a <= Math.ulp(c);
-                hmc = H0;
-                hc = H1 * c;
-                for (int j = 1; j < numberOfPoints; j++) {
-                    // Compute H[j+1](c)
-                    final double jp1 = j + 1;
-                    final double s = FastMath.sqrt(2 / jp1);
-                    final double sm = FastMath.sqrt(j / jp1);
-                    final double hpc = s * c * hc - sm * hmc;
-                    hmc = hc;
-                    hc = hpc;
-                }
-                // Now h = H[n+1](c) and hm = H[n](c).
-                if (!done) {
-                    if (ha * hc < 0) {
-                        b = c;
-                        hmb = hmc;
-                        hb = hc;
-                    } else {
-                        a = c;
-                        hma = hmc;
-                        ha = hc;
-                    }
-                    c = 0.5 * (a + b);
-                }
-            }
-            final double d = sqrtTwoTimesNumPoints * hmc;
-            final double w = 2 / (d * d);
-
-            points[i] = c;
-            weights[i] = w;
-
-            final int idx = lastNumPoints - i;
-            points[idx] = -c;
-            weights[idx] = w;
-        }
-
-        // If "numberOfPoints" is odd, 0 is a root.
-        // Note: as written, the test for oddness will work for negative
-        // integers too (although it is not necessary here), preventing
-        // a FindBugs warning.
-        if (numberOfPoints % 2 != 0) {
-            double hm = H0;
-            for (int j = 1; j < numberOfPoints; j += 2) {
-                final double jp1 = j + 1;
-                hm = -FastMath.sqrt(j / jp1) * hm;
-            }
-            final double d = sqrtTwoTimesNumPoints * hm;
-            final double w = 2 / (d * d);
-
-            points[iMax] = 0d;
-            weights[iMax] = w;
-        }
-
-        return new Pair<Double[], Double[]>(points, weights);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
deleted file mode 100644
index 93e1738..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreHighPrecisionRuleFactory.java
+++ /dev/null
@@ -1,215 +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.analysis.integration.gauss;
-
-import java.math.BigDecimal;
-import java.math.MathContext;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Factory that creates Gauss-type quadrature rule using Legendre polynomials.
- * In this implementation, the lower and upper bounds of the natural interval
- * of integration are -1 and 1, respectively.
- * The Legendre polynomials are evaluated using the recurrence relation
- * presented in <a href="http://en.wikipedia.org/wiki/Abramowitz_and_Stegun"
- * Abramowitz and Stegun, 1964</a>.
- *
- * @since 3.1
- */
-public class LegendreHighPrecisionRuleFactory extends BaseRuleFactory<BigDecimal> {
-    /** Settings for enhanced precision computations. */
-    private final MathContext mContext;
-    /** The number {@code 2}. */
-    private final BigDecimal two;
-    /** The number {@code -1}. */
-    private final BigDecimal minusOne;
-    /** The number {@code 0.5}. */
-    private final BigDecimal oneHalf;
-
-    /**
-     * Default precision is {@link MathContext#DECIMAL128 DECIMAL128}.
-     */
-    public LegendreHighPrecisionRuleFactory() {
-        this(MathContext.DECIMAL128);
-    }
-
-    /**
-     * @param mContext Precision setting for computing the quadrature rules.
-     */
-    public LegendreHighPrecisionRuleFactory(MathContext mContext) {
-        this.mContext = mContext;
-        two = new BigDecimal("2", mContext);
-        minusOne = new BigDecimal("-1", mContext);
-        oneHalf = new BigDecimal("0.5", mContext);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected Pair<BigDecimal[], BigDecimal[]> computeRule(int numberOfPoints)
-        throws DimensionMismatchException {
-
-        if (numberOfPoints == 1) {
-            // Break recursion.
-            return new Pair<BigDecimal[], BigDecimal[]>(new BigDecimal[] { BigDecimal.ZERO },
-                                                        new BigDecimal[] { two });
-        }
-
-        // Get previous rule.
-        // If it has not been computed yet it will trigger a recursive call
-        // to this method.
-        final BigDecimal[] previousPoints = getRuleInternal(numberOfPoints - 1).getFirst();
-
-        // Compute next rule.
-        final BigDecimal[] points = new BigDecimal[numberOfPoints];
-        final BigDecimal[] weights = new BigDecimal[numberOfPoints];
-
-        // Find i-th root of P[n+1] by bracketing.
-        final int iMax = numberOfPoints / 2;
-        for (int i = 0; i < iMax; i++) {
-            // Lower-bound of the interval.
-            BigDecimal a = (i == 0) ? minusOne : previousPoints[i - 1];
-            // Upper-bound of the interval.
-            BigDecimal b = (iMax == 1) ? BigDecimal.ONE : previousPoints[i];
-            // P[j-1](a)
-            BigDecimal pma = BigDecimal.ONE;
-            // P[j](a)
-            BigDecimal pa = a;
-            // P[j-1](b)
-            BigDecimal pmb = BigDecimal.ONE;
-            // P[j](b)
-            BigDecimal pb = b;
-            for (int j = 1; j < numberOfPoints; j++) {
-                final BigDecimal b_two_j_p_1 = new BigDecimal(2 * j + 1, mContext);
-                final BigDecimal b_j = new BigDecimal(j, mContext);
-                final BigDecimal b_j_p_1 = new BigDecimal(j + 1, mContext);
-
-                // Compute P[j+1](a)
-                // ppa = ((2 * j + 1) * a * pa - j * pma) / (j + 1);
-
-                BigDecimal tmp1 = a.multiply(b_two_j_p_1, mContext);
-                tmp1 = pa.multiply(tmp1, mContext);
-                BigDecimal tmp2 = pma.multiply(b_j, mContext);
-                // P[j+1](a)
-                BigDecimal ppa = tmp1.subtract(tmp2, mContext);
-                ppa = ppa.divide(b_j_p_1, mContext);
-
-                // Compute P[j+1](b)
-                // ppb = ((2 * j + 1) * b * pb - j * pmb) / (j + 1);
-
-                tmp1 = b.multiply(b_two_j_p_1, mContext);
-                tmp1 = pb.multiply(tmp1, mContext);
-                tmp2 = pmb.multiply(b_j, mContext);
-                // P[j+1](b)
-                BigDecimal ppb = tmp1.subtract(tmp2, mContext);
-                ppb = ppb.divide(b_j_p_1, mContext);
-
-                pma = pa;
-                pa = ppa;
-                pmb = pb;
-                pb = ppb;
-            }
-            // Now pa = P[n+1](a), and pma = P[n](a). Same holds for b.
-            // Middle of the interval.
-            BigDecimal c = a.add(b, mContext).multiply(oneHalf, mContext);
-            // P[j-1](c)
-            BigDecimal pmc = BigDecimal.ONE;
-            // P[j](c)
-            BigDecimal pc = c;
-            boolean done = false;
-            while (!done) {
-                BigDecimal tmp1 = b.subtract(a, mContext);
-                BigDecimal tmp2 = c.ulp().multiply(BigDecimal.TEN, mContext);
-                done = tmp1.compareTo(tmp2) <= 0;
-                pmc = BigDecimal.ONE;
-                pc = c;
-                for (int j = 1; j < numberOfPoints; j++) {
-                    final BigDecimal b_two_j_p_1 = new BigDecimal(2 * j + 1, mContext);
-                    final BigDecimal b_j = new BigDecimal(j, mContext);
-                    final BigDecimal b_j_p_1 = new BigDecimal(j + 1, mContext);
-
-                    // Compute P[j+1](c)
-                    tmp1 = c.multiply(b_two_j_p_1, mContext);
-                    tmp1 = pc.multiply(tmp1, mContext);
-                    tmp2 = pmc.multiply(b_j, mContext);
-                    // P[j+1](c)
-                    BigDecimal ppc = tmp1.subtract(tmp2, mContext);
-                    ppc = ppc.divide(b_j_p_1, mContext);
-
-                    pmc = pc;
-                    pc = ppc;
-                }
-                // Now pc = P[n+1](c) and pmc = P[n](c).
-                if (!done) {
-                    if (pa.signum() * pc.signum() <= 0) {
-                        b = c;
-                        pmb = pmc;
-                        pb = pc;
-                    } else {
-                        a = c;
-                        pma = pmc;
-                        pa = pc;
-                    }
-                    c = a.add(b, mContext).multiply(oneHalf, mContext);
-                }
-            }
-            final BigDecimal nP = new BigDecimal(numberOfPoints, mContext);
-            BigDecimal tmp1 = pmc.subtract(c.multiply(pc, mContext), mContext);
-            tmp1 = tmp1.multiply(nP);
-            tmp1 = tmp1.pow(2, mContext);
-            BigDecimal tmp2 = c.pow(2, mContext);
-            tmp2 = BigDecimal.ONE.subtract(tmp2, mContext);
-            tmp2 = tmp2.multiply(two, mContext);
-            tmp2 = tmp2.divide(tmp1, mContext);
-
-            points[i] = c;
-            weights[i] = tmp2;
-
-            final int idx = numberOfPoints - i - 1;
-            points[idx] = c.negate(mContext);
-            weights[idx] = tmp2;
-        }
-        // If "numberOfPoints" is odd, 0 is a root.
-        // Note: as written, the test for oddness will work for negative
-        // integers too (although it is not necessary here), preventing
-        // a FindBugs warning.
-        if (numberOfPoints % 2 != 0) {
-            BigDecimal pmc = BigDecimal.ONE;
-            for (int j = 1; j < numberOfPoints; j += 2) {
-                final BigDecimal b_j = new BigDecimal(j, mContext);
-                final BigDecimal b_j_p_1 = new BigDecimal(j + 1, mContext);
-
-                // pmc = -j * pmc / (j + 1);
-                pmc = pmc.multiply(b_j, mContext);
-                pmc = pmc.divide(b_j_p_1, mContext);
-                pmc = pmc.negate(mContext);
-            }
-
-            // 2 / pow(numberOfPoints * pmc, 2);
-            final BigDecimal nP = new BigDecimal(numberOfPoints, mContext);
-            BigDecimal tmp1 = pmc.multiply(nP, mContext);
-            tmp1 = tmp1.pow(2, mContext);
-            BigDecimal tmp2 = two.divide(tmp1, mContext);
-
-            points[iMax] = BigDecimal.ZERO;
-            weights[iMax] = tmp2;
-        }
-
-        return new Pair<BigDecimal[], BigDecimal[]>(points, weights);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java
deleted file mode 100644
index 225fa01..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/LegendreRuleFactory.java
+++ /dev/null
@@ -1,140 +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.analysis.integration.gauss;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Factory that creates Gauss-type quadrature rule using Legendre polynomials.
- * In this implementation, the lower and upper bounds of the natural interval
- * of integration are -1 and 1, respectively.
- * The Legendre polynomials are evaluated using the recurrence relation
- * presented in <a href="http://en.wikipedia.org/wiki/Abramowitz_and_Stegun"
- * Abramowitz and Stegun, 1964</a>.
- *
- * @since 3.1
- */
-public class LegendreRuleFactory extends BaseRuleFactory<Double> {
-    /** {@inheritDoc} */
-    @Override
-    protected Pair<Double[], Double[]> computeRule(int numberOfPoints)
-        throws DimensionMismatchException {
-
-        if (numberOfPoints == 1) {
-            // Break recursion.
-            return new Pair<Double[], Double[]>(new Double[] { 0d },
-                                                new Double[] { 2d });
-        }
-
-        // Get previous rule.
-        // If it has not been computed yet it will trigger a recursive call
-        // to this method.
-        final Double[] previousPoints = getRuleInternal(numberOfPoints - 1).getFirst();
-
-        // Compute next rule.
-        final Double[] points = new Double[numberOfPoints];
-        final Double[] weights = new Double[numberOfPoints];
-
-        // Find i-th root of P[n+1] by bracketing.
-        final int iMax = numberOfPoints / 2;
-        for (int i = 0; i < iMax; i++) {
-            // Lower-bound of the interval.
-            double a = (i == 0) ? -1 : previousPoints[i - 1].doubleValue();
-            // Upper-bound of the interval.
-            double b = (iMax == 1) ? 1 : previousPoints[i].doubleValue();
-            // P[j-1](a)
-            double pma = 1;
-            // P[j](a)
-            double pa = a;
-            // P[j-1](b)
-            double pmb = 1;
-            // P[j](b)
-            double pb = b;
-            for (int j = 1; j < numberOfPoints; j++) {
-                final int two_j_p_1 = 2 * j + 1;
-                final int j_p_1 = j + 1;
-                // P[j+1](a)
-                final double ppa = (two_j_p_1 * a * pa - j * pma) / j_p_1;
-                // P[j+1](b)
-                final double ppb = (two_j_p_1 * b * pb - j * pmb) / j_p_1;
-                pma = pa;
-                pa = ppa;
-                pmb = pb;
-                pb = ppb;
-            }
-            // Now pa = P[n+1](a), and pma = P[n](a) (same holds for b).
-            // Middle of the interval.
-            double c = 0.5 * (a + b);
-            // P[j-1](c)
-            double pmc = 1;
-            // P[j](c)
-            double pc = c;
-            boolean done = false;
-            while (!done) {
-                done = b - a <= Math.ulp(c);
-                pmc = 1;
-                pc = c;
-                for (int j = 1; j < numberOfPoints; j++) {
-                    // P[j+1](c)
-                    final double ppc = ((2 * j + 1) * c * pc - j * pmc) / (j + 1);
-                    pmc = pc;
-                    pc = ppc;
-                }
-                // Now pc = P[n+1](c) and pmc = P[n](c).
-                if (!done) {
-                    if (pa * pc <= 0) {
-                        b = c;
-                        pmb = pmc;
-                        pb = pc;
-                    } else {
-                        a = c;
-                        pma = pmc;
-                        pa = pc;
-                    }
-                    c = 0.5 * (a + b);
-                }
-            }
-            final double d = numberOfPoints * (pmc - c * pc);
-            final double w = 2 * (1 - c * c) / (d * d);
-
-            points[i] = c;
-            weights[i] = w;
-
-            final int idx = numberOfPoints - i - 1;
-            points[idx] = -c;
-            weights[idx] = w;
-        }
-        // If "numberOfPoints" is odd, 0 is a root.
-        // Note: as written, the test for oddness will work for negative
-        // integers too (although it is not necessary here), preventing
-        // a FindBugs warning.
-        if (numberOfPoints % 2 != 0) {
-            double pmc = 1;
-            for (int j = 1; j < numberOfPoints; j += 2) {
-                pmc = -j * pmc / (j + 1);
-            }
-            final double d = numberOfPoints * pmc;
-            final double w = 2 / (d * d);
-
-            points[iMax] = 0d;
-            weights[iMax] = w;
-        }
-
-        return new Pair<Double[], Double[]>(points, weights);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/SymmetricGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/SymmetricGaussIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/SymmetricGaussIntegrator.java
deleted file mode 100644
index 7fa4884..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/SymmetricGaussIntegrator.java
+++ /dev/null
@@ -1,103 +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.analysis.integration.gauss;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * This class's implements {@link #integrate(UnivariateFunction) integrate}
- * method assuming that the integral is symmetric about 0.
- * This allows to reduce numerical errors.
- *
- * @since 3.3
- */
-public class SymmetricGaussIntegrator extends GaussIntegrator {
-    /**
-     * Creates an integrator from the given {@code points} and {@code weights}.
-     * The integration interval is defined by the first and last value of
-     * {@code points} which must be sorted in increasing order.
-     *
-     * @param points Integration points.
-     * @param weights Weights of the corresponding integration nodes.
-     * @throws NonMonotonicSequenceException if the {@code points} are not
-     * sorted in increasing order.
-     * @throws DimensionMismatchException if points and weights don't have the same length
-     */
-    public SymmetricGaussIntegrator(double[] points,
-                                    double[] weights)
-        throws NonMonotonicSequenceException, DimensionMismatchException {
-        super(points, weights);
-    }
-
-    /**
-     * Creates an integrator from the given pair of points (first element of
-     * the pair) and weights (second element of the pair.
-     *
-     * @param pointsAndWeights Integration points and corresponding weights.
-     * @throws NonMonotonicSequenceException if the {@code points} are not
-     * sorted in increasing order.
-     *
-     * @see #SymmetricGaussIntegrator(double[], double[])
-     */
-    public SymmetricGaussIntegrator(Pair<double[], double[]> pointsAndWeights)
-        throws NonMonotonicSequenceException {
-        this(pointsAndWeights.getFirst(), pointsAndWeights.getSecond());
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public double integrate(UnivariateFunction f) {
-        final int ruleLength = getNumberOfPoints();
-
-        if (ruleLength == 1) {
-            return getWeight(0) * f.value(0d);
-        }
-
-        final int iMax = ruleLength / 2;
-        double s = 0;
-        double c = 0;
-        for (int i = 0; i < iMax; i++) {
-            final double p = getPoint(i);
-            final double w = getWeight(i);
-
-            final double f1 = f.value(p);
-            final double f2 = f.value(-p);
-
-            final double y = w * (f1 + f2) - c;
-            final double t = s + y;
-
-            c = (t - s) - y;
-            s = t;
-        }
-
-        if (ruleLength % 2 != 0) {
-            final double w = getWeight(iMax);
-
-            final double y = w * f.value(0d) - c;
-            final double t = s + y;
-
-            s = t;
-        }
-
-        return s;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/package-info.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/package-info.java
deleted file mode 100644
index 066da30..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-/**
- *
- * Gauss family of quadrature schemes.
- *
- */
-package org.apache.commons.math3.analysis.integration.gauss;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/package-info.java b/src/main/java/org/apache/commons/math3/analysis/integration/package-info.java
deleted file mode 100644
index f4df3ba..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/package-info.java
+++ /dev/null
@@ -1,22 +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.
- */
-/**
- *
- *     Numerical integration (quadrature) algorithms for univariate real functions.
- *
- */
-package org.apache.commons.math3.analysis.integration;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/AkimaSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/AkimaSplineInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/AkimaSplineInterpolator.java
deleted file mode 100644
index 5b89dfe..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/AkimaSplineInterpolator.java
+++ /dev/null
@@ -1,215 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * Computes a cubic spline interpolation for the data set using the Akima
- * algorithm, as originally formulated by Hiroshi Akima in his 1970 paper
- * "A New Method of Interpolation and Smooth Curve Fitting Based on Local Procedures."
- * J. ACM 17, 4 (October 1970), 589-602. DOI=10.1145/321607.321609
- * http://doi.acm.org/10.1145/321607.321609
- * <p>
- * This implementation is based on the Akima implementation in the CubicSpline
- * class in the Math.NET Numerics library. The method referenced is
- * CubicSpline.InterpolateAkimaSorted
- * </p>
- * <p>
- * The {@link #interpolate(double[], double[]) interpolate} method returns a
- * {@link PolynomialSplineFunction} consisting of n cubic polynomials, defined
- * over the subintervals determined by the x values, {@code x[0] < x[i] ... < x[n]}.
- * The Akima algorithm requires that {@code n >= 5}.
- * </p>
- */
-public class AkimaSplineInterpolator
-    implements UnivariateInterpolator {
-    /** The minimum number of points that are needed to compute the function. */
-    private static final int MINIMUM_NUMBER_POINTS = 5;
-
-    /**
-     * Computes an interpolating function for the data set.
-     *
-     * @param xvals the arguments for the interpolation points
-     * @param yvals the values for the interpolation points
-     * @return a function which interpolates the data set
-     * @throws DimensionMismatchException if {@code xvals} and {@code yvals} have
-     *         different sizes.
-     * @throws NonMonotonicSequenceException if {@code xvals} is not sorted in
-     *         strict increasing order.
-     * @throws NumberIsTooSmallException if the size of {@code xvals} is smaller
-     *         than 5.
-     */
-    public PolynomialSplineFunction interpolate(double[] xvals,
-                                                double[] yvals)
-        throws DimensionMismatchException,
-               NumberIsTooSmallException,
-               NonMonotonicSequenceException {
-        if (xvals == null ||
-            yvals == null) {
-            throw new NullArgumentException();
-        }
-
-        if (xvals.length != yvals.length) {
-            throw new DimensionMismatchException(xvals.length, yvals.length);
-        }
-
-        if (xvals.length < MINIMUM_NUMBER_POINTS) {
-            throw new NumberIsTooSmallException(LocalizedFormats.NUMBER_OF_POINTS,
-                                                xvals.length,
-                                                MINIMUM_NUMBER_POINTS, true);
-        }
-
-        MathArrays.checkOrder(xvals);
-
-        final int numberOfDiffAndWeightElements = xvals.length - 1;
-
-        final double[] differences = new double[numberOfDiffAndWeightElements];
-        final double[] weights = new double[numberOfDiffAndWeightElements];
-
-        for (int i = 0; i < differences.length; i++) {
-            differences[i] = (yvals[i + 1] - yvals[i]) / (xvals[i + 1] - xvals[i]);
-        }
-
-        for (int i = 1; i < weights.length; i++) {
-            weights[i] = FastMath.abs(differences[i] - differences[i - 1]);
-        }
-
-        // Prepare Hermite interpolation scheme.
-        final double[] firstDerivatives = new double[xvals.length];
-
-        for (int i = 2; i < firstDerivatives.length - 2; i++) {
-            final double wP = weights[i + 1];
-            final double wM = weights[i - 1];
-            if (Precision.equals(wP, 0.0) &&
-                Precision.equals(wM, 0.0)) {
-                final double xv = xvals[i];
-                final double xvP = xvals[i + 1];
-                final double xvM = xvals[i - 1];
-                firstDerivatives[i] = (((xvP - xv) * differences[i - 1]) + ((xv - xvM) * differences[i])) / (xvP - xvM);
-            } else {
-                firstDerivatives[i] = ((wP * differences[i - 1]) + (wM * differences[i])) / (wP + wM);
-            }
-        }
-
-        firstDerivatives[0] = differentiateThreePoint(xvals, yvals, 0, 0, 1, 2);
-        firstDerivatives[1] = differentiateThreePoint(xvals, yvals, 1, 0, 1, 2);
-        firstDerivatives[xvals.length - 2] = differentiateThreePoint(xvals, yvals, xvals.length - 2,
-                                                                     xvals.length - 3, xvals.length - 2,
-                                                                     xvals.length - 1);
-        firstDerivatives[xvals.length - 1] = differentiateThreePoint(xvals, yvals, xvals.length - 1,
-                                                                     xvals.length - 3, xvals.length - 2,
-                                                                     xvals.length - 1);
-
-        return interpolateHermiteSorted(xvals, yvals, firstDerivatives);
-    }
-
-    /**
-     * Three point differentiation helper, modeled off of the same method in the
-     * Math.NET CubicSpline class. This is used by both the Apache Math and the
-     * Math.NET Akima Cubic Spline algorithms
-     *
-     * @param xvals x values to calculate the numerical derivative with
-     * @param yvals y values to calculate the numerical derivative with
-     * @param indexOfDifferentiation index of the elemnt we are calculating the derivative around
-     * @param indexOfFirstSample index of the first element to sample for the three point method
-     * @param indexOfSecondsample index of the second element to sample for the three point method
-     * @param indexOfThirdSample index of the third element to sample for the three point method
-     * @return the derivative
-     */
-    private double differentiateThreePoint(double[] xvals, double[] yvals,
-                                           int indexOfDifferentiation,
-                                           int indexOfFirstSample,
-                                           int indexOfSecondsample,
-                                           int indexOfThirdSample) {
-        final double x0 = yvals[indexOfFirstSample];
-        final double x1 = yvals[indexOfSecondsample];
-        final double x2 = yvals[indexOfThirdSample];
-
-        final double t = xvals[indexOfDifferentiation] - xvals[indexOfFirstSample];
-        final double t1 = xvals[indexOfSecondsample] - xvals[indexOfFirstSample];
-        final double t2 = xvals[indexOfThirdSample] - xvals[indexOfFirstSample];
-
-        final double a = (x2 - x0 - (t2 / t1 * (x1 - x0))) / (t2 * t2 - t1 * t2);
-        final double b = (x1 - x0 - a * t1 * t1) / t1;
-
-        return (2 * a * t) + b;
-    }
-
-    /**
-     * Creates a Hermite cubic spline interpolation from the set of (x,y) value
-     * pairs and their derivatives. This is modeled off of the
-     * InterpolateHermiteSorted method in the Math.NET CubicSpline class.
-     *
-     * @param xvals x values for interpolation
-     * @param yvals y values for interpolation
-     * @param firstDerivatives first derivative values of the function
-     * @return polynomial that fits the function
-     */
-    private PolynomialSplineFunction interpolateHermiteSorted(double[] xvals,
-                                                              double[] yvals,
-                                                              double[] firstDerivatives) {
-        if (xvals.length != yvals.length) {
-            throw new DimensionMismatchException(xvals.length, yvals.length);
-        }
-
-        if (xvals.length != firstDerivatives.length) {
-            throw new DimensionMismatchException(xvals.length,
-                                                 firstDerivatives.length);
-        }
-
-        final int minimumLength = 2;
-        if (xvals.length < minimumLength) {
-            throw new NumberIsTooSmallException(LocalizedFormats.NUMBER_OF_POINTS,
-                                                xvals.length, minimumLength,
-                                                true);
-        }
-
-        final int size = xvals.length - 1;
-        final PolynomialFunction[] polynomials = new PolynomialFunction[size];
-        final double[] coefficients = new double[4];
-
-        for (int i = 0; i < polynomials.length; i++) {
-            final double w = xvals[i + 1] - xvals[i];
-            final double w2 = w * w;
-
-            final double yv = yvals[i];
-            final double yvP = yvals[i + 1];
-
-            final double fd = firstDerivatives[i];
-            final double fdP = firstDerivatives[i + 1];
-
-            coefficients[0] = yv;
-            coefficients[1] = firstDerivatives[i];
-            coefficients[2] = (3 * (yvP - yv) / w - 2 * fd - fdP) / w;
-            coefficients[3] = (2 * (yv - yvP) / w + fd + fdP) / w2;
-            polynomials[i] = new PolynomialFunction(coefficients);
-        }
-
-        return new PolynomialSplineFunction(xvals, polynomials);
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolatingFunction.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolatingFunction.java
deleted file mode 100644
index 7fe947f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolatingFunction.java
+++ /dev/null
@@ -1,325 +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.analysis.interpolation;
-
-import java.util.Arrays;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Function that implements the
- * <a href="http://en.wikipedia.org/wiki/Bicubic_interpolation">
- * bicubic spline interpolation</a>.
- *
- * @since 3.4
- */
-public class BicubicInterpolatingFunction
-    implements BivariateFunction {
-    /** Number of coefficients. */
-    private static final int NUM_COEFF = 16;
-    /**
-     * Matrix to compute the spline coefficients from the function values
-     * and function derivatives values
-     */
-    private static final double[][] AINV = {
-        { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 },
-        { -3,3,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0 },
-        { 2,-2,0,0,1,1,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-3,3,0,0,-2,-1,0,0 },
-        { 0,0,0,0,0,0,0,0,2,-2,0,0,1,1,0,0 },
-        { -3,0,3,0,0,0,0,0,-2,0,-1,0,0,0,0,0 },
-        { 0,0,0,0,-3,0,3,0,0,0,0,0,-2,0,-1,0 },
-        { 9,-9,-9,9,6,3,-6,-3,6,-6,3,-3,4,2,2,1 },
-        { -6,6,6,-6,-3,-3,3,3,-4,4,-2,2,-2,-2,-1,-1 },
-        { 2,0,-2,0,0,0,0,0,1,0,1,0,0,0,0,0 },
-        { 0,0,0,0,2,0,-2,0,0,0,0,0,1,0,1,0 },
-        { -6,6,6,-6,-4,-2,4,2,-3,3,-3,3,-2,-1,-2,-1 },
-        { 4,-4,-4,4,2,2,-2,-2,2,-2,2,-2,1,1,1,1 }
-    };
-
-    /** Samples x-coordinates */
-    private final double[] xval;
-    /** Samples y-coordinates */
-    private final double[] yval;
-    /** Set of cubic splines patching the whole data grid */
-    private final BicubicFunction[][] splines;
-
-    /**
-     * @param x Sample values of the x-coordinate, in increasing order.
-     * @param y Sample values of the y-coordinate, in increasing order.
-     * @param f Values of the function on every grid point.
-     * @param dFdX Values of the partial derivative of function with respect
-     * to x on every grid point.
-     * @param dFdY Values of the partial derivative of function with respect
-     * to y on every grid point.
-     * @param d2FdXdY Values of the cross partial derivative of function on
-     * every grid point.
-     * @throws DimensionMismatchException if the various arrays do not contain
-     * the expected number of elements.
-     * @throws NonMonotonicSequenceException if {@code x} or {@code y} are
-     * not strictly increasing.
-     * @throws NoDataException if any of the arrays has zero length.
-     */
-    public BicubicInterpolatingFunction(double[] x,
-                                        double[] y,
-                                        double[][] f,
-                                        double[][] dFdX,
-                                        double[][] dFdY,
-                                        double[][] d2FdXdY)
-        throws DimensionMismatchException,
-               NoDataException,
-               NonMonotonicSequenceException {
-        final int xLen = x.length;
-        final int yLen = y.length;
-
-        if (xLen == 0 || yLen == 0 || f.length == 0 || f[0].length == 0) {
-            throw new NoDataException();
-        }
-        if (xLen != f.length) {
-            throw new DimensionMismatchException(xLen, f.length);
-        }
-        if (xLen != dFdX.length) {
-            throw new DimensionMismatchException(xLen, dFdX.length);
-        }
-        if (xLen != dFdY.length) {
-            throw new DimensionMismatchException(xLen, dFdY.length);
-        }
-        if (xLen != d2FdXdY.length) {
-            throw new DimensionMismatchException(xLen, d2FdXdY.length);
-        }
-
-        MathArrays.checkOrder(x);
-        MathArrays.checkOrder(y);
-
-        xval = x.clone();
-        yval = y.clone();
-
-        final int lastI = xLen - 1;
-        final int lastJ = yLen - 1;
-        splines = new BicubicFunction[lastI][lastJ];
-
-        for (int i = 0; i < lastI; i++) {
-            if (f[i].length != yLen) {
-                throw new DimensionMismatchException(f[i].length, yLen);
-            }
-            if (dFdX[i].length != yLen) {
-                throw new DimensionMismatchException(dFdX[i].length, yLen);
-            }
-            if (dFdY[i].length != yLen) {
-                throw new DimensionMismatchException(dFdY[i].length, yLen);
-            }
-            if (d2FdXdY[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdXdY[i].length, yLen);
-            }
-            final int ip1 = i + 1;
-            final double xR = xval[ip1] - xval[i];
-            for (int j = 0; j < lastJ; j++) {
-                final int jp1 = j + 1;
-                final double yR = yval[jp1] - yval[j];
-                final double xRyR = xR * yR;
-                final double[] beta = new double[] {
-                    f[i][j], f[ip1][j], f[i][jp1], f[ip1][jp1],
-                    dFdX[i][j] * xR, dFdX[ip1][j] * xR, dFdX[i][jp1] * xR, dFdX[ip1][jp1] * xR,
-                    dFdY[i][j] * yR, dFdY[ip1][j] * yR, dFdY[i][jp1] * yR, dFdY[ip1][jp1] * yR,
-                    d2FdXdY[i][j] * xRyR, d2FdXdY[ip1][j] * xRyR, d2FdXdY[i][jp1] * xRyR, d2FdXdY[ip1][jp1] * xRyR
-                };
-
-                splines[i][j] = new BicubicFunction(computeSplineCoefficients(beta));
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double value(double x, double y)
-        throws OutOfRangeException {
-        final int i = searchIndex(x, xval);
-        final int j = searchIndex(y, yval);
-
-        final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]);
-        final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]);
-
-        return splines[i][j].value(xN, yN);
-    }
-
-    /**
-     * Indicates whether a point is within the interpolation range.
-     *
-     * @param x First coordinate.
-     * @param y Second coordinate.
-     * @return {@code true} if (x, y) is a valid point.
-     */
-    public boolean isValidPoint(double x, double y) {
-        if (x < xval[0] ||
-            x > xval[xval.length - 1] ||
-            y < yval[0] ||
-            y > yval[yval.length - 1]) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * @param c Coordinate.
-     * @param val Coordinate samples.
-     * @return the index in {@code val} corresponding to the interval
-     * containing {@code c}.
-     * @throws OutOfRangeException if {@code c} is out of the
-     * range defined by the boundary values of {@code val}.
-     */
-    private int searchIndex(double c, double[] val) {
-        final int r = Arrays.binarySearch(val, c);
-
-        if (r == -1 ||
-            r == -val.length - 1) {
-            throw new OutOfRangeException(c, val[0], val[val.length - 1]);
-        }
-
-        if (r < 0) {
-            // "c" in within an interpolation sub-interval: Return the
-            // index of the sample at the lower end of the sub-interval.
-            return -r - 2;
-        }
-        final int last = val.length - 1;
-        if (r == last) {
-            // "c" is the last sample of the range: Return the index
-            // of the sample at the lower end of the last sub-interval.
-            return last - 1;
-        }
-
-        // "c" is another sample point.
-        return r;
-    }
-
-    /**
-     * Compute the spline coefficients from the list of function values and
-     * function partial derivatives values at the four corners of a grid
-     * element. They must be specified in the following order:
-     * <ul>
-     *  <li>f(0,0)</li>
-     *  <li>f(1,0)</li>
-     *  <li>f(0,1)</li>
-     *  <li>f(1,1)</li>
-     *  <li>f<sub>x</sub>(0,0)</li>
-     *  <li>f<sub>x</sub>(1,0)</li>
-     *  <li>f<sub>x</sub>(0,1)</li>
-     *  <li>f<sub>x</sub>(1,1)</li>
-     *  <li>f<sub>y</sub>(0,0)</li>
-     *  <li>f<sub>y</sub>(1,0)</li>
-     *  <li>f<sub>y</sub>(0,1)</li>
-     *  <li>f<sub>y</sub>(1,1)</li>
-     *  <li>f<sub>xy</sub>(0,0)</li>
-     *  <li>f<sub>xy</sub>(1,0)</li>
-     *  <li>f<sub>xy</sub>(0,1)</li>
-     *  <li>f<sub>xy</sub>(1,1)</li>
-     * </ul>
-     * where the subscripts indicate the partial derivative with respect to
-     * the corresponding variable(s).
-     *
-     * @param beta List of function values and function partial derivatives
-     * values.
-     * @return the spline coefficients.
-     */
-    private double[] computeSplineCoefficients(double[] beta) {
-        final double[] a = new double[NUM_COEFF];
-
-        for (int i = 0; i < NUM_COEFF; i++) {
-            double result = 0;
-            final double[] row = AINV[i];
-            for (int j = 0; j < NUM_COEFF; j++) {
-                result += row[j] * beta[j];
-            }
-            a[i] = result;
-        }
-
-        return a;
-    }
-}
-
-/**
- * Bicubic function.
- */
-class BicubicFunction implements BivariateFunction {
-    /** Number of points. */
-    private static final short N = 4;
-    /** Coefficients */
-    private final double[][] a;
-
-    /**
-     * Simple constructor.
-     *
-     * @param coeff Spline coefficients.
-     */
-    public BicubicFunction(double[] coeff) {
-        a = new double[N][N];
-        for (int j = 0; j < N; j++) {
-            final double[] aJ = a[j];
-            for (int i = 0; i < N; i++) {
-                aJ[i] = coeff[i * N + j];
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double value(double x, double y) {
-        if (x < 0 || x > 1) {
-            throw new OutOfRangeException(x, 0, 1);
-        }
-        if (y < 0 || y > 1) {
-            throw new OutOfRangeException(y, 0, 1);
-        }
-
-        final double x2 = x * x;
-        final double x3 = x2 * x;
-        final double[] pX = {1, x, x2, x3};
-
-        final double y2 = y * y;
-        final double y3 = y2 * y;
-        final double[] pY = {1, y, y2, y3};
-
-        return apply(pX, pY, a);
-    }
-
-    /**
-     * Compute the value of the bicubic polynomial.
-     *
-     * @param pX Powers of the x-coordinate.
-     * @param pY Powers of the y-coordinate.
-     * @param coeff Spline coefficients.
-     * @return the interpolated value.
-     */
-    private double apply(double[] pX, double[] pY, double[][] coeff) {
-        double result = 0;
-        for (int i = 0; i < N; i++) {
-            final double r = MathArrays.linearCombination(coeff[i], pY);
-            result += r * pX[i];
-        }
-
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolator.java
deleted file mode 100644
index 82ab44e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/BicubicInterpolator.java
+++ /dev/null
@@ -1,112 +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.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Generates a {@link BicubicInterpolatingFunction bicubic interpolating
- * function}.
- * <p>
- *  Caveat: Because the interpolation scheme requires that derivatives be
- *  specified at the sample points, those are approximated with finite
- *  differences (using the 2-points symmetric formulae).
- *  Since their values are undefined at the borders of the provided
- *  interpolation ranges, the interpolated values will be wrong at the
- *  edges of the patch.
- *  The {@code interpolate} method will return a function that overrides
- *  {@link BicubicInterpolatingFunction#isValidPoint(double,double)} to
- *  indicate points where the interpolation will be inaccurate.
- * </p>
- *
- * @since 3.4
- */
-public class BicubicInterpolator
-    implements BivariateGridInterpolator {
-    /**
-     * {@inheritDoc}
-     */
-    public BicubicInterpolatingFunction interpolate(final double[] xval,
-                                                    final double[] yval,
-                                                    final double[][] fval)
-        throws NoDataException, DimensionMismatchException,
-               NonMonotonicSequenceException, NumberIsTooSmallException {
-        if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
-            throw new NoDataException();
-        }
-        if (xval.length != fval.length) {
-            throw new DimensionMismatchException(xval.length, fval.length);
-        }
-
-        MathArrays.checkOrder(xval);
-        MathArrays.checkOrder(yval);
-
-        final int xLen = xval.length;
-        final int yLen = yval.length;
-
-        // Approximation to the partial derivatives using finite differences.
-        final double[][] dFdX = new double[xLen][yLen];
-        final double[][] dFdY = new double[xLen][yLen];
-        final double[][] d2FdXdY = new double[xLen][yLen];
-        for (int i = 1; i < xLen - 1; i++) {
-            final int nI = i + 1;
-            final int pI = i - 1;
-
-            final double nX = xval[nI];
-            final double pX = xval[pI];
-
-            final double deltaX = nX - pX;
-
-            for (int j = 1; j < yLen - 1; j++) {
-                final int nJ = j + 1;
-                final int pJ = j - 1;
-
-                final double nY = yval[nJ];
-                final double pY = yval[pJ];
-
-                final double deltaY = nY - pY;
-
-                dFdX[i][j] = (fval[nI][j] - fval[pI][j]) / deltaX;
-                dFdY[i][j] = (fval[i][nJ] - fval[i][pJ]) / deltaY;
-
-                final double deltaXY = deltaX * deltaY;
-
-                d2FdXdY[i][j] = (fval[nI][nJ] - fval[nI][pJ] - fval[pI][nJ] + fval[pI][pJ]) / deltaXY;
-            }
-        }
-
-        // Create the interpolating function.
-        return new BicubicInterpolatingFunction(xval, yval, fval,
-                                                dFdX, dFdY, d2FdXdY) {
-            @Override
-            public boolean isValidPoint(double x, double y) {
-                if (x < xval[1] ||
-                    x > xval[xval.length - 2] ||
-                    y < yval[1] ||
-                    y > yval[yval.length - 2]) {
-                    return false;
-                } else {
-                    return true;
-                }
-            }
-        };
-    }
-}


[31/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/PascalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/PascalDistribution.java b/src/main/java/org/apache/commons/math3/distribution/PascalDistribution.java
deleted file mode 100644
index bf39933..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/PascalDistribution.java
+++ /dev/null
@@ -1,248 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * <p>
- * Implementation of the Pascal distribution. The Pascal distribution is a
- * special case of the Negative Binomial distribution where the number of
- * successes parameter is an integer.
- * </p>
- * <p>
- * There are various ways to express the probability mass and distribution
- * functions for the Pascal distribution. The present implementation represents
- * the distribution of the number of failures before {@code r} successes occur.
- * This is the convention adopted in e.g.
- * <a href="http://mathworld.wolfram.com/NegativeBinomialDistribution.html">MathWorld</a>,
- * but <em>not</em> in
- * <a href="http://en.wikipedia.org/wiki/Negative_binomial_distribution">Wikipedia</a>.
- * </p>
- * <p>
- * For a random variable {@code X} whose values are distributed according to this
- * distribution, the probability mass function is given by<br/>
- * {@code P(X = k) = C(k + r - 1, r - 1) * p^r * (1 - p)^k,}<br/>
- * where {@code r} is the number of successes, {@code p} is the probability of
- * success, and {@code X} is the total number of failures. {@code C(n, k)} is
- * the binomial coefficient ({@code n} choose {@code k}). The mean and variance
- * of {@code X} are<br/>
- * {@code E(X) = (1 - p) * r / p, var(X) = (1 - p) * r / p^2.}<br/>
- * Finally, the cumulative distribution function is given by<br/>
- * {@code P(X <= k) = I(p, r, k + 1)},
- * where I is the regularized incomplete Beta function.
- * </p>
- *
- * @see <a href="http://en.wikipedia.org/wiki/Negative_binomial_distribution">
- * Negative binomial distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/NegativeBinomialDistribution.html">
- * Negative binomial distribution (MathWorld)</a>
- * @since 1.2 (changed to concrete class in 3.0)
- */
-public class PascalDistribution extends AbstractIntegerDistribution {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 6751309484392813623L;
-    /** The number of successes. */
-    private final int numberOfSuccesses;
-    /** The probability of success. */
-    private final double probabilityOfSuccess;
-    /** The value of {@code log(p)}, where {@code p} is the probability of success,
-     * stored for faster computation. */
-    private final double logProbabilityOfSuccess;
-    /** The value of {@code log(1-p)}, where {@code p} is the probability of success,
-     * stored for faster computation. */
-    private final double log1mProbabilityOfSuccess;
-
-    /**
-     * Create a Pascal distribution with the given number of successes and
-     * probability of success.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param r Number of successes.
-     * @param p Probability of success.
-     * @throws NotStrictlyPositiveException if the number of successes is not positive
-     * @throws OutOfRangeException if the probability of success is not in the
-     * range {@code [0, 1]}.
-     */
-    public PascalDistribution(int r, double p)
-        throws NotStrictlyPositiveException, OutOfRangeException {
-        this(new Well19937c(), r, p);
-    }
-
-    /**
-     * Create a Pascal distribution with the given number of successes and
-     * probability of success.
-     *
-     * @param rng Random number generator.
-     * @param r Number of successes.
-     * @param p Probability of success.
-     * @throws NotStrictlyPositiveException if the number of successes is not positive
-     * @throws OutOfRangeException if the probability of success is not in the
-     * range {@code [0, 1]}.
-     * @since 3.1
-     */
-    public PascalDistribution(RandomGenerator rng,
-                              int r,
-                              double p)
-        throws NotStrictlyPositiveException, OutOfRangeException {
-        super(rng);
-
-        if (r <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SUCCESSES,
-                                                   r);
-        }
-        if (p < 0 || p > 1) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-
-        numberOfSuccesses = r;
-        probabilityOfSuccess = p;
-        logProbabilityOfSuccess = FastMath.log(p);
-        log1mProbabilityOfSuccess = FastMath.log1p(-p);
-    }
-
-    /**
-     * Access the number of successes for this distribution.
-     *
-     * @return the number of successes.
-     */
-    public int getNumberOfSuccesses() {
-        return numberOfSuccesses;
-    }
-
-    /**
-     * Access the probability of success for this distribution.
-     *
-     * @return the probability of success.
-     */
-    public double getProbabilityOfSuccess() {
-        return probabilityOfSuccess;
-    }
-
-    /** {@inheritDoc} */
-    public double probability(int x) {
-        double ret;
-        if (x < 0) {
-            ret = 0.0;
-        } else {
-            ret = CombinatoricsUtils.binomialCoefficientDouble(x +
-                  numberOfSuccesses - 1, numberOfSuccesses - 1) *
-                  FastMath.pow(probabilityOfSuccess, numberOfSuccesses) *
-                  FastMath.pow(1.0 - probabilityOfSuccess, x);
-        }
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logProbability(int x) {
-        double ret;
-        if (x < 0) {
-            ret = Double.NEGATIVE_INFINITY;
-        } else {
-            ret = CombinatoricsUtils.binomialCoefficientLog(x +
-                  numberOfSuccesses - 1, numberOfSuccesses - 1) +
-                  logProbabilityOfSuccess * numberOfSuccesses +
-                  log1mProbabilityOfSuccess * x;
-        }
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(int x) {
-        double ret;
-        if (x < 0) {
-            ret = 0.0;
-        } else {
-            ret = Beta.regularizedBeta(probabilityOfSuccess,
-                    numberOfSuccesses, x + 1.0);
-        }
-        return ret;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For number of successes {@code r} and probability of success {@code p},
-     * the mean is {@code r * (1 - p) / p}.
-     */
-    public double getNumericalMean() {
-        final double p = getProbabilityOfSuccess();
-        final double r = getNumberOfSuccesses();
-        return (r * (1 - p)) / p;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For number of successes {@code r} and probability of success {@code p},
-     * the variance is {@code r * (1 - p) / p^2}.
-     */
-    public double getNumericalVariance() {
-        final double p = getProbabilityOfSuccess();
-        final double r = getNumberOfSuccesses();
-        return r * (1 - p) / (p * p);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the parameters.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public int getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity no matter the
-     * parameters. Positive infinity is symbolized by {@code Integer.MAX_VALUE}.
-     *
-     * @return upper bound of the support (always {@code Integer.MAX_VALUE}
-     * for positive infinity)
-     */
-    public int getSupportUpperBound() {
-        return Integer.MAX_VALUE;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/PoissonDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/PoissonDistribution.java b/src/main/java/org/apache/commons/math3/distribution/PoissonDistribution.java
deleted file mode 100644
index 0d885e9..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/PoissonDistribution.java
+++ /dev/null
@@ -1,395 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Implementation of the Poisson distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Poisson_distribution">Poisson distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/PoissonDistribution.html">Poisson distribution (MathWorld)</a>
- */
-public class PoissonDistribution extends AbstractIntegerDistribution {
-    /**
-     * Default maximum number of iterations for cumulative probability calculations.
-     * @since 2.1
-     */
-    public static final int DEFAULT_MAX_ITERATIONS = 10000000;
-    /**
-     * Default convergence criterion.
-     * @since 2.1
-     */
-    public static final double DEFAULT_EPSILON = 1e-12;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -3349935121172596109L;
-    /** Distribution used to compute normal approximation. */
-    private final NormalDistribution normal;
-    /** Distribution needed for the {@link #sample()} method. */
-    private final ExponentialDistribution exponential;
-    /** Mean of the distribution. */
-    private final double mean;
-
-    /**
-     * Maximum number of iterations for cumulative probability. Cumulative
-     * probabilities are estimated using either Lanczos series approximation
-     * of {@link Gamma#regularizedGammaP(double, double, double, int)}
-     * or continued fraction approximation of
-     * {@link Gamma#regularizedGammaQ(double, double, double, int)}.
-     */
-    private final int maxIterations;
-
-    /** Convergence criterion for cumulative probability. */
-    private final double epsilon;
-
-    /**
-     * Creates a new Poisson distribution with specified mean.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param p the Poisson mean
-     * @throws NotStrictlyPositiveException if {@code p <= 0}.
-     */
-    public PoissonDistribution(double p) throws NotStrictlyPositiveException {
-        this(p, DEFAULT_EPSILON, DEFAULT_MAX_ITERATIONS);
-    }
-
-    /**
-     * Creates a new Poisson distribution with specified mean, convergence
-     * criterion and maximum number of iterations.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param p Poisson mean.
-     * @param epsilon Convergence criterion for cumulative probabilities.
-     * @param maxIterations the maximum number of iterations for cumulative
-     * probabilities.
-     * @throws NotStrictlyPositiveException if {@code p <= 0}.
-     * @since 2.1
-     */
-    public PoissonDistribution(double p, double epsilon, int maxIterations)
-    throws NotStrictlyPositiveException {
-        this(new Well19937c(), p, epsilon, maxIterations);
-    }
-
-    /**
-     * Creates a new Poisson distribution with specified mean, convergence
-     * criterion and maximum number of iterations.
-     *
-     * @param rng Random number generator.
-     * @param p Poisson mean.
-     * @param epsilon Convergence criterion for cumulative probabilities.
-     * @param maxIterations the maximum number of iterations for cumulative
-     * probabilities.
-     * @throws NotStrictlyPositiveException if {@code p <= 0}.
-     * @since 3.1
-     */
-    public PoissonDistribution(RandomGenerator rng,
-                               double p,
-                               double epsilon,
-                               int maxIterations)
-    throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (p <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.MEAN, p);
-        }
-        mean = p;
-        this.epsilon = epsilon;
-        this.maxIterations = maxIterations;
-
-        // Use the same RNG instance as the parent class.
-        normal = new NormalDistribution(rng, p, FastMath.sqrt(p),
-                                        NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-        exponential = new ExponentialDistribution(rng, 1,
-                                                  ExponentialDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a new Poisson distribution with the specified mean and
-     * convergence criterion.
-     *
-     * @param p Poisson mean.
-     * @param epsilon Convergence criterion for cumulative probabilities.
-     * @throws NotStrictlyPositiveException if {@code p <= 0}.
-     * @since 2.1
-     */
-    public PoissonDistribution(double p, double epsilon)
-    throws NotStrictlyPositiveException {
-        this(p, epsilon, DEFAULT_MAX_ITERATIONS);
-    }
-
-    /**
-     * Creates a new Poisson distribution with the specified mean and maximum
-     * number of iterations.
-     *
-     * @param p Poisson mean.
-     * @param maxIterations Maximum number of iterations for cumulative
-     * probabilities.
-     * @since 2.1
-     */
-    public PoissonDistribution(double p, int maxIterations) {
-        this(p, DEFAULT_EPSILON, maxIterations);
-    }
-
-    /**
-     * Get the mean for the distribution.
-     *
-     * @return the mean for the distribution.
-     */
-    public double getMean() {
-        return mean;
-    }
-
-    /** {@inheritDoc} */
-    public double probability(int x) {
-        final double logProbability = logProbability(x);
-        return logProbability == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logProbability);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logProbability(int x) {
-        double ret;
-        if (x < 0 || x == Integer.MAX_VALUE) {
-            ret = Double.NEGATIVE_INFINITY;
-        } else if (x == 0) {
-            ret = -mean;
-        } else {
-            ret = -SaddlePointExpansion.getStirlingError(x) -
-                  SaddlePointExpansion.getDeviancePart(x, mean) -
-                  0.5 * FastMath.log(MathUtils.TWO_PI) - 0.5 * FastMath.log(x);
-        }
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(int x) {
-        if (x < 0) {
-            return 0;
-        }
-        if (x == Integer.MAX_VALUE) {
-            return 1;
-        }
-        return Gamma.regularizedGammaQ((double) x + 1, mean, epsilon,
-                                       maxIterations);
-    }
-
-    /**
-     * Calculates the Poisson distribution function using a normal
-     * approximation. The {@code N(mean, sqrt(mean))} distribution is used
-     * to approximate the Poisson distribution. The computation uses
-     * "half-correction" (evaluating the normal distribution function at
-     * {@code x + 0.5}).
-     *
-     * @param x Upper bound, inclusive.
-     * @return the distribution function value calculated using a normal
-     * approximation.
-     */
-    public double normalApproximateProbability(int x)  {
-        // calculate the probability using half-correction
-        return normal.cumulativeProbability(x + 0.5);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For mean parameter {@code p}, the mean is {@code p}.
-     */
-    public double getNumericalMean() {
-        return getMean();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For mean parameter {@code p}, the variance is {@code p}.
-     */
-    public double getNumericalVariance() {
-        return getMean();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the mean parameter.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public int getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is positive infinity,
-     * regardless of the parameter values. There is no integer infinity,
-     * so this method returns {@code Integer.MAX_VALUE}.
-     *
-     * @return upper bound of the support (always {@code Integer.MAX_VALUE} for
-     * positive infinity)
-     */
-    public int getSupportUpperBound() {
-        return Integer.MAX_VALUE;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     * <p>
-     * <strong>Algorithm Description</strong>:
-     * <ul>
-     *  <li>For small means, uses simulation of a Poisson process
-     *   using Uniform deviates, as described
-     *   <a href="http://irmi.epfl.ch/cmos/Pmmi/interactive/rng7.htm"> here</a>.
-     *   The Poisson process (and hence value returned) is bounded by 1000 * mean.
-     *  </li>
-     *  <li>For large means, uses the rejection algorithm described in
-     *   <blockquote>
-     *    Devroye, Luc. (1981).<i>The Computer Generation of Poisson Random Variables</i><br>
-     *    <strong>Computing</strong> vol. 26 pp. 197-207.<br>
-     *   </blockquote>
-     *  </li>
-     * </ul>
-     * </p>
-     *
-     * @return a random value.
-     * @since 2.2
-     */
-    @Override
-    public int sample() {
-        return (int) FastMath.min(nextPoisson(mean), Integer.MAX_VALUE);
-    }
-
-    /**
-     * @param meanPoisson Mean of the Poisson distribution.
-     * @return the next sample.
-     */
-    private long nextPoisson(double meanPoisson) {
-        final double pivot = 40.0d;
-        if (meanPoisson < pivot) {
-            double p = FastMath.exp(-meanPoisson);
-            long n = 0;
-            double r = 1.0d;
-            double rnd = 1.0d;
-
-            while (n < 1000 * meanPoisson) {
-                rnd = random.nextDouble();
-                r *= rnd;
-                if (r >= p) {
-                    n++;
-                } else {
-                    return n;
-                }
-            }
-            return n;
-        } else {
-            final double lambda = FastMath.floor(meanPoisson);
-            final double lambdaFractional = meanPoisson - lambda;
-            final double logLambda = FastMath.log(lambda);
-            final double logLambdaFactorial = CombinatoricsUtils.factorialLog((int) lambda);
-            final long y2 = lambdaFractional < Double.MIN_VALUE ? 0 : nextPoisson(lambdaFractional);
-            final double delta = FastMath.sqrt(lambda * FastMath.log(32 * lambda / FastMath.PI + 1));
-            final double halfDelta = delta / 2;
-            final double twolpd = 2 * lambda + delta;
-            final double a1 = FastMath.sqrt(FastMath.PI * twolpd) * FastMath.exp(1 / (8 * lambda));
-            final double a2 = (twolpd / delta) * FastMath.exp(-delta * (1 + delta) / twolpd);
-            final double aSum = a1 + a2 + 1;
-            final double p1 = a1 / aSum;
-            final double p2 = a2 / aSum;
-            final double c1 = 1 / (8 * lambda);
-
-            double x = 0;
-            double y = 0;
-            double v = 0;
-            int a = 0;
-            double t = 0;
-            double qr = 0;
-            double qa = 0;
-            for (;;) {
-                final double u = random.nextDouble();
-                if (u <= p1) {
-                    final double n = random.nextGaussian();
-                    x = n * FastMath.sqrt(lambda + halfDelta) - 0.5d;
-                    if (x > delta || x < -lambda) {
-                        continue;
-                    }
-                    y = x < 0 ? FastMath.floor(x) : FastMath.ceil(x);
-                    final double e = exponential.sample();
-                    v = -e - (n * n / 2) + c1;
-                } else {
-                    if (u > p1 + p2) {
-                        y = lambda;
-                        break;
-                    } else {
-                        x = delta + (twolpd / delta) * exponential.sample();
-                        y = FastMath.ceil(x);
-                        v = -exponential.sample() - delta * (x + 1) / twolpd;
-                    }
-                }
-                a = x < 0 ? 1 : 0;
-                t = y * (y + 1) / (2 * lambda);
-                if (v < -t && a == 0) {
-                    y = lambda + y;
-                    break;
-                }
-                qr = t * ((2 * y + 1) / (6 * lambda) - 1);
-                qa = qr - (t * t) / (3 * (lambda + a * (y + 1)));
-                if (v < qa) {
-                    y = lambda + y;
-                    break;
-                }
-                if (v > qr) {
-                    continue;
-                }
-                if (v < y * logLambda - CombinatoricsUtils.factorialLog((int) (y + lambda)) + logLambdaFactorial) {
-                    y = lambda + y;
-                    break;
-                }
-            }
-            return y2 + (long) y;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/RealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/RealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/RealDistribution.java
deleted file mode 100644
index cb2045d..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/RealDistribution.java
+++ /dev/null
@@ -1,196 +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.distribution;
-
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-
-/**
- * Base interface for distributions on the reals.
- *
- * @since 3.0
- */
-public interface RealDistribution {
-    /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(X = x)}. In other
-     * words, this method represents the probability mass function (PMF)
-     * for the distribution.
-     *
-     * @param x the point at which the PMF is evaluated
-     * @return the value of the probability mass function at point {@code x}
-     */
-    double probability(double x);
-
-    /**
-     * Returns the probability density function (PDF) of this distribution
-     * evaluated at the specified point {@code x}. In general, the PDF is
-     * the derivative of the {@link #cumulativeProbability(double) CDF}.
-     * If the derivative does not exist at {@code x}, then an appropriate
-     * replacement should be returned, e.g. {@code Double.POSITIVE_INFINITY},
-     * {@code Double.NaN}, or  the limit inferior or limit superior of the
-     * difference quotient.
-     *
-     * @param x the point at which the PDF is evaluated
-     * @return the value of the probability density function at point {@code x}
-     */
-    double density(double x);
-
-    /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(X <= x)}. In other
-     * words, this method represents the (cumulative) distribution function
-     * (CDF) for this distribution.
-     *
-     * @param x the point at which the CDF is evaluated
-     * @return the probability that a random variable with this
-     * distribution takes a value less than or equal to {@code x}
-     */
-    double cumulativeProbability(double x);
-
-    /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(x0 < X <= x1)}.
-     *
-     * @param x0 the exclusive lower bound
-     * @param x1 the inclusive upper bound
-     * @return the probability that a random variable with this distribution
-     * takes a value between {@code x0} and {@code x1},
-     * excluding the lower and including the upper endpoint
-     * @throws NumberIsTooLargeException if {@code x0 > x1}
-     *
-     * @deprecated As of 3.1. In 4.0, this method will be renamed
-     * {@code probability(double x0, double x1)}.
-     */
-    @Deprecated
-    double cumulativeProbability(double x0, double x1) throws NumberIsTooLargeException;
-
-    /**
-     * Computes the quantile function of this distribution. For a random
-     * variable {@code X} distributed according to this distribution, the
-     * returned value is
-     * <ul>
-     * <li><code>inf{x in R | P(X<=x) >= p}</code> for {@code 0 < p <= 1},</li>
-     * <li><code>inf{x in R | P(X<=x) > 0}</code> for {@code p = 0}.</li>
-     * </ul>
-     *
-     * @param p the cumulative probability
-     * @return the smallest {@code p}-quantile of this distribution
-     * (largest 0-quantile for {@code p = 0})
-     * @throws OutOfRangeException if {@code p < 0} or {@code p > 1}
-     */
-    double inverseCumulativeProbability(double p) throws OutOfRangeException;
-
-    /**
-     * Use this method to get the numerical value of the mean of this
-     * distribution.
-     *
-     * @return the mean or {@code Double.NaN} if it is not defined
-     */
-    double getNumericalMean();
-
-    /**
-     * Use this method to get the numerical value of the variance of this
-     * distribution.
-     *
-     * @return the variance (possibly {@code Double.POSITIVE_INFINITY} as
-     * for certain cases in {@link TDistribution}) or {@code Double.NaN} if it
-     * is not defined
-     */
-    double getNumericalVariance();
-
-    /**
-     * Access the lower bound of the support. This method must return the same
-     * value as {@code inverseCumulativeProbability(0)}. In other words, this
-     * method must return
-     * <p><code>inf {x in R | P(X <= x) > 0}</code>.</p>
-     *
-     * @return lower bound of the support (might be
-     * {@code Double.NEGATIVE_INFINITY})
-     */
-    double getSupportLowerBound();
-
-    /**
-     * Access the upper bound of the support. This method must return the same
-     * value as {@code inverseCumulativeProbability(1)}. In other words, this
-     * method must return
-     * <p><code>inf {x in R | P(X <= x) = 1}</code>.</p>
-     *
-     * @return upper bound of the support (might be
-     * {@code Double.POSITIVE_INFINITY})
-     */
-    double getSupportUpperBound();
-
-    /**
-     * Whether or not the lower bound of support is in the domain of the density
-     * function.  Returns true iff {@code getSupporLowerBound()} is finite and
-     * {@code density(getSupportLowerBound())} returns a non-NaN, non-infinite
-     * value.
-     *
-     * @return true if the lower bound of support is finite and the density
-     * function returns a non-NaN, non-infinite value there
-     * @deprecated to be removed in 4.0
-     */
-    @Deprecated
-    boolean isSupportLowerBoundInclusive();
-
-    /**
-     * Whether or not the upper bound of support is in the domain of the density
-     * function.  Returns true iff {@code getSupportUpperBound()} is finite and
-     * {@code density(getSupportUpperBound())} returns a non-NaN, non-infinite
-     * value.
-     *
-     * @return true if the upper bound of support is finite and the density
-     * function returns a non-NaN, non-infinite value there
-     * @deprecated to be removed in 4.0
-     */
-    @Deprecated
-    boolean isSupportUpperBoundInclusive();
-
-    /**
-     * Use this method to get information about whether the support is connected,
-     * i.e. whether all values between the lower and upper bound of the support
-     * are included in the support.
-     *
-     * @return whether the support is connected or not
-     */
-    boolean isSupportConnected();
-
-    /**
-     * Reseed the random generator used to generate samples.
-     *
-     * @param seed the new seed
-     */
-    void reseedRandomGenerator(long seed);
-
-    /**
-     * Generate a random value sampled from this distribution.
-     *
-     * @return a random value.
-     */
-    double sample();
-
-    /**
-     * Generate a random sample from the distribution.
-     *
-     * @param sampleSize the number of random values to generate
-     * @return an array representing the random sample
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
-     * if {@code sampleSize} is not positive
-     */
-    double[] sample(int sampleSize);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/SaddlePointExpansion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/SaddlePointExpansion.java b/src/main/java/org/apache/commons/math3/distribution/SaddlePointExpansion.java
deleted file mode 100644
index 63b3293..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/SaddlePointExpansion.java
+++ /dev/null
@@ -1,200 +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.distribution;
-
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * <p>
- * Utility class used by various distributions to accurately compute their
- * respective probability mass functions. The implementation for this class is
- * based on the Catherine Loader's <a target="_blank"
- * href="http://www.herine.net/stat/software/dbinom.html">dbinom</a> routines.
- * </p>
- * <p>
- * This class is not intended to be called directly.
- * </p>
- * <p>
- * References:
- * <ol>
- * <li>Catherine Loader (2000). "Fast and Accurate Computation of Binomial
- * Probabilities.". <a target="_blank"
- * href="http://www.herine.net/stat/papers/dbinom.pdf">
- * http://www.herine.net/stat/papers/dbinom.pdf</a></li>
- * </ol>
- * </p>
- *
- * @since 2.1
- */
-final class SaddlePointExpansion {
-
-    /** 1/2 * log(2 &#960;). */
-    private static final double HALF_LOG_2_PI = 0.5 * FastMath.log(MathUtils.TWO_PI);
-
-    /** exact Stirling expansion error for certain values. */
-    private static final double[] EXACT_STIRLING_ERRORS = { 0.0, /* 0.0 */
-    0.1534264097200273452913848, /* 0.5 */
-    0.0810614667953272582196702, /* 1.0 */
-    0.0548141210519176538961390, /* 1.5 */
-    0.0413406959554092940938221, /* 2.0 */
-    0.03316287351993628748511048, /* 2.5 */
-    0.02767792568499833914878929, /* 3.0 */
-    0.02374616365629749597132920, /* 3.5 */
-    0.02079067210376509311152277, /* 4.0 */
-    0.01848845053267318523077934, /* 4.5 */
-    0.01664469118982119216319487, /* 5.0 */
-    0.01513497322191737887351255, /* 5.5 */
-    0.01387612882307074799874573, /* 6.0 */
-    0.01281046524292022692424986, /* 6.5 */
-    0.01189670994589177009505572, /* 7.0 */
-    0.01110455975820691732662991, /* 7.5 */
-    0.010411265261972096497478567, /* 8.0 */
-    0.009799416126158803298389475, /* 8.5 */
-    0.009255462182712732917728637, /* 9.0 */
-    0.008768700134139385462952823, /* 9.5 */
-    0.008330563433362871256469318, /* 10.0 */
-    0.007934114564314020547248100, /* 10.5 */
-    0.007573675487951840794972024, /* 11.0 */
-    0.007244554301320383179543912, /* 11.5 */
-    0.006942840107209529865664152, /* 12.0 */
-    0.006665247032707682442354394, /* 12.5 */
-    0.006408994188004207068439631, /* 13.0 */
-    0.006171712263039457647532867, /* 13.5 */
-    0.005951370112758847735624416, /* 14.0 */
-    0.005746216513010115682023589, /* 14.5 */
-    0.005554733551962801371038690 /* 15.0 */
-    };
-
-    /**
-     * Default constructor.
-     */
-    private SaddlePointExpansion() {
-        super();
-    }
-
-    /**
-     * Compute the error of Stirling's series at the given value.
-     * <p>
-     * References:
-     * <ol>
-     * <li>Eric W. Weisstein. "Stirling's Series." From MathWorld--A Wolfram Web
-     * Resource. <a target="_blank"
-     * href="http://mathworld.wolfram.com/StirlingsSeries.html">
-     * http://mathworld.wolfram.com/StirlingsSeries.html</a></li>
-     * </ol>
-     * </p>
-     *
-     * @param z the value.
-     * @return the Striling's series error.
-     */
-    static double getStirlingError(double z) {
-        double ret;
-        if (z < 15.0) {
-            double z2 = 2.0 * z;
-            if (FastMath.floor(z2) == z2) {
-                ret = EXACT_STIRLING_ERRORS[(int) z2];
-            } else {
-                ret = Gamma.logGamma(z + 1.0) - (z + 0.5) * FastMath.log(z) +
-                      z - HALF_LOG_2_PI;
-            }
-        } else {
-            double z2 = z * z;
-            ret = (0.083333333333333333333 -
-                    (0.00277777777777777777778 -
-                            (0.00079365079365079365079365 -
-                                    (0.000595238095238095238095238 -
-                                            0.0008417508417508417508417508 /
-                                            z2) / z2) / z2) / z2) / z;
-        }
-        return ret;
-    }
-
-    /**
-     * A part of the deviance portion of the saddle point approximation.
-     * <p>
-     * References:
-     * <ol>
-     * <li>Catherine Loader (2000). "Fast and Accurate Computation of Binomial
-     * Probabilities.". <a target="_blank"
-     * href="http://www.herine.net/stat/papers/dbinom.pdf">
-     * http://www.herine.net/stat/papers/dbinom.pdf</a></li>
-     * </ol>
-     * </p>
-     *
-     * @param x the x value.
-     * @param mu the average.
-     * @return a part of the deviance.
-     */
-    static double getDeviancePart(double x, double mu) {
-        double ret;
-        if (FastMath.abs(x - mu) < 0.1 * (x + mu)) {
-            double d = x - mu;
-            double v = d / (x + mu);
-            double s1 = v * d;
-            double s = Double.NaN;
-            double ej = 2.0 * x * v;
-            v *= v;
-            int j = 1;
-            while (s1 != s) {
-                s = s1;
-                ej *= v;
-                s1 = s + ej / ((j * 2) + 1);
-                ++j;
-            }
-            ret = s1;
-        } else {
-            ret = x * FastMath.log(x / mu) + mu - x;
-        }
-        return ret;
-    }
-
-    /**
-     * Compute the logarithm of the PMF for a binomial distribution
-     * using the saddle point expansion.
-     *
-     * @param x the value at which the probability is evaluated.
-     * @param n the number of trials.
-     * @param p the probability of success.
-     * @param q the probability of failure (1 - p).
-     * @return log(p(x)).
-     */
-    static double logBinomialProbability(int x, int n, double p, double q) {
-        double ret;
-        if (x == 0) {
-            if (p < 0.1) {
-                ret = -getDeviancePart(n, n * q) - n * p;
-            } else {
-                ret = n * FastMath.log(q);
-            }
-        } else if (x == n) {
-            if (q < 0.1) {
-                ret = -getDeviancePart(n, n * p) - n * q;
-            } else {
-                ret = n * FastMath.log(p);
-            }
-        } else {
-            ret = getStirlingError(n) - getStirlingError(x) -
-                  getStirlingError(n - x) - getDeviancePart(x, n * p) -
-                  getDeviancePart(n - x, n * q);
-            double f = (MathUtils.TWO_PI * x * (n - x)) / n;
-            ret = -0.5 * FastMath.log(f) + ret;
-        }
-        return ret;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/TDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/TDistribution.java b/src/main/java/org/apache/commons/math3/distribution/TDistribution.java
deleted file mode 100644
index 0c0e1cb..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/TDistribution.java
+++ /dev/null
@@ -1,272 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of Student's t-distribution.
- *
- * @see "<a href='http://en.wikipedia.org/wiki/Student&apos;s_t-distribution'>Student's t-distribution (Wikipedia)</a>"
- * @see "<a href='http://mathworld.wolfram.com/Studentst-Distribution.html'>Student's t-distribution (MathWorld)</a>"
- */
-public class TDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -5852615386664158222L;
-    /** The degrees of freedom. */
-    private final double degreesOfFreedom;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-    /** Static computation factor based on degreesOfFreedom. */
-    private final double factor;
-
-    /**
-     * Create a t distribution using the given degrees of freedom.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param degreesOfFreedom Degrees of freedom.
-     * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
-     */
-    public TDistribution(double degreesOfFreedom)
-        throws NotStrictlyPositiveException {
-        this(degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create a t distribution using the given degrees of freedom and the
-     * specified inverse cumulative probability absolute accuracy.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param degreesOfFreedom Degrees of freedom.
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates
-     * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
-     * @since 2.1
-     */
-    public TDistribution(double degreesOfFreedom, double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        this(new Well19937c(), degreesOfFreedom, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a t distribution.
-     *
-     * @param rng Random number generator.
-     * @param degreesOfFreedom Degrees of freedom.
-     * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
-     * @since 3.3
-     */
-    public TDistribution(RandomGenerator rng, double degreesOfFreedom)
-        throws NotStrictlyPositiveException {
-        this(rng, degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a t distribution.
-     *
-     * @param rng Random number generator.
-     * @param degreesOfFreedom Degrees of freedom.
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates
-     * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
-     * @since 3.1
-     */
-    public TDistribution(RandomGenerator rng,
-                         double degreesOfFreedom,
-                         double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (degreesOfFreedom <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
-                                                   degreesOfFreedom);
-        }
-        this.degreesOfFreedom = degreesOfFreedom;
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-
-        final double n = degreesOfFreedom;
-        final double nPlus1Over2 = (n + 1) / 2;
-        factor = Gamma.logGamma(nPlus1Over2) -
-                 0.5 * (FastMath.log(FastMath.PI) + FastMath.log(n)) -
-                 Gamma.logGamma(n / 2);
-    }
-
-    /**
-     * Access the degrees of freedom.
-     *
-     * @return the degrees of freedom.
-     */
-    public double getDegreesOfFreedom() {
-        return degreesOfFreedom;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        return FastMath.exp(logDensity(x));
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logDensity(double x) {
-        final double n = degreesOfFreedom;
-        final double nPlus1Over2 = (n + 1) / 2;
-        return factor - nPlus1Over2 * FastMath.log(1 + x * x / n);
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x) {
-        double ret;
-        if (x == 0) {
-            ret = 0.5;
-        } else {
-            double t =
-                Beta.regularizedBeta(
-                    degreesOfFreedom / (degreesOfFreedom + (x * x)),
-                    0.5 * degreesOfFreedom,
-                    0.5);
-            if (x < 0.0) {
-                ret = 0.5 * t;
-            } else {
-                ret = 1.0 - 0.5 * t;
-            }
-        }
-
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For degrees of freedom parameter {@code df}, the mean is
-     * <ul>
-     *  <li>if {@code df > 1} then {@code 0},</li>
-     * <li>else undefined ({@code Double.NaN}).</li>
-     * </ul>
-     */
-    public double getNumericalMean() {
-        final double df = getDegreesOfFreedom();
-
-        if (df > 1) {
-            return 0;
-        }
-
-        return Double.NaN;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For degrees of freedom parameter {@code df}, the variance is
-     * <ul>
-     *  <li>if {@code df > 2} then {@code df / (df - 2)},</li>
-     *  <li>if {@code 1 < df <= 2} then positive infinity
-     *  ({@code Double.POSITIVE_INFINITY}),</li>
-     *  <li>else undefined ({@code Double.NaN}).</li>
-     * </ul>
-     */
-    public double getNumericalVariance() {
-        final double df = getDegreesOfFreedom();
-
-        if (df > 2) {
-            return df / (df - 2);
-        }
-
-        if (df > 1 && df <= 2) {
-            return Double.POSITIVE_INFINITY;
-        }
-
-        return Double.NaN;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always negative infinity no matter the
-     * parameters.
-     *
-     * @return lower bound of the support (always
-     * {@code Double.NEGATIVE_INFINITY})
-     */
-    public double getSupportLowerBound() {
-        return Double.NEGATIVE_INFINITY;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity no matter the
-     * parameters.
-     *
-     * @return upper bound of the support (always
-     * {@code Double.POSITIVE_INFINITY})
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/TriangularDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/TriangularDistribution.java b/src/main/java/org/apache/commons/math3/distribution/TriangularDistribution.java
deleted file mode 100644
index 1a81ecb..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/TriangularDistribution.java
+++ /dev/null
@@ -1,282 +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.distribution;
-
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the triangular real distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Triangular_distribution">
- * Triangular distribution (Wikipedia)</a>
- *
- * @since 3.0
- */
-public class TriangularDistribution extends AbstractRealDistribution {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20120112L;
-    /** Lower limit of this distribution (inclusive). */
-    private final double a;
-    /** Upper limit of this distribution (inclusive). */
-    private final double b;
-    /** Mode of this distribution. */
-    private final double c;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Creates a triangular real distribution using the given lower limit,
-     * upper limit, and mode.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param a Lower limit of this distribution (inclusive).
-     * @param b Upper limit of this distribution (inclusive).
-     * @param c Mode of this distribution.
-     * @throws NumberIsTooLargeException if {@code a >= b} or if {@code c > b}.
-     * @throws NumberIsTooSmallException if {@code c < a}.
-     */
-    public TriangularDistribution(double a, double c, double b)
-        throws NumberIsTooLargeException, NumberIsTooSmallException {
-        this(new Well19937c(), a, c, b);
-    }
-
-    /**
-     * Creates a triangular distribution.
-     *
-     * @param rng Random number generator.
-     * @param a Lower limit of this distribution (inclusive).
-     * @param b Upper limit of this distribution (inclusive).
-     * @param c Mode of this distribution.
-     * @throws NumberIsTooLargeException if {@code a >= b} or if {@code c > b}.
-     * @throws NumberIsTooSmallException if {@code c < a}.
-     * @since 3.1
-     */
-    public TriangularDistribution(RandomGenerator rng,
-                                  double a,
-                                  double c,
-                                  double b)
-        throws NumberIsTooLargeException, NumberIsTooSmallException {
-        super(rng);
-
-        if (a >= b) {
-            throw new NumberIsTooLargeException(
-                            LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                            a, b, false);
-        }
-        if (c < a) {
-            throw new NumberIsTooSmallException(
-                    LocalizedFormats.NUMBER_TOO_SMALL, c, a, true);
-        }
-        if (c > b) {
-            throw new NumberIsTooLargeException(
-                    LocalizedFormats.NUMBER_TOO_LARGE, c, b, true);
-        }
-
-        this.a = a;
-        this.c = c;
-        this.b = b;
-        solverAbsoluteAccuracy = FastMath.max(FastMath.ulp(a), FastMath.ulp(b));
-    }
-
-    /**
-     * Returns the mode {@code c} of this distribution.
-     *
-     * @return the mode {@code c} of this distribution
-     */
-    public double getMode() {
-        return c;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * <p>
-     * For this distribution, the returned value is not really meaningful,
-     * since exact formulas are implemented for the computation of the
-     * {@link #inverseCumulativeProbability(double)} (no solver is invoked).
-     * </p>
-     * <p>
-     * For lower limit {@code a} and upper limit {@code b}, the current
-     * implementation returns {@code max(ulp(a), ulp(b)}.
-     * </p>
-     */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower limit {@code a}, upper limit {@code b} and mode {@code c}, the
-     * PDF is given by
-     * <ul>
-     * <li>{@code 2 * (x - a) / [(b - a) * (c - a)]} if {@code a <= x < c},</li>
-     * <li>{@code 2 / (b - a)} if {@code x = c},</li>
-     * <li>{@code 2 * (b - x) / [(b - a) * (b - c)]} if {@code c < x <= b},</li>
-     * <li>{@code 0} otherwise.
-     * </ul>
-     */
-    public double density(double x) {
-        if (x < a) {
-            return 0;
-        }
-        if (a <= x && x < c) {
-            double divident = 2 * (x - a);
-            double divisor = (b - a) * (c - a);
-            return divident / divisor;
-        }
-        if (x == c) {
-            return 2 / (b - a);
-        }
-        if (c < x && x <= b) {
-            double divident = 2 * (b - x);
-            double divisor = (b - a) * (b - c);
-            return divident / divisor;
-        }
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower limit {@code a}, upper limit {@code b} and mode {@code c}, the
-     * CDF is given by
-     * <ul>
-     * <li>{@code 0} if {@code x < a},</li>
-     * <li>{@code (x - a)^2 / [(b - a) * (c - a)]} if {@code a <= x < c},</li>
-     * <li>{@code (c - a) / (b - a)} if {@code x = c},</li>
-     * <li>{@code 1 - (b - x)^2 / [(b - a) * (b - c)]} if {@code c < x <= b},</li>
-     * <li>{@code 1} if {@code x > b}.</li>
-     * </ul>
-     */
-    public double cumulativeProbability(double x)  {
-        if (x < a) {
-            return 0;
-        }
-        if (a <= x && x < c) {
-            double divident = (x - a) * (x - a);
-            double divisor = (b - a) * (c - a);
-            return divident / divisor;
-        }
-        if (x == c) {
-            return (c - a) / (b - a);
-        }
-        if (c < x && x <= b) {
-            double divident = (b - x) * (b - x);
-            double divisor = (b - a) * (b - c);
-            return 1 - (divident / divisor);
-        }
-        return 1;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower limit {@code a}, upper limit {@code b}, and mode {@code c},
-     * the mean is {@code (a + b + c) / 3}.
-     */
-    public double getNumericalMean() {
-        return (a + b + c) / 3;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower limit {@code a}, upper limit {@code b}, and mode {@code c},
-     * the variance is {@code (a^2 + b^2 + c^2 - a * b - a * c - b * c) / 18}.
-     */
-    public double getNumericalVariance() {
-        return (a * a + b * b + c * c - a * b - a * c - b * c) / 18;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is equal to the lower limit parameter
-     * {@code a} of the distribution.
-     *
-     * @return lower bound of the support
-     */
-    public double getSupportLowerBound() {
-        return a;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is equal to the upper limit parameter
-     * {@code b} of the distribution.
-     *
-     * @return upper bound of the support
-     */
-    public double getSupportUpperBound() {
-        return b;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    @Override
-    public double inverseCumulativeProbability(double p)
-        throws OutOfRangeException {
-        if (p < 0 || p > 1) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-        if (p == 0) {
-            return a;
-        }
-        if (p == 1) {
-            return b;
-        }
-        if (p < (c - a) / (b - a)) {
-            return a + FastMath.sqrt(p * (b - a) * (c - a));
-        }
-        return b - FastMath.sqrt((1 - p) * (b - a) * (b - c));
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/UniformIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/UniformIntegerDistribution.java b/src/main/java/org/apache/commons/math3/distribution/UniformIntegerDistribution.java
deleted file mode 100644
index dd5ffa4..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/UniformIntegerDistribution.java
+++ /dev/null
@@ -1,181 +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.distribution;
-
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-
-/**
- * Implementation of the uniform integer distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Uniform_distribution_(discrete)"
- * >Uniform distribution (discrete), at Wikipedia</a>
- *
- * @since 3.0
- */
-public class UniformIntegerDistribution extends AbstractIntegerDistribution {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20120109L;
-    /** Lower bound (inclusive) of this distribution. */
-    private final int lower;
-    /** Upper bound (inclusive) of this distribution. */
-    private final int upper;
-
-    /**
-     * Creates a new uniform integer distribution using the given lower and
-     * upper bounds (both inclusive).
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param lower Lower bound (inclusive) of this distribution.
-     * @param upper Upper bound (inclusive) of this distribution.
-     * @throws NumberIsTooLargeException if {@code lower >= upper}.
-     */
-    public UniformIntegerDistribution(int lower, int upper)
-        throws NumberIsTooLargeException {
-        this(new Well19937c(), lower, upper);
-    }
-
-    /**
-     * Creates a new uniform integer distribution using the given lower and
-     * upper bounds (both inclusive).
-     *
-     * @param rng Random number generator.
-     * @param lower Lower bound (inclusive) of this distribution.
-     * @param upper Upper bound (inclusive) of this distribution.
-     * @throws NumberIsTooLargeException if {@code lower > upper}.
-     * @since 3.1
-     */
-    public UniformIntegerDistribution(RandomGenerator rng,
-                                      int lower,
-                                      int upper)
-        throws NumberIsTooLargeException {
-        super(rng);
-
-        if (lower > upper) {
-            throw new NumberIsTooLargeException(
-                            LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                            lower, upper, true);
-        }
-        this.lower = lower;
-        this.upper = upper;
-    }
-
-    /** {@inheritDoc} */
-    public double probability(int x) {
-        if (x < lower || x > upper) {
-            return 0;
-        }
-        return 1.0 / (upper - lower + 1);
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(int x) {
-        if (x < lower) {
-            return 0;
-        }
-        if (x > upper) {
-            return 1;
-        }
-        return (x - lower + 1.0) / (upper - lower + 1.0);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower bound {@code lower} and upper bound {@code upper}, the mean is
-     * {@code 0.5 * (lower + upper)}.
-     */
-    public double getNumericalMean() {
-        return 0.5 * (lower + upper);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower bound {@code lower} and upper bound {@code upper}, and
-     * {@code n = upper - lower + 1}, the variance is {@code (n^2 - 1) / 12}.
-     */
-    public double getNumericalVariance() {
-        double n = upper - lower + 1;
-        return (n * n - 1) / 12.0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is equal to the lower bound parameter
-     * of the distribution.
-     *
-     * @return lower bound of the support
-     */
-    public int getSupportLowerBound() {
-        return lower;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is equal to the upper bound parameter
-     * of the distribution.
-     *
-     * @return upper bound of the support
-     */
-    public int getSupportUpperBound() {
-        return upper;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int sample() {
-        final int max = (upper - lower) + 1;
-        if (max <= 0) {
-            // The range is too wide to fit in a positive int (larger
-            // than 2^31); as it covers more than half the integer range,
-            // we use a simple rejection method.
-            while (true) {
-                final int r = random.nextInt();
-                if (r >= lower &&
-                    r <= upper) {
-                    return r;
-                }
-            }
-        } else {
-            // We can shift the range and directly generate a positive int.
-            return lower + random.nextInt(max);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java
deleted file mode 100644
index 10c7712..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/UniformRealDistribution.java
+++ /dev/null
@@ -1,243 +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.distribution;
-
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-
-/**
- * Implementation of the uniform real distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Uniform_distribution_(continuous)"
- * >Uniform distribution (continuous), at Wikipedia</a>
- *
- * @since 3.0
- */
-public class UniformRealDistribution extends AbstractRealDistribution {
-    /** Default inverse cumulative probability accuracy.
-     * @deprecated as of 3.2 not used anymore, will be removed in 4.0
-     */
-    @Deprecated
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20120109L;
-    /** Lower bound of this distribution (inclusive). */
-    private final double lower;
-    /** Upper bound of this distribution (exclusive). */
-    private final double upper;
-
-    /**
-     * Create a standard uniform real distribution with lower bound (inclusive)
-     * equal to zero and upper bound (exclusive) equal to one.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     */
-    public UniformRealDistribution() {
-        this(0, 1);
-    }
-
-    /**
-     * Create a uniform real distribution using the given lower and upper
-     * bounds.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param lower Lower bound of this distribution (inclusive).
-     * @param upper Upper bound of this distribution (exclusive).
-     * @throws NumberIsTooLargeException if {@code lower >= upper}.
-     */
-    public UniformRealDistribution(double lower, double upper)
-        throws NumberIsTooLargeException {
-        this(new Well19937c(), lower, upper);
-    }
-
-    /**
-     * Create a uniform distribution.
-     *
-     * @param lower Lower bound of this distribution (inclusive).
-     * @param upper Upper bound of this distribution (exclusive).
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NumberIsTooLargeException if {@code lower >= upper}.
-     * @deprecated as of 3.2, inverse CDF is now calculated analytically, use
-     *             {@link #UniformRealDistribution(double, double)} instead.
-     */
-    @Deprecated
-    public UniformRealDistribution(double lower, double upper, double inverseCumAccuracy)
-        throws NumberIsTooLargeException {
-        this(new Well19937c(), lower, upper);
-    }
-
-    /**
-     * Creates a uniform distribution.
-     *
-     * @param rng Random number generator.
-     * @param lower Lower bound of this distribution (inclusive).
-     * @param upper Upper bound of this distribution (exclusive).
-     * @param inverseCumAccuracy Inverse cumulative probability accuracy.
-     * @throws NumberIsTooLargeException if {@code lower >= upper}.
-     * @since 3.1
-     * @deprecated as of 3.2, inverse CDF is now calculated analytically, use
-     *             {@link #UniformRealDistribution(RandomGenerator, double, double)}
-     *             instead.
-     */
-    @Deprecated
-    public UniformRealDistribution(RandomGenerator rng,
-                                   double lower,
-                                   double upper,
-                                   double inverseCumAccuracy){
-        this(rng, lower, upper);
-    }
-
-    /**
-     * Creates a uniform distribution.
-     *
-     * @param rng Random number generator.
-     * @param lower Lower bound of this distribution (inclusive).
-     * @param upper Upper bound of this distribution (exclusive).
-     * @throws NumberIsTooLargeException if {@code lower >= upper}.
-     * @since 3.1
-     */
-    public UniformRealDistribution(RandomGenerator rng,
-                                   double lower,
-                                   double upper)
-        throws NumberIsTooLargeException {
-        super(rng);
-        if (lower >= upper) {
-            throw new NumberIsTooLargeException(
-                            LocalizedFormats.LOWER_BOUND_NOT_BELOW_UPPER_BOUND,
-                            lower, upper, false);
-        }
-
-        this.lower = lower;
-        this.upper = upper;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        if (x < lower || x > upper) {
-            return 0.0;
-        }
-        return 1 / (upper - lower);
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x)  {
-        if (x <= lower) {
-            return 0;
-        }
-        if (x >= upper) {
-            return 1;
-        }
-        return (x - lower) / (upper - lower);
-    }
-
-    @Override
-    public double inverseCumulativeProbability(final double p)
-            throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-        return p * (upper - lower) + lower;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower bound {@code lower} and upper bound {@code upper}, the mean is
-     * {@code 0.5 * (lower + upper)}.
-     */
-    public double getNumericalMean() {
-        return 0.5 * (lower + upper);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For lower bound {@code lower} and upper bound {@code upper}, the
-     * variance is {@code (upper - lower)^2 / 12}.
-     */
-    public double getNumericalVariance() {
-        double ul = upper - lower;
-        return ul * ul / 12;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is equal to the lower bound parameter
-     * of the distribution.
-     *
-     * @return lower bound of the support
-     */
-    public double getSupportLowerBound() {
-        return lower;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is equal to the upper bound parameter
-     * of the distribution.
-     *
-     * @return upper bound of the support
-     */
-    public double getSupportUpperBound() {
-        return upper;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double sample()  {
-        final double u = random.nextDouble();
-        return u * upper + (1 - u) * lower;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java b/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java
deleted file mode 100644
index f1fdabd..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java
+++ /dev/null
@@ -1,353 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the Weibull distribution. This implementation uses the
- * two parameter form of the distribution defined by
- * <a href="http://mathworld.wolfram.com/WeibullDistribution.html">
- * Weibull Distribution</a>, equations (1) and (2).
- *
- * @see <a href="http://en.wikipedia.org/wiki/Weibull_distribution">Weibull distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/WeibullDistribution.html">Weibull distribution (MathWorld)</a>
- * @since 1.1 (changed to concrete class in 3.0)
- */
-public class WeibullDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 8589540077390120676L;
-    /** The shape parameter. */
-    private final double shape;
-    /** The scale parameter. */
-    private final double scale;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-    /** Cached numerical mean */
-    private double numericalMean = Double.NaN;
-    /** Whether or not the numerical mean has been calculated */
-    private boolean numericalMeanIsCalculated = false;
-    /** Cached numerical variance */
-    private double numericalVariance = Double.NaN;
-    /** Whether or not the numerical variance has been calculated */
-    private boolean numericalVarianceIsCalculated = false;
-
-    /**
-     * Create a Weibull distribution with the given shape and scale and a
-     * location equal to zero.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param alpha Shape parameter.
-     * @param beta Scale parameter.
-     * @throws NotStrictlyPositiveException if {@code alpha <= 0} or
-     * {@code beta <= 0}.
-     */
-    public WeibullDistribution(double alpha, double beta)
-        throws NotStrictlyPositiveException {
-        this(alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create a Weibull distribution with the given shape, scale and inverse
-     * cumulative probability accuracy and a location equal to zero.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param alpha Shape parameter.
-     * @param beta Scale parameter.
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates
-     * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code alpha <= 0} or
-     * {@code beta <= 0}.
-     * @since 2.1
-     */
-    public WeibullDistribution(double alpha, double beta,
-                               double inverseCumAccuracy) {
-        this(new Well19937c(), alpha, beta, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a Weibull distribution.
-     *
-     * @param rng Random number generator.
-     * @param alpha Shape parameter.
-     * @param beta Scale parameter.
-     * @throws NotStrictlyPositiveException if {@code alpha <= 0} or {@code beta <= 0}.
-     * @since 3.3
-     */
-    public WeibullDistribution(RandomGenerator rng, double alpha, double beta)
-        throws NotStrictlyPositiveException {
-        this(rng, alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a Weibull distribution.
-     *
-     * @param rng Random number generator.
-     * @param alpha Shape parameter.
-     * @param beta Scale parameter.
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates
-     * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code alpha <= 0} or {@code beta <= 0}.
-     * @since 3.1
-     */
-    public WeibullDistribution(RandomGenerator rng,
-                               double alpha,
-                               double beta,
-                               double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (alpha <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SHAPE,
-                                                   alpha);
-        }
-        if (beta <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SCALE,
-                                                   beta);
-        }
-        scale = beta;
-        shape = alpha;
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * Access the shape parameter, {@code alpha}.
-     *
-     * @return the shape parameter, {@code alpha}.
-     */
-    public double getShape() {
-        return shape;
-    }
-
-    /**
-     * Access the scale parameter, {@code beta}.
-     *
-     * @return the scale parameter, {@code beta}.
-     */
-    public double getScale() {
-        return scale;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        if (x < 0) {
-            return 0;
-        }
-
-        final double xscale = x / scale;
-        final double xscalepow = FastMath.pow(xscale, shape - 1);
-
-        /*
-         * FastMath.pow(x / scale, shape) =
-         * FastMath.pow(xscale, shape) =
-         * FastMath.pow(xscale, shape - 1) * xscale
-         */
-        final double xscalepowshape = xscalepow * xscale;
-
-        return (shape / scale) * xscalepow * FastMath.exp(-xscalepowshape);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logDensity(double x) {
-        if (x < 0) {
-            return Double.NEGATIVE_INFINITY;
-        }
-
-        final double xscale = x / scale;
-        final double logxscalepow = FastMath.log(xscale) * (shape - 1);
-
-        /*
-         * FastMath.pow(x / scale, shape) =
-         * FastMath.pow(xscale, shape) =
-         * FastMath.pow(xscale, shape - 1) * xscale
-         */
-        final double xscalepowshape = FastMath.exp(logxscalepow) * xscale;
-
-        return FastMath.log(shape / scale) + logxscalepow - xscalepowshape;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x) {
-        double ret;
-        if (x <= 0.0) {
-            ret = 0.0;
-        } else {
-            ret = 1.0 - FastMath.exp(-FastMath.pow(x / scale, shape));
-        }
-        return ret;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns {@code 0} when {@code p == 0} and
-     * {@code Double.POSITIVE_INFINITY} when {@code p == 1}.
-     */
-    @Override
-    public double inverseCumulativeProbability(double p) {
-        double ret;
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0.0, 1.0);
-        } else if (p == 0) {
-            ret = 0.0;
-        } else  if (p == 1) {
-            ret = Double.POSITIVE_INFINITY;
-        } else {
-            ret = scale * FastMath.pow(-FastMath.log1p(-p), 1.0 / shape);
-        }
-        return ret;
-    }
-
-    /**
-     * Return the absolute accuracy setting of the solver used to estimate
-     * inverse cumulative probabilities.
-     *
-     * @return the solver absolute accuracy.
-     * @since 2.1
-     */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The mean is {@code scale * Gamma(1 + (1 / shape))}, where {@code Gamma()}
-     * is the Gamma-function.
-     */
-    public double getNumericalMean() {
-        if (!numericalMeanIsCalculated) {
-            numericalMean = calculateNumericalMean();
-            numericalMeanIsCalculated = true;
-        }
-        return numericalMean;
-    }
-
-    /**
-     * used by {@link #getNumericalMean()}
-     *
-     * @return the mean of this distribution
-     */
-    protected double calculateNumericalMean() {
-        final double sh = getShape();
-        final double sc = getScale();
-
-        return sc * FastMath.exp(Gamma.logGamma(1 + (1 / sh)));
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The variance is {@code scale^2 * Gamma(1 + (2 / shape)) - mean^2}
-     * where {@code Gamma()} is the Gamma-function.
-     */
-    public double getNumericalVariance() {
-        if (!numericalVarianceIsCalculated) {
-            numericalVariance = calculateNumericalVariance();
-            numericalVarianceIsCalculated = true;
-        }
-        return numericalVariance;
-    }
-
-    /**
-     * used by {@link #getNumericalVariance()}
-     *
-     * @return the variance of this distribution
-     */
-    protected double calculateNumericalVariance() {
-        final double sh = getShape();
-        final double sc = getScale();
-        final double mn = getNumericalMean();
-
-        return (sc * sc) * FastMath.exp(Gamma.logGamma(1 + (2 / sh))) -
-               (mn * mn);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the parameters.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity
-     * no matter the parameters.
-     *
-     * @return upper bound of the support (always
-     * {@code Double.POSITIVE_INFINITY})
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}
-


[37/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/complex/ComplexFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/complex/ComplexFormat.java b/src/main/java/org/apache/commons/math3/complex/ComplexFormat.java
deleted file mode 100644
index affb638..0000000
--- a/src/main/java/org/apache/commons/math3/complex/ComplexFormat.java
+++ /dev/null
@@ -1,427 +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.complex;
-
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.CompositeFormat;
-
-/**
- * Formats a Complex number in cartesian format "Re(c) + Im(c)i".  'i' can
- * be replaced with 'j' (or anything else), and the number format for both real
- * and imaginary parts can be configured.
- *
- */
-public class ComplexFormat {
-
-     /** The default imaginary character. */
-    private static final String DEFAULT_IMAGINARY_CHARACTER = "i";
-    /** The notation used to signify the imaginary part of the complex number. */
-    private final String imaginaryCharacter;
-    /** The format used for the imaginary part. */
-    private final NumberFormat imaginaryFormat;
-    /** The format used for the real part. */
-    private final NumberFormat realFormat;
-
-    /**
-     * Create an instance with the default imaginary character, 'i', and the
-     * default number format for both real and imaginary parts.
-     */
-    public ComplexFormat() {
-        this.imaginaryCharacter = DEFAULT_IMAGINARY_CHARACTER;
-        this.imaginaryFormat = CompositeFormat.getDefaultNumberFormat();
-        this.realFormat = imaginaryFormat;
-    }
-
-    /**
-     * Create an instance with a custom number format for both real and
-     * imaginary parts.
-     * @param format the custom format for both real and imaginary parts.
-     * @throws NullArgumentException if {@code realFormat} is {@code null}.
-     */
-    public ComplexFormat(NumberFormat format) throws NullArgumentException {
-        if (format == null) {
-            throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT);
-        }
-        this.imaginaryCharacter = DEFAULT_IMAGINARY_CHARACTER;
-        this.imaginaryFormat = format;
-        this.realFormat = format;
-    }
-
-    /**
-     * Create an instance with a custom number format for the real part and a
-     * custom number format for the imaginary part.
-     * @param realFormat the custom format for the real part.
-     * @param imaginaryFormat the custom format for the imaginary part.
-     * @throws NullArgumentException if {@code imaginaryFormat} is {@code null}.
-     * @throws NullArgumentException if {@code realFormat} is {@code null}.
-      */
-    public ComplexFormat(NumberFormat realFormat, NumberFormat imaginaryFormat)
-        throws NullArgumentException {
-        if (imaginaryFormat == null) {
-            throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT);
-        }
-        if (realFormat == null) {
-            throw new NullArgumentException(LocalizedFormats.REAL_FORMAT);
-        }
-
-        this.imaginaryCharacter = DEFAULT_IMAGINARY_CHARACTER;
-        this.imaginaryFormat = imaginaryFormat;
-        this.realFormat = realFormat;
-    }
-
-    /**
-     * Create an instance with a custom imaginary character, and the default
-     * number format for both real and imaginary parts.
-     * @param imaginaryCharacter The custom imaginary character.
-     * @throws NullArgumentException if {@code imaginaryCharacter} is
-     * {@code null}.
-     * @throws NoDataException if {@code imaginaryCharacter} is an
-     * empty string.
-     */
-    public ComplexFormat(String imaginaryCharacter)
-        throws NullArgumentException, NoDataException {
-        this(imaginaryCharacter, CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with a custom imaginary character, and a custom number
-     * format for both real and imaginary parts.
-     * @param imaginaryCharacter The custom imaginary character.
-     * @param format the custom format for both real and imaginary parts.
-     * @throws NullArgumentException if {@code imaginaryCharacter} is
-     * {@code null}.
-     * @throws NoDataException if {@code imaginaryCharacter} is an
-     * empty string.
-     * @throws NullArgumentException if {@code format} is {@code null}.
-     */
-    public ComplexFormat(String imaginaryCharacter, NumberFormat format)
-        throws NullArgumentException, NoDataException {
-        this(imaginaryCharacter, format, format);
-    }
-
-    /**
-     * Create an instance with a custom imaginary character, a custom number
-     * format for the real part, and a custom number format for the imaginary
-     * part.
-     *
-     * @param imaginaryCharacter The custom imaginary character.
-     * @param realFormat the custom format for the real part.
-     * @param imaginaryFormat the custom format for the imaginary part.
-     * @throws NullArgumentException if {@code imaginaryCharacter} is
-     * {@code null}.
-     * @throws NoDataException if {@code imaginaryCharacter} is an
-     * empty string.
-     * @throws NullArgumentException if {@code imaginaryFormat} is {@code null}.
-     * @throws NullArgumentException if {@code realFormat} is {@code null}.
-     */
-    public ComplexFormat(String imaginaryCharacter,
-                         NumberFormat realFormat,
-                         NumberFormat imaginaryFormat)
-        throws NullArgumentException, NoDataException {
-        if (imaginaryCharacter == null) {
-            throw new NullArgumentException();
-        }
-        if (imaginaryCharacter.length() == 0) {
-            throw new NoDataException();
-        }
-        if (imaginaryFormat == null) {
-            throw new NullArgumentException(LocalizedFormats.IMAGINARY_FORMAT);
-        }
-        if (realFormat == null) {
-            throw new NullArgumentException(LocalizedFormats.REAL_FORMAT);
-        }
-
-        this.imaginaryCharacter = imaginaryCharacter;
-        this.imaginaryFormat = imaginaryFormat;
-        this.realFormat = realFormat;
-    }
-
-    /**
-     * Get the set of locales for which complex formats are available.
-     * <p>This is the same set as the {@link NumberFormat} set.</p>
-     * @return available complex format locales.
-     */
-    public static Locale[] getAvailableLocales() {
-        return NumberFormat.getAvailableLocales();
-    }
-
-    /**
-     * This method calls {@link #format(Object,StringBuffer,FieldPosition)}.
-     *
-     * @param c Complex object to format.
-     * @return A formatted number in the form "Re(c) + Im(c)i".
-     */
-    public String format(Complex c) {
-        return format(c, new StringBuffer(), new FieldPosition(0)).toString();
-    }
-
-    /**
-     * This method calls {@link #format(Object,StringBuffer,FieldPosition)}.
-     *
-     * @param c Double object to format.
-     * @return A formatted number.
-     */
-    public String format(Double c) {
-        return format(new Complex(c, 0), new StringBuffer(), new FieldPosition(0)).toString();
-    }
-
-    /**
-     * Formats a {@link Complex} object to produce a string.
-     *
-     * @param complex the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     */
-    public StringBuffer format(Complex complex, StringBuffer toAppendTo,
-                               FieldPosition pos) {
-        pos.setBeginIndex(0);
-        pos.setEndIndex(0);
-
-        // format real
-        double re = complex.getReal();
-        CompositeFormat.formatDouble(re, getRealFormat(), toAppendTo, pos);
-
-        // format sign and imaginary
-        double im = complex.getImaginary();
-        StringBuffer imAppendTo;
-        if (im < 0.0) {
-            toAppendTo.append(" - ");
-            imAppendTo = formatImaginary(-im, new StringBuffer(), pos);
-            toAppendTo.append(imAppendTo);
-            toAppendTo.append(getImaginaryCharacter());
-        } else if (im > 0.0 || Double.isNaN(im)) {
-            toAppendTo.append(" + ");
-            imAppendTo = formatImaginary(im, new StringBuffer(), pos);
-            toAppendTo.append(imAppendTo);
-            toAppendTo.append(getImaginaryCharacter());
-        }
-
-        return toAppendTo;
-    }
-
-    /**
-     * Format the absolute value of the imaginary part.
-     *
-     * @param absIm Absolute value of the imaginary part of a complex number.
-     * @param toAppendTo where the text is to be appended.
-     * @param pos On input: an alignment field, if desired. On output: the
-     * offsets of the alignment field.
-     * @return the value passed in as toAppendTo.
-     */
-    private StringBuffer formatImaginary(double absIm,
-                                         StringBuffer toAppendTo,
-                                         FieldPosition pos) {
-        pos.setBeginIndex(0);
-        pos.setEndIndex(0);
-
-        CompositeFormat.formatDouble(absIm, getImaginaryFormat(), toAppendTo, pos);
-        if (toAppendTo.toString().equals("1")) {
-            // Remove the character "1" if it is the only one.
-            toAppendTo.setLength(0);
-        }
-
-        return toAppendTo;
-    }
-
-    /**
-     * Formats a object to produce a string.  {@code obj} must be either a
-     * {@link Complex} object or a {@link Number} object.  Any other type of
-     * object will result in an {@link IllegalArgumentException} being thrown.
-     *
-     * @param obj the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
-     * @throws MathIllegalArgumentException is {@code obj} is not a valid type.
-     */
-    public StringBuffer format(Object obj, StringBuffer toAppendTo,
-                               FieldPosition pos)
-        throws MathIllegalArgumentException {
-
-        StringBuffer ret = null;
-
-        if (obj instanceof Complex) {
-            ret = format( (Complex)obj, toAppendTo, pos);
-        } else if (obj instanceof Number) {
-            ret = format(new Complex(((Number)obj).doubleValue(), 0.0),
-                         toAppendTo, pos);
-        } else {
-            throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_FORMAT_INSTANCE_AS_COMPLEX,
-                                                   obj.getClass().getName());
-        }
-
-        return ret;
-    }
-
-    /**
-     * Access the imaginaryCharacter.
-     * @return the imaginaryCharacter.
-     */
-    public String getImaginaryCharacter() {
-        return imaginaryCharacter;
-    }
-
-    /**
-     * Access the imaginaryFormat.
-     * @return the imaginaryFormat.
-     */
-    public NumberFormat getImaginaryFormat() {
-        return imaginaryFormat;
-    }
-
-    /**
-     * Returns the default complex format for the current locale.
-     * @return the default complex format.
-     */
-    public static ComplexFormat getInstance() {
-        return getInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default complex format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the complex format specific to the given locale.
-     */
-    public static ComplexFormat getInstance(Locale locale) {
-        NumberFormat f = CompositeFormat.getDefaultNumberFormat(locale);
-        return new ComplexFormat(f);
-    }
-
-    /**
-     * Returns the default complex format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @param imaginaryCharacter Imaginary character.
-     * @return the complex format specific to the given locale.
-     * @throws NullArgumentException if {@code imaginaryCharacter} is
-     * {@code null}.
-     * @throws NoDataException if {@code imaginaryCharacter} is an
-     * empty string.
-     */
-    public static ComplexFormat getInstance(String imaginaryCharacter, Locale locale)
-        throws NullArgumentException, NoDataException {
-        NumberFormat f = CompositeFormat.getDefaultNumberFormat(locale);
-        return new ComplexFormat(imaginaryCharacter, f);
-    }
-
-    /**
-     * Access the realFormat.
-     * @return the realFormat.
-     */
-    public NumberFormat getRealFormat() {
-        return realFormat;
-    }
-
-    /**
-     * Parses a string to produce a {@link Complex} object.
-     *
-     * @param source the string to parse.
-     * @return the parsed {@link Complex} object.
-     * @throws MathParseException if the beginning of the specified string
-     * cannot be parsed.
-     */
-    public Complex parse(String source) throws MathParseException {
-        ParsePosition parsePosition = new ParsePosition(0);
-        Complex result = parse(source, parsePosition);
-        if (parsePosition.getIndex() == 0) {
-            throw new MathParseException(source,
-                                         parsePosition.getErrorIndex(),
-                                         Complex.class);
-        }
-        return result;
-    }
-
-    /**
-     * Parses a string to produce a {@link Complex} object.
-     *
-     * @param source the string to parse
-     * @param pos input/ouput parsing parameter.
-     * @return the parsed {@link Complex} object.
-     */
-    public Complex parse(String source, ParsePosition pos) {
-        int initialIndex = pos.getIndex();
-
-        // parse whitespace
-        CompositeFormat.parseAndIgnoreWhitespace(source, pos);
-
-        // parse real
-        Number re = CompositeFormat.parseNumber(source, getRealFormat(), pos);
-        if (re == null) {
-            // invalid real number
-            // set index back to initial, error index should already be set
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse sign
-        int startIndex = pos.getIndex();
-        char c = CompositeFormat.parseNextCharacter(source, pos);
-        int sign = 0;
-        switch (c) {
-        case 0 :
-            // no sign
-            // return real only complex number
-            return new Complex(re.doubleValue(), 0.0);
-        case '-' :
-            sign = -1;
-            break;
-        case '+' :
-            sign = 1;
-            break;
-        default :
-            // invalid sign
-            // set index back to initial, error index should be the last
-            // character examined.
-            pos.setIndex(initialIndex);
-            pos.setErrorIndex(startIndex);
-            return null;
-        }
-
-        // parse whitespace
-        CompositeFormat.parseAndIgnoreWhitespace(source, pos);
-
-        // parse imaginary
-        Number im = CompositeFormat.parseNumber(source, getRealFormat(), pos);
-        if (im == null) {
-            // invalid imaginary number
-            // set index back to initial, error index should already be set
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse imaginary character
-        if (!CompositeFormat.parseFixedstring(source, getImaginaryCharacter(), pos)) {
-            return null;
-        }
-
-        return new Complex(re.doubleValue(), im.doubleValue() * sign);
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/complex/ComplexUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/complex/ComplexUtils.java b/src/main/java/org/apache/commons/math3/complex/ComplexUtils.java
deleted file mode 100644
index 55db946..0000000
--- a/src/main/java/org/apache/commons/math3/complex/ComplexUtils.java
+++ /dev/null
@@ -1,86 +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.complex;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Static implementations of common
- * {@link org.apache.commons.math3.complex.Complex} utilities functions.
- *
- */
-public class ComplexUtils {
-
-    /**
-     * Default constructor.
-     */
-    private ComplexUtils() {}
-
-    /**
-     * Creates a complex number from the given polar representation.
-     * <p>
-     * The value returned is <code>r&middot;e<sup>i&middot;theta</sup></code>,
-     * computed as <code>r&middot;cos(theta) + r&middot;sin(theta)i</code></p>
-     * <p>
-     * If either <code>r</code> or <code>theta</code> is NaN, or
-     * <code>theta</code> is infinite, {@link Complex#NaN} is returned.</p>
-     * <p>
-     * If <code>r</code> is infinite and <code>theta</code> is finite,
-     * infinite or NaN values may be returned in parts of the result, following
-     * the rules for double arithmetic.<pre>
-     * Examples:
-     * <code>
-     * polar2Complex(INFINITY, &pi;/4) = INFINITY + INFINITY i
-     * polar2Complex(INFINITY, 0) = INFINITY + NaN i
-     * polar2Complex(INFINITY, -&pi;/4) = INFINITY - INFINITY i
-     * polar2Complex(INFINITY, 5&pi;/4) = -INFINITY - INFINITY i </code></pre></p>
-     *
-     * @param r the modulus of the complex number to create
-     * @param theta  the argument of the complex number to create
-     * @return <code>r&middot;e<sup>i&middot;theta</sup></code>
-     * @throws MathIllegalArgumentException if {@code r} is negative.
-     * @since 1.1
-     */
-    public static Complex polar2Complex(double r, double theta) throws MathIllegalArgumentException {
-        if (r < 0) {
-            throw new MathIllegalArgumentException(
-                  LocalizedFormats.NEGATIVE_COMPLEX_MODULE, r);
-        }
-        return new Complex(r * FastMath.cos(theta), r * FastMath.sin(theta));
-    }
-
-    /**
-     * Convert an array of primitive doubles to an array of {@code Complex} objects.
-     *
-     * @param real Array of numbers to be converted to their {@code Complex}
-     * equivalent.
-     * @return an array of {@code Complex} objects.
-     *
-     * @since 3.1
-     */
-    public static Complex[] convertToComplex(double[] real) {
-        final Complex c[] = new Complex[real.length];
-        for (int i = 0; i < real.length; i++) {
-            c[i] = new Complex(real[i], 0);
-        }
-
-        return c;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/complex/Quaternion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/complex/Quaternion.java b/src/main/java/org/apache/commons/math3/complex/Quaternion.java
deleted file mode 100644
index e845596..0000000
--- a/src/main/java/org/apache/commons/math3/complex/Quaternion.java
+++ /dev/null
@@ -1,464 +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.complex;
-
-import java.io.Serializable;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * This class implements <a href="http://mathworld.wolfram.com/Quaternion.html">
- * quaternions</a> (Hamilton's hypercomplex numbers).
- * <br/>
- * Instance of this class are guaranteed to be immutable.
- *
- * @since 3.1
- */
-public final class Quaternion implements Serializable {
-    /** Identity quaternion. */
-    public static final Quaternion IDENTITY = new Quaternion(1, 0, 0, 0);
-    /** Zero quaternion. */
-    public static final Quaternion ZERO = new Quaternion(0, 0, 0, 0);
-    /** i */
-    public static final Quaternion I = new Quaternion(0, 1, 0, 0);
-    /** j */
-    public static final Quaternion J = new Quaternion(0, 0, 1, 0);
-    /** k */
-    public static final Quaternion K = new Quaternion(0, 0, 0, 1);
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20092012L;
-
-    /** First component (scalar part). */
-    private final double q0;
-    /** Second component (first vector part). */
-    private final double q1;
-    /** Third component (second vector part). */
-    private final double q2;
-    /** Fourth component (third vector part). */
-    private final double q3;
-
-    /**
-     * Builds a quaternion from its components.
-     *
-     * @param a Scalar component.
-     * @param b First vector component.
-     * @param c Second vector component.
-     * @param d Third vector component.
-     */
-    public Quaternion(final double a,
-                      final double b,
-                      final double c,
-                      final double d) {
-        this.q0 = a;
-        this.q1 = b;
-        this.q2 = c;
-        this.q3 = d;
-    }
-
-    /**
-     * Builds a quaternion from scalar and vector parts.
-     *
-     * @param scalar Scalar part of the quaternion.
-     * @param v Components of the vector part of the quaternion.
-     *
-     * @throws DimensionMismatchException if the array length is not 3.
-     */
-    public Quaternion(final double scalar,
-                      final double[] v)
-        throws DimensionMismatchException {
-        if (v.length != 3) {
-            throw new DimensionMismatchException(v.length, 3);
-        }
-        this.q0 = scalar;
-        this.q1 = v[0];
-        this.q2 = v[1];
-        this.q3 = v[2];
-    }
-
-    /**
-     * Builds a pure quaternion from a vector (assuming that the scalar
-     * part is zero).
-     *
-     * @param v Components of the vector part of the pure quaternion.
-     */
-    public Quaternion(final double[] v) {
-        this(0, v);
-    }
-
-    /**
-     * Returns the conjugate quaternion of the instance.
-     *
-     * @return the conjugate quaternion
-     */
-    public Quaternion getConjugate() {
-        return new Quaternion(q0, -q1, -q2, -q3);
-    }
-
-    /**
-     * Returns the Hamilton product of two quaternions.
-     *
-     * @param q1 First quaternion.
-     * @param q2 Second quaternion.
-     * @return the product {@code q1} and {@code q2}, in that order.
-     */
-    public static Quaternion multiply(final Quaternion q1, final Quaternion q2) {
-        // Components of the first quaternion.
-        final double q1a = q1.getQ0();
-        final double q1b = q1.getQ1();
-        final double q1c = q1.getQ2();
-        final double q1d = q1.getQ3();
-
-        // Components of the second quaternion.
-        final double q2a = q2.getQ0();
-        final double q2b = q2.getQ1();
-        final double q2c = q2.getQ2();
-        final double q2d = q2.getQ3();
-
-        // Components of the product.
-        final double w = q1a * q2a - q1b * q2b - q1c * q2c - q1d * q2d;
-        final double x = q1a * q2b + q1b * q2a + q1c * q2d - q1d * q2c;
-        final double y = q1a * q2c - q1b * q2d + q1c * q2a + q1d * q2b;
-        final double z = q1a * q2d + q1b * q2c - q1c * q2b + q1d * q2a;
-
-        return new Quaternion(w, x, y, z);
-    }
-
-    /**
-     * Returns the Hamilton product of the instance by a quaternion.
-     *
-     * @param q Quaternion.
-     * @return the product of this instance with {@code q}, in that order.
-     */
-    public Quaternion multiply(final Quaternion q) {
-        return multiply(this, q);
-    }
-
-    /**
-     * Computes the sum of two quaternions.
-     *
-     * @param q1 Quaternion.
-     * @param q2 Quaternion.
-     * @return the sum of {@code q1} and {@code q2}.
-     */
-    public static Quaternion add(final Quaternion q1,
-                                 final Quaternion q2) {
-        return new Quaternion(q1.getQ0() + q2.getQ0(),
-                              q1.getQ1() + q2.getQ1(),
-                              q1.getQ2() + q2.getQ2(),
-                              q1.getQ3() + q2.getQ3());
-    }
-
-    /**
-     * Computes the sum of the instance and another quaternion.
-     *
-     * @param q Quaternion.
-     * @return the sum of this instance and {@code q}
-     */
-    public Quaternion add(final Quaternion q) {
-        return add(this, q);
-    }
-
-    /**
-     * Subtracts two quaternions.
-     *
-     * @param q1 First Quaternion.
-     * @param q2 Second quaternion.
-     * @return the difference between {@code q1} and {@code q2}.
-     */
-    public static Quaternion subtract(final Quaternion q1,
-                                      final Quaternion q2) {
-        return new Quaternion(q1.getQ0() - q2.getQ0(),
-                              q1.getQ1() - q2.getQ1(),
-                              q1.getQ2() - q2.getQ2(),
-                              q1.getQ3() - q2.getQ3());
-    }
-
-    /**
-     * Subtracts a quaternion from the instance.
-     *
-     * @param q Quaternion.
-     * @return the difference between this instance and {@code q}.
-     */
-    public Quaternion subtract(final Quaternion q) {
-        return subtract(this, q);
-    }
-
-    /**
-     * Computes the dot-product of two quaternions.
-     *
-     * @param q1 Quaternion.
-     * @param q2 Quaternion.
-     * @return the dot product of {@code q1} and {@code q2}.
-     */
-    public static double dotProduct(final Quaternion q1,
-                                    final Quaternion q2) {
-        return q1.getQ0() * q2.getQ0() +
-            q1.getQ1() * q2.getQ1() +
-            q1.getQ2() * q2.getQ2() +
-            q1.getQ3() * q2.getQ3();
-    }
-
-    /**
-     * Computes the dot-product of the instance by a quaternion.
-     *
-     * @param q Quaternion.
-     * @return the dot product of this instance and {@code q}.
-     */
-    public double dotProduct(final Quaternion q) {
-        return dotProduct(this, q);
-    }
-
-    /**
-     * Computes the norm of the quaternion.
-     *
-     * @return the norm.
-     */
-    public double getNorm() {
-        return FastMath.sqrt(q0 * q0 +
-                             q1 * q1 +
-                             q2 * q2 +
-                             q3 * q3);
-    }
-
-    /**
-     * Computes the normalized quaternion (the versor of the instance).
-     * The norm of the quaternion must not be zero.
-     *
-     * @return a normalized quaternion.
-     * @throws ZeroException if the norm of the quaternion is zero.
-     */
-    public Quaternion normalize() {
-        final double norm = getNorm();
-
-        if (norm < Precision.SAFE_MIN) {
-            throw new ZeroException(LocalizedFormats.NORM, norm);
-        }
-
-        return new Quaternion(q0 / norm,
-                              q1 / norm,
-                              q2 / norm,
-                              q3 / norm);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public boolean equals(Object other) {
-        if (this == other) {
-            return true;
-        }
-        if (other instanceof Quaternion) {
-            final Quaternion q = (Quaternion) other;
-            return q0 == q.getQ0() &&
-                q1 == q.getQ1() &&
-                q2 == q.getQ2() &&
-                q3 == q.getQ3();
-        }
-
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int hashCode() {
-        // "Effective Java" (second edition, p. 47).
-        int result = 17;
-        for (double comp : new double[] { q0, q1, q2, q3 }) {
-            final int c = MathUtils.hash(comp);
-            result = 31 * result + c;
-        }
-        return result;
-    }
-
-    /**
-     * Checks whether this instance is equal to another quaternion
-     * within a given tolerance.
-     *
-     * @param q Quaternion with which to compare the current quaternion.
-     * @param eps Tolerance.
-     * @return {@code true} if the each of the components are equal
-     * within the allowed absolute error.
-     */
-    public boolean equals(final Quaternion q,
-                          final double eps) {
-        return Precision.equals(q0, q.getQ0(), eps) &&
-            Precision.equals(q1, q.getQ1(), eps) &&
-            Precision.equals(q2, q.getQ2(), eps) &&
-            Precision.equals(q3, q.getQ3(), eps);
-    }
-
-    /**
-     * Checks whether the instance is a unit quaternion within a given
-     * tolerance.
-     *
-     * @param eps Tolerance (absolute error).
-     * @return {@code true} if the norm is 1 within the given tolerance,
-     * {@code false} otherwise
-     */
-    public boolean isUnitQuaternion(double eps) {
-        return Precision.equals(getNorm(), 1d, eps);
-    }
-
-    /**
-     * Checks whether the instance is a pure quaternion within a given
-     * tolerance.
-     *
-     * @param eps Tolerance (absolute error).
-     * @return {@code true} if the scalar part of the quaternion is zero.
-     */
-    public boolean isPureQuaternion(double eps) {
-        return FastMath.abs(getQ0()) <= eps;
-    }
-
-    /**
-     * Returns the polar form of the quaternion.
-     *
-     * @return the unit quaternion with positive scalar part.
-     */
-    public Quaternion getPositivePolarForm() {
-        if (getQ0() < 0) {
-            final Quaternion unitQ = normalize();
-            // The quaternion of rotation (normalized quaternion) q and -q
-            // are equivalent (i.e. represent the same rotation).
-            return new Quaternion(-unitQ.getQ0(),
-                                  -unitQ.getQ1(),
-                                  -unitQ.getQ2(),
-                                  -unitQ.getQ3());
-        } else {
-            return this.normalize();
-        }
-    }
-
-    /**
-     * Returns the inverse of this instance.
-     * The norm of the quaternion must not be zero.
-     *
-     * @return the inverse.
-     * @throws ZeroException if the norm (squared) of the quaternion is zero.
-     */
-    public Quaternion getInverse() {
-        final double squareNorm = q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3;
-        if (squareNorm < Precision.SAFE_MIN) {
-            throw new ZeroException(LocalizedFormats.NORM, squareNorm);
-        }
-
-        return new Quaternion(q0 / squareNorm,
-                              -q1 / squareNorm,
-                              -q2 / squareNorm,
-                              -q3 / squareNorm);
-    }
-
-    /**
-     * Gets the first component of the quaternion (scalar part).
-     *
-     * @return the scalar part.
-     */
-    public double getQ0() {
-        return q0;
-    }
-
-    /**
-     * Gets the second component of the quaternion (first component
-     * of the vector part).
-     *
-     * @return the first component of the vector part.
-     */
-    public double getQ1() {
-        return q1;
-    }
-
-    /**
-     * Gets the third component of the quaternion (second component
-     * of the vector part).
-     *
-     * @return the second component of the vector part.
-     */
-    public double getQ2() {
-        return q2;
-    }
-
-    /**
-     * Gets the fourth component of the quaternion (third component
-     * of the vector part).
-     *
-     * @return the third component of the vector part.
-     */
-    public double getQ3() {
-        return q3;
-    }
-
-    /**
-     * Gets the scalar part of the quaternion.
-     *
-     * @return the scalar part.
-     * @see #getQ0()
-     */
-    public double getScalarPart() {
-        return getQ0();
-    }
-
-    /**
-     * Gets the three components of the vector part of the quaternion.
-     *
-     * @return the vector part.
-     * @see #getQ1()
-     * @see #getQ2()
-     * @see #getQ3()
-     */
-    public double[] getVectorPart() {
-        return new double[] { getQ1(), getQ2(), getQ3() };
-    }
-
-    /**
-     * Multiplies the instance by a scalar.
-     *
-     * @param alpha Scalar factor.
-     * @return a scaled quaternion.
-     */
-    public Quaternion multiply(final double alpha) {
-        return new Quaternion(alpha * q0,
-                              alpha * q1,
-                              alpha * q2,
-                              alpha * q3);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        final String sp = " ";
-        final StringBuilder s = new StringBuilder();
-        s.append("[")
-            .append(q0).append(sp)
-            .append(q1).append(sp)
-            .append(q2).append(sp)
-            .append(q3)
-            .append("]");
-
-        return s.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/complex/RootsOfUnity.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/complex/RootsOfUnity.java b/src/main/java/org/apache/commons/math3/complex/RootsOfUnity.java
deleted file mode 100644
index 4e63835..0000000
--- a/src/main/java/org/apache/commons/math3/complex/RootsOfUnity.java
+++ /dev/null
@@ -1,218 +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.complex;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * A helper class for the computation and caching of the {@code n}-th roots of
- * unity.
- *
- * @since 3.0
- */
-public class RootsOfUnity implements Serializable {
-
-    /** Serializable version id. */
-    private static final long serialVersionUID = 20120201L;
-
-    /** Number of roots of unity. */
-    private int omegaCount;
-
-    /** Real part of the roots. */
-    private double[] omegaReal;
-
-    /**
-     * Imaginary part of the {@code n}-th roots of unity, for positive values
-     * of {@code n}. In this array, the roots are stored in counter-clockwise
-     * order.
-     */
-    private double[] omegaImaginaryCounterClockwise;
-
-    /**
-     * Imaginary part of the {@code n}-th roots of unity, for negative values
-     * of {@code n}. In this array, the roots are stored in clockwise order.
-     */
-    private double[] omegaImaginaryClockwise;
-
-    /**
-     * {@code true} if {@link #computeRoots(int)} was called with a positive
-     * value of its argument {@code n}. In this case, counter-clockwise ordering
-     * of the roots of unity should be used.
-     */
-    private boolean isCounterClockWise;
-
-    /**
-     * Build an engine for computing the {@code n}-th roots of unity.
-     */
-    public RootsOfUnity() {
-
-        omegaCount = 0;
-        omegaReal = null;
-        omegaImaginaryCounterClockwise = null;
-        omegaImaginaryClockwise = null;
-        isCounterClockWise = true;
-    }
-
-    /**
-     * Returns {@code true} if {@link #computeRoots(int)} was called with a
-     * positive value of its argument {@code n}. If {@code true}, then
-     * counter-clockwise ordering of the roots of unity should be used.
-     *
-     * @return {@code true} if the roots of unity are stored in
-     * counter-clockwise order
-     * @throws MathIllegalStateException if no roots of unity have been computed
-     * yet
-     */
-    public synchronized boolean isCounterClockWise()
-            throws MathIllegalStateException {
-
-        if (omegaCount == 0) {
-            throw new MathIllegalStateException(
-                    LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET);
-        }
-        return isCounterClockWise;
-    }
-
-    /**
-     * <p>
-     * Computes the {@code n}-th roots of unity. The roots are stored in
-     * {@code omega[]}, such that {@code omega[k] = w ^ k}, where
-     * {@code k = 0, ..., n - 1}, {@code w = exp(2 * pi * i / n)} and
-     * {@code i = sqrt(-1)}.
-     * </p>
-     * <p>
-     * Note that {@code n} can be positive of negative
-     * </p>
-     * <ul>
-     * <li>{@code abs(n)} is always the number of roots of unity.</li>
-     * <li>If {@code n > 0}, then the roots are stored in counter-clockwise order.</li>
-     * <li>If {@code n < 0}, then the roots are stored in clockwise order.</p>
-     * </ul>
-     *
-     * @param n the (signed) number of roots of unity to be computed
-     * @throws ZeroException if {@code n = 0}
-     */
-    public synchronized void computeRoots(int n) throws ZeroException {
-
-        if (n == 0) {
-            throw new ZeroException(
-                    LocalizedFormats.CANNOT_COMPUTE_0TH_ROOT_OF_UNITY);
-        }
-
-        isCounterClockWise = n > 0;
-
-        // avoid repetitive calculations
-        final int absN = FastMath.abs(n);
-
-        if (absN == omegaCount) {
-            return;
-        }
-
-        // calculate everything from scratch
-        final double t = 2.0 * FastMath.PI / absN;
-        final double cosT = FastMath.cos(t);
-        final double sinT = FastMath.sin(t);
-        omegaReal = new double[absN];
-        omegaImaginaryCounterClockwise = new double[absN];
-        omegaImaginaryClockwise = new double[absN];
-        omegaReal[0] = 1.0;
-        omegaImaginaryCounterClockwise[0] = 0.0;
-        omegaImaginaryClockwise[0] = 0.0;
-        for (int i = 1; i < absN; i++) {
-            omegaReal[i] = omegaReal[i - 1] * cosT -
-                    omegaImaginaryCounterClockwise[i - 1] * sinT;
-            omegaImaginaryCounterClockwise[i] = omegaReal[i - 1] * sinT +
-                    omegaImaginaryCounterClockwise[i - 1] * cosT;
-            omegaImaginaryClockwise[i] = -omegaImaginaryCounterClockwise[i];
-        }
-        omegaCount = absN;
-    }
-
-    /**
-     * Get the real part of the {@code k}-th {@code n}-th root of unity.
-     *
-     * @param k index of the {@code n}-th root of unity
-     * @return real part of the {@code k}-th {@code n}-th root of unity
-     * @throws MathIllegalStateException if no roots of unity have been
-     * computed yet
-     * @throws MathIllegalArgumentException if {@code k} is out of range
-     */
-    public synchronized double getReal(int k)
-            throws MathIllegalStateException, MathIllegalArgumentException {
-
-        if (omegaCount == 0) {
-            throw new MathIllegalStateException(
-                    LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET);
-        }
-        if ((k < 0) || (k >= omegaCount)) {
-            throw new OutOfRangeException(
-                    LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX,
-                    Integer.valueOf(k),
-                    Integer.valueOf(0),
-                    Integer.valueOf(omegaCount - 1));
-        }
-
-        return omegaReal[k];
-    }
-
-    /**
-     * Get the imaginary part of the {@code k}-th {@code n}-th root of unity.
-     *
-     * @param k index of the {@code n}-th root of unity
-     * @return imaginary part of the {@code k}-th {@code n}-th root of unity
-     * @throws MathIllegalStateException if no roots of unity have been
-     * computed yet
-     * @throws OutOfRangeException if {@code k} is out of range
-     */
-    public synchronized double getImaginary(int k)
-            throws MathIllegalStateException, OutOfRangeException {
-
-        if (omegaCount == 0) {
-            throw new MathIllegalStateException(
-                    LocalizedFormats.ROOTS_OF_UNITY_NOT_COMPUTED_YET);
-        }
-        if ((k < 0) || (k >= omegaCount)) {
-            throw new OutOfRangeException(
-                    LocalizedFormats.OUT_OF_RANGE_ROOT_OF_UNITY_INDEX,
-                    Integer.valueOf(k),
-                    Integer.valueOf(0),
-                    Integer.valueOf(omegaCount - 1));
-        }
-
-        return isCounterClockWise ? omegaImaginaryCounterClockwise[k] :
-            omegaImaginaryClockwise[k];
-    }
-
-    /**
-     * Returns the number of roots of unity currently stored. If
-     * {@link #computeRoots(int)} was called with {@code n}, then this method
-     * returns {@code abs(n)}. If no roots of unity have been computed yet, this
-     * method returns 0.
-     *
-     * @return the number of roots of unity currently stored
-     */
-    public synchronized int getNumberOfRoots() {
-        return omegaCount;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/complex/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/complex/package-info.java b/src/main/java/org/apache/commons/math3/complex/package-info.java
deleted file mode 100644
index 818806d..0000000
--- a/src/main/java/org/apache/commons/math3/complex/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- *
- *     Complex number type and implementations of complex transcendental
- *     functions.
- *
- */
-package org.apache.commons.math3.complex;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java b/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java
deleted file mode 100644
index c0328b6..0000000
--- a/src/main/java/org/apache/commons/math3/dfp/BracketingNthOrderBrentSolverDFP.java
+++ /dev/null
@@ -1,436 +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.dfp;
-
-
-import org.apache.commons.math3.analysis.solvers.AllowedSolution;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * This class implements a modification of the <a
- * href="http://mathworld.wolfram.com/BrentsMethod.html"> Brent algorithm</a>.
- * <p>
- * The changes with respect to the original Brent algorithm are:
- * <ul>
- *   <li>the returned value is chosen in the current interval according
- *   to user specified {@link AllowedSolution},</li>
- *   <li>the maximal order for the invert polynomial root search is
- *   user-specified instead of being invert quadratic only</li>
- * </ul>
- * </p>
- * The given interval must bracket the root.
- *
- */
-public class BracketingNthOrderBrentSolverDFP {
-
-   /** Maximal aging triggering an attempt to balance the bracketing interval. */
-    private static final int MAXIMAL_AGING = 2;
-
-    /** Maximal order. */
-    private final int maximalOrder;
-
-    /** Function value accuracy. */
-    private final Dfp functionValueAccuracy;
-
-    /** Absolute accuracy. */
-    private final Dfp absoluteAccuracy;
-
-    /** Relative accuracy. */
-    private final Dfp relativeAccuracy;
-
-    /** Evaluations counter. */
-    private final Incrementor evaluations = new Incrementor();
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param functionValueAccuracy Function value accuracy.
-     * @param maximalOrder maximal order.
-     * @exception NumberIsTooSmallException if maximal order is lower than 2
-     */
-    public BracketingNthOrderBrentSolverDFP(final Dfp relativeAccuracy,
-                                            final Dfp absoluteAccuracy,
-                                            final Dfp functionValueAccuracy,
-                                            final int maximalOrder)
-        throws NumberIsTooSmallException {
-        if (maximalOrder < 2) {
-            throw new NumberIsTooSmallException(maximalOrder, 2, true);
-        }
-        this.maximalOrder = maximalOrder;
-        this.absoluteAccuracy = absoluteAccuracy;
-        this.relativeAccuracy = relativeAccuracy;
-        this.functionValueAccuracy = functionValueAccuracy;
-    }
-
-    /** Get the maximal order.
-     * @return maximal order
-     */
-    public int getMaximalOrder() {
-        return maximalOrder;
-    }
-
-    /**
-     * Get the maximal number of function evaluations.
-     *
-     * @return the maximal number of function evaluations.
-     */
-    public int getMaxEvaluations() {
-        return evaluations.getMaximalCount();
-    }
-
-    /**
-     * Get the number of evaluations of the objective function.
-     * The number of evaluations corresponds to the last call to the
-     * {@code optimize} method. It is 0 if the method has not been
-     * called yet.
-     *
-     * @return the number of evaluations of the objective function.
-     */
-    public int getEvaluations() {
-        return evaluations.getCount();
-    }
-
-    /**
-     * Get the absolute accuracy.
-     * @return absolute accuracy
-     */
-    public Dfp getAbsoluteAccuracy() {
-        return absoluteAccuracy;
-    }
-
-    /**
-     * Get the relative accuracy.
-     * @return relative accuracy
-     */
-    public Dfp getRelativeAccuracy() {
-        return relativeAccuracy;
-    }
-
-    /**
-     * Get the function accuracy.
-     * @return function accuracy
-     */
-    public Dfp getFunctionValueAccuracy() {
-        return functionValueAccuracy;
-    }
-
-    /**
-     * Solve for a zero in the given interval.
-     * A solver may require that the interval brackets a single zero root.
-     * Solvers that do require bracketing should be able to handle the case
-     * where one of the endpoints is itself a root.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param allowedSolution The kind of solutions that the root-finding algorithm may
-     * accept as solutions.
-     * @return a value where the function is zero.
-     * @exception NullArgumentException if f is null.
-     * @exception NoBracketingException if root cannot be bracketed
-     */
-    public Dfp solve(final int maxEval, final UnivariateDfpFunction f,
-                     final Dfp min, final Dfp max, final AllowedSolution allowedSolution)
-        throws NullArgumentException, NoBracketingException {
-        return solve(maxEval, f, min, max, min.add(max).divide(2), allowedSolution);
-    }
-
-    /**
-     * Solve for a zero in the given interval, start at {@code startValue}.
-     * A solver may require that the interval brackets a single zero root.
-     * Solvers that do require bracketing should be able to handle the case
-     * where one of the endpoints is itself a root.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param startValue Start value to use.
-     * @param allowedSolution The kind of solutions that the root-finding algorithm may
-     * accept as solutions.
-     * @return a value where the function is zero.
-     * @exception NullArgumentException if f is null.
-     * @exception NoBracketingException if root cannot be bracketed
-     */
-    public Dfp solve(final int maxEval, final UnivariateDfpFunction f,
-                     final Dfp min, final Dfp max, final Dfp startValue,
-                     final AllowedSolution allowedSolution)
-        throws NullArgumentException, NoBracketingException {
-
-        // Checks.
-        MathUtils.checkNotNull(f);
-
-        // Reset.
-        evaluations.setMaximalCount(maxEval);
-        evaluations.resetCount();
-        Dfp zero = startValue.getZero();
-        Dfp nan  = zero.newInstance((byte) 1, Dfp.QNAN);
-
-        // prepare arrays with the first points
-        final Dfp[] x = new Dfp[maximalOrder + 1];
-        final Dfp[] y = new Dfp[maximalOrder + 1];
-        x[0] = min;
-        x[1] = startValue;
-        x[2] = max;
-
-        // evaluate initial guess
-        evaluations.incrementCount();
-        y[1] = f.value(x[1]);
-        if (y[1].isZero()) {
-            // return the initial guess if it is a perfect root.
-            return x[1];
-        }
-
-        // evaluate first  endpoint
-        evaluations.incrementCount();
-        y[0] = f.value(x[0]);
-        if (y[0].isZero()) {
-            // return the first endpoint if it is a perfect root.
-            return x[0];
-        }
-
-        int nbPoints;
-        int signChangeIndex;
-        if (y[0].multiply(y[1]).negativeOrNull()) {
-
-            // reduce interval if it brackets the root
-            nbPoints        = 2;
-            signChangeIndex = 1;
-
-        } else {
-
-            // evaluate second endpoint
-            evaluations.incrementCount();
-            y[2] = f.value(x[2]);
-            if (y[2].isZero()) {
-                // return the second endpoint if it is a perfect root.
-                return x[2];
-            }
-
-            if (y[1].multiply(y[2]).negativeOrNull()) {
-                // use all computed point as a start sampling array for solving
-                nbPoints        = 3;
-                signChangeIndex = 2;
-            } else {
-                throw new NoBracketingException(x[0].toDouble(), x[2].toDouble(),
-                                                y[0].toDouble(), y[2].toDouble());
-            }
-
-        }
-
-        // prepare a work array for inverse polynomial interpolation
-        final Dfp[] tmpX = new Dfp[x.length];
-
-        // current tightest bracketing of the root
-        Dfp xA    = x[signChangeIndex - 1];
-        Dfp yA    = y[signChangeIndex - 1];
-        Dfp absXA = xA.abs();
-        Dfp absYA = yA.abs();
-        int agingA   = 0;
-        Dfp xB    = x[signChangeIndex];
-        Dfp yB    = y[signChangeIndex];
-        Dfp absXB = xB.abs();
-        Dfp absYB = yB.abs();
-        int agingB   = 0;
-
-        // search loop
-        while (true) {
-
-            // check convergence of bracketing interval
-            Dfp maxX = absXA.lessThan(absXB) ? absXB : absXA;
-            Dfp maxY = absYA.lessThan(absYB) ? absYB : absYA;
-            final Dfp xTol = absoluteAccuracy.add(relativeAccuracy.multiply(maxX));
-            if (xB.subtract(xA).subtract(xTol).negativeOrNull() ||
-                maxY.lessThan(functionValueAccuracy)) {
-                switch (allowedSolution) {
-                case ANY_SIDE :
-                    return absYA.lessThan(absYB) ? xA : xB;
-                case LEFT_SIDE :
-                    return xA;
-                case RIGHT_SIDE :
-                    return xB;
-                case BELOW_SIDE :
-                    return yA.lessThan(zero) ? xA : xB;
-                case ABOVE_SIDE :
-                    return yA.lessThan(zero) ? xB : xA;
-                default :
-                    // this should never happen
-                    throw new MathInternalError(null);
-                }
-            }
-
-            // target for the next evaluation point
-            Dfp targetY;
-            if (agingA >= MAXIMAL_AGING) {
-                // we keep updating the high bracket, try to compensate this
-                targetY = yB.divide(16).negate();
-            } else if (agingB >= MAXIMAL_AGING) {
-                // we keep updating the low bracket, try to compensate this
-                targetY = yA.divide(16).negate();
-            } else {
-                // bracketing is balanced, try to find the root itself
-                targetY = zero;
-            }
-
-            // make a few attempts to guess a root,
-            Dfp nextX;
-            int start = 0;
-            int end   = nbPoints;
-            do {
-
-                // guess a value for current target, using inverse polynomial interpolation
-                System.arraycopy(x, start, tmpX, start, end - start);
-                nextX = guessX(targetY, tmpX, y, start, end);
-
-                if (!(nextX.greaterThan(xA) && nextX.lessThan(xB))) {
-                    // the guessed root is not strictly inside of the tightest bracketing interval
-
-                    // the guessed root is either not strictly inside the interval or it
-                    // is a NaN (which occurs when some sampling points share the same y)
-                    // we try again with a lower interpolation order
-                    if (signChangeIndex - start >= end - signChangeIndex) {
-                        // we have more points before the sign change, drop the lowest point
-                        ++start;
-                    } else {
-                        // we have more points after sign change, drop the highest point
-                        --end;
-                    }
-
-                    // we need to do one more attempt
-                    nextX = nan;
-
-                }
-
-            } while (nextX.isNaN() && (end - start > 1));
-
-            if (nextX.isNaN()) {
-                // fall back to bisection
-                nextX = xA.add(xB.subtract(xA).divide(2));
-                start = signChangeIndex - 1;
-                end   = signChangeIndex;
-            }
-
-            // evaluate the function at the guessed root
-            evaluations.incrementCount();
-            final Dfp nextY = f.value(nextX);
-            if (nextY.isZero()) {
-                // we have found an exact root, since it is not an approximation
-                // we don't need to bother about the allowed solutions setting
-                return nextX;
-            }
-
-            if ((nbPoints > 2) && (end - start != nbPoints)) {
-
-                // we have been forced to ignore some points to keep bracketing,
-                // they are probably too far from the root, drop them from now on
-                nbPoints = end - start;
-                System.arraycopy(x, start, x, 0, nbPoints);
-                System.arraycopy(y, start, y, 0, nbPoints);
-                signChangeIndex -= start;
-
-            } else  if (nbPoints == x.length) {
-
-                // we have to drop one point in order to insert the new one
-                nbPoints--;
-
-                // keep the tightest bracketing interval as centered as possible
-                if (signChangeIndex >= (x.length + 1) / 2) {
-                    // we drop the lowest point, we have to shift the arrays and the index
-                    System.arraycopy(x, 1, x, 0, nbPoints);
-                    System.arraycopy(y, 1, y, 0, nbPoints);
-                    --signChangeIndex;
-                }
-
-            }
-
-            // insert the last computed point
-            //(by construction, we know it lies inside the tightest bracketing interval)
-            System.arraycopy(x, signChangeIndex, x, signChangeIndex + 1, nbPoints - signChangeIndex);
-            x[signChangeIndex] = nextX;
-            System.arraycopy(y, signChangeIndex, y, signChangeIndex + 1, nbPoints - signChangeIndex);
-            y[signChangeIndex] = nextY;
-            ++nbPoints;
-
-            // update the bracketing interval
-            if (nextY.multiply(yA).negativeOrNull()) {
-                // the sign change occurs before the inserted point
-                xB = nextX;
-                yB = nextY;
-                absYB = yB.abs();
-                ++agingA;
-                agingB = 0;
-            } else {
-                // the sign change occurs after the inserted point
-                xA = nextX;
-                yA = nextY;
-                absYA = yA.abs();
-                agingA = 0;
-                ++agingB;
-
-                // update the sign change index
-                signChangeIndex++;
-
-            }
-
-        }
-
-    }
-
-    /** Guess an x value by n<sup>th</sup> order inverse polynomial interpolation.
-     * <p>
-     * The x value is guessed by evaluating polynomial Q(y) at y = targetY, where Q
-     * is built such that for all considered points (x<sub>i</sub>, y<sub>i</sub>),
-     * Q(y<sub>i</sub>) = x<sub>i</sub>.
-     * </p>
-     * @param targetY target value for y
-     * @param x reference points abscissas for interpolation,
-     * note that this array <em>is</em> modified during computation
-     * @param y reference points ordinates for interpolation
-     * @param start start index of the points to consider (inclusive)
-     * @param end end index of the points to consider (exclusive)
-     * @return guessed root (will be a NaN if two points share the same y)
-     */
-    private Dfp guessX(final Dfp targetY, final Dfp[] x, final Dfp[] y,
-                       final int start, final int end) {
-
-        // compute Q Newton coefficients by divided differences
-        for (int i = start; i < end - 1; ++i) {
-            final int delta = i + 1 - start;
-            for (int j = end - 1; j > i; --j) {
-                x[j] = x[j].subtract(x[j-1]).divide(y[j].subtract(y[j - delta]));
-            }
-        }
-
-        // evaluate Q(targetY)
-        Dfp x0 = targetY.getZero();
-        for (int j = end - 1; j >= start; --j) {
-            x0 = x[j].add(x0.multiply(targetY.subtract(y[j])));
-        }
-
-        return x0;
-
-    }
-
-}


[55/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java
index fdbe236..3ce415d 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomCirclePointGenerator.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well44497b;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Factory for generating a cloud of points that approximate a circle.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java
index 2da67c6..a08b959 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/RandomStraightLinePointGenerator.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.awt.geom.Point2D;
 
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well44497b;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
 
 /**
  * Factory for generating a cloud of points that approximate a straight line.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java
index 6fca154..8265215 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDataset.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class gives access to the statistical reference datasets provided by the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java
index 2c49165..99995e8 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StatisticalReferenceDatasetFactory.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * A factory to create instances of {@link StatisticalReferenceDataset} from

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java
index 092e37f..e93c604 100644
--- a/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java
+++ b/src/test/java/org/apache/commons/math4/optim/nonlinear/vector/jacobian/StraightLineProblem.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.vector.jacobian;
+package org.apache.commons.math4.optim.nonlinear.vector.jacobian;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.MultivariateMatrixFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.stat.regression.SimpleRegression;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunction;
-import org.apache.commons.math3.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunction;
+import org.apache.commons.math4.optim.nonlinear.vector.ModelFunctionJacobian;
+import org.apache.commons.math4.stat.regression.SimpleRegression;
 
 /**
  * Class that models a straight line defined as {@code y = a x + b}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/univariate/BracketFinderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/univariate/BracketFinderTest.java b/src/test/java/org/apache/commons/math4/optim/univariate/BracketFinderTest.java
index d341949..b7ea9e1 100644
--- a/src/test/java/org/apache/commons/math4/optim/univariate/BracketFinderTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/univariate/BracketFinderTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.univariate.BracketFinder;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/univariate/BrentOptimizerTest.java
index 575eb5c..d5ea82a 100644
--- a/src/test/java/org/apache/commons/math4/optim/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/univariate/BrentOptimizerTest.java
@@ -14,22 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.StepFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.StepFunction;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.univariate.BrentOptimizer;
+import org.apache.commons.math4.optim.univariate.SearchInterval;
+import org.apache.commons.math4.optim.univariate.SimpleUnivariateValueChecker;
+import org.apache.commons.math4.optim.univariate.UnivariateObjectiveFunction;
+import org.apache.commons.math4.optim.univariate.UnivariateOptimizer;
+import org.apache.commons.math4.optim.univariate.UnivariatePointValuePair;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizerTest.java b/src/test/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizerTest.java
index d979c72..4946431 100644
--- a/src/test/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/univariate/MultiStartUnivariateOptimizerTest.java
@@ -14,16 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.MaxEval;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.MathIllegalStateException;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.optim.MaxEval;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.optim.univariate.BrentOptimizer;
+import org.apache.commons.math4.optim.univariate.MultiStartUnivariateOptimizer;
+import org.apache.commons.math4.optim.univariate.SearchInterval;
+import org.apache.commons.math4.optim.univariate.UnivariateObjectiveFunction;
+import org.apache.commons.math4.optim.univariate.UnivariateOptimizer;
+import org.apache.commons.math4.optim.univariate.UnivariatePointValuePair;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueCheckerTest.java
index e7b7904..72c02b1 100644
--- a/src/test/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optim/univariate/SimpleUnivariateValueCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.univariate;
+package org.apache.commons.math4.optim.univariate;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optim.univariate.SimpleUnivariateValueChecker;
+import org.apache.commons.math4.optim.univariate.UnivariatePointValuePair;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java
index 9eabe99..60c412e 100644
--- a/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableMultiStartOptimizerTest.java
@@ -15,18 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.optimization.general.CircleScalar;
-import org.apache.commons.math3.optimization.general.ConjugateGradientFormula;
-import org.apache.commons.math3.optimization.general.NonLinearConjugateGradientOptimizer;
-import org.apache.commons.math3.random.GaussianRandomGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.MultivariateDifferentiableMultiStartOptimizer;
+import org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
+import org.apache.commons.math4.optimization.general.CircleScalar;
+import org.apache.commons.math4.optimization.general.ConjugateGradientFormula;
+import org.apache.commons.math4.optimization.general.NonLinearConjugateGradientOptimizer;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomVectorGenerator;
+import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java
index bdc1c13..f36d364 100644
--- a/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/MultivariateDifferentiableVectorMultiStartOptimizerTest.java
@@ -15,19 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
-
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optimization.general.GaussNewtonOptimizer;
-import org.apache.commons.math3.random.GaussianRandomGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator;
+package org.apache.commons.math4.optimization;
+
+
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.MultivariateDifferentiableVectorMultiStartOptimizer;
+import org.apache.commons.math4.optimization.MultivariateDifferentiableVectorOptimizer;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.SimpleVectorValueChecker;
+import org.apache.commons.math4.optimization.general.GaussNewtonOptimizer;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomVectorGenerator;
+import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizerTest.java
index dc52366..f3f4461 100644
--- a/src/test/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/MultivariateMultiStartOptimizerTest.java
@@ -15,16 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optimization.direct.NelderMeadSimplex;
-import org.apache.commons.math3.optimization.direct.SimplexOptimizer;
-import org.apache.commons.math3.random.GaussianRandomGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomVectorGenerator;
-import org.apache.commons.math3.random.UncorrelatedRandomVectorGenerator;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.MultivariateMultiStartOptimizer;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
+import org.apache.commons.math4.optimization.direct.NelderMeadSimplex;
+import org.apache.commons.math4.optimization.direct.SimplexOptimizer;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomVectorGenerator;
+import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/PointValuePairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/PointValuePairTest.java b/src/test/java/org/apache/commons/math4/optimization/PointValuePairTest.java
index e683ee6..558541f 100644
--- a/src/test/java/org/apache/commons/math4/optimization/PointValuePairTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/PointValuePairTest.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.optimization.PointValuePair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/PointVectorValuePairTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/PointVectorValuePairTest.java b/src/test/java/org/apache/commons/math4/optimization/PointVectorValuePairTest.java
index 153de52..9d59f73 100644
--- a/src/test/java/org/apache/commons/math4/optimization/PointVectorValuePairTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/PointVectorValuePairTest.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/SimplePointCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/SimplePointCheckerTest.java b/src/test/java/org/apache/commons/math4/optimization/SimplePointCheckerTest.java
index 5595b11..44238ca 100644
--- a/src/test/java/org/apache/commons/math4/optimization/SimplePointCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/SimplePointCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimplePointChecker;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/SimpleValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/SimpleValueCheckerTest.java b/src/test/java/org/apache/commons/math4/optimization/SimpleValueCheckerTest.java
index baf865f..53b0d13 100644
--- a/src/test/java/org/apache/commons/math4/optimization/SimpleValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/SimpleValueCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/SimpleVectorValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/SimpleVectorValueCheckerTest.java b/src/test/java/org/apache/commons/math4/optimization/SimpleVectorValueCheckerTest.java
index 54ade9f..abe807a 100644
--- a/src/test/java/org/apache/commons/math4/optimization/SimpleVectorValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/SimpleVectorValueCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.SimpleVectorValueChecker;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizerTest.java
index a957637..add96f3 100644
--- a/src/test/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/direct/BOBYQAOptimizerTest.java
@@ -14,21 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 import java.util.Arrays;
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.InitialGuess;
-import org.apache.commons.math3.optimization.SimpleBounds;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.InitialGuess;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleBounds;
+import org.apache.commons.math4.optimization.direct.BOBYQAOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/direct/CMAESOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/direct/CMAESOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/direct/CMAESOptimizerTest.java
index 29c3eec..f8587ee 100644
--- a/src/test/java/org/apache/commons/math4/optimization/direct/CMAESOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/direct/CMAESOptimizerTest.java
@@ -14,25 +14,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 import java.util.Arrays;
 import java.util.Random;
 
-import org.apache.commons.math3.Retry;
-import org.apache.commons.math3.RetryRunner;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.InitialGuess;
-import org.apache.commons.math3.optimization.SimpleBounds;
-import org.apache.commons.math3.random.MersenneTwister;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.Retry;
+import org.apache.commons.math4.RetryRunner;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.InitialGuess;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleBounds;
+import org.apache.commons.math4.optimization.direct.CMAESOptimizer;
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapterTest.java b/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapterTest.java
index 138584a..76d9139 100644
--- a/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapterTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapterTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.direct.MultivariateFunctionMappingAdapter;
+import org.apache.commons.math4.optimization.direct.NelderMeadSimplex;
+import org.apache.commons.math4.optimization.direct.SimplexOptimizer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java b/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java
index 0ad840b..0080bca 100644
--- a/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapterTest.java
@@ -15,13 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
+package org.apache.commons.math4.optimization.direct;
 
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.SimplePointChecker;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimplePointChecker;
+import org.apache.commons.math4.optimization.direct.MultivariateFunctionPenaltyAdapter;
+import org.apache.commons.math4.optimization.direct.NelderMeadSimplex;
+import org.apache.commons.math4.optimization.direct.SimplexOptimizer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/direct/PowellOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/direct/PowellOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/direct/PowellOptimizerTest.java
index fcb31fb..227277f 100644
--- a/src/test/java/org/apache/commons/math4/optimization/direct/PowellOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/direct/PowellOptimizerTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.direct;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.SumSincFunction;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.MultivariateOptimizer;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optimization.direct;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.SumSincFunction;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.MultivariateOptimizer;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.direct.PowellOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerMultiDirectionalTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerMultiDirectionalTest.java b/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerMultiDirectionalTest.java
index 9dfa46c..2ae7eaf 100644
--- a/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerMultiDirectionalTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerMultiDirectionalTest.java
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.SimpleValueChecker;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optimization.direct;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
+import org.apache.commons.math4.optimization.direct.MultiDirectionalSimplex;
+import org.apache.commons.math4.optimization.direct.SimplexOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerNelderMeadTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerNelderMeadTest.java b/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerNelderMeadTest.java
index 83ba20a..80a8476 100644
--- a/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerNelderMeadTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/direct/SimplexOptimizerNelderMeadTest.java
@@ -15,18 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.direct;
-
-
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.LeastSquaresConverter;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optimization.direct;
+
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.LeastSquaresConverter;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.direct.NelderMeadSimplex;
+import org.apache.commons.math4.optimization.direct.SimplexOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/fitting/CurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/fitting/CurveFitterTest.java b/src/test/java/org/apache/commons/math4/optimization/fitting/CurveFitterTest.java
index eb1bdb7..3857fc7 100644
--- a/src/test/java/org/apache/commons/math4/optimization/fitting/CurveFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/fitting/CurveFitterTest.java
@@ -15,11 +15,12 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
-import org.apache.commons.math3.optimization.general.LevenbergMarquardtOptimizer;
-import org.apache.commons.math3.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
+import org.apache.commons.math4.optimization.fitting.CurveFitter;
+import org.apache.commons.math4.optimization.general.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math4/optimization/fitting/GaussianFitterTest.java
index ddccdb2..ed38f60 100644
--- a/src/test/java/org/apache/commons/math4/optimization/fitting/GaussianFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/fitting/GaussianFitterTest.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.optimization.general.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.optimization.fitting.GaussianFitter;
+import org.apache.commons.math4.optimization.general.LevenbergMarquardtOptimizer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/fitting/HarmonicFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/fitting/HarmonicFitterTest.java b/src/test/java/org/apache/commons/math4/optimization/fitting/HarmonicFitterTest.java
index f2c1108..31a9bcc 100644
--- a/src/test/java/org/apache/commons/math4/optimization/fitting/HarmonicFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/fitting/HarmonicFitterTest.java
@@ -15,16 +15,18 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.function.HarmonicOscillator;
-import org.apache.commons.math3.optimization.general.LevenbergMarquardtOptimizer;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.optimization.fitting.HarmonicFitter;
+import org.apache.commons.math4.optimization.fitting.WeightedObservedPoint;
+import org.apache.commons.math4.optimization.general.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/fitting/PolynomialFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/fitting/PolynomialFitterTest.java b/src/test/java/org/apache/commons/math4/optimization/fitting/PolynomialFitterTest.java
index ad58b80..5f87c6f 100644
--- a/src/test/java/org/apache/commons/math4/optimization/fitting/PolynomialFitterTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/fitting/PolynomialFitterTest.java
@@ -15,22 +15,24 @@
 // specific language governing permissions and limitations
 // under the License.
 
-package org.apache.commons.math3.optimization.fitting;
+package org.apache.commons.math4.optimization.fitting;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction.Parametric;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer;
-import org.apache.commons.math3.optimization.general.GaussNewtonOptimizer;
-import org.apache.commons.math3.optimization.general.LevenbergMarquardtOptimizer;
-import org.apache.commons.math3.optimization.SimpleVectorValueChecker;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction.Parametric;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer;
+import org.apache.commons.math4.optimization.SimpleVectorValueChecker;
+import org.apache.commons.math4.optimization.fitting.CurveFitter;
+import org.apache.commons.math4.optimization.fitting.PolynomialFitter;
+import org.apache.commons.math4.optimization.general.GaussNewtonOptimizer;
+import org.apache.commons.math4.optimization.general.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java b/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
index 4dbe17d..3f0f5c1 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerAbstractTest.java
@@ -14,22 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.IOException;
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.general.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTest.java
index 67a2385..e965ac3 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTest.java
@@ -11,14 +11,15 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.IOException;
 import java.util.Arrays;
 
 import org.junit.Assert;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.general.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java b/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java
index 71898fc..da39013 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizerTestValidation.java
@@ -11,17 +11,18 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.util.Arrays;
 import java.util.List;
 import java.util.ArrayList;
 import java.awt.geom.Point2D;
 
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.general.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 
@@ -29,7 +30,7 @@ import org.junit.Assert;
  * This class demonstrates the main functionality of the
  * {@link AbstractLeastSquaresOptimizer}, common to the
  * optimizer implementations in package
- * {@link org.apache.commons.math3.optimization.general}.
+ * {@link org.apache.commons.math4.optimization.general}.
  * <br/>
  * Not enabled by default, as the class name does not end with "Test".
  * <br/>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/CircleProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/CircleProblem.java b/src/test/java/org/apache/commons/math4/optimization/general/CircleProblem.java
index feca13e..f4bb05a 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/CircleProblem.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/CircleProblem.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Class that models a circle.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/CircleScalar.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/CircleScalar.java b/src/test/java/org/apache/commons/math4/optimization/general/CircleScalar.java
index 6b39b41..2727218 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/CircleScalar.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/CircleScalar.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
 
 /**
  * Class used in the tests.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/CircleVectorial.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/CircleVectorial.java b/src/test/java/org/apache/commons/math4/optimization/general/CircleVectorial.java
index 7d79e56..b0f4da5 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/CircleVectorial.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/CircleVectorial.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
 
 /**
  * Class used in the tests.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizerTest.java
index c987e14..88e2f3a 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizerTest.java
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.IOException;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.optimization.SimpleVectorValueChecker;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.SimpleVectorValueChecker;
+import org.apache.commons.math4.optimization.general.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.optimization.general.GaussNewtonOptimizer;
 import org.junit.Test;
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizerTest.java
index 81c2c52..da77546 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizerTest.java
@@ -15,22 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.general.AbstractLeastSquaresOptimizer;
+import org.apache.commons.math4.optimization.general.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.Ignore;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/MinpackTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/MinpackTest.java b/src/test/java/org/apache/commons/math4/optimization/general/MinpackTest.java
index 63432f7..50440c3 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/MinpackTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/MinpackTest.java
@@ -15,16 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.general.LevenbergMarquardtOptimizer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizerTest.java
index 26091a4..d9000a8 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizerTest.java
@@ -15,19 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.solvers.BrentSolver;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.SimpleValueChecker;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.solvers.BrentSolver;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
+import org.apache.commons.math4.optimization.general.ConjugateGradientFormula;
+import org.apache.commons.math4.optimization.general.NonLinearConjugateGradientOptimizer;
+import org.apache.commons.math4.optimization.general.Preconditioner;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/RandomCirclePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/RandomCirclePointGenerator.java b/src/test/java/org/apache/commons/math4/optimization/general/RandomCirclePointGenerator.java
index 86f8272..3e3f919 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/RandomCirclePointGenerator.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/RandomCirclePointGenerator.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well44497b;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.geometry.euclidean.twod.Vector2D;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Factory for generating a cloud of points that approximate a circle.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/RandomStraightLinePointGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/RandomStraightLinePointGenerator.java b/src/test/java/org/apache/commons/math4/optimization/general/RandomStraightLinePointGenerator.java
index db626e8..2a0a970 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/RandomStraightLinePointGenerator.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/RandomStraightLinePointGenerator.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.awt.geom.Point2D;
 
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well44497b;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
 
 /**
  * Factory for generating a cloud of points that approximate a straight line.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDataset.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDataset.java b/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDataset.java
index 1b6c440..2b7f6ca 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDataset.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDataset.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class gives access to the statistical reference datasets provided by the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDatasetFactory.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDatasetFactory.java b/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDatasetFactory.java
index 167c856..f7fa021 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDatasetFactory.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/StatisticalReferenceDatasetFactory.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
 
 /**
  * A factory to create instances of {@link StatisticalReferenceDataset} from

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/general/StraightLineProblem.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/general/StraightLineProblem.java b/src/test/java/org/apache/commons/math4/optimization/general/StraightLineProblem.java
index 1b7d933..a81da4c 100644
--- a/src/test/java/org/apache/commons/math4/optimization/general/StraightLineProblem.java
+++ b/src/test/java/org/apache/commons/math4/optimization/general/StraightLineProblem.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.util.ArrayList;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.stat.regression.SimpleRegression;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.stat.regression.SimpleRegression;
 
 /**
  * Class that models a straight line defined as {@code y = a x + b}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/linear/SimplexSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/linear/SimplexSolverTest.java b/src/test/java/org/apache/commons/math4/optimization/linear/SimplexSolverTest.java
index 110992a..0331bd8 100644
--- a/src/test/java/org/apache/commons/math4/optimization/linear/SimplexSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/linear/SimplexSolverTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import org.junit.Assert;
 
@@ -23,9 +23,15 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.linear.LinearConstraint;
+import org.apache.commons.math4.optimization.linear.LinearObjectiveFunction;
+import org.apache.commons.math4.optimization.linear.NoFeasibleSolutionException;
+import org.apache.commons.math4.optimization.linear.Relationship;
+import org.apache.commons.math4.optimization.linear.SimplexSolver;
+import org.apache.commons.math4.optimization.linear.UnboundedSolutionException;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Test;
 
 @Deprecated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/linear/SimplexTableauTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/linear/SimplexTableauTest.java b/src/test/java/org/apache/commons/math4/optimization/linear/SimplexTableauTest.java
index 7fad943..6b642bf 100644
--- a/src/test/java/org/apache/commons/math4/optimization/linear/SimplexTableauTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/linear/SimplexTableauTest.java
@@ -15,13 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.optimization.GoalType;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.linear.LinearConstraint;
+import org.apache.commons.math4.optimization.linear.LinearObjectiveFunction;
+import org.apache.commons.math4.optimization.linear.Relationship;
+import org.apache.commons.math4.optimization.linear.SimplexTableau;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/univariate/BracketFinderTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/univariate/BracketFinderTest.java b/src/test/java/org/apache/commons/math4/optimization/univariate/BracketFinderTest.java
index b5783c2..d6e0a31 100644
--- a/src/test/java/org/apache/commons/math4/optimization/univariate/BracketFinderTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/univariate/BracketFinderTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optimization.GoalType;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.univariate.BracketFinder;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/univariate/BrentOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/univariate/BrentOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/univariate/BrentOptimizerTest.java
index 34ee8c7..18f71b9 100644
--- a/src/test/java/org/apache/commons/math4/optimization/univariate/BrentOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/univariate/BrentOptimizerTest.java
@@ -14,21 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.univariate;
-
-
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.StepFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optimization.univariate;
+
+
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.StepFunction;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.univariate.BrentOptimizer;
+import org.apache.commons.math4.optimization.univariate.SimpleUnivariateValueChecker;
+import org.apache.commons.math4.optimization.univariate.UnivariateOptimizer;
+import org.apache.commons.math4.optimization.univariate.UnivariatePointValuePair;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueCheckerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueCheckerTest.java b/src/test/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueCheckerTest.java
index 8ad9f66..c9f44ad 100644
--- a/src/test/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueCheckerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueCheckerTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optimization.univariate.SimpleUnivariateValueChecker;
+import org.apache.commons.math4.optimization.univariate.UnivariatePointValuePair;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizerTest.java b/src/test/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizerTest.java
index 18fbdab..ea4b4ab 100644
--- a/src/test/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizerTest.java
+++ b/src/test/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizerTest.java
@@ -15,14 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.univariate.BrentOptimizer;
+import org.apache.commons.math4.optimization.univariate.UnivariateMultiStartOptimizer;
+import org.apache.commons.math4.optimization.univariate.UnivariateOptimizer;
+import org.apache.commons.math4.optimization.univariate.UnivariatePointValuePair;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/primes/PrimesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/primes/PrimesTest.java b/src/test/java/org/apache/commons/math4/primes/PrimesTest.java
index 19eef5d..085dfac 100644
--- a/src/test/java/org/apache/commons/math4/primes/PrimesTest.java
+++ b/src/test/java/org/apache/commons/math4/primes/PrimesTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.primes;
+package org.apache.commons.math4.primes;
 
 
 import java.util.HashSet;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.primes.Primes;
+import org.apache.commons.math4.primes.SmallPrimes;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/AbstractRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/AbstractRandomGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/AbstractRandomGeneratorTest.java
index 1f3d2b0..282ec38 100644
--- a/src/test/java/org/apache/commons/math4/random/AbstractRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/AbstractRandomGeneratorTest.java
@@ -14,7 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
+
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * Test cases for the AbstractRandomGenerator class.


[42/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java
deleted file mode 100644
index b747841..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolatingFunction.java
+++ /dev/null
@@ -1,250 +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.analysis.interpolation;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Interpolating function that implements the
- * <a href="http://www.dudziak.com/microsphere.php">Microsphere Projection</a>.
- *
- */
-public class MicrosphereInterpolatingFunction
-    implements MultivariateFunction {
-    /**
-     * Space dimension.
-     */
-    private final int dimension;
-    /**
-     * Internal accounting data for the interpolation algorithm.
-     * Each element of the list corresponds to one surface element of
-     * the microsphere.
-     */
-    private final List<MicrosphereSurfaceElement> microsphere;
-    /**
-     * Exponent used in the power law that computes the weights of the
-     * sample data.
-     */
-    private final double brightnessExponent;
-    /**
-     * Sample data.
-     */
-    private final Map<RealVector, Double> samples;
-
-    /**
-     * Class for storing the accounting data needed to perform the
-     * microsphere projection.
-     */
-    private static class MicrosphereSurfaceElement {
-        /** Normal vector characterizing a surface element. */
-        private final RealVector normal;
-        /** Illumination received from the brightest sample. */
-        private double brightestIllumination;
-        /** Brightest sample. */
-        private Map.Entry<RealVector, Double> brightestSample;
-
-        /**
-         * @param n Normal vector characterizing a surface element
-         * of the microsphere.
-         */
-        MicrosphereSurfaceElement(double[] n) {
-            normal = new ArrayRealVector(n);
-        }
-
-        /**
-         * Return the normal vector.
-         * @return the normal vector
-         */
-        RealVector normal() {
-            return normal;
-        }
-
-        /**
-         * Reset "illumination" and "sampleIndex".
-         */
-        void reset() {
-            brightestIllumination = 0;
-            brightestSample = null;
-        }
-
-        /**
-         * Store the illumination and index of the brightest sample.
-         * @param illuminationFromSample illumination received from sample
-         * @param sample current sample illuminating the element
-         */
-        void store(final double illuminationFromSample,
-                   final Map.Entry<RealVector, Double> sample) {
-            if (illuminationFromSample > this.brightestIllumination) {
-                this.brightestIllumination = illuminationFromSample;
-                this.brightestSample = sample;
-            }
-        }
-
-        /**
-         * Get the illumination of the element.
-         * @return the illumination.
-         */
-        double illumination() {
-            return brightestIllumination;
-        }
-
-        /**
-         * Get the sample illuminating the element the most.
-         * @return the sample.
-         */
-        Map.Entry<RealVector, Double> sample() {
-            return brightestSample;
-        }
-    }
-
-    /**
-     * @param xval Arguments for the interpolation points.
-     * {@code xval[i][0]} is the first component of interpolation point
-     * {@code i}, {@code xval[i][1]} is the second component, and so on
-     * until {@code xval[i][d-1]}, the last component of that interpolation
-     * point (where {@code dimension} is thus the dimension of the sampled
-     * space).
-     * @param yval Values for the interpolation points.
-     * @param brightnessExponent Brightness dimming factor.
-     * @param microsphereElements Number of surface elements of the
-     * microsphere.
-     * @param rand Unit vector generator for creating the microsphere.
-     * @throws DimensionMismatchException if the lengths of {@code yval} and
-     * {@code xval} (equal to {@code n}, the number of interpolation points)
-     * do not match, or the the arrays {@code xval[0]} ... {@code xval[n]},
-     * have lengths different from {@code dimension}.
-     * @throws NoDataException if there an array has zero-length.
-     * @throws NullArgumentException if an argument is {@code null}.
-     */
-    public MicrosphereInterpolatingFunction(double[][] xval,
-                                            double[] yval,
-                                            int brightnessExponent,
-                                            int microsphereElements,
-                                            UnitSphereRandomVectorGenerator rand)
-        throws DimensionMismatchException,
-               NoDataException,
-               NullArgumentException {
-        if (xval == null ||
-            yval == null) {
-            throw new NullArgumentException();
-        }
-        if (xval.length == 0) {
-            throw new NoDataException();
-        }
-        if (xval.length != yval.length) {
-            throw new DimensionMismatchException(xval.length, yval.length);
-        }
-        if (xval[0] == null) {
-            throw new NullArgumentException();
-        }
-
-        dimension = xval[0].length;
-        this.brightnessExponent = brightnessExponent;
-
-        // Copy data samples.
-        samples = new HashMap<RealVector, Double>(yval.length);
-        for (int i = 0; i < xval.length; ++i) {
-            final double[] xvalI = xval[i];
-            if (xvalI == null) {
-                throw new NullArgumentException();
-            }
-            if (xvalI.length != dimension) {
-                throw new DimensionMismatchException(xvalI.length, dimension);
-            }
-
-            samples.put(new ArrayRealVector(xvalI), yval[i]);
-        }
-
-        microsphere = new ArrayList<MicrosphereSurfaceElement>(microsphereElements);
-        // Generate the microsphere, assuming that a fairly large number of
-        // randomly generated normals will represent a sphere.
-        for (int i = 0; i < microsphereElements; i++) {
-            microsphere.add(new MicrosphereSurfaceElement(rand.nextVector()));
-        }
-    }
-
-    /**
-     * @param point Interpolation point.
-     * @return the interpolated value.
-     * @throws DimensionMismatchException if point dimension does not math sample
-     */
-    public double value(double[] point) throws DimensionMismatchException {
-        final RealVector p = new ArrayRealVector(point);
-
-        // Reset.
-        for (MicrosphereSurfaceElement md : microsphere) {
-            md.reset();
-        }
-
-        // Compute contribution of each sample points to the microsphere elements illumination
-        for (Map.Entry<RealVector, Double> sd : samples.entrySet()) {
-
-            // Vector between interpolation point and current sample point.
-            final RealVector diff = sd.getKey().subtract(p);
-            final double diffNorm = diff.getNorm();
-
-            if (FastMath.abs(diffNorm) < FastMath.ulp(1d)) {
-                // No need to interpolate, as the interpolation point is
-                // actually (very close to) one of the sampled points.
-                return sd.getValue();
-            }
-
-            for (MicrosphereSurfaceElement md : microsphere) {
-                final double w = FastMath.pow(diffNorm, -brightnessExponent);
-                md.store(cosAngle(diff, md.normal()) * w, sd);
-            }
-
-        }
-
-        // Interpolation calculation.
-        double value = 0;
-        double totalWeight = 0;
-        for (MicrosphereSurfaceElement md : microsphere) {
-            final double iV = md.illumination();
-            final Map.Entry<RealVector, Double> sd = md.sample();
-            if (sd != null) {
-                value += iV * sd.getValue();
-                totalWeight += iV;
-            }
-        }
-
-        return value / totalWeight;
-    }
-
-    /**
-     * Compute the cosine of the angle between 2 vectors.
-     *
-     * @param v Vector.
-     * @param w Vector.
-     * @return the cosine of the angle between {@code v} and {@code w}.
-     */
-    private double cosAngle(final RealVector v, final RealVector w) {
-        return v.dotProduct(w) / (v.getNorm() * w.getNorm());
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java
deleted file mode 100644
index c9881ce..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/MicrosphereInterpolator.java
+++ /dev/null
@@ -1,102 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-
-/**
- * Interpolator that implements the algorithm described in
- * <em>William Dudziak</em>'s
- * <a href="http://www.dudziak.com/microsphere.pdf">MS thesis</a>.
- *
- * @since 2.1
- */
-public class MicrosphereInterpolator
-    implements MultivariateInterpolator {
-    /**
-     * Default number of surface elements that composes the microsphere.
-     */
-    public static final int DEFAULT_MICROSPHERE_ELEMENTS = 2000;
-    /**
-     * Default exponent used the weights calculation.
-     */
-    public static final int DEFAULT_BRIGHTNESS_EXPONENT = 2;
-    /**
-     * Number of surface elements of the microsphere.
-     */
-    private final int microsphereElements;
-    /**
-     * Exponent used in the power law that computes the weights of the
-     * sample data.
-     */
-    private final int brightnessExponent;
-
-    /**
-     * Create a microsphere interpolator with default settings.
-     * Calling this constructor is equivalent to call {@link
-     * #MicrosphereInterpolator(int, int)
-     * MicrosphereInterpolator(MicrosphereInterpolator.DEFAULT_MICROSPHERE_ELEMENTS,
-     * MicrosphereInterpolator.DEFAULT_BRIGHTNESS_EXPONENT)}.
-     */
-    public MicrosphereInterpolator() {
-        this(DEFAULT_MICROSPHERE_ELEMENTS, DEFAULT_BRIGHTNESS_EXPONENT);
-    }
-
-    /** Create a microsphere interpolator.
-     * @param elements Number of surface elements of the microsphere.
-     * @param exponent Exponent used in the power law that computes the
-     * weights (distance dimming factor) of the sample data.
-     * @throws NotPositiveException if {@code exponent < 0}.
-     * @throws NotStrictlyPositiveException if {@code elements <= 0}.
-     */
-    public MicrosphereInterpolator(final int elements,
-                                   final int exponent)
-        throws NotPositiveException,
-               NotStrictlyPositiveException {
-        if (exponent < 0) {
-            throw new NotPositiveException(exponent);
-        }
-        if (elements <= 0) {
-            throw new NotStrictlyPositiveException(elements);
-        }
-
-        microsphereElements = elements;
-        brightnessExponent = exponent;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public MultivariateFunction interpolate(final double[][] xval,
-                                            final double[] yval)
-        throws DimensionMismatchException,
-               NoDataException,
-               NullArgumentException {
-        final UnitSphereRandomVectorGenerator rand
-            = new UnitSphereRandomVectorGenerator(xval[0].length);
-        return new MicrosphereInterpolatingFunction(xval, yval,
-                                                    brightnessExponent,
-                                                    microsphereElements,
-                                                    rand);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/MultivariateInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/MultivariateInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/MultivariateInterpolator.java
deleted file mode 100644
index 7d76374..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/MultivariateInterpolator.java
+++ /dev/null
@@ -1,51 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-
-/**
- * Interface representing a univariate real interpolating function.
- *
- * @since 2.1
- */
-public interface MultivariateInterpolator {
-
-    /**
-     * Computes an interpolating function for the data set.
-     *
-     * @param xval the arguments for the interpolation points.
-     * {@code xval[i][0]} is the first component of interpolation point
-     * {@code i}, {@code xval[i][1]} is the second component, and so on
-     * until {@code xval[i][d-1]}, the last component of that interpolation
-     * point (where {@code d} is thus the dimension of the space).
-     * @param yval the values for the interpolation points
-     * @return a function which interpolates the data set
-     * @throws MathIllegalArgumentException if the arguments violate assumptions
-     * made by the interpolation algorithm.
-     * @throws DimensionMismatchException when the array dimensions are not consistent.
-     * @throws NoDataException if an array has zero-length.
-     * @throws NullArgumentException if the arguments are {@code null}.
-     */
-    MultivariateFunction interpolate(double[][] xval, double[] yval)
-        throws MathIllegalArgumentException, DimensionMismatchException,
-               NoDataException, NullArgumentException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java
deleted file mode 100644
index 6b47451..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/NevilleInterpolator.java
+++ /dev/null
@@ -1,60 +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.analysis.interpolation;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunctionLagrangeForm;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html">
- * Neville's Algorithm</a> for interpolation of real univariate functions. For
- * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X,
- * chapter 2.
- * <p>
- * The actual code of Neville's algorithm is in PolynomialFunctionLagrangeForm,
- * this class provides an easy-to-use interface to it.</p>
- *
- * @since 1.2
- */
-public class NevilleInterpolator implements UnivariateInterpolator,
-    Serializable {
-
-    /** serializable version identifier */
-    static final long serialVersionUID = 3003707660147873733L;
-
-    /**
-     * Computes an interpolating function for the data set.
-     *
-     * @param x Interpolating points.
-     * @param y Interpolating values.
-     * @return a function which interpolates the data set
-     * @throws DimensionMismatchException if the array lengths are different.
-     * @throws NumberIsTooSmallException if the number of points is less than 2.
-     * @throws NonMonotonicSequenceException if two abscissae have the same
-     * value.
-     */
-    public PolynomialFunctionLagrangeForm interpolate(double x[], double y[])
-        throws DimensionMismatchException,
-               NumberIsTooSmallException,
-               NonMonotonicSequenceException {
-        return new PolynomialFunctionLagrangeForm(x, y);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java
deleted file mode 100644
index 7dd135a..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunction.java
+++ /dev/null
@@ -1,210 +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.analysis.interpolation;
-
-import java.util.Arrays;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Function that implements the
- * <a href="http://www.paulinternet.nl/?page=bicubic">bicubic spline</a>
- * interpolation.
- * This implementation currently uses {@link AkimaSplineInterpolator} as the
- * underlying one-dimensional interpolator, which requires 5 sample points;
- * insufficient data will raise an exception when the
- * {@link #value(double,double) value} method is called.
- *
- * @since 3.4
- */
-public class PiecewiseBicubicSplineInterpolatingFunction
-    implements BivariateFunction {
-    /** The minimum number of points that are needed to compute the function. */
-    private static final int MIN_NUM_POINTS = 5;
-    /** Samples x-coordinates */
-    private final double[] xval;
-    /** Samples y-coordinates */
-    private final double[] yval;
-    /** Set of cubic splines patching the whole data grid */
-    private final double[][] fval;
-
-    /**
-     * @param x Sample values of the x-coordinate, in increasing order.
-     * @param y Sample values of the y-coordinate, in increasing order.
-     * @param f Values of the function on every grid point. the expected number
-     *        of elements.
-     * @throws NonMonotonicSequenceException if {@code x} or {@code y} are not
-     *         strictly increasing.
-     * @throws NullArgumentException if any of the arguments are null
-     * @throws NoDataException if any of the arrays has zero length.
-     * @throws DimensionMismatchException if the length of x and y don't match the row, column
-     *         height of f
-     */
-    public PiecewiseBicubicSplineInterpolatingFunction(double[] x,
-                                                       double[] y,
-                                                       double[][] f)
-        throws DimensionMismatchException,
-               NullArgumentException,
-               NoDataException,
-               NonMonotonicSequenceException {
-        if (x == null ||
-            y == null ||
-            f == null ||
-            f[0] == null) {
-            throw new NullArgumentException();
-        }
-
-        final int xLen = x.length;
-        final int yLen = y.length;
-
-        if (xLen == 0 ||
-            yLen == 0 ||
-            f.length == 0 ||
-            f[0].length == 0) {
-            throw new NoDataException();
-        }
-
-        if (xLen < MIN_NUM_POINTS ||
-            yLen < MIN_NUM_POINTS ||
-            f.length < MIN_NUM_POINTS ||
-            f[0].length < MIN_NUM_POINTS) {
-            throw new InsufficientDataException();
-        }
-
-        if (xLen != f.length) {
-            throw new DimensionMismatchException(xLen, f.length);
-        }
-
-        if (yLen != f[0].length) {
-            throw new DimensionMismatchException(yLen, f[0].length);
-        }
-
-        MathArrays.checkOrder(x);
-        MathArrays.checkOrder(y);
-
-        xval = x.clone();
-        yval = y.clone();
-        fval = f.clone();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double value(double x,
-                        double y)
-        throws OutOfRangeException {
-        final AkimaSplineInterpolator interpolator = new AkimaSplineInterpolator();
-        final int offset = 2;
-        final int count = offset + 3;
-        final int i = searchIndex(x, xval, offset, count);
-        final int j = searchIndex(y, yval, offset, count);
-
-        final double xArray[] = new double[count];
-        final double yArray[] = new double[count];
-        final double zArray[] = new double[count];
-        final double interpArray[] = new double[count];
-
-        for (int index = 0; index < count; index++) {
-            xArray[index] = xval[i + index];
-            yArray[index] = yval[j + index];
-        }
-
-        for (int zIndex = 0; zIndex < count; zIndex++) {
-            for (int index = 0; index < count; index++) {
-                zArray[index] = fval[i + index][j + zIndex];
-            }
-            final PolynomialSplineFunction spline = interpolator.interpolate(xArray, zArray);
-            interpArray[zIndex] = spline.value(x);
-        }
-
-        final PolynomialSplineFunction spline = interpolator.interpolate(yArray, interpArray);
-
-        double returnValue = spline.value(y);
-
-        return returnValue;
-    }
-
-    /**
-     * Indicates whether a point is within the interpolation range.
-     *
-     * @param x First coordinate.
-     * @param y Second coordinate.
-     * @return {@code true} if (x, y) is a valid point.
-     * @since 3.3
-     */
-    public boolean isValidPoint(double x,
-                                double y) {
-        if (x < xval[0] ||
-            x > xval[xval.length - 1] ||
-            y < yval[0] ||
-            y > yval[yval.length - 1]) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * @param c Coordinate.
-     * @param val Coordinate samples.
-     * @param offset how far back from found value to offset for querying
-     * @param count total number of elements forward from beginning that will be
-     *        queried
-     * @return the index in {@code val} corresponding to the interval containing
-     *         {@code c}.
-     * @throws OutOfRangeException if {@code c} is out of the range defined by
-     *         the boundary values of {@code val}.
-     */
-    private int searchIndex(double c,
-                            double[] val,
-                            int offset,
-                            int count) {
-        int r = Arrays.binarySearch(val, c);
-
-        if (r == -1 || r == -val.length - 1) {
-            throw new OutOfRangeException(c, val[0], val[val.length - 1]);
-        }
-
-        if (r < 0) {
-            // "c" in within an interpolation sub-interval, which returns
-            // negative
-            // need to remove the negative sign for consistency
-            r = -r - offset - 1;
-        } else {
-            r -= offset;
-        }
-
-        if (r < 0) {
-            r = 0;
-        }
-
-        if ((r + count) >= val.length) {
-            // "c" is the last sample of the range: Return the index
-            // of the sample at the lower end of the last sub-interval.
-            r = val.length - count;
-        }
-
-        return r;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java
deleted file mode 100644
index 826f328..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/PiecewiseBicubicSplineInterpolator.java
+++ /dev/null
@@ -1,61 +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.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Generates a piecewise-bicubic interpolating function.
- *
- * @since 2.2
- */
-public class PiecewiseBicubicSplineInterpolator
-    implements BivariateGridInterpolator {
-
-    /**
-     * {@inheritDoc}
-     */
-    public PiecewiseBicubicSplineInterpolatingFunction interpolate( final double[] xval,
-                                                                    final double[] yval,
-                                                                    final double[][] fval)
-        throws DimensionMismatchException,
-               NullArgumentException,
-               NoDataException,
-               NonMonotonicSequenceException {
-        if ( xval == null ||
-             yval == null ||
-             fval == null ||
-             fval[0] == null ) {
-            throw new NullArgumentException();
-        }
-
-        if ( xval.length == 0 ||
-             yval.length == 0 ||
-             fval.length == 0 ) {
-            throw new NoDataException();
-        }
-
-        MathArrays.checkOrder(xval);
-        MathArrays.checkOrder(yval);
-
-        return new PiecewiseBicubicSplineInterpolatingFunction( xval, yval, fval );
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
deleted file mode 100644
index e1639b2..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
+++ /dev/null
@@ -1,171 +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.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
-import org.apache.commons.math3.fitting.PolynomialFitter;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.optim.SimpleVectorValueChecker;
-
-/**
- * Generates a bicubic interpolation function.
- * Prior to generating the interpolating function, the input is smoothed using
- * polynomial fitting.
- *
- * @since 2.2
- * @deprecated To be removed in 4.0 (see MATH-1166).
- */
-@Deprecated
-public class SmoothingPolynomialBicubicSplineInterpolator
-    extends BicubicSplineInterpolator {
-    /** Fitter for x. */
-    private final PolynomialFitter xFitter;
-    /** Degree of the fitting polynomial. */
-    private final int xDegree;
-    /** Fitter for y. */
-    private final PolynomialFitter yFitter;
-    /** Degree of the fitting polynomial. */
-    private final int yDegree;
-
-    /**
-     * Default constructor. The degree of the fitting polynomials is set to 3.
-     */
-    public SmoothingPolynomialBicubicSplineInterpolator() {
-        this(3);
-    }
-
-    /**
-     * @param degree Degree of the polynomial fitting functions.
-     * @exception NotPositiveException if degree is not positive
-     */
-    public SmoothingPolynomialBicubicSplineInterpolator(int degree)
-        throws NotPositiveException {
-        this(degree, degree);
-    }
-
-    /**
-     * @param xDegree Degree of the polynomial fitting functions along the
-     * x-dimension.
-     * @param yDegree Degree of the polynomial fitting functions along the
-     * y-dimension.
-     * @exception NotPositiveException if degrees are not positive
-     */
-    public SmoothingPolynomialBicubicSplineInterpolator(int xDegree, int yDegree)
-        throws NotPositiveException {
-        if (xDegree < 0) {
-            throw new NotPositiveException(xDegree);
-        }
-        if (yDegree < 0) {
-            throw new NotPositiveException(yDegree);
-        }
-        this.xDegree = xDegree;
-        this.yDegree = yDegree;
-
-        final double safeFactor = 1e2;
-        final SimpleVectorValueChecker checker
-            = new SimpleVectorValueChecker(safeFactor * Precision.EPSILON,
-                                           safeFactor * Precision.SAFE_MIN);
-        xFitter = new PolynomialFitter(new GaussNewtonOptimizer(false, checker));
-        yFitter = new PolynomialFitter(new GaussNewtonOptimizer(false, checker));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public BicubicSplineInterpolatingFunction interpolate(final double[] xval,
-                                                          final double[] yval,
-                                                          final double[][] fval)
-        throws NoDataException, NullArgumentException,
-               DimensionMismatchException, NonMonotonicSequenceException {
-        if (xval.length == 0 || yval.length == 0 || fval.length == 0) {
-            throw new NoDataException();
-        }
-        if (xval.length != fval.length) {
-            throw new DimensionMismatchException(xval.length, fval.length);
-        }
-
-        final int xLen = xval.length;
-        final int yLen = yval.length;
-
-        for (int i = 0; i < xLen; i++) {
-            if (fval[i].length != yLen) {
-                throw new DimensionMismatchException(fval[i].length, yLen);
-            }
-        }
-
-        MathArrays.checkOrder(xval);
-        MathArrays.checkOrder(yval);
-
-        // For each line y[j] (0 <= j < yLen), construct a polynomial, with
-        // respect to variable x, fitting array fval[][j]
-        final PolynomialFunction[] yPolyX = new PolynomialFunction[yLen];
-        for (int j = 0; j < yLen; j++) {
-            xFitter.clearObservations();
-            for (int i = 0; i < xLen; i++) {
-                xFitter.addObservedPoint(1, xval[i], fval[i][j]);
-            }
-
-            // Initial guess for the fit is zero for each coefficients (of which
-            // there are "xDegree" + 1).
-            yPolyX[j] = new PolynomialFunction(xFitter.fit(new double[xDegree + 1]));
-        }
-
-        // For every knot (xval[i], yval[j]) of the grid, calculate corrected
-        // values fval_1
-        final double[][] fval_1 = new double[xLen][yLen];
-        for (int j = 0; j < yLen; j++) {
-            final PolynomialFunction f = yPolyX[j];
-            for (int i = 0; i < xLen; i++) {
-                fval_1[i][j] = f.value(xval[i]);
-            }
-        }
-
-        // For each line x[i] (0 <= i < xLen), construct a polynomial, with
-        // respect to variable y, fitting array fval_1[i][]
-        final PolynomialFunction[] xPolyY = new PolynomialFunction[xLen];
-        for (int i = 0; i < xLen; i++) {
-            yFitter.clearObservations();
-            for (int j = 0; j < yLen; j++) {
-                yFitter.addObservedPoint(1, yval[j], fval_1[i][j]);
-            }
-
-            // Initial guess for the fit is zero for each coefficients (of which
-            // there are "yDegree" + 1).
-            xPolyY[i] = new PolynomialFunction(yFitter.fit(new double[yDegree + 1]));
-        }
-
-        // For every knot (xval[i], yval[j]) of the grid, calculate corrected
-        // values fval_2
-        final double[][] fval_2 = new double[xLen][yLen];
-        for (int i = 0; i < xLen; i++) {
-            final PolynomialFunction f = xPolyY[i];
-            for (int j = 0; j < yLen; j++) {
-                fval_2[i][j] = f.value(yval[j]);
-            }
-        }
-
-        return super.interpolate(xval, yval, fval_2);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java
deleted file mode 100644
index a9ca862..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/SplineInterpolator.java
+++ /dev/null
@@ -1,127 +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.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Computes a natural (also known as "free", "unclamped") cubic spline interpolation for the data set.
- * <p>
- * The {@link #interpolate(double[], double[])} method returns a {@link PolynomialSplineFunction}
- * consisting of n cubic polynomials, defined over the subintervals determined by the x values,
- * x[0] < x[i] ... < x[n].  The x values are referred to as "knot points."</p>
- * <p>
- * The value of the PolynomialSplineFunction at a point x that is greater than or equal to the smallest
- * knot point and strictly less than the largest knot point is computed by finding the subinterval to which
- * x belongs and computing the value of the corresponding polynomial at <code>x - x[i] </code> where
- * <code>i</code> is the index of the subinterval.  See {@link PolynomialSplineFunction} for more details.
- * </p>
- * <p>
- * The interpolating polynomials satisfy: <ol>
- * <li>The value of the PolynomialSplineFunction at each of the input x values equals the
- *  corresponding y value.</li>
- * <li>Adjacent polynomials are equal through two derivatives at the knot points (i.e., adjacent polynomials
- *  "match up" at the knot points, as do their first and second derivatives).</li>
- * </ol></p>
- * <p>
- * The cubic spline interpolation algorithm implemented is as described in R.L. Burden, J.D. Faires,
- * <u>Numerical Analysis</u>, 4th Ed., 1989, PWS-Kent, ISBN 0-53491-585-X, pp 126-131.
- * </p>
- *
- */
-public class SplineInterpolator implements UnivariateInterpolator {
-    /**
-     * Computes an interpolating function for the data set.
-     * @param x the arguments for the interpolation points
-     * @param y the values for the interpolation points
-     * @return a function which interpolates the data set
-     * @throws DimensionMismatchException if {@code x} and {@code y}
-     * have different sizes.
-     * @throws NonMonotonicSequenceException if {@code x} is not sorted in
-     * strict increasing order.
-     * @throws NumberIsTooSmallException if the size of {@code x} is smaller
-     * than 3.
-     */
-    public PolynomialSplineFunction interpolate(double x[], double y[])
-        throws DimensionMismatchException,
-               NumberIsTooSmallException,
-               NonMonotonicSequenceException {
-        if (x.length != y.length) {
-            throw new DimensionMismatchException(x.length, y.length);
-        }
-
-        if (x.length < 3) {
-            throw new NumberIsTooSmallException(LocalizedFormats.NUMBER_OF_POINTS,
-                                                x.length, 3, true);
-        }
-
-        // Number of intervals.  The number of data points is n + 1.
-        final int n = x.length - 1;
-
-        MathArrays.checkOrder(x);
-
-        // Differences between knot points
-        final double h[] = new double[n];
-        for (int i = 0; i < n; i++) {
-            h[i] = x[i + 1] - x[i];
-        }
-
-        final double mu[] = new double[n];
-        final double z[] = new double[n + 1];
-        mu[0] = 0d;
-        z[0] = 0d;
-        double g = 0;
-        for (int i = 1; i < n; i++) {
-            g = 2d * (x[i+1]  - x[i - 1]) - h[i - 1] * mu[i -1];
-            mu[i] = h[i] / g;
-            z[i] = (3d * (y[i + 1] * h[i - 1] - y[i] * (x[i + 1] - x[i - 1])+ y[i - 1] * h[i]) /
-                    (h[i - 1] * h[i]) - h[i - 1] * z[i - 1]) / g;
-        }
-
-        // cubic spline coefficients --  b is linear, c quadratic, d is cubic (original y's are constants)
-        final double b[] = new double[n];
-        final double c[] = new double[n + 1];
-        final double d[] = new double[n];
-
-        z[n] = 0d;
-        c[n] = 0d;
-
-        for (int j = n -1; j >=0; j--) {
-            c[j] = z[j] - mu[j] * c[j + 1];
-            b[j] = (y[j + 1] - y[j]) / h[j] - h[j] * (c[j + 1] + 2d * c[j]) / 3d;
-            d[j] = (c[j + 1] - c[j]) / (3d * h[j]);
-        }
-
-        final PolynomialFunction polynomials[] = new PolynomialFunction[n];
-        final double coefficients[] = new double[4];
-        for (int i = 0; i < n; i++) {
-            coefficients[0] = y[i];
-            coefficients[1] = b[i];
-            coefficients[2] = c[i];
-            coefficients[3] = d[i];
-            polynomials[i] = new PolynomialFunction(coefficients);
-        }
-
-        return new PolynomialSplineFunction(x, polynomials);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunction.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunction.java
deleted file mode 100644
index 9344d89..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolatingFunction.java
+++ /dev/null
@@ -1,508 +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.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.TrivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Function that implements the
- * <a href="http://en.wikipedia.org/wiki/Tricubic_interpolation">
- * tricubic spline interpolation</a>, as proposed in
- * <blockquote>
- *  Tricubic interpolation in three dimensions<br>
- *  F. Lekien and J. Marsden<br>
- *  <em>Int. J. Numer. Meth. Eng</em> 2005; <b>63</b>:455-471<br>
- * </blockquote>
- *
- * @since 3.4.
- */
-public class TricubicInterpolatingFunction
-    implements TrivariateFunction {
-    /**
-     * Matrix to compute the spline coefficients from the function values
-     * and function derivatives values
-     */
-    private static final double[][] AINV = {
-        { 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -3,3,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 2,-2,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 9,-9,-9,9,0,0,0,0,6,3,-6,-3,0,0,0,0,6,-6,3,-3,0,0,0,0,0,0,0,0,0,0,0,0,4,2,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,6,-6,0,0,0,0,-3,-3,3,3,0,0,0,0,-4,4,-2,2,0,0,0,0,0,0,0,0,0,0,0,0,-2,-2,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,6,-6,0,0,0,0,-4,-2,4,2,0,0,0,0,-3,3,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 4,-4,-4,4,0,0,0,0,2,2,-2,-2,0,0,0,0,2,-2,2,-2,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,0,0,0,0,-2,-1,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,0,0,0,0,1,1,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,-9,-9,9,0,0,0,0,0,0,0,0,0,0,0,0,6,3,-6,-3,0,0,0,0,6,-6,3,-3,0,0,0,0,4,2,2,1,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,6,-6,0,0,0,0,0,0,0,0,0,0,0,0,-3,-3,3,3,0,0,0,0,-4,4,-2,2,0,0,0,0,-2,-2,-1,-1,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,6,-6,0,0,0,0,0,0,0,0,0,0,0,0,-4,-2,4,2,0,0,0,0,-3,3,-3,3,0,0,0,0,-2,-1,-2,-1,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,-4,-4,4,0,0,0,0,0,0,0,0,0,0,0,0,2,2,-2,-2,0,0,0,0,2,-2,2,-2,0,0,0,0,1,1,1,1,0,0,0,0 },
-        {-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 9,-9,0,0,-9,9,0,0,6,3,0,0,-6,-3,0,0,0,0,0,0,0,0,0,0,6,-6,0,0,3,-3,0,0,0,0,0,0,0,0,0,0,4,2,0,0,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,0,0,6,-6,0,0,-3,-3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,-4,4,0,0,-2,2,0,0,0,0,0,0,0,0,0,0,-2,-2,0,0,-1,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,0,0,-1,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,-9,0,0,-9,9,0,0,0,0,0,0,0,0,0,0,6,3,0,0,-6,-3,0,0,0,0,0,0,0,0,0,0,6,-6,0,0,3,-3,0,0,4,2,0,0,2,1,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,0,0,6,-6,0,0,0,0,0,0,0,0,0,0,-3,-3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,-4,4,0,0,-2,2,0,0,-2,-2,0,0,-1,-1,0,0 },
-        { 9,0,-9,0,-9,0,9,0,0,0,0,0,0,0,0,0,6,0,3,0,-6,0,-3,0,6,0,-6,0,3,0,-3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,2,0,2,0,1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,9,0,-9,0,-9,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,3,0,-6,0,-3,0,6,0,-6,0,3,0,-3,0,0,0,0,0,0,0,0,0,4,0,2,0,2,0,1,0 },
-        { -27,27,27,-27,27,-27,-27,27,-18,-9,18,9,18,9,-18,-9,-18,18,-9,9,18,-18,9,-9,-18,18,18,-18,-9,9,9,-9,-12,-6,-6,-3,12,6,6,3,-12,-6,12,6,-6,-3,6,3,-12,12,-6,6,-6,6,-3,3,-8,-4,-4,-2,-4,-2,-2,-1 },
-        { 18,-18,-18,18,-18,18,18,-18,9,9,-9,-9,-9,-9,9,9,12,-12,6,-6,-12,12,-6,6,12,-12,-12,12,6,-6,-6,6,6,6,3,3,-6,-6,-3,-3,6,6,-6,-6,3,3,-3,-3,8,-8,4,-4,4,-4,2,-2,4,4,2,2,2,2,1,1 },
-        { -6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,-3,0,-3,0,3,0,3,0,-4,0,4,0,-2,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-2,0,-1,0,-1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-3,0,-3,0,3,0,3,0,-4,0,4,0,-2,0,2,0,0,0,0,0,0,0,0,0,-2,0,-2,0,-1,0,-1,0 },
-        { 18,-18,-18,18,-18,18,18,-18,12,6,-12,-6,-12,-6,12,6,9,-9,9,-9,-9,9,-9,9,12,-12,-12,12,6,-6,-6,6,6,3,6,3,-6,-3,-6,-3,8,4,-8,-4,4,2,-4,-2,6,-6,6,-6,3,-3,3,-3,4,2,4,2,2,1,2,1 },
-        { -12,12,12,-12,12,-12,-12,12,-6,-6,6,6,6,6,-6,-6,-6,6,-6,6,6,-6,6,-6,-8,8,8,-8,-4,4,4,-4,-3,-3,-3,-3,3,3,3,3,-4,-4,4,4,-2,-2,2,2,-4,4,-4,4,-2,2,-2,2,-2,-2,-2,-2,-1,-1,-1,-1 },
-        { 2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { -6,6,0,0,6,-6,0,0,-4,-2,0,0,4,2,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,-3,3,0,0,0,0,0,0,0,0,0,0,-2,-1,0,0,-2,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 4,-4,0,0,-4,4,0,0,2,2,0,0,-2,-2,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,2,-2,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-6,6,0,0,6,-6,0,0,0,0,0,0,0,0,0,0,-4,-2,0,0,4,2,0,0,0,0,0,0,0,0,0,0,-3,3,0,0,-3,3,0,0,-2,-1,0,0,-2,-1,0,0 },
-        { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,-4,0,0,-4,4,0,0,0,0,0,0,0,0,0,0,2,2,0,0,-2,-2,0,0,0,0,0,0,0,0,0,0,2,-2,0,0,2,-2,0,0,1,1,0,0,1,1,0,0 },
-        { -6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,-4,0,-2,0,4,0,2,0,-3,0,3,0,-3,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,0,-1,0,-2,0,-1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,-6,0,6,0,6,0,-6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-4,0,-2,0,4,0,2,0,-3,0,3,0,-3,0,3,0,0,0,0,0,0,0,0,0,-2,0,-1,0,-2,0,-1,0 },
-        { 18,-18,-18,18,-18,18,18,-18,12,6,-12,-6,-12,-6,12,6,12,-12,6,-6,-12,12,-6,6,9,-9,-9,9,9,-9,-9,9,8,4,4,2,-8,-4,-4,-2,6,3,-6,-3,6,3,-6,-3,6,-6,3,-3,6,-6,3,-3,4,2,2,1,4,2,2,1 },
-        { -12,12,12,-12,12,-12,-12,12,-6,-6,6,6,6,6,-6,-6,-8,8,-4,4,8,-8,4,-4,-6,6,6,-6,-6,6,6,-6,-4,-4,-2,-2,4,4,2,2,-3,-3,3,3,-3,-3,3,3,-4,4,-2,2,-4,4,-2,2,-2,-2,-1,-1,-2,-2,-1,-1 },
-        { 4,0,-4,0,-4,0,4,0,0,0,0,0,0,0,0,0,2,0,2,0,-2,0,-2,0,2,0,-2,0,2,0,-2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0 },
-        { 0,0,0,0,0,0,0,0,4,0,-4,0,-4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,2,0,-2,0,-2,0,2,0,-2,0,2,0,-2,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,0 },
-        { -12,12,12,-12,12,-12,-12,12,-8,-4,8,4,8,4,-8,-4,-6,6,-6,6,6,-6,6,-6,-6,6,6,-6,-6,6,6,-6,-4,-2,-4,-2,4,2,4,2,-4,-2,4,2,-4,-2,4,2,-3,3,-3,3,-3,3,-3,3,-2,-1,-2,-1,-2,-1,-2,-1 },
-        { 8,-8,-8,8,-8,8,8,-8,4,4,-4,-4,-4,-4,4,4,4,-4,4,-4,-4,4,-4,4,4,-4,-4,4,4,-4,-4,4,2,2,2,2,-2,-2,-2,-2,2,2,-2,-2,2,2,-2,-2,2,-2,2,-2,2,-2,2,-2,1,1,1,1,1,1,1,1 }
-    };
-
-    /** Samples x-coordinates */
-    private final double[] xval;
-    /** Samples y-coordinates */
-    private final double[] yval;
-    /** Samples z-coordinates */
-    private final double[] zval;
-    /** Set of cubic splines pacthing the whole data grid */
-    private final TricubicFunction[][][] splines;
-
-    /**
-     * @param x Sample values of the x-coordinate, in increasing order.
-     * @param y Sample values of the y-coordinate, in increasing order.
-     * @param z Sample values of the y-coordinate, in increasing order.
-     * @param f Values of the function on every grid point.
-     * @param dFdX Values of the partial derivative of function with respect to x on every grid point.
-     * @param dFdY Values of the partial derivative of function with respect to y on every grid point.
-     * @param dFdZ Values of the partial derivative of function with respect to z on every grid point.
-     * @param d2FdXdY Values of the cross partial derivative of function on every grid point.
-     * @param d2FdXdZ Values of the cross partial derivative of function on every grid point.
-     * @param d2FdYdZ Values of the cross partial derivative of function on every grid point.
-     * @param d3FdXdYdZ Values of the cross partial derivative of function on every grid point.
-     * @throws NoDataException if any of the arrays has zero length.
-     * @throws DimensionMismatchException if the various arrays do not contain the expected number of elements.
-     * @throws NonMonotonicSequenceException if {@code x}, {@code y} or {@code z} are not strictly increasing.
-     */
-    public TricubicInterpolatingFunction(double[] x,
-                                         double[] y,
-                                         double[] z,
-                                         double[][][] f,
-                                         double[][][] dFdX,
-                                         double[][][] dFdY,
-                                         double[][][] dFdZ,
-                                         double[][][] d2FdXdY,
-                                         double[][][] d2FdXdZ,
-                                         double[][][] d2FdYdZ,
-                                         double[][][] d3FdXdYdZ)
-        throws NoDataException,
-               DimensionMismatchException,
-               NonMonotonicSequenceException {
-        final int xLen = x.length;
-        final int yLen = y.length;
-        final int zLen = z.length;
-
-        if (xLen == 0 || yLen == 0 || z.length == 0 || f.length == 0 || f[0].length == 0) {
-            throw new NoDataException();
-        }
-        if (xLen != f.length) {
-            throw new DimensionMismatchException(xLen, f.length);
-        }
-        if (xLen != dFdX.length) {
-            throw new DimensionMismatchException(xLen, dFdX.length);
-        }
-        if (xLen != dFdY.length) {
-            throw new DimensionMismatchException(xLen, dFdY.length);
-        }
-        if (xLen != dFdZ.length) {
-            throw new DimensionMismatchException(xLen, dFdZ.length);
-        }
-        if (xLen != d2FdXdY.length) {
-            throw new DimensionMismatchException(xLen, d2FdXdY.length);
-        }
-        if (xLen != d2FdXdZ.length) {
-            throw new DimensionMismatchException(xLen, d2FdXdZ.length);
-        }
-        if (xLen != d2FdYdZ.length) {
-            throw new DimensionMismatchException(xLen, d2FdYdZ.length);
-        }
-        if (xLen != d3FdXdYdZ.length) {
-            throw new DimensionMismatchException(xLen, d3FdXdYdZ.length);
-        }
-
-        MathArrays.checkOrder(x);
-        MathArrays.checkOrder(y);
-        MathArrays.checkOrder(z);
-
-        xval = x.clone();
-        yval = y.clone();
-        zval = z.clone();
-
-        final int lastI = xLen - 1;
-        final int lastJ = yLen - 1;
-        final int lastK = zLen - 1;
-        splines = new TricubicFunction[lastI][lastJ][lastK];
-
-        for (int i = 0; i < lastI; i++) {
-            if (f[i].length != yLen) {
-                throw new DimensionMismatchException(f[i].length, yLen);
-            }
-            if (dFdX[i].length != yLen) {
-                throw new DimensionMismatchException(dFdX[i].length, yLen);
-            }
-            if (dFdY[i].length != yLen) {
-                throw new DimensionMismatchException(dFdY[i].length, yLen);
-            }
-            if (dFdZ[i].length != yLen) {
-                throw new DimensionMismatchException(dFdZ[i].length, yLen);
-            }
-            if (d2FdXdY[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdXdY[i].length, yLen);
-            }
-            if (d2FdXdZ[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdXdZ[i].length, yLen);
-            }
-            if (d2FdYdZ[i].length != yLen) {
-                throw new DimensionMismatchException(d2FdYdZ[i].length, yLen);
-            }
-            if (d3FdXdYdZ[i].length != yLen) {
-                throw new DimensionMismatchException(d3FdXdYdZ[i].length, yLen);
-            }
-
-            final int ip1 = i + 1;
-            final double xR = xval[ip1] - xval[i];
-            for (int j = 0; j < lastJ; j++) {
-                if (f[i][j].length != zLen) {
-                    throw new DimensionMismatchException(f[i][j].length, zLen);
-                }
-                if (dFdX[i][j].length != zLen) {
-                    throw new DimensionMismatchException(dFdX[i][j].length, zLen);
-                }
-                if (dFdY[i][j].length != zLen) {
-                    throw new DimensionMismatchException(dFdY[i][j].length, zLen);
-                }
-                if (dFdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(dFdZ[i][j].length, zLen);
-                }
-                if (d2FdXdY[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d2FdXdY[i][j].length, zLen);
-                }
-                if (d2FdXdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d2FdXdZ[i][j].length, zLen);
-                }
-                if (d2FdYdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d2FdYdZ[i][j].length, zLen);
-                }
-                if (d3FdXdYdZ[i][j].length != zLen) {
-                    throw new DimensionMismatchException(d3FdXdYdZ[i][j].length, zLen);
-                }
-
-                final int jp1 = j + 1;
-                final double yR = yval[jp1] - yval[j];
-                final double xRyR = xR * yR;
-                for (int k = 0; k < lastK; k++) {
-                    final int kp1 = k + 1;
-                    final double zR = zval[kp1] - zval[k];
-                    final double xRzR = xR * zR;
-                    final double yRzR = yR * zR;
-                    final double xRyRzR = xR * yRzR;
-
-                    final double[] beta = new double[] {
-                        f[i][j][k], f[ip1][j][k],
-                        f[i][jp1][k], f[ip1][jp1][k],
-                        f[i][j][kp1], f[ip1][j][kp1],
-                        f[i][jp1][kp1], f[ip1][jp1][kp1],
-
-                        dFdX[i][j][k] * xR, dFdX[ip1][j][k] * xR,
-                        dFdX[i][jp1][k] * xR, dFdX[ip1][jp1][k] * xR,
-                        dFdX[i][j][kp1] * xR, dFdX[ip1][j][kp1] * xR,
-                        dFdX[i][jp1][kp1] * xR, dFdX[ip1][jp1][kp1] * xR,
-
-                        dFdY[i][j][k] * yR, dFdY[ip1][j][k] * yR,
-                        dFdY[i][jp1][k] * yR, dFdY[ip1][jp1][k] * yR,
-                        dFdY[i][j][kp1] * yR, dFdY[ip1][j][kp1] * yR,
-                        dFdY[i][jp1][kp1] * yR, dFdY[ip1][jp1][kp1] * yR,
-
-                        dFdZ[i][j][k] * zR, dFdZ[ip1][j][k] * zR,
-                        dFdZ[i][jp1][k] * zR, dFdZ[ip1][jp1][k] * zR,
-                        dFdZ[i][j][kp1] * zR, dFdZ[ip1][j][kp1] * zR,
-                        dFdZ[i][jp1][kp1] * zR, dFdZ[ip1][jp1][kp1] * zR,
-
-                        d2FdXdY[i][j][k] * xRyR, d2FdXdY[ip1][j][k] * xRyR,
-                        d2FdXdY[i][jp1][k] * xRyR, d2FdXdY[ip1][jp1][k] * xRyR,
-                        d2FdXdY[i][j][kp1] * xRyR, d2FdXdY[ip1][j][kp1] * xRyR,
-                        d2FdXdY[i][jp1][kp1] * xRyR, d2FdXdY[ip1][jp1][kp1] * xRyR,
-
-                        d2FdXdZ[i][j][k] * xRzR, d2FdXdZ[ip1][j][k] * xRzR,
-                        d2FdXdZ[i][jp1][k] * xRzR, d2FdXdZ[ip1][jp1][k] * xRzR,
-                        d2FdXdZ[i][j][kp1] * xRzR, d2FdXdZ[ip1][j][kp1] * xRzR,
-                        d2FdXdZ[i][jp1][kp1] * xRzR, d2FdXdZ[ip1][jp1][kp1] * xRzR,
-
-                        d2FdYdZ[i][j][k] * yRzR, d2FdYdZ[ip1][j][k] * yRzR,
-                        d2FdYdZ[i][jp1][k] * yRzR, d2FdYdZ[ip1][jp1][k] * yRzR,
-                        d2FdYdZ[i][j][kp1] * yRzR, d2FdYdZ[ip1][j][kp1] * yRzR,
-                        d2FdYdZ[i][jp1][kp1] * yRzR, d2FdYdZ[ip1][jp1][kp1] * yRzR,
-
-                        d3FdXdYdZ[i][j][k] * xRyRzR, d3FdXdYdZ[ip1][j][k] * xRyRzR,
-                        d3FdXdYdZ[i][jp1][k] * xRyRzR, d3FdXdYdZ[ip1][jp1][k] * xRyRzR,
-                        d3FdXdYdZ[i][j][kp1] * xRyRzR, d3FdXdYdZ[ip1][j][kp1] * xRyRzR,
-                        d3FdXdYdZ[i][jp1][kp1] * xRyRzR, d3FdXdYdZ[ip1][jp1][kp1] * xRyRzR,
-                    };
-
-                    splines[i][j][k] = new TricubicFunction(computeCoefficients(beta));
-                }
-            }
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws OutOfRangeException if any of the variables is outside its interpolation range.
-     */
-    public double value(double x, double y, double z)
-        throws OutOfRangeException {
-        final int i = searchIndex(x, xval);
-        if (i == -1) {
-            throw new OutOfRangeException(x, xval[0], xval[xval.length - 1]);
-        }
-        final int j = searchIndex(y, yval);
-        if (j == -1) {
-            throw new OutOfRangeException(y, yval[0], yval[yval.length - 1]);
-        }
-        final int k = searchIndex(z, zval);
-        if (k == -1) {
-            throw new OutOfRangeException(z, zval[0], zval[zval.length - 1]);
-        }
-
-        final double xN = (x - xval[i]) / (xval[i + 1] - xval[i]);
-        final double yN = (y - yval[j]) / (yval[j + 1] - yval[j]);
-        final double zN = (z - zval[k]) / (zval[k + 1] - zval[k]);
-
-        return splines[i][j][k].value(xN, yN, zN);
-    }
-
-    /**
-     * Indicates whether a point is within the interpolation range.
-     *
-     * @param x First coordinate.
-     * @param y Second coordinate.
-     * @param z Third coordinate.
-     * @return {@code true} if (x, y, z) is a valid point.
-     */
-    public boolean isValidPoint(double x, double y, double z) {
-        if (x < xval[0] ||
-            x > xval[xval.length - 1] ||
-            y < yval[0] ||
-            y > yval[yval.length - 1] ||
-            z < zval[0] ||
-            z > zval[zval.length - 1]) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    /**
-     * @param c Coordinate.
-     * @param val Coordinate samples.
-     * @return the index in {@code val} corresponding to the interval containing {@code c}, or {@code -1}
-     *   if {@code c} is out of the range defined by the end values of {@code val}.
-     */
-    private int searchIndex(double c, double[] val) {
-        if (c < val[0]) {
-            return -1;
-        }
-
-        final int max = val.length;
-        for (int i = 1; i < max; i++) {
-            if (c <= val[i]) {
-                return i - 1;
-            }
-        }
-
-        return -1;
-    }
-
-    /**
-     * Compute the spline coefficients from the list of function values and
-     * function partial derivatives values at the four corners of a grid
-     * element. They must be specified in the following order:
-     * <ul>
-     *  <li>f(0,0,0)</li>
-     *  <li>f(1,0,0)</li>
-     *  <li>f(0,1,0)</li>
-     *  <li>f(1,1,0)</li>
-     *  <li>f(0,0,1)</li>
-     *  <li>f(1,0,1)</li>
-     *  <li>f(0,1,1)</li>
-     *  <li>f(1,1,1)</li>
-     *
-     *  <li>f<sub>x</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>x</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>y</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>y</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>z</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>z</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>xy</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>xy</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>xz</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>xz</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>yz</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>yz</sub>(1,1,1)</li>
-     *
-     *  <li>f<sub>xyz</sub>(0,0,0)</li>
-     *  <li>... <em>(same order as above)</em></li>
-     *  <li>f<sub>xyz</sub>(1,1,1)</li>
-     * </ul>
-     * where the subscripts indicate the partial derivative with respect to
-     * the corresponding variable(s).
-     *
-     * @param beta List of function values and function partial derivatives values.
-     * @return the spline coefficients.
-     */
-    private double[] computeCoefficients(double[] beta) {
-        final int sz = 64;
-        final double[] a = new double[sz];
-
-        for (int i = 0; i < sz; i++) {
-            double result = 0;
-            final double[] row = AINV[i];
-            for (int j = 0; j < sz; j++) {
-                result += row[j] * beta[j];
-            }
-            a[i] = result;
-        }
-
-        return a;
-    }
-}
-
-/**
- * 3D-spline function.
- *
- */
-class TricubicFunction
-    implements TrivariateFunction {
-    /** Number of points. */
-    private static final short N = 4;
-    /** Coefficients */
-    private final double[][][] a = new double[N][N][N];
-
-    /**
-     * @param aV List of spline coefficients.
-     */
-    public TricubicFunction(double[] aV) {
-        for (int i = 0; i < N; i++) {
-            for (int j = 0; j < N; j++) {
-                for (int k = 0; k < N; k++) {
-                    a[i][j][k] = aV[i + N * (j + N * k)];
-                }
-            }
-        }
-    }
-
-    /**
-     * @param x x-coordinate of the interpolation point.
-     * @param y y-coordinate of the interpolation point.
-     * @param z z-coordinate of the interpolation point.
-     * @return the interpolated value.
-     * @throws OutOfRangeException if {@code x}, {@code y} or
-     * {@code z} are not in the interval {@code [0, 1]}.
-     */
-    public double value(double x, double y, double z)
-        throws OutOfRangeException {
-        if (x < 0 || x > 1) {
-            throw new OutOfRangeException(x, 0, 1);
-        }
-        if (y < 0 || y > 1) {
-            throw new OutOfRangeException(y, 0, 1);
-        }
-        if (z < 0 || z > 1) {
-            throw new OutOfRangeException(z, 0, 1);
-        }
-
-        final double x2 = x * x;
-        final double x3 = x2 * x;
-        final double[] pX = { 1, x, x2, x3 };
-
-        final double y2 = y * y;
-        final double y3 = y2 * y;
-        final double[] pY = { 1, y, y2, y3 };
-
-        final double z2 = z * z;
-        final double z3 = z2 * z;
-        final double[] pZ = { 1, z, z2, z3 };
-
-        double result = 0;
-        for (int i = 0; i < N; i++) {
-            for (int j = 0; j < N; j++) {
-                for (int k = 0; k < N; k++) {
-                    result += a[i][j][k] * pX[i] * pY[j] * pZ[k];
-                }
-            }
-        }
-
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolator.java b/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolator.java
deleted file mode 100644
index 531e736..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/interpolation/TricubicInterpolator.java
+++ /dev/null
@@ -1,142 +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.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Generates a tricubic interpolating function.
- *
- * @since 3.4
- */
-public class TricubicInterpolator
-    implements TrivariateGridInterpolator {
-    /**
-     * {@inheritDoc}
-     */
-    public TricubicInterpolatingFunction interpolate(final double[] xval,
-                                                     final double[] yval,
-                                                     final double[] zval,
-                                                     final double[][][] fval)
-        throws NoDataException, NumberIsTooSmallException,
-               DimensionMismatchException, NonMonotonicSequenceException {
-        if (xval.length == 0 || yval.length == 0 || zval.length == 0 || fval.length == 0) {
-            throw new NoDataException();
-        }
-        if (xval.length != fval.length) {
-            throw new DimensionMismatchException(xval.length, fval.length);
-        }
-
-        MathArrays.checkOrder(xval);
-        MathArrays.checkOrder(yval);
-        MathArrays.checkOrder(zval);
-
-        final int xLen = xval.length;
-        final int yLen = yval.length;
-        final int zLen = zval.length;
-
-        // Approximation to the partial derivatives using finite differences.
-        final double[][][] dFdX = new double[xLen][yLen][zLen];
-        final double[][][] dFdY = new double[xLen][yLen][zLen];
-        final double[][][] dFdZ = new double[xLen][yLen][zLen];
-        final double[][][] d2FdXdY = new double[xLen][yLen][zLen];
-        final double[][][] d2FdXdZ = new double[xLen][yLen][zLen];
-        final double[][][] d2FdYdZ = new double[xLen][yLen][zLen];
-        final double[][][] d3FdXdYdZ = new double[xLen][yLen][zLen];
-
-        for (int i = 1; i < xLen - 1; i++) {
-            if (yval.length != fval[i].length) {
-                throw new DimensionMismatchException(yval.length, fval[i].length);
-            }
-
-            final int nI = i + 1;
-            final int pI = i - 1;
-
-            final double nX = xval[nI];
-            final double pX = xval[pI];
-
-            final double deltaX = nX - pX;
-
-            for (int j = 1; j < yLen - 1; j++) {
-                if (zval.length != fval[i][j].length) {
-                    throw new DimensionMismatchException(zval.length, fval[i][j].length);
-                }
-
-                final int nJ = j + 1;
-                final int pJ = j - 1;
-
-                final double nY = yval[nJ];
-                final double pY = yval[pJ];
-
-                final double deltaY = nY - pY;
-                final double deltaXY = deltaX * deltaY;
-
-                for (int k = 1; k < zLen - 1; k++) {
-                    final int nK = k + 1;
-                    final int pK = k - 1;
-
-                    final double nZ = zval[nK];
-                    final double pZ = zval[pK];
-
-                    final double deltaZ = nZ - pZ;
-
-                    dFdX[i][j][k] = (fval[nI][j][k] - fval[pI][j][k]) / deltaX;
-                    dFdY[i][j][k] = (fval[i][nJ][k] - fval[i][pJ][k]) / deltaY;
-                    dFdZ[i][j][k] = (fval[i][j][nK] - fval[i][j][pK]) / deltaZ;
-
-                    final double deltaXZ = deltaX * deltaZ;
-                    final double deltaYZ = deltaY * deltaZ;
-
-                    d2FdXdY[i][j][k] = (fval[nI][nJ][k] - fval[nI][pJ][k] - fval[pI][nJ][k] + fval[pI][pJ][k]) / deltaXY;
-                    d2FdXdZ[i][j][k] = (fval[nI][j][nK] - fval[nI][j][pK] - fval[pI][j][nK] + fval[pI][j][pK]) / deltaXZ;
-                    d2FdYdZ[i][j][k] = (fval[i][nJ][nK] - fval[i][nJ][pK] - fval[i][pJ][nK] + fval[i][pJ][pK]) / deltaYZ;
-
-                    final double deltaXYZ = deltaXY * deltaZ;
-
-                    d3FdXdYdZ[i][j][k] = (fval[nI][nJ][nK] - fval[nI][pJ][nK] -
-                                          fval[pI][nJ][nK] + fval[pI][pJ][nK] -
-                                          fval[nI][nJ][pK] + fval[nI][pJ][pK] +
-                                          fval[pI][nJ][pK] - fval[pI][pJ][pK]) / deltaXYZ;
-                }
-            }
-        }
-
-        // Create the interpolating function.
-        return new TricubicInterpolatingFunction(xval, yval, zval, fval,
-                                                 dFdX, dFdY, dFdZ,
-                                                 d2FdXdY, d2FdXdZ, d2FdYdZ,
-                                                 d3FdXdYdZ) {
-            @Override
-            public boolean isValidPoint(double x, double y, double z) {
-                if (x < xval[1] ||
-                    x > xval[xval.length - 2] ||
-                    y < yval[1] ||
-                    y > yval[yval.length - 2] ||
-                    z < zval[1] ||
-                    z > zval[zval.length - 2]) {
-                    return false;
-                } else {
-                    return true;
-                }
-            }
-        };
-    }
-}


[05/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/BlockRealMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/BlockRealMatrix.java b/src/main/java/org/apache/commons/math3/linear/BlockRealMatrix.java
deleted file mode 100644
index 1ea22b6..0000000
--- a/src/main/java/org/apache/commons/math3/linear/BlockRealMatrix.java
+++ /dev/null
@@ -1,1581 +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.linear;
-
-import java.io.Serializable;
-import java.util.Arrays;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Cache-friendly implementation of RealMatrix using a flat arrays to store
- * square blocks of the matrix.
- * <p>
- * This implementation is specially designed to be cache-friendly. Square blocks are
- * stored as small arrays and allow efficient traversal of data both in row major direction
- * and columns major direction, one block at a time. This greatly increases performances
- * for algorithms that use crossed directions loops like multiplication or transposition.
- * </p>
- * <p>
- * The size of square blocks is a static parameter. It may be tuned according to the cache
- * size of the target computer processor. As a rule of thumbs, it should be the largest
- * value that allows three blocks to be simultaneously cached (this is necessary for example
- * for matrix multiplication). The default value is to use 52x52 blocks which is well suited
- * for processors with 64k L1 cache (one block holds 2704 values or 21632 bytes). This value
- * could be lowered to 36x36 for processors with 32k L1 cache.
- * </p>
- * <p>
- * The regular blocks represent {@link #BLOCK_SIZE} x {@link #BLOCK_SIZE} squares. Blocks
- * at right hand side and bottom side which may be smaller to fit matrix dimensions. The square
- * blocks are flattened in row major order in single dimension arrays which are therefore
- * {@link #BLOCK_SIZE}<sup>2</sup> elements long for regular blocks. The blocks are themselves
- * organized in row major order.
- * </p>
- * <p>
- * As an example, for a block size of 52x52, a 100x60 matrix would be stored in 4 blocks.
- * Block 0 would be a double[2704] array holding the upper left 52x52 square, block 1 would be
- * a double[416] array holding the upper right 52x8 rectangle, block 2 would be a double[2496]
- * array holding the lower left 48x52 rectangle and block 3 would be a double[384] array
- * holding the lower right 48x8 rectangle.
- * </p>
- * <p>
- * The layout complexity overhead versus simple mapping of matrices to java
- * arrays is negligible for small matrices (about 1%). The gain from cache efficiency leads
- * to up to 3-fold improvements for matrices of moderate to large size.
- * </p>
- * @since 2.0
- */
-public class BlockRealMatrix extends AbstractRealMatrix implements Serializable {
-    /** Block size. */
-    public static final int BLOCK_SIZE = 52;
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 4991895511313664478L;
-    /** Blocks of matrix entries. */
-    private final double blocks[][];
-    /** Number of rows of the matrix. */
-    private final int rows;
-    /** Number of columns of the matrix. */
-    private final int columns;
-    /** Number of block rows of the matrix. */
-    private final int blockRows;
-    /** Number of block columns of the matrix. */
-    private final int blockColumns;
-
-    /**
-     * Create a new matrix with the supplied row and column dimensions.
-     *
-     * @param rows  the number of rows in the new matrix
-     * @param columns  the number of columns in the new matrix
-     * @throws NotStrictlyPositiveException if row or column dimension is not
-     * positive.
-     */
-    public BlockRealMatrix(final int rows, final int columns)
-        throws NotStrictlyPositiveException {
-        super(rows, columns);
-        this.rows = rows;
-        this.columns = columns;
-
-        // number of blocks
-        blockRows = (rows + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        // allocate storage blocks, taking care of smaller ones at right and bottom
-        blocks = createBlocksLayout(rows, columns);
-    }
-
-    /**
-     * Create a new dense matrix copying entries from raw layout data.
-     * <p>The input array <em>must</em> already be in raw layout.</p>
-     * <p>Calling this constructor is equivalent to call:
-     * <pre>matrix = new BlockRealMatrix(rawData.length, rawData[0].length,
-     *                                   toBlocksLayout(rawData), false);</pre>
-     * </p>
-     *
-     * @param rawData data for new matrix, in raw layout
-     * @throws DimensionMismatchException if the shape of {@code blockData} is
-     * inconsistent with block layout.
-     * @throws NotStrictlyPositiveException if row or column dimension is not
-     * positive.
-     * @see #BlockRealMatrix(int, int, double[][], boolean)
-     */
-    public BlockRealMatrix(final double[][] rawData)
-        throws DimensionMismatchException, NotStrictlyPositiveException {
-        this(rawData.length, rawData[0].length, toBlocksLayout(rawData), false);
-    }
-
-    /**
-     * Create a new dense matrix copying entries from block layout data.
-     * <p>The input array <em>must</em> already be in blocks layout.</p>
-     *
-     * @param rows Number of rows in the new matrix.
-     * @param columns Number of columns in the new matrix.
-     * @param blockData data for new matrix
-     * @param copyArray Whether the input array will be copied or referenced.
-     * @throws DimensionMismatchException if the shape of {@code blockData} is
-     * inconsistent with block layout.
-     * @throws NotStrictlyPositiveException if row or column dimension is not
-     * positive.
-     * @see #createBlocksLayout(int, int)
-     * @see #toBlocksLayout(double[][])
-     * @see #BlockRealMatrix(double[][])
-     */
-    public BlockRealMatrix(final int rows, final int columns,
-                           final double[][] blockData, final boolean copyArray)
-        throws DimensionMismatchException, NotStrictlyPositiveException {
-        super(rows, columns);
-        this.rows = rows;
-        this.columns = columns;
-
-        // number of blocks
-        blockRows = (rows + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        if (copyArray) {
-            // allocate storage blocks, taking care of smaller ones at right and bottom
-            blocks = new double[blockRows * blockColumns][];
-        } else {
-            // reference existing array
-            blocks = blockData;
-        }
-
-        int index = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock, ++index) {
-                if (blockData[index].length != iHeight * blockWidth(jBlock)) {
-                    throw new DimensionMismatchException(blockData[index].length,
-                                                         iHeight * blockWidth(jBlock));
-                }
-                if (copyArray) {
-                    blocks[index] = blockData[index].clone();
-                }
-            }
-        }
-    }
-
-    /**
-     * Convert a data array from raw layout to blocks layout.
-     * <p>
-     * Raw layout is the straightforward layout where element at row i and
-     * column j is in array element <code>rawData[i][j]</code>. Blocks layout
-     * is the layout used in {@link BlockRealMatrix} instances, where the matrix
-     * is split in square blocks (except at right and bottom side where blocks may
-     * be rectangular to fit matrix size) and each block is stored in a flattened
-     * one-dimensional array.
-     * </p>
-     * <p>
-     * This method creates an array in blocks layout from an input array in raw layout.
-     * It can be used to provide the array argument of the {@link
-     * #BlockRealMatrix(int, int, double[][], boolean)} constructor.
-     * </p>
-     * @param rawData Data array in raw layout.
-     * @return a new data array containing the same entries but in blocks layout.
-     * @throws DimensionMismatchException if {@code rawData} is not rectangular.
-     * @see #createBlocksLayout(int, int)
-     * @see #BlockRealMatrix(int, int, double[][], boolean)
-     */
-    public static double[][] toBlocksLayout(final double[][] rawData)
-        throws DimensionMismatchException {
-        final int rows = rawData.length;
-        final int columns = rawData[0].length;
-        final int blockRows = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        // safety checks
-        for (int i = 0; i < rawData.length; ++i) {
-            final int length = rawData[i].length;
-            if (length != columns) {
-                throw new DimensionMismatchException(columns, length);
-            }
-        }
-
-        // convert array
-        final double[][] blocks = new double[blockRows * blockColumns][];
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            final int iHeight = pEnd - pStart;
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final int jWidth = qEnd - qStart;
-
-                // allocate new block
-                final double[] block = new double[iHeight * jWidth];
-                blocks[blockIndex] = block;
-
-                // copy data
-                int index = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    System.arraycopy(rawData[p], qStart, block, index, jWidth);
-                    index += jWidth;
-                }
-                ++blockIndex;
-            }
-        }
-
-        return blocks;
-    }
-
-    /**
-     * Create a data array in blocks layout.
-     * <p>
-     * This method can be used to create the array argument of the {@link
-     * #BlockRealMatrix(int, int, double[][], boolean)} constructor.
-     * </p>
-     * @param rows Number of rows in the new matrix.
-     * @param columns Number of columns in the new matrix.
-     * @return a new data array in blocks layout.
-     * @see #toBlocksLayout(double[][])
-     * @see #BlockRealMatrix(int, int, double[][], boolean)
-     */
-    public static double[][] createBlocksLayout(final int rows, final int columns) {
-        final int blockRows = (rows    + BLOCK_SIZE - 1) / BLOCK_SIZE;
-        final int blockColumns = (columns + BLOCK_SIZE - 1) / BLOCK_SIZE;
-
-        final double[][] blocks = new double[blockRows * blockColumns][];
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            final int iHeight = pEnd - pStart;
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final int jWidth = qEnd - qStart;
-                blocks[blockIndex] = new double[iHeight * jWidth];
-                ++blockIndex;
-            }
-        }
-
-        return blocks;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix createMatrix(final int rowDimension,
-                                        final int columnDimension)
-        throws NotStrictlyPositiveException {
-        return new BlockRealMatrix(rowDimension, columnDimension);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix copy() {
-        // create an empty matrix
-        BlockRealMatrix copied = new BlockRealMatrix(rows, columns);
-
-        // copy the blocks
-        for (int i = 0; i < blocks.length; ++i) {
-            System.arraycopy(blocks[i], 0, copied.blocks[i], 0, blocks[i].length);
-        }
-
-        return copied;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix add(final RealMatrix m)
-        throws MatrixDimensionMismatchException {
-        try {
-            return add((BlockRealMatrix) m);
-        } catch (ClassCastException cce) {
-            // safety check
-            MatrixUtils.checkAdditionCompatible(this, m);
-
-            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
-
-            // perform addition block-wise, to ensure good cache behavior
-            int blockIndex = 0;
-            for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-                for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-
-                    // perform addition on the current block
-                    final double[] outBlock = out.blocks[blockIndex];
-                    final double[] tBlock   = blocks[blockIndex];
-                    final int pStart = iBlock * BLOCK_SIZE;
-                    final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    int k = 0;
-                    for (int p = pStart; p < pEnd; ++p) {
-                        for (int q = qStart; q < qEnd; ++q) {
-                            outBlock[k] = tBlock[k] + m.getEntry(p, q);
-                            ++k;
-                        }
-                    }
-                    // go to next block
-                    ++blockIndex;
-                }
-            }
-
-            return out;
-        }
-    }
-
-    /**
-     * Compute the sum of this matrix and {@code m}.
-     *
-     * @param m Matrix to be added.
-     * @return {@code this} + m.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as this matrix.
-     */
-    public BlockRealMatrix add(final BlockRealMatrix m)
-        throws MatrixDimensionMismatchException {
-        // safety check
-        MatrixUtils.checkAdditionCompatible(this, m);
-
-        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
-
-        // perform addition block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final double[] outBlock = out.blocks[blockIndex];
-            final double[] tBlock = blocks[blockIndex];
-            final double[] mBlock = m.blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k] + mBlock[k];
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix subtract(final RealMatrix m)
-        throws MatrixDimensionMismatchException {
-        try {
-            return subtract((BlockRealMatrix) m);
-        } catch (ClassCastException cce) {
-            // safety check
-            MatrixUtils.checkSubtractionCompatible(this, m);
-
-            final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
-
-            // perform subtraction block-wise, to ensure good cache behavior
-            int blockIndex = 0;
-            for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-                for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-
-                    // perform subtraction on the current block
-                    final double[] outBlock = out.blocks[blockIndex];
-                    final double[] tBlock = blocks[blockIndex];
-                    final int pStart = iBlock * BLOCK_SIZE;
-                    final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    int k = 0;
-                    for (int p = pStart; p < pEnd; ++p) {
-                        for (int q = qStart; q < qEnd; ++q) {
-                            outBlock[k] = tBlock[k] - m.getEntry(p, q);
-                            ++k;
-                        }
-                    }
-                    // go to next block
-                    ++blockIndex;
-                }
-            }
-
-            return out;
-        }
-    }
-
-    /**
-     * Subtract {@code m} from this matrix.
-     *
-     * @param m Matrix to be subtracted.
-     * @return {@code this} - m.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the
-     * same size as this matrix.
-     */
-    public BlockRealMatrix subtract(final BlockRealMatrix m)
-        throws MatrixDimensionMismatchException {
-        // safety check
-        MatrixUtils.checkSubtractionCompatible(this, m);
-
-        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
-
-        // perform subtraction block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final double[] outBlock = out.blocks[blockIndex];
-            final double[] tBlock = blocks[blockIndex];
-            final double[] mBlock = m.blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k] - mBlock[k];
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix scalarAdd(final double d) {
-
-        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
-
-        // perform subtraction block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final double[] outBlock = out.blocks[blockIndex];
-            final double[] tBlock = blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k] + d;
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealMatrix scalarMultiply(final double d) {
-        final BlockRealMatrix out = new BlockRealMatrix(rows, columns);
-
-        // perform subtraction block-wise, to ensure good cache behavior
-        for (int blockIndex = 0; blockIndex < out.blocks.length; ++blockIndex) {
-            final double[] outBlock = out.blocks[blockIndex];
-            final double[] tBlock = blocks[blockIndex];
-            for (int k = 0; k < outBlock.length; ++k) {
-                outBlock[k] = tBlock[k] * d;
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix multiply(final RealMatrix m)
-        throws DimensionMismatchException {
-        try {
-            return multiply((BlockRealMatrix) m);
-        } catch (ClassCastException cce) {
-            // safety check
-            MatrixUtils.checkMultiplicationCompatible(this, m);
-
-            final BlockRealMatrix out = new BlockRealMatrix(rows, m.getColumnDimension());
-
-            // perform multiplication block-wise, to ensure good cache behavior
-            int blockIndex = 0;
-            for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-                final int pStart = iBlock * BLOCK_SIZE;
-                final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-
-                for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd = FastMath.min(qStart + BLOCK_SIZE, m.getColumnDimension());
-
-                    // select current block
-                    final double[] outBlock = out.blocks[blockIndex];
-
-                    // perform multiplication on current block
-                    for (int kBlock = 0; kBlock < blockColumns; ++kBlock) {
-                        final int kWidth = blockWidth(kBlock);
-                        final double[] tBlock = blocks[iBlock * blockColumns + kBlock];
-                        final int rStart = kBlock * BLOCK_SIZE;
-                        int k = 0;
-                        for (int p = pStart; p < pEnd; ++p) {
-                            final int lStart = (p - pStart) * kWidth;
-                            final int lEnd = lStart + kWidth;
-                            for (int q = qStart; q < qEnd; ++q) {
-                                double sum = 0;
-                                int r = rStart;
-                                for (int l = lStart; l < lEnd; ++l) {
-                                    sum += tBlock[l] * m.getEntry(r, q);
-                                    ++r;
-                                }
-                                outBlock[k] += sum;
-                                ++k;
-                            }
-                        }
-                    }
-                    // go to next block
-                    ++blockIndex;
-                }
-            }
-
-            return out;
-        }
-    }
-
-    /**
-     * Returns the result of postmultiplying this by {@code m}.
-     *
-     * @param m Matrix to postmultiply by.
-     * @return {@code this} * m.
-     * @throws DimensionMismatchException if the matrices are not compatible.
-     */
-    public BlockRealMatrix multiply(BlockRealMatrix m)
-        throws DimensionMismatchException {
-        // safety check
-        MatrixUtils.checkMultiplicationCompatible(this, m);
-
-        final BlockRealMatrix out = new BlockRealMatrix(rows, m.columns);
-
-        // perform multiplication block-wise, to ensure good cache behavior
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-
-            for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-                final int jWidth = out.blockWidth(jBlock);
-                final int jWidth2 = jWidth  + jWidth;
-                final int jWidth3 = jWidth2 + jWidth;
-                final int jWidth4 = jWidth3 + jWidth;
-
-                // select current block
-                final double[] outBlock = out.blocks[blockIndex];
-
-                // perform multiplication on current block
-                for (int kBlock = 0; kBlock < blockColumns; ++kBlock) {
-                    final int kWidth = blockWidth(kBlock);
-                    final double[] tBlock = blocks[iBlock * blockColumns + kBlock];
-                    final double[] mBlock = m.blocks[kBlock * m.blockColumns + jBlock];
-                    int k = 0;
-                    for (int p = pStart; p < pEnd; ++p) {
-                        final int lStart = (p - pStart) * kWidth;
-                        final int lEnd = lStart + kWidth;
-                        for (int nStart = 0; nStart < jWidth; ++nStart) {
-                            double sum = 0;
-                            int l = lStart;
-                            int n = nStart;
-                            while (l < lEnd - 3) {
-                                sum += tBlock[l] * mBlock[n] +
-                                       tBlock[l + 1] * mBlock[n + jWidth] +
-                                       tBlock[l + 2] * mBlock[n + jWidth2] +
-                                       tBlock[l + 3] * mBlock[n + jWidth3];
-                                l += 4;
-                                n += jWidth4;
-                            }
-                            while (l < lEnd) {
-                                sum += tBlock[l++] * mBlock[n];
-                                n += jWidth;
-                            }
-                            outBlock[k] += sum;
-                            ++k;
-                        }
-                    }
-                }
-                // go to next block
-                ++blockIndex;
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[][] getData() {
-        final double[][] data = new double[getRowDimension()][getColumnDimension()];
-        final int lastColumns = columns - (blockColumns - 1) * BLOCK_SIZE;
-
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            int regularPos = 0;
-            int lastPos = 0;
-            for (int p = pStart; p < pEnd; ++p) {
-                final double[] dataP = data[p];
-                int blockIndex = iBlock * blockColumns;
-                int dataPos = 0;
-                for (int jBlock = 0; jBlock < blockColumns - 1; ++jBlock) {
-                    System.arraycopy(blocks[blockIndex++], regularPos, dataP, dataPos, BLOCK_SIZE);
-                    dataPos += BLOCK_SIZE;
-                }
-                System.arraycopy(blocks[blockIndex], lastPos, dataP, dataPos, lastColumns);
-                regularPos += BLOCK_SIZE;
-                lastPos    += lastColumns;
-            }
-        }
-
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getNorm() {
-        final double[] colSums = new double[BLOCK_SIZE];
-        double maxColSum = 0;
-        for (int jBlock = 0; jBlock < blockColumns; jBlock++) {
-            final int jWidth = blockWidth(jBlock);
-            Arrays.fill(colSums, 0, jWidth, 0.0);
-            for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-                final int iHeight = blockHeight(iBlock);
-                final double[] block = blocks[iBlock * blockColumns + jBlock];
-                for (int j = 0; j < jWidth; ++j) {
-                    double sum = 0;
-                    for (int i = 0; i < iHeight; ++i) {
-                        sum += FastMath.abs(block[i * jWidth + j]);
-                    }
-                    colSums[j] += sum;
-                }
-            }
-            for (int j = 0; j < jWidth; ++j) {
-                maxColSum = FastMath.max(maxColSum, colSums[j]);
-            }
-        }
-        return maxColSum;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getFrobeniusNorm() {
-        double sum2 = 0;
-        for (int blockIndex = 0; blockIndex < blocks.length; ++blockIndex) {
-            for (final double entry : blocks[blockIndex]) {
-                sum2 += entry * entry;
-            }
-        }
-        return FastMath.sqrt(sum2);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix getSubMatrix(final int startRow, final int endRow,
-                                        final int startColumn,
-                                        final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        // safety checks
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-
-        // create the output matrix
-        final BlockRealMatrix out =
-            new BlockRealMatrix(endRow - startRow + 1, endColumn - startColumn + 1);
-
-        // compute blocks shifts
-        final int blockStartRow = startRow / BLOCK_SIZE;
-        final int rowsShift = startRow % BLOCK_SIZE;
-        final int blockStartColumn = startColumn / BLOCK_SIZE;
-        final int columnsShift = startColumn % BLOCK_SIZE;
-
-        // perform extraction block-wise, to ensure good cache behavior
-        int pBlock = blockStartRow;
-        for (int iBlock = 0; iBlock < out.blockRows; ++iBlock) {
-            final int iHeight = out.blockHeight(iBlock);
-            int qBlock = blockStartColumn;
-            for (int jBlock = 0; jBlock < out.blockColumns; ++jBlock) {
-                final int jWidth = out.blockWidth(jBlock);
-
-                // handle one block of the output matrix
-                final int outIndex = iBlock * out.blockColumns + jBlock;
-                final double[] outBlock = out.blocks[outIndex];
-                final int index = pBlock * blockColumns + qBlock;
-                final int width = blockWidth(qBlock);
-
-                final int heightExcess = iHeight + rowsShift - BLOCK_SIZE;
-                final int widthExcess = jWidth + columnsShift - BLOCK_SIZE;
-                if (heightExcess > 0) {
-                    // the submatrix block spans on two blocks rows from the original matrix
-                    if (widthExcess > 0) {
-                        // the submatrix block spans on two blocks columns from the original matrix
-                        final int width2 = blockWidth(qBlock + 1);
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, BLOCK_SIZE,
-                                      columnsShift, BLOCK_SIZE,
-                                      outBlock, jWidth, 0, 0);
-                        copyBlockPart(blocks[index + 1], width2,
-                                      rowsShift, BLOCK_SIZE,
-                                      0, widthExcess,
-                                      outBlock, jWidth, 0, jWidth - widthExcess);
-                        copyBlockPart(blocks[index + blockColumns], width,
-                                      0, heightExcess,
-                                      columnsShift, BLOCK_SIZE,
-                                      outBlock, jWidth, iHeight - heightExcess, 0);
-                        copyBlockPart(blocks[index + blockColumns + 1], width2,
-                                      0, heightExcess,
-                                      0, widthExcess,
-                                      outBlock, jWidth, iHeight - heightExcess, jWidth - widthExcess);
-                    } else {
-                        // the submatrix block spans on one block column from the original matrix
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, BLOCK_SIZE,
-                                      columnsShift, jWidth + columnsShift,
-                                      outBlock, jWidth, 0, 0);
-                        copyBlockPart(blocks[index + blockColumns], width,
-                                      0, heightExcess,
-                                      columnsShift, jWidth + columnsShift,
-                                      outBlock, jWidth, iHeight - heightExcess, 0);
-                    }
-                } else {
-                    // the submatrix block spans on one block row from the original matrix
-                    if (widthExcess > 0) {
-                        // the submatrix block spans on two blocks columns from the original matrix
-                        final int width2 = blockWidth(qBlock + 1);
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, iHeight + rowsShift,
-                                      columnsShift, BLOCK_SIZE,
-                                      outBlock, jWidth, 0, 0);
-                        copyBlockPart(blocks[index + 1], width2,
-                                      rowsShift, iHeight + rowsShift,
-                                      0, widthExcess,
-                                      outBlock, jWidth, 0, jWidth - widthExcess);
-                    } else {
-                        // the submatrix block spans on one block column from the original matrix
-                        copyBlockPart(blocks[index], width,
-                                      rowsShift, iHeight + rowsShift,
-                                      columnsShift, jWidth + columnsShift,
-                                      outBlock, jWidth, 0, 0);
-                    }
-               }
-                ++qBlock;
-            }
-            ++pBlock;
-        }
-
-        return out;
-    }
-
-    /**
-     * Copy a part of a block into another one
-     * <p>This method can be called only when the specified part fits in both
-     * blocks, no verification is done here.</p>
-     * @param srcBlock source block
-     * @param srcWidth source block width ({@link #BLOCK_SIZE} or smaller)
-     * @param srcStartRow start row in the source block
-     * @param srcEndRow end row (exclusive) in the source block
-     * @param srcStartColumn start column in the source block
-     * @param srcEndColumn end column (exclusive) in the source block
-     * @param dstBlock destination block
-     * @param dstWidth destination block width ({@link #BLOCK_SIZE} or smaller)
-     * @param dstStartRow start row in the destination block
-     * @param dstStartColumn start column in the destination block
-     */
-    private void copyBlockPart(final double[] srcBlock, final int srcWidth,
-                               final int srcStartRow, final int srcEndRow,
-                               final int srcStartColumn, final int srcEndColumn,
-                               final double[] dstBlock, final int dstWidth,
-                               final int dstStartRow, final int dstStartColumn) {
-        final int length = srcEndColumn - srcStartColumn;
-        int srcPos = srcStartRow * srcWidth + srcStartColumn;
-        int dstPos = dstStartRow * dstWidth + dstStartColumn;
-        for (int srcRow = srcStartRow; srcRow < srcEndRow; ++srcRow) {
-            System.arraycopy(srcBlock, srcPos, dstBlock, dstPos, length);
-            srcPos += srcWidth;
-            dstPos += dstWidth;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setSubMatrix(final double[][] subMatrix, final int row,
-                             final int column)
-        throws OutOfRangeException, NoDataException, NullArgumentException,
-        DimensionMismatchException {
-        // safety checks
-        MathUtils.checkNotNull(subMatrix);
-        final int refLength = subMatrix[0].length;
-        if (refLength == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-        }
-        final int endRow = row + subMatrix.length - 1;
-        final int endColumn = column + refLength - 1;
-        MatrixUtils.checkSubMatrixIndex(this, row, endRow, column, endColumn);
-        for (final double[] subRow : subMatrix) {
-            if (subRow.length != refLength) {
-                throw new DimensionMismatchException(refLength, subRow.length);
-            }
-        }
-
-        // compute blocks bounds
-        final int blockStartRow = row / BLOCK_SIZE;
-        final int blockEndRow = (endRow + BLOCK_SIZE) / BLOCK_SIZE;
-        final int blockStartColumn = column / BLOCK_SIZE;
-        final int blockEndColumn = (endColumn + BLOCK_SIZE) / BLOCK_SIZE;
-
-        // perform copy block-wise, to ensure good cache behavior
-        for (int iBlock = blockStartRow; iBlock < blockEndRow; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final int firstRow = iBlock * BLOCK_SIZE;
-            final int iStart = FastMath.max(row,    firstRow);
-            final int iEnd = FastMath.min(endRow + 1, firstRow + iHeight);
-
-            for (int jBlock = blockStartColumn; jBlock < blockEndColumn; ++jBlock) {
-                final int jWidth = blockWidth(jBlock);
-                final int firstColumn = jBlock * BLOCK_SIZE;
-                final int jStart = FastMath.max(column,    firstColumn);
-                final int jEnd = FastMath.min(endColumn + 1, firstColumn + jWidth);
-                final int jLength = jEnd - jStart;
-
-                // handle one block, row by row
-                final double[] block = blocks[iBlock * blockColumns + jBlock];
-                for (int i = iStart; i < iEnd; ++i) {
-                    System.arraycopy(subMatrix[i - row], jStart - column,
-                                     block, (i - firstRow) * jWidth + (jStart - firstColumn),
-                                     jLength);
-                }
-
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix getRowMatrix(final int row)
-        throws OutOfRangeException {
-        MatrixUtils.checkRowIndex(this, row);
-        final BlockRealMatrix out = new BlockRealMatrix(1, columns);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock = row / BLOCK_SIZE;
-        final int iRow = row - iBlock * BLOCK_SIZE;
-        int outBlockIndex = 0;
-        int outIndex = 0;
-        double[] outBlock = out.blocks[outBlockIndex];
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth = blockWidth(jBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            final int available = outBlock.length - outIndex;
-            if (jWidth > available) {
-                System.arraycopy(block, iRow * jWidth, outBlock, outIndex, available);
-                outBlock = out.blocks[++outBlockIndex];
-                System.arraycopy(block, iRow * jWidth, outBlock, 0, jWidth - available);
-                outIndex = jWidth - available;
-            } else {
-                System.arraycopy(block, iRow * jWidth, outBlock, outIndex, jWidth);
-                outIndex += jWidth;
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setRowMatrix(final int row, final RealMatrix matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        try {
-            setRowMatrix(row, (BlockRealMatrix) matrix);
-        } catch (ClassCastException cce) {
-            super.setRowMatrix(row, matrix);
-        }
-    }
-
-    /**
-     * Sets the entries in row number <code>row</code>
-     * as a row matrix.  Row indices start at 0.
-     *
-     * @param row the row to be set
-     * @param matrix row matrix (must have one row and the same number of columns
-     * as the instance)
-     * @throws OutOfRangeException if the specified row index is invalid.
-     * @throws MatrixDimensionMismatchException if the matrix dimensions do
-     * not match one instance row.
-     */
-    public void setRowMatrix(final int row, final BlockRealMatrix matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkRowIndex(this, row);
-        final int nCols = getColumnDimension();
-        if ((matrix.getRowDimension() != 1) ||
-            (matrix.getColumnDimension() != nCols)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       1, nCols);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock = row / BLOCK_SIZE;
-        final int iRow = row - iBlock * BLOCK_SIZE;
-        int mBlockIndex = 0;
-        int mIndex = 0;
-        double[] mBlock = matrix.blocks[mBlockIndex];
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth = blockWidth(jBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            final int available  = mBlock.length - mIndex;
-            if (jWidth > available) {
-                System.arraycopy(mBlock, mIndex, block, iRow * jWidth, available);
-                mBlock = matrix.blocks[++mBlockIndex];
-                System.arraycopy(mBlock, 0, block, iRow * jWidth, jWidth - available);
-                mIndex = jWidth - available;
-            } else {
-                System.arraycopy(mBlock, mIndex, block, iRow * jWidth, jWidth);
-                mIndex += jWidth;
-           }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix getColumnMatrix(final int column)
-        throws OutOfRangeException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final BlockRealMatrix out = new BlockRealMatrix(rows, 1);
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth = blockWidth(jBlock);
-        int outBlockIndex = 0;
-        int outIndex = 0;
-        double[] outBlock = out.blocks[outBlockIndex];
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                if (outIndex >= outBlock.length) {
-                    outBlock = out.blocks[++outBlockIndex];
-                    outIndex = 0;
-                }
-                outBlock[outIndex++] = block[i * jWidth + jColumn];
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setColumnMatrix(final int column, final RealMatrix matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        try {
-            setColumnMatrix(column, (BlockRealMatrix) matrix);
-        } catch (ClassCastException cce) {
-            super.setColumnMatrix(column, matrix);
-        }
-    }
-
-    /**
-     * Sets the entries in column number <code>column</code>
-     * as a column matrix.  Column indices start at 0.
-     *
-     * @param column the column to be set
-     * @param matrix column matrix (must have one column and the same number of rows
-     * as the instance)
-     * @throws OutOfRangeException if the specified column index is invalid.
-     * @throws MatrixDimensionMismatchException if the matrix dimensions do
-     * not match one instance column.
-     */
-    void setColumnMatrix(final int column, final BlockRealMatrix matrix)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final int nRows = getRowDimension();
-        if ((matrix.getRowDimension() != nRows) ||
-            (matrix.getColumnDimension() != 1)) {
-            throw new MatrixDimensionMismatchException(matrix.getRowDimension(),
-                                                       matrix.getColumnDimension(),
-                                                       nRows, 1);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth = blockWidth(jBlock);
-        int mBlockIndex = 0;
-        int mIndex = 0;
-        double[] mBlock = matrix.blocks[mBlockIndex];
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                if (mIndex >= mBlock.length) {
-                    mBlock = matrix.blocks[++mBlockIndex];
-                    mIndex = 0;
-                }
-                block[i * jWidth + jColumn] = mBlock[mIndex++];
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector getRowVector(final int row)
-        throws OutOfRangeException {
-        MatrixUtils.checkRowIndex(this, row);
-        final double[] outData = new double[columns];
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock = row / BLOCK_SIZE;
-        final int iRow = row - iBlock * BLOCK_SIZE;
-        int outIndex = 0;
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth = blockWidth(jBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            System.arraycopy(block, iRow * jWidth, outData, outIndex, jWidth);
-            outIndex += jWidth;
-        }
-
-        return new ArrayRealVector(outData, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setRowVector(final int row, final RealVector vector)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        try {
-            setRow(row, ((ArrayRealVector) vector).getDataRef());
-        } catch (ClassCastException cce) {
-            super.setRowVector(row, vector);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector getColumnVector(final int column)
-        throws OutOfRangeException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final double[] outData = new double[rows];
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth = blockWidth(jBlock);
-        int outIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                outData[outIndex++] = block[i * jWidth + jColumn];
-            }
-        }
-
-        return new ArrayRealVector(outData, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setColumnVector(final int column, final RealVector vector)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        try {
-            setColumn(column, ((ArrayRealVector) vector).getDataRef());
-        } catch (ClassCastException cce) {
-            super.setColumnVector(column, vector);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] getRow(final int row) throws OutOfRangeException {
-        MatrixUtils.checkRowIndex(this, row);
-        final double[] out = new double[columns];
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock = row / BLOCK_SIZE;
-        final int iRow = row - iBlock * BLOCK_SIZE;
-        int outIndex = 0;
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth     = blockWidth(jBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            System.arraycopy(block, iRow * jWidth, out, outIndex, jWidth);
-            outIndex += jWidth;
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setRow(final int row, final double[] array)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkRowIndex(this, row);
-        final int nCols = getColumnDimension();
-        if (array.length != nCols) {
-            throw new MatrixDimensionMismatchException(1, array.length, 1, nCols);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int iBlock = row / BLOCK_SIZE;
-        final int iRow = row - iBlock * BLOCK_SIZE;
-        int outIndex = 0;
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth     = blockWidth(jBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            System.arraycopy(array, outIndex, block, iRow * jWidth, jWidth);
-            outIndex += jWidth;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] getColumn(final int column) throws OutOfRangeException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final double[] out = new double[rows];
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock  = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth  = blockWidth(jBlock);
-        int outIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                out[outIndex++] = block[i * jWidth + jColumn];
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setColumn(final int column, final double[] array)
-        throws OutOfRangeException, MatrixDimensionMismatchException {
-        MatrixUtils.checkColumnIndex(this, column);
-        final int nRows = getRowDimension();
-        if (array.length != nRows) {
-            throw new MatrixDimensionMismatchException(array.length, 1, nRows, 1);
-        }
-
-        // perform copy block-wise, to ensure good cache behavior
-        final int jBlock  = column / BLOCK_SIZE;
-        final int jColumn = column - jBlock * BLOCK_SIZE;
-        final int jWidth = blockWidth(jBlock);
-        int outIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int iHeight = blockHeight(iBlock);
-            final double[] block = blocks[iBlock * blockColumns + jBlock];
-            for (int i = 0; i < iHeight; ++i) {
-                block[i * jWidth + jColumn] = array[outIndex++];
-            }
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getEntry(final int row, final int column)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        final int iBlock = row / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k = (row - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-        return blocks[iBlock * blockColumns + jBlock][k];
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void setEntry(final int row, final int column, final double value)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        final int iBlock = row / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k = (row - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-        blocks[iBlock * blockColumns + jBlock][k] = value;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void addToEntry(final int row, final int column,
-                           final double increment)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        final int iBlock = row    / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k = (row    - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-        blocks[iBlock * blockColumns + jBlock][k] += increment;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void multiplyEntry(final int row, final int column,
-                              final double factor)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        final int iBlock = row / BLOCK_SIZE;
-        final int jBlock = column / BLOCK_SIZE;
-        final int k = (row - iBlock * BLOCK_SIZE) * blockWidth(jBlock) +
-            (column - jBlock * BLOCK_SIZE);
-        blocks[iBlock * blockColumns + jBlock][k] *= factor;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public BlockRealMatrix transpose() {
-        final int nRows = getRowDimension();
-        final int nCols = getColumnDimension();
-        final BlockRealMatrix out = new BlockRealMatrix(nCols, nRows);
-
-        // perform transpose block-wise, to ensure good cache behavior
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockColumns; ++iBlock) {
-            for (int jBlock = 0; jBlock < blockRows; ++jBlock) {
-                // transpose current block
-                final double[] outBlock = out.blocks[blockIndex];
-                final double[] tBlock = blocks[jBlock * blockColumns + iBlock];
-                final int pStart = iBlock * BLOCK_SIZE;
-                final int pEnd = FastMath.min(pStart + BLOCK_SIZE, columns);
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd = FastMath.min(qStart + BLOCK_SIZE, rows);
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    final int lInc = pEnd - pStart;
-                    int l = p - pStart;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        outBlock[k] = tBlock[l];
-                        ++k;
-                        l+= lInc;
-                    }
-                }
-                // go to next block
-                ++blockIndex;
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getRowDimension() {
-        return rows;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getColumnDimension() {
-        return columns;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] operate(final double[] v)
-        throws DimensionMismatchException {
-        if (v.length != columns) {
-            throw new DimensionMismatchException(v.length, columns);
-        }
-        final double[] out = new double[rows];
-
-        // perform multiplication block-wise, to ensure good cache behavior
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final double[] block  = blocks[iBlock * blockColumns + jBlock];
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    double sum = 0;
-                    int q = qStart;
-                    while (q < qEnd - 3) {
-                        sum += block[k]     * v[q]     +
-                               block[k + 1] * v[q + 1] +
-                               block[k + 2] * v[q + 2] +
-                               block[k + 3] * v[q + 3];
-                        k += 4;
-                        q += 4;
-                    }
-                    while (q < qEnd) {
-                        sum += block[k++] * v[q++];
-                    }
-                    out[p] += sum;
-                }
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] preMultiply(final double[] v)
-        throws DimensionMismatchException {
-        if (v.length != rows) {
-            throw new DimensionMismatchException(v.length, rows);
-        }
-        final double[] out = new double[columns];
-
-        // perform multiplication block-wise, to ensure good cache behavior
-        for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-            final int jWidth  = blockWidth(jBlock);
-            final int jWidth2 = jWidth  + jWidth;
-            final int jWidth3 = jWidth2 + jWidth;
-            final int jWidth4 = jWidth3 + jWidth;
-            final int qStart = jBlock * BLOCK_SIZE;
-            final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-            for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-                final double[] block  = blocks[iBlock * blockColumns + jBlock];
-                final int pStart = iBlock * BLOCK_SIZE;
-                final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-                for (int q = qStart; q < qEnd; ++q) {
-                    int k = q - qStart;
-                    double sum = 0;
-                    int p = pStart;
-                    while (p < pEnd - 3) {
-                        sum += block[k]           * v[p]     +
-                               block[k + jWidth]  * v[p + 1] +
-                               block[k + jWidth2] * v[p + 2] +
-                               block[k + jWidth3] * v[p + 3];
-                        k += jWidth4;
-                        p += 4;
-                    }
-                    while (p < pEnd) {
-                        sum += block[k] * v[p++];
-                        k += jWidth;
-                    }
-                    out[q] += sum;
-                }
-            }
-        }
-
-        return out;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixChangingVisitor visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    final double[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - pStart) * jWidth;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixPreservingVisitor visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int qStart = jBlock * BLOCK_SIZE;
-                    final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                    final double[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - pStart) * jWidth;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixChangingVisitor visitor,
-                                 final int startRow, final int endRow,
-                                 final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0 = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int q0 = jBlock * BLOCK_SIZE;
-                    final int qStart = FastMath.max(startColumn, q0);
-                    final int qEnd = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                    final double[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInRowOrder(final RealMatrixPreservingVisitor visitor,
-                                 final int startRow, final int endRow,
-                                 final int startColumn, final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0 = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int p = pStart; p < pEnd; ++p) {
-                for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                    final int jWidth = blockWidth(jBlock);
-                    final int q0 = jBlock * BLOCK_SIZE;
-                    final int qStart = FastMath.max(startColumn, q0);
-                    final int qEnd = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                    final double[] block = blocks[iBlock * blockColumns + jBlock];
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-             }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final double[] block = blocks[blockIndex];
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-                ++blockIndex;
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor) {
-        visitor.start(rows, columns, 0, rows - 1, 0, columns - 1);
-        int blockIndex = 0;
-        for (int iBlock = 0; iBlock < blockRows; ++iBlock) {
-            final int pStart = iBlock * BLOCK_SIZE;
-            final int pEnd = FastMath.min(pStart + BLOCK_SIZE, rows);
-            for (int jBlock = 0; jBlock < blockColumns; ++jBlock) {
-                final int qStart = jBlock * BLOCK_SIZE;
-                final int qEnd = FastMath.min(qStart + BLOCK_SIZE, columns);
-                final double[] block = blocks[blockIndex];
-                int k = 0;
-                for (int p = pStart; p < pEnd; ++p) {
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-                ++blockIndex;
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInOptimizedOrder(final RealMatrixChangingVisitor visitor,
-                                       final int startRow, final int endRow,
-                                       final int startColumn,
-                                       final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0 = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                final int jWidth = blockWidth(jBlock);
-                final int q0 = jBlock * BLOCK_SIZE;
-                final int qStart = FastMath.max(startColumn, q0);
-                final int qEnd = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                final double[] block = blocks[iBlock * blockColumns + jBlock];
-                for (int p = pStart; p < pEnd; ++p) {
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        block[k] = visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-            }
-        }
-        return visitor.end();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double walkInOptimizedOrder(final RealMatrixPreservingVisitor visitor,
-                                       final int startRow, final int endRow,
-                                       final int startColumn,
-                                       final int endColumn)
-        throws OutOfRangeException, NumberIsTooSmallException {
-        MatrixUtils.checkSubMatrixIndex(this, startRow, endRow, startColumn, endColumn);
-        visitor.start(rows, columns, startRow, endRow, startColumn, endColumn);
-        for (int iBlock = startRow / BLOCK_SIZE; iBlock < 1 + endRow / BLOCK_SIZE; ++iBlock) {
-            final int p0 = iBlock * BLOCK_SIZE;
-            final int pStart = FastMath.max(startRow, p0);
-            final int pEnd = FastMath.min((iBlock + 1) * BLOCK_SIZE, 1 + endRow);
-            for (int jBlock = startColumn / BLOCK_SIZE; jBlock < 1 + endColumn / BLOCK_SIZE; ++jBlock) {
-                final int jWidth = blockWidth(jBlock);
-                final int q0 = jBlock * BLOCK_SIZE;
-                final int qStart = FastMath.max(startColumn, q0);
-                final int qEnd = FastMath.min((jBlock + 1) * BLOCK_SIZE, 1 + endColumn);
-                final double[] block = blocks[iBlock * blockColumns + jBlock];
-                for (int p = pStart; p < pEnd; ++p) {
-                    int k = (p - p0) * jWidth + qStart - q0;
-                    for (int q = qStart; q < qEnd; ++q) {
-                        visitor.visit(p, q, block[k]);
-                        ++k;
-                    }
-                }
-            }
-        }
-        return visitor.end();
-    }
-
-    /**
-     * Get the height of a block.
-     * @param blockRow row index (in block sense) of the block
-     * @return height (number of rows) of the block
-     */
-    private int blockHeight(final int blockRow) {
-        return (blockRow == blockRows - 1) ? rows - blockRow * BLOCK_SIZE : BLOCK_SIZE;
-    }
-
-    /**
-     * Get the width of a block.
-     * @param blockColumn column index (in block sense) of the block
-     * @return width (number of columns) of the block
-     */
-    private int blockWidth(final int blockColumn) {
-        return (blockColumn == blockColumns - 1) ? columns - blockColumn * BLOCK_SIZE : BLOCK_SIZE;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/CholeskyDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/CholeskyDecomposition.java b/src/main/java/org/apache/commons/math3/linear/CholeskyDecomposition.java
deleted file mode 100644
index 63b9a83..0000000
--- a/src/main/java/org/apache/commons/math3/linear/CholeskyDecomposition.java
+++ /dev/null
@@ -1,310 +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.linear;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-
-
-/**
- * Calculates the Cholesky decomposition of a matrix.
- * <p>The Cholesky decomposition of a real symmetric positive-definite
- * matrix A consists of a lower triangular matrix L with same size such
- * that: A = LL<sup>T</sup>. In a sense, this is the square root of A.</p>
- * <p>This class is based on the class with similar name from the
- * <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a> library, with the
- * following changes:</p>
- * <ul>
- *   <li>a {@link #getLT() getLT} method has been added,</li>
- *   <li>the {@code isspd} method has been removed, since the constructor of
- *   this class throws a {@link NonPositiveDefiniteMatrixException} when a
- *   matrix cannot be decomposed,</li>
- *   <li>a {@link #getDeterminant() getDeterminant} method has been added,</li>
- *   <li>the {@code solve} method has been replaced by a {@link #getSolver()
- *   getSolver} method and the equivalent method provided by the returned
- *   {@link DecompositionSolver}.</li>
- * </ul>
- *
- * @see <a href="http://mathworld.wolfram.com/CholeskyDecomposition.html">MathWorld</a>
- * @see <a href="http://en.wikipedia.org/wiki/Cholesky_decomposition">Wikipedia</a>
- * @since 2.0 (changed to concrete class in 3.0)
- */
-public class CholeskyDecomposition {
-    /**
-     * Default threshold above which off-diagonal elements are considered too different
-     * and matrix not symmetric.
-     */
-    public static final double DEFAULT_RELATIVE_SYMMETRY_THRESHOLD = 1.0e-15;
-    /**
-     * Default threshold below which diagonal elements are considered null
-     * and matrix not positive definite.
-     */
-    public static final double DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD = 1.0e-10;
-    /** Row-oriented storage for L<sup>T</sup> matrix data. */
-    private double[][] lTData;
-    /** Cached value of L. */
-    private RealMatrix cachedL;
-    /** Cached value of LT. */
-    private RealMatrix cachedLT;
-
-    /**
-     * Calculates the Cholesky decomposition of the given matrix.
-     * <p>
-     * Calling this constructor is equivalent to call {@link
-     * #CholeskyDecomposition(RealMatrix, double, double)} with the
-     * thresholds set to the default values {@link
-     * #DEFAULT_RELATIVE_SYMMETRY_THRESHOLD} and {@link
-     * #DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD}
-     * </p>
-     * @param matrix the matrix to decompose
-     * @throws NonSquareMatrixException if the matrix is not square.
-     * @throws NonSymmetricMatrixException if the matrix is not symmetric.
-     * @throws NonPositiveDefiniteMatrixException if the matrix is not
-     * strictly positive definite.
-     * @see #CholeskyDecomposition(RealMatrix, double, double)
-     * @see #DEFAULT_RELATIVE_SYMMETRY_THRESHOLD
-     * @see #DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD
-     */
-    public CholeskyDecomposition(final RealMatrix matrix) {
-        this(matrix, DEFAULT_RELATIVE_SYMMETRY_THRESHOLD,
-             DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD);
-    }
-
-    /**
-     * Calculates the Cholesky decomposition of the given matrix.
-     * @param matrix the matrix to decompose
-     * @param relativeSymmetryThreshold threshold above which off-diagonal
-     * elements are considered too different and matrix not symmetric
-     * @param absolutePositivityThreshold threshold below which diagonal
-     * elements are considered null and matrix not positive definite
-     * @throws NonSquareMatrixException if the matrix is not square.
-     * @throws NonSymmetricMatrixException if the matrix is not symmetric.
-     * @throws NonPositiveDefiniteMatrixException if the matrix is not
-     * strictly positive definite.
-     * @see #CholeskyDecomposition(RealMatrix)
-     * @see #DEFAULT_RELATIVE_SYMMETRY_THRESHOLD
-     * @see #DEFAULT_ABSOLUTE_POSITIVITY_THRESHOLD
-     */
-    public CholeskyDecomposition(final RealMatrix matrix,
-                                     final double relativeSymmetryThreshold,
-                                     final double absolutePositivityThreshold) {
-        if (!matrix.isSquare()) {
-            throw new NonSquareMatrixException(matrix.getRowDimension(),
-                                               matrix.getColumnDimension());
-        }
-
-        final int order = matrix.getRowDimension();
-        lTData   = matrix.getData();
-        cachedL  = null;
-        cachedLT = null;
-
-        // check the matrix before transformation
-        for (int i = 0; i < order; ++i) {
-            final double[] lI = lTData[i];
-
-            // check off-diagonal elements (and reset them to 0)
-            for (int j = i + 1; j < order; ++j) {
-                final double[] lJ = lTData[j];
-                final double lIJ = lI[j];
-                final double lJI = lJ[i];
-                final double maxDelta =
-                    relativeSymmetryThreshold * FastMath.max(FastMath.abs(lIJ), FastMath.abs(lJI));
-                if (FastMath.abs(lIJ - lJI) > maxDelta) {
-                    throw new NonSymmetricMatrixException(i, j, relativeSymmetryThreshold);
-                }
-                lJ[i] = 0;
-           }
-        }
-
-        // transform the matrix
-        for (int i = 0; i < order; ++i) {
-
-            final double[] ltI = lTData[i];
-
-            // check diagonal element
-            if (ltI[i] <= absolutePositivityThreshold) {
-                throw new NonPositiveDefiniteMatrixException(ltI[i], i, absolutePositivityThreshold);
-            }
-
-            ltI[i] = FastMath.sqrt(ltI[i]);
-            final double inverse = 1.0 / ltI[i];
-
-            for (int q = order - 1; q > i; --q) {
-                ltI[q] *= inverse;
-                final double[] ltQ = lTData[q];
-                for (int p = q; p < order; ++p) {
-                    ltQ[p] -= ltI[q] * ltI[p];
-                }
-            }
-        }
-    }
-
-    /**
-     * Returns the matrix L of the decomposition.
-     * <p>L is an lower-triangular matrix</p>
-     * @return the L matrix
-     */
-    public RealMatrix getL() {
-        if (cachedL == null) {
-            cachedL = getLT().transpose();
-        }
-        return cachedL;
-    }
-
-    /**
-     * Returns the transpose of the matrix L of the decomposition.
-     * <p>L<sup>T</sup> is an upper-triangular matrix</p>
-     * @return the transpose of the matrix L of the decomposition
-     */
-    public RealMatrix getLT() {
-
-        if (cachedLT == null) {
-            cachedLT = MatrixUtils.createRealMatrix(lTData);
-        }
-
-        // return the cached matrix
-        return cachedLT;
-    }
-
-    /**
-     * Return the determinant of the matrix
-     * @return determinant of the matrix
-     */
-    public double getDeterminant() {
-        double determinant = 1.0;
-        for (int i = 0; i < lTData.length; ++i) {
-            double lTii = lTData[i][i];
-            determinant *= lTii * lTii;
-        }
-        return determinant;
-    }
-
-    /**
-     * Get a solver for finding the A &times; X = B solution in least square sense.
-     * @return a solver
-     */
-    public DecompositionSolver getSolver() {
-        return new Solver(lTData);
-    }
-
-    /** Specialized solver. */
-    private static class Solver implements DecompositionSolver {
-        /** Row-oriented storage for L<sup>T</sup> matrix data. */
-        private final double[][] lTData;
-
-        /**
-         * Build a solver from decomposed matrix.
-         * @param lTData row-oriented storage for L<sup>T</sup> matrix data
-         */
-        private Solver(final double[][] lTData) {
-            this.lTData = lTData;
-        }
-
-        /** {@inheritDoc} */
-        public boolean isNonSingular() {
-            // if we get this far, the matrix was positive definite, hence non-singular
-            return true;
-        }
-
-        /** {@inheritDoc} */
-        public RealVector solve(final RealVector b) {
-            final int m = lTData.length;
-            if (b.getDimension() != m) {
-                throw new DimensionMismatchException(b.getDimension(), m);
-            }
-
-            final double[] x = b.toArray();
-
-            // Solve LY = b
-            for (int j = 0; j < m; j++) {
-                final double[] lJ = lTData[j];
-                x[j] /= lJ[j];
-                final double xJ = x[j];
-                for (int i = j + 1; i < m; i++) {
-                    x[i] -= xJ * lJ[i];
-                }
-            }
-
-            // Solve LTX = Y
-            for (int j = m - 1; j >= 0; j--) {
-                x[j] /= lTData[j][j];
-                final double xJ = x[j];
-                for (int i = 0; i < j; i++) {
-                    x[i] -= xJ * lTData[i][j];
-                }
-            }
-
-            return new ArrayRealVector(x, false);
-        }
-
-        /** {@inheritDoc} */
-        public RealMatrix solve(RealMatrix b) {
-            final int m = lTData.length;
-            if (b.getRowDimension() != m) {
-                throw new DimensionMismatchException(b.getRowDimension(), m);
-            }
-
-            final int nColB = b.getColumnDimension();
-            final double[][] x = b.getData();
-
-            // Solve LY = b
-            for (int j = 0; j < m; j++) {
-                final double[] lJ = lTData[j];
-                final double lJJ = lJ[j];
-                final double[] xJ = x[j];
-                for (int k = 0; k < nColB; ++k) {
-                    xJ[k] /= lJJ;
-                }
-                for (int i = j + 1; i < m; i++) {
-                    final double[] xI = x[i];
-                    final double lJI = lJ[i];
-                    for (int k = 0; k < nColB; ++k) {
-                        xI[k] -= xJ[k] * lJI;
-                    }
-                }
-            }
-
-            // Solve LTX = Y
-            for (int j = m - 1; j >= 0; j--) {
-                final double lJJ = lTData[j][j];
-                final double[] xJ = x[j];
-                for (int k = 0; k < nColB; ++k) {
-                    xJ[k] /= lJJ;
-                }
-                for (int i = 0; i < j; i++) {
-                    final double[] xI = x[i];
-                    final double lIJ = lTData[i][j];
-                    for (int k = 0; k < nColB; ++k) {
-                        xI[k] -= xJ[k] * lIJ;
-                    }
-                }
-            }
-
-            return new Array2DRowRealMatrix(x);
-        }
-
-        /**
-         * Get the inverse of the decomposed matrix.
-         *
-         * @return the inverse matrix.
-         */
-        public RealMatrix getInverse() {
-            return solve(MatrixUtils.createRealIdentityMatrix(lTData.length));
-        }
-    }
-}


[30/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
deleted file mode 100644
index 18cb2f4..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
+++ /dev/null
@@ -1,262 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the Zipf distribution.
- *
- * @see <a href="http://mathworld.wolfram.com/ZipfDistribution.html">Zipf distribution (MathWorld)</a>
- */
-public class ZipfDistribution extends AbstractIntegerDistribution {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -140627372283420404L;
-    /** Number of elements. */
-    private final int numberOfElements;
-    /** Exponent parameter of the distribution. */
-    private final double exponent;
-    /** Cached numerical mean */
-    private double numericalMean = Double.NaN;
-    /** Whether or not the numerical mean has been calculated */
-    private boolean numericalMeanIsCalculated = false;
-    /** Cached numerical variance */
-    private double numericalVariance = Double.NaN;
-    /** Whether or not the numerical variance has been calculated */
-    private boolean numericalVarianceIsCalculated = false;
-
-    /**
-     * Create a new Zipf distribution with the given number of elements and
-     * exponent.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param numberOfElements Number of elements.
-     * @param exponent Exponent.
-     * @exception NotStrictlyPositiveException if {@code numberOfElements <= 0}
-     * or {@code exponent <= 0}.
-     */
-    public ZipfDistribution(final int numberOfElements, final double exponent) {
-        this(new Well19937c(), numberOfElements, exponent);
-    }
-
-    /**
-     * Creates a Zipf distribution.
-     *
-     * @param rng Random number generator.
-     * @param numberOfElements Number of elements.
-     * @param exponent Exponent.
-     * @exception NotStrictlyPositiveException if {@code numberOfElements <= 0}
-     * or {@code exponent <= 0}.
-     * @since 3.1
-     */
-    public ZipfDistribution(RandomGenerator rng,
-                            int numberOfElements,
-                            double exponent)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (numberOfElements <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.DIMENSION,
-                                                   numberOfElements);
-        }
-        if (exponent <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.EXPONENT,
-                                                   exponent);
-        }
-
-        this.numberOfElements = numberOfElements;
-        this.exponent = exponent;
-    }
-
-    /**
-     * Get the number of elements (e.g. corpus size) for the distribution.
-     *
-     * @return the number of elements
-     */
-    public int getNumberOfElements() {
-        return numberOfElements;
-    }
-
-    /**
-     * Get the exponent characterizing the distribution.
-     *
-     * @return the exponent
-     */
-    public double getExponent() {
-        return exponent;
-    }
-
-    /** {@inheritDoc} */
-    public double probability(final int x) {
-        if (x <= 0 || x > numberOfElements) {
-            return 0.0;
-        }
-
-        return (1.0 / FastMath.pow(x, exponent)) / generalizedHarmonic(numberOfElements, exponent);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logProbability(int x) {
-        if (x <= 0 || x > numberOfElements) {
-            return Double.NEGATIVE_INFINITY;
-        }
-
-        return -FastMath.log(x) * exponent - FastMath.log(generalizedHarmonic(numberOfElements, exponent));
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(final int x) {
-        if (x <= 0) {
-            return 0.0;
-        } else if (x >= numberOfElements) {
-            return 1.0;
-        }
-
-        return generalizedHarmonic(x, exponent) / generalizedHarmonic(numberOfElements, exponent);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For number of elements {@code N} and exponent {@code s}, the mean is
-     * {@code Hs1 / Hs}, where
-     * <ul>
-     *  <li>{@code Hs1 = generalizedHarmonic(N, s - 1)},</li>
-     *  <li>{@code Hs = generalizedHarmonic(N, s)}.</li>
-     * </ul>
-     */
-    public double getNumericalMean() {
-        if (!numericalMeanIsCalculated) {
-            numericalMean = calculateNumericalMean();
-            numericalMeanIsCalculated = true;
-        }
-        return numericalMean;
-    }
-
-    /**
-     * Used by {@link #getNumericalMean()}.
-     *
-     * @return the mean of this distribution
-     */
-    protected double calculateNumericalMean() {
-        final int N = getNumberOfElements();
-        final double s = getExponent();
-
-        final double Hs1 = generalizedHarmonic(N, s - 1);
-        final double Hs = generalizedHarmonic(N, s);
-
-        return Hs1 / Hs;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For number of elements {@code N} and exponent {@code s}, the mean is
-     * {@code (Hs2 / Hs) - (Hs1^2 / Hs^2)}, where
-     * <ul>
-     *  <li>{@code Hs2 = generalizedHarmonic(N, s - 2)},</li>
-     *  <li>{@code Hs1 = generalizedHarmonic(N, s - 1)},</li>
-     *  <li>{@code Hs = generalizedHarmonic(N, s)}.</li>
-     * </ul>
-     */
-    public double getNumericalVariance() {
-        if (!numericalVarianceIsCalculated) {
-            numericalVariance = calculateNumericalVariance();
-            numericalVarianceIsCalculated = true;
-        }
-        return numericalVariance;
-    }
-
-    /**
-     * Used by {@link #getNumericalVariance()}.
-     *
-     * @return the variance of this distribution
-     */
-    protected double calculateNumericalVariance() {
-        final int N = getNumberOfElements();
-        final double s = getExponent();
-
-        final double Hs2 = generalizedHarmonic(N, s - 2);
-        final double Hs1 = generalizedHarmonic(N, s - 1);
-        final double Hs = generalizedHarmonic(N, s);
-
-        return (Hs2 / Hs) - ((Hs1 * Hs1) / (Hs * Hs));
-    }
-
-    /**
-     * Calculates the Nth generalized harmonic number. See
-     * <a href="http://mathworld.wolfram.com/HarmonicSeries.html">Harmonic
-     * Series</a>.
-     *
-     * @param n Term in the series to calculate (must be larger than 1)
-     * @param m Exponent (special case {@code m = 1} is the harmonic series).
-     * @return the n<sup>th</sup> generalized harmonic number.
-     */
-    private double generalizedHarmonic(final int n, final double m) {
-        double value = 0;
-        for (int k = n; k > 0; --k) {
-            value += 1.0 / FastMath.pow(k, m);
-        }
-        return value;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 1 no matter the parameters.
-     *
-     * @return lower bound of the support (always 1)
-     */
-    public int getSupportLowerBound() {
-        return 1;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is the number of elements.
-     *
-     * @return upper bound of the support
-     */
-    public int getSupportUpperBound() {
-        return getNumberOfElements();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java b/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
deleted file mode 100644
index 0b4ac0d..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
+++ /dev/null
@@ -1,454 +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.distribution.fitting;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.math3.distribution.MultivariateNormalDistribution;
-import org.apache.commons.math3.distribution.MixtureMultivariateNormalDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.stat.correlation.Covariance;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * Expectation-Maximization</a> algorithm for fitting the parameters of
- * multivariate normal mixture model distributions.
- *
- * This implementation is pure original code based on <a
- * href="https://www.ee.washington.edu/techsite/papers/documents/UWEETR-2010-0002.pdf">
- * EM Demystified: An Expectation-Maximization Tutorial</a> by Yihua Chen and Maya R. Gupta,
- * Department of Electrical Engineering, University of Washington, Seattle, WA 98195.
- * It was verified using external tools like <a
- * href="http://cran.r-project.org/web/packages/mixtools/index.html">CRAN Mixtools</a>
- * (see the JUnit test cases) but it is <strong>not</strong> based on Mixtools code at all.
- * The discussion of the origin of this class can be seen in the comments of the <a
- * href="https://issues.apache.org/jira/browse/MATH-817">MATH-817</a> JIRA issue.
- * @since 3.2
- */
-public class MultivariateNormalMixtureExpectationMaximization {
-    /**
-     * Default maximum number of iterations allowed per fitting process.
-     */
-    private static final int DEFAULT_MAX_ITERATIONS = 1000;
-    /**
-     * Default convergence threshold for fitting.
-     */
-    private static final double DEFAULT_THRESHOLD = 1E-5;
-    /**
-     * The data to fit.
-     */
-    private final double[][] data;
-    /**
-     * The model fit against the data.
-     */
-    private MixtureMultivariateNormalDistribution fittedModel;
-    /**
-     * The log likelihood of the data given the fitted model.
-     */
-    private double logLikelihood = 0d;
-
-    /**
-     * Creates an object to fit a multivariate normal mixture model to data.
-     *
-     * @param data Data to use in fitting procedure
-     * @throws NotStrictlyPositiveException if data has no rows
-     * @throws DimensionMismatchException if rows of data have different numbers
-     *             of columns
-     * @throws NumberIsTooSmallException if the number of columns in the data is
-     *             less than 2
-     */
-    public MultivariateNormalMixtureExpectationMaximization(double[][] data)
-        throws NotStrictlyPositiveException,
-               DimensionMismatchException,
-               NumberIsTooSmallException {
-        if (data.length < 1) {
-            throw new NotStrictlyPositiveException(data.length);
-        }
-
-        this.data = new double[data.length][data[0].length];
-
-        for (int i = 0; i < data.length; i++) {
-            if (data[i].length != data[0].length) {
-                // Jagged arrays not allowed
-                throw new DimensionMismatchException(data[i].length,
-                                                     data[0].length);
-            }
-            if (data[i].length < 2) {
-                throw new NumberIsTooSmallException(LocalizedFormats.NUMBER_TOO_SMALL,
-                                                    data[i].length, 2, true);
-            }
-            this.data[i] = MathArrays.copyOf(data[i], data[i].length);
-        }
-    }
-
-    /**
-     * Fit a mixture model to the data supplied to the constructor.
-     *
-     * The quality of the fit depends on the concavity of the data provided to
-     * the constructor and the initial mixture provided to this function. If the
-     * data has many local optima, multiple runs of the fitting function with
-     * different initial mixtures may be required to find the optimal solution.
-     * If a SingularMatrixException is encountered, it is possible that another
-     * initialization would work.
-     *
-     * @param initialMixture Model containing initial values of weights and
-     *            multivariate normals
-     * @param maxIterations Maximum iterations allowed for fit
-     * @param threshold Convergence threshold computed as difference in
-     *             logLikelihoods between successive iterations
-     * @throws SingularMatrixException if any component's covariance matrix is
-     *             singular during fitting
-     * @throws NotStrictlyPositiveException if numComponents is less than one
-     *             or threshold is less than Double.MIN_VALUE
-     * @throws DimensionMismatchException if initialMixture mean vector and data
-     *             number of columns are not equal
-     */
-    public void fit(final MixtureMultivariateNormalDistribution initialMixture,
-                    final int maxIterations,
-                    final double threshold)
-            throws SingularMatrixException,
-                   NotStrictlyPositiveException,
-                   DimensionMismatchException {
-        if (maxIterations < 1) {
-            throw new NotStrictlyPositiveException(maxIterations);
-        }
-
-        if (threshold < Double.MIN_VALUE) {
-            throw new NotStrictlyPositiveException(threshold);
-        }
-
-        final int n = data.length;
-
-        // Number of data columns. Jagged data already rejected in constructor,
-        // so we can assume the lengths of each row are equal.
-        final int numCols = data[0].length;
-        final int k = initialMixture.getComponents().size();
-
-        final int numMeanColumns
-            = initialMixture.getComponents().get(0).getSecond().getMeans().length;
-
-        if (numMeanColumns != numCols) {
-            throw new DimensionMismatchException(numMeanColumns, numCols);
-        }
-
-        int numIterations = 0;
-        double previousLogLikelihood = 0d;
-
-        logLikelihood = Double.NEGATIVE_INFINITY;
-
-        // Initialize model to fit to initial mixture.
-        fittedModel = new MixtureMultivariateNormalDistribution(initialMixture.getComponents());
-
-        while (numIterations++ <= maxIterations &&
-               FastMath.abs(previousLogLikelihood - logLikelihood) > threshold) {
-            previousLogLikelihood = logLikelihood;
-            double sumLogLikelihood = 0d;
-
-            // Mixture components
-            final List<Pair<Double, MultivariateNormalDistribution>> components
-                = fittedModel.getComponents();
-
-            // Weight and distribution of each component
-            final double[] weights = new double[k];
-
-            final MultivariateNormalDistribution[] mvns = new MultivariateNormalDistribution[k];
-
-            for (int j = 0; j < k; j++) {
-                weights[j] = components.get(j).getFirst();
-                mvns[j] = components.get(j).getSecond();
-            }
-
-            // E-step: compute the data dependent parameters of the expectation
-            // function.
-            // The percentage of row's total density between a row and a
-            // component
-            final double[][] gamma = new double[n][k];
-
-            // Sum of gamma for each component
-            final double[] gammaSums = new double[k];
-
-            // Sum of gamma times its row for each each component
-            final double[][] gammaDataProdSums = new double[k][numCols];
-
-            for (int i = 0; i < n; i++) {
-                final double rowDensity = fittedModel.density(data[i]);
-                sumLogLikelihood += FastMath.log(rowDensity);
-
-                for (int j = 0; j < k; j++) {
-                    gamma[i][j] = weights[j] * mvns[j].density(data[i]) / rowDensity;
-                    gammaSums[j] += gamma[i][j];
-
-                    for (int col = 0; col < numCols; col++) {
-                        gammaDataProdSums[j][col] += gamma[i][j] * data[i][col];
-                    }
-                }
-            }
-
-            logLikelihood = sumLogLikelihood / n;
-
-            // M-step: compute the new parameters based on the expectation
-            // function.
-            final double[] newWeights = new double[k];
-            final double[][] newMeans = new double[k][numCols];
-
-            for (int j = 0; j < k; j++) {
-                newWeights[j] = gammaSums[j] / n;
-                for (int col = 0; col < numCols; col++) {
-                    newMeans[j][col] = gammaDataProdSums[j][col] / gammaSums[j];
-                }
-            }
-
-            // Compute new covariance matrices
-            final RealMatrix[] newCovMats = new RealMatrix[k];
-            for (int j = 0; j < k; j++) {
-                newCovMats[j] = new Array2DRowRealMatrix(numCols, numCols);
-            }
-            for (int i = 0; i < n; i++) {
-                for (int j = 0; j < k; j++) {
-                    final RealMatrix vec
-                        = new Array2DRowRealMatrix(MathArrays.ebeSubtract(data[i], newMeans[j]));
-                    final RealMatrix dataCov
-                        = vec.multiply(vec.transpose()).scalarMultiply(gamma[i][j]);
-                    newCovMats[j] = newCovMats[j].add(dataCov);
-                }
-            }
-
-            // Converting to arrays for use by fitted model
-            final double[][][] newCovMatArrays = new double[k][numCols][numCols];
-            for (int j = 0; j < k; j++) {
-                newCovMats[j] = newCovMats[j].scalarMultiply(1d / gammaSums[j]);
-                newCovMatArrays[j] = newCovMats[j].getData();
-            }
-
-            // Update current model
-            fittedModel = new MixtureMultivariateNormalDistribution(newWeights,
-                                                                    newMeans,
-                                                                    newCovMatArrays);
-        }
-
-        if (FastMath.abs(previousLogLikelihood - logLikelihood) > threshold) {
-            // Did not converge before the maximum number of iterations
-            throw new ConvergenceException();
-        }
-    }
-
-    /**
-     * Fit a mixture model to the data supplied to the constructor.
-     *
-     * The quality of the fit depends on the concavity of the data provided to
-     * the constructor and the initial mixture provided to this function. If the
-     * data has many local optima, multiple runs of the fitting function with
-     * different initial mixtures may be required to find the optimal solution.
-     * If a SingularMatrixException is encountered, it is possible that another
-     * initialization would work.
-     *
-     * @param initialMixture Model containing initial values of weights and
-     *            multivariate normals
-     * @throws SingularMatrixException if any component's covariance matrix is
-     *             singular during fitting
-     * @throws NotStrictlyPositiveException if numComponents is less than one or
-     *             threshold is less than Double.MIN_VALUE
-     */
-    public void fit(MixtureMultivariateNormalDistribution initialMixture)
-        throws SingularMatrixException,
-               NotStrictlyPositiveException {
-        fit(initialMixture, DEFAULT_MAX_ITERATIONS, DEFAULT_THRESHOLD);
-    }
-
-    /**
-     * Helper method to create a multivariate normal mixture model which can be
-     * used to initialize {@link #fit(MixtureMultivariateNormalDistribution)}.
-     *
-     * This method uses the data supplied to the constructor to try to determine
-     * a good mixture model at which to start the fit, but it is not guaranteed
-     * to supply a model which will find the optimal solution or even converge.
-     *
-     * @param data Data to estimate distribution
-     * @param numComponents Number of components for estimated mixture
-     * @return Multivariate normal mixture model estimated from the data
-     * @throws NumberIsTooLargeException if {@code numComponents} is greater
-     * than the number of data rows.
-     * @throws NumberIsTooSmallException if {@code numComponents < 2}.
-     * @throws NotStrictlyPositiveException if data has less than 2 rows
-     * @throws DimensionMismatchException if rows of data have different numbers
-     *             of columns
-     */
-    public static MixtureMultivariateNormalDistribution estimate(final double[][] data,
-                                                                 final int numComponents)
-        throws NotStrictlyPositiveException,
-               DimensionMismatchException {
-        if (data.length < 2) {
-            throw new NotStrictlyPositiveException(data.length);
-        }
-        if (numComponents < 2) {
-            throw new NumberIsTooSmallException(numComponents, 2, true);
-        }
-        if (numComponents > data.length) {
-            throw new NumberIsTooLargeException(numComponents, data.length, true);
-        }
-
-        final int numRows = data.length;
-        final int numCols = data[0].length;
-
-        // sort the data
-        final DataRow[] sortedData = new DataRow[numRows];
-        for (int i = 0; i < numRows; i++) {
-            sortedData[i] = new DataRow(data[i]);
-        }
-        Arrays.sort(sortedData);
-
-        // uniform weight for each bin
-        final double weight = 1d / numComponents;
-
-        // components of mixture model to be created
-        final List<Pair<Double, MultivariateNormalDistribution>> components =
-                new ArrayList<Pair<Double, MultivariateNormalDistribution>>(numComponents);
-
-        // create a component based on data in each bin
-        for (int binIndex = 0; binIndex < numComponents; binIndex++) {
-            // minimum index (inclusive) from sorted data for this bin
-            final int minIndex = (binIndex * numRows) / numComponents;
-
-            // maximum index (exclusive) from sorted data for this bin
-            final int maxIndex = ((binIndex + 1) * numRows) / numComponents;
-
-            // number of data records that will be in this bin
-            final int numBinRows = maxIndex - minIndex;
-
-            // data for this bin
-            final double[][] binData = new double[numBinRows][numCols];
-
-            // mean of each column for the data in the this bin
-            final double[] columnMeans = new double[numCols];
-
-            // populate bin and create component
-            for (int i = minIndex, iBin = 0; i < maxIndex; i++, iBin++) {
-                for (int j = 0; j < numCols; j++) {
-                    final double val = sortedData[i].getRow()[j];
-                    columnMeans[j] += val;
-                    binData[iBin][j] = val;
-                }
-            }
-
-            MathArrays.scaleInPlace(1d / numBinRows, columnMeans);
-
-            // covariance matrix for this bin
-            final double[][] covMat
-                = new Covariance(binData).getCovarianceMatrix().getData();
-            final MultivariateNormalDistribution mvn
-                = new MultivariateNormalDistribution(columnMeans, covMat);
-
-            components.add(new Pair<Double, MultivariateNormalDistribution>(weight, mvn));
-        }
-
-        return new MixtureMultivariateNormalDistribution(components);
-    }
-
-    /**
-     * Gets the log likelihood of the data under the fitted model.
-     *
-     * @return Log likelihood of data or zero of no data has been fit
-     */
-    public double getLogLikelihood() {
-        return logLikelihood;
-    }
-
-    /**
-     * Gets the fitted model.
-     *
-     * @return fitted model or {@code null} if no fit has been performed yet.
-     */
-    public MixtureMultivariateNormalDistribution getFittedModel() {
-        return new MixtureMultivariateNormalDistribution(fittedModel.getComponents());
-    }
-
-    /**
-     * Class used for sorting user-supplied data.
-     */
-    private static class DataRow implements Comparable<DataRow> {
-        /** One data row. */
-        private final double[] row;
-        /** Mean of the data row. */
-        private Double mean;
-
-        /**
-         * Create a data row.
-         * @param data Data to use for the row
-         */
-        DataRow(final double[] data) {
-            // Store reference.
-            row = data;
-            // Compute mean.
-            mean = 0d;
-            for (int i = 0; i < data.length; i++) {
-                mean += data[i];
-            }
-            mean /= data.length;
-        }
-
-        /**
-         * Compare two data rows.
-         * @param other The other row
-         * @return int for sorting
-         */
-        public int compareTo(final DataRow other) {
-            return mean.compareTo(other.mean);
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public boolean equals(Object other) {
-
-            if (this == other) {
-                return true;
-            }
-
-            if (other instanceof DataRow) {
-                return MathArrays.equals(row, ((DataRow) other).row);
-            }
-
-            return false;
-
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public int hashCode() {
-            return Arrays.hashCode(row);
-        }
-        /**
-         * Get a data row.
-         * @return data row array
-         */
-        public double[] getRow() {
-            return row;
-        }
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/fitting/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/fitting/package-info.java b/src/main/java/org/apache/commons/math3/distribution/fitting/package-info.java
deleted file mode 100644
index aa95c6d..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/fitting/package-info.java
+++ /dev/null
@@ -1,20 +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.
- */
-/**
- * Fitting of parameters against distributions.
- */
-package org.apache.commons.math3.distribution.fitting;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/package-info.java b/src/main/java/org/apache/commons/math3/distribution/package-info.java
deleted file mode 100644
index 4e11196..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/package-info.java
+++ /dev/null
@@ -1,20 +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.
- */
-/**
- * Implementations of common discrete and continuous distributions.
- */
-package org.apache.commons.math3.distribution;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/ConvergenceException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/ConvergenceException.java b/src/main/java/org/apache/commons/math3/exception/ConvergenceException.java
deleted file mode 100644
index 3aecfc2..0000000
--- a/src/main/java/org/apache/commons/math3/exception/ConvergenceException.java
+++ /dev/null
@@ -1,50 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Error thrown when a numerical computation can not be performed because the
- * numerical result failed to converge to a finite value.
- *
- * @since 2.2
- */
-public class ConvergenceException extends MathIllegalStateException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 4330003017885151975L;
-
-    /**
-     * Construct the exception.
-     */
-    public ConvergenceException() {
-        this(LocalizedFormats.CONVERGENCE_FAILED);
-    }
-
-    /**
-     * Construct the exception with a specific context and arguments.
-     *
-     * @param pattern Message pattern providing the specific context of
-     * the error.
-     * @param args Arguments.
-     */
-    public ConvergenceException(Localizable pattern,
-                                Object ... args) {
-        getContext().addMessage(pattern, args);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/DimensionMismatchException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/DimensionMismatchException.java b/src/main/java/org/apache/commons/math3/exception/DimensionMismatchException.java
deleted file mode 100644
index 2bf84c8..0000000
--- a/src/main/java/org/apache/commons/math3/exception/DimensionMismatchException.java
+++ /dev/null
@@ -1,64 +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.exception;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.Localizable;
-
-/**
- * Exception to be thrown when two dimensions differ.
- *
- * @since 2.2
- */
-public class DimensionMismatchException extends MathIllegalNumberException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -8415396756375798143L;
-    /** Correct dimension. */
-    private final int dimension;
-
-    /**
-     * Construct an exception from the mismatched dimensions.
-     *
-     * @param specific Specific context information pattern.
-     * @param wrong Wrong dimension.
-     * @param expected Expected dimension.
-     */
-    public DimensionMismatchException(Localizable specific,
-                                      int wrong,
-                                      int expected) {
-        super(specific, Integer.valueOf(wrong), Integer.valueOf(expected));
-        dimension = expected;
-    }
-
-    /**
-     * Construct an exception from the mismatched dimensions.
-     *
-     * @param wrong Wrong dimension.
-     * @param expected Expected dimension.
-     */
-    public DimensionMismatchException(int wrong,
-                                      int expected) {
-        this(LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, wrong, expected);
-    }
-
-    /**
-     * @return the expected dimension.
-     */
-    public int getDimension() {
-        return dimension;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java b/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
deleted file mode 100644
index ec61d4e..0000000
--- a/src/main/java/org/apache/commons/math3/exception/InsufficientDataException.java
+++ /dev/null
@@ -1,49 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when there is insufficient data to perform a computation.
- *
- * @since 3.3
- */
-public class InsufficientDataException
-    extends MathIllegalArgumentException {
-
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -2629324471511903359L;
-
-    /**
-     * Construct the exception.
-     */
-    public InsufficientDataException() {
-        this(LocalizedFormats.INSUFFICIENT_DATA);
-    }
-
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param pattern Message pattern providing the specific context of the error.
-     * @param arguments Values for replacing the placeholders in {@code pattern}.
-     */
-    public InsufficientDataException(Localizable pattern, Object... arguments) {
-        super(pattern, arguments);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathArithmeticException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathArithmeticException.java b/src/main/java/org/apache/commons/math3/exception/MathArithmeticException.java
deleted file mode 100644
index c3826e4..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathArithmeticException.java
+++ /dev/null
@@ -1,76 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
-
-/**
- * Base class for arithmetic exceptions.
- * It is used for all the exceptions that have the semantics of the standard
- * {@link ArithmeticException}, but must also provide a localized
- * message.
- *
- * @since 3.0
- */
-public class MathArithmeticException extends ArithmeticException
-    implements ExceptionContextProvider {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
-    /** Context. */
-    private final ExceptionContext context;
-
-    /**
-     * Default constructor.
-     */
-    public MathArithmeticException() {
-        context = new ExceptionContext(this);
-        context.addMessage(LocalizedFormats.ARITHMETIC_EXCEPTION);
-    }
-
-    /**
-     * Constructor with a specific message.
-     *
-     * @param pattern Message pattern providing the specific context of
-     * the error.
-     * @param args Arguments.
-     */
-    public MathArithmeticException(Localizable pattern,
-                                   Object ... args) {
-        context = new ExceptionContext(this);
-        context.addMessage(pattern, args);
-    }
-
-    /** {@inheritDoc} */
-    public ExceptionContext getContext() {
-        return context;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getMessage() {
-        return context.getMessage();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getLocalizedMessage() {
-        return context.getLocalizedMessage();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathIllegalArgumentException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathIllegalArgumentException.java b/src/main/java/org/apache/commons/math3/exception/MathIllegalArgumentException.java
deleted file mode 100644
index 89012f0..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathIllegalArgumentException.java
+++ /dev/null
@@ -1,64 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
-
-/**
- * Base class for all preconditions violation exceptions.
- * In most cases, this class should not be instantiated directly: it should
- * serve as a base class to create all the exceptions that have the semantics
- * of the standard {@link IllegalArgumentException}.
- *
- * @since 2.2
- */
-public class MathIllegalArgumentException extends IllegalArgumentException
-    implements ExceptionContextProvider {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
-    /** Context. */
-    private final ExceptionContext context;
-
-    /**
-     * @param pattern Message pattern explaining the cause of the error.
-     * @param args Arguments.
-     */
-    public MathIllegalArgumentException(Localizable pattern,
-                                        Object ... args) {
-        context = new ExceptionContext(this);
-        context.addMessage(pattern, args);
-    }
-
-    /** {@inheritDoc} */
-    public ExceptionContext getContext() {
-        return context;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getMessage() {
-        return context.getMessage();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getLocalizedMessage() {
-        return context.getLocalizedMessage();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathIllegalNumberException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathIllegalNumberException.java b/src/main/java/org/apache/commons/math3/exception/MathIllegalNumberException.java
deleted file mode 100644
index 8edb2cb..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathIllegalNumberException.java
+++ /dev/null
@@ -1,60 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-
-/**
- * Base class for exceptions raised by a wrong number.
- * This class is not intended to be instantiated directly: it should serve
- * as a base class to create all the exceptions that are raised because some
- * precondition is violated by a number argument.
- *
- * @since 2.2
- */
-public class MathIllegalNumberException extends MathIllegalArgumentException {
-
-    /** Helper to avoid boxing warnings. @since 3.3 */
-    protected static final Integer INTEGER_ZERO = Integer.valueOf(0);
-
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -7447085893598031110L;
-
-    /** Requested. */
-    private final Number argument;
-
-    /**
-     * Construct an exception.
-     *
-     * @param pattern Localizable pattern.
-     * @param wrong Wrong number.
-     * @param arguments Arguments.
-     */
-    protected MathIllegalNumberException(Localizable pattern,
-                                         Number wrong,
-                                         Object ... arguments) {
-        super(pattern, wrong, arguments);
-        argument = wrong;
-    }
-
-    /**
-     * @return the requested value.
-     */
-    public Number getArgument() {
-        return argument;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathIllegalStateException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathIllegalStateException.java b/src/main/java/org/apache/commons/math3/exception/MathIllegalStateException.java
deleted file mode 100644
index f516536..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathIllegalStateException.java
+++ /dev/null
@@ -1,88 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
-
-/**
- * Base class for all exceptions that signal that the process
- * throwing the exception is in a state that does not comply with
- * the set of states that it is designed to be in.
- *
- * @since 2.2
- */
-public class MathIllegalStateException extends IllegalStateException
-    implements ExceptionContextProvider {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
-    /** Context. */
-    private final ExceptionContext context;
-
-    /**
-     * Simple constructor.
-     *
-     * @param pattern Message pattern explaining the cause of the error.
-     * @param args Arguments.
-     */
-    public MathIllegalStateException(Localizable pattern,
-                                     Object ... args) {
-        context = new ExceptionContext(this);
-        context.addMessage(pattern, args);
-    }
-
-    /**
-     * Simple constructor.
-     *
-     * @param cause Root cause.
-     * @param pattern Message pattern explaining the cause of the error.
-     * @param args Arguments.
-     */
-    public MathIllegalStateException(Throwable cause,
-                                     Localizable pattern,
-                                     Object ... args) {
-        super(cause);
-        context = new ExceptionContext(this);
-        context.addMessage(pattern, args);
-    }
-
-    /**
-     * Default constructor.
-     */
-    public MathIllegalStateException() {
-        this(LocalizedFormats.ILLEGAL_STATE);
-    }
-
-    /** {@inheritDoc} */
-    public ExceptionContext getContext() {
-        return context;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getMessage() {
-        return context.getMessage();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getLocalizedMessage() {
-        return context.getLocalizedMessage();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathInternalError.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathInternalError.java b/src/main/java/org/apache/commons/math3/exception/MathInternalError.java
deleted file mode 100644
index 5ca66c9..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathInternalError.java
+++ /dev/null
@@ -1,57 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception triggered when something that shouldn't happen does happen.
- *
- * @since 2.2
- */
-public class MathInternalError extends MathIllegalStateException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6276776513966934846L;
-    /** URL for reporting problems. */
-    private static final String REPORT_URL = "https://issues.apache.org/jira/browse/MATH";
-
-    /**
-     * Simple constructor.
-     */
-    public MathInternalError() {
-        getContext().addMessage(LocalizedFormats.INTERNAL_ERROR, REPORT_URL);
-    }
-
-    /**
-     * Simple constructor.
-     * @param cause root cause
-     */
-    public MathInternalError(final Throwable cause) {
-        super(cause, LocalizedFormats.INTERNAL_ERROR, REPORT_URL);
-    }
-
-    /**
-     * Constructor accepting a localized message.
-     *
-     * @param pattern Message pattern explaining the cause of the error.
-     * @param args Arguments.
-     */
-    public MathInternalError(Localizable pattern, Object ... args) {
-        super(pattern, args);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathParseException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathParseException.java b/src/main/java/org/apache/commons/math3/exception/MathParseException.java
deleted file mode 100644
index 0c84767..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathParseException.java
+++ /dev/null
@@ -1,56 +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.exception;
-
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Class to signal parse failures.
- *
- * @since 2.2
- */
-public class MathParseException extends MathIllegalStateException
-    implements ExceptionContextProvider {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
-
-    /**
-     * @param wrong Bad string representation of the object.
-     * @param position Index, in the {@code wrong} string, that caused the
-     * parsing to fail.
-     * @param type Class of the object supposedly represented by the
-     * {@code wrong} string.
-     */
-    public MathParseException(String wrong,
-                              int position,
-                              Class<?> type) {
-        getContext().addMessage(LocalizedFormats.CANNOT_PARSE_AS_TYPE,
-                                wrong, Integer.valueOf(position), type.getName());
-    }
-
-    /**
-     * @param wrong Bad string representation of the object.
-     * @param position Index, in the {@code wrong} string, that caused the
-     * parsing to fail.
-     */
-    public MathParseException(String wrong,
-                              int position) {
-        getContext().addMessage(LocalizedFormats.CANNOT_PARSE,
-                                wrong, Integer.valueOf(position));
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathRuntimeException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathRuntimeException.java b/src/main/java/org/apache/commons/math3/exception/MathRuntimeException.java
deleted file mode 100644
index 9f04704..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathRuntimeException.java
+++ /dev/null
@@ -1,65 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
-
-/**
- * As of release 4.0, all exceptions thrown by the Commons Math code (except
- * {@link NullArgumentException}) inherit from this class.
- * In most cases, this class should not be instantiated directly: it should
- * serve as a base class for implementing exception classes that describe a
- * specific "problem".
- *
- * @since 3.1
- */
-public class MathRuntimeException extends RuntimeException
-    implements ExceptionContextProvider {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 20120926L;
-    /** Context. */
-    private final ExceptionContext context;
-
-    /**
-     * @param pattern Message pattern explaining the cause of the error.
-     * @param args Arguments.
-     */
-    public MathRuntimeException(Localizable pattern,
-                                Object ... args) {
-        context = new ExceptionContext(this);
-        context.addMessage(pattern, args);
-    }
-
-    /** {@inheritDoc} */
-    public ExceptionContext getContext() {
-        return context;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getMessage() {
-        return context.getMessage();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getLocalizedMessage() {
-        return context.getLocalizedMessage();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MathUnsupportedOperationException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MathUnsupportedOperationException.java b/src/main/java/org/apache/commons/math3/exception/MathUnsupportedOperationException.java
deleted file mode 100644
index 4a829f0..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MathUnsupportedOperationException.java
+++ /dev/null
@@ -1,72 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.exception.util.ExceptionContextProvider;
-
-/**
- * Base class for all unsupported features.
- * It is used for all the exceptions that have the semantics of the standard
- * {@link UnsupportedOperationException}, but must also provide a localized
- * message.
- *
- * @since 2.2
- */
-public class MathUnsupportedOperationException extends UnsupportedOperationException
-    implements ExceptionContextProvider {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6024911025449780478L;
-    /** Context. */
-    private final ExceptionContext context;
-
-    /**
-     * Default constructor.
-     */
-    public MathUnsupportedOperationException() {
-        this(LocalizedFormats.UNSUPPORTED_OPERATION);
-    }
-    /**
-     * @param pattern Message pattern providing the specific context of
-     * the error.
-     * @param args Arguments.
-     */
-    public MathUnsupportedOperationException(Localizable pattern,
-                                             Object ... args) {
-        context = new ExceptionContext(this);
-        context.addMessage(pattern, args);
-    }
-
-    /** {@inheritDoc} */
-    public ExceptionContext getContext() {
-        return context;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getMessage() {
-        return context.getMessage();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getLocalizedMessage() {
-        return context.getLocalizedMessage();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MaxCountExceededException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MaxCountExceededException.java b/src/main/java/org/apache/commons/math3/exception/MaxCountExceededException.java
deleted file mode 100644
index e846ce9..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MaxCountExceededException.java
+++ /dev/null
@@ -1,63 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when some counter maximum value is exceeded.
- *
- * @since 3.0
- */
-public class MaxCountExceededException extends MathIllegalStateException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 4330003017885151975L;
-    /**
-     * Maximum number of evaluations.
-     */
-    private final Number max;
-
-    /**
-     * Construct the exception.
-     *
-     * @param max Maximum.
-     */
-    public MaxCountExceededException(Number max) {
-        this(LocalizedFormats.MAX_COUNT_EXCEEDED, max);
-    }
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Specific context pattern.
-     * @param max Maximum.
-     * @param args Additional arguments.
-     */
-    public MaxCountExceededException(Localizable specific,
-                                     Number max,
-                                     Object ... args) {
-        getContext().addMessage(specific, max, args);
-        this.max = max;
-    }
-
-    /**
-     * @return the maximum number of evaluations.
-     */
-    public Number getMax() {
-        return max;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/MultiDimensionMismatchException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/MultiDimensionMismatchException.java b/src/main/java/org/apache/commons/math3/exception/MultiDimensionMismatchException.java
deleted file mode 100644
index 16b1fc9..0000000
--- a/src/main/java/org/apache/commons/math3/exception/MultiDimensionMismatchException.java
+++ /dev/null
@@ -1,90 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when two sets of dimensions differ.
- *
- * @since 3.0
- */
-public class MultiDimensionMismatchException extends MathIllegalArgumentException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -8415396756375798143L;
-
-    /** Wrong dimensions. */
-    private final Integer[] wrong;
-    /** Correct dimensions. */
-    private final Integer[] expected;
-
-    /**
-     * Construct an exception from the mismatched dimensions.
-     *
-     * @param wrong Wrong dimensions.
-     * @param expected Expected dimensions.
-     */
-    public MultiDimensionMismatchException(Integer[] wrong,
-                                           Integer[] expected) {
-        this(LocalizedFormats.DIMENSIONS_MISMATCH, wrong, expected);
-    }
-
-    /**
-     * Construct an exception from the mismatched dimensions.
-     *
-     * @param specific Message pattern providing the specific context of
-     * the error.
-     * @param wrong Wrong dimensions.
-     * @param expected Expected dimensions.
-     */
-    public MultiDimensionMismatchException(Localizable specific,
-                                           Integer[] wrong,
-                                           Integer[] expected) {
-        super(specific, wrong, expected);
-        this.wrong = wrong.clone();
-        this.expected = expected.clone();
-    }
-
-    /**
-     * @return an array containing the wrong dimensions.
-     */
-    public Integer[] getWrongDimensions() {
-        return wrong.clone();
-    }
-    /**
-     * @return an array containing the expected dimensions.
-     */
-    public Integer[] getExpectedDimensions() {
-        return expected.clone();
-    }
-
-    /**
-     * @param index Dimension index.
-     * @return the wrong dimension stored at {@code index}.
-     */
-    public int getWrongDimension(int index) {
-        return wrong[index].intValue();
-    }
-    /**
-     * @param index Dimension index.
-     * @return the expected dimension stored at {@code index}.
-     */
-    public int getExpectedDimension(int index) {
-        return expected[index].intValue();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NoBracketingException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NoBracketingException.java b/src/main/java/org/apache/commons/math3/exception/NoBracketingException.java
deleted file mode 100644
index 50083e1..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NoBracketingException.java
+++ /dev/null
@@ -1,106 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when function values have the same sign at both
- * ends of an interval.
- *
- * @since 3.0
- */
-public class NoBracketingException extends MathIllegalArgumentException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -3629324471511904459L;
-    /** Lower end of the interval. */
-    private final double lo;
-    /** Higher end of the interval. */
-    private final double hi;
-    /** Value at lower end of the interval. */
-    private final double fLo;
-    /** Value at higher end of the interval. */
-    private final double fHi;
-
-    /**
-     * Construct the exception.
-     *
-     * @param lo Lower end of the interval.
-     * @param hi Higher end of the interval.
-     * @param fLo Value at lower end of the interval.
-     * @param fHi Value at higher end of the interval.
-     */
-    public NoBracketingException(double lo, double hi,
-                                 double fLo, double fHi) {
-        this(LocalizedFormats.SAME_SIGN_AT_ENDPOINTS, lo, hi, fLo, fHi);
-    }
-
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Contextual information on what caused the exception.
-     * @param lo Lower end of the interval.
-     * @param hi Higher end of the interval.
-     * @param fLo Value at lower end of the interval.
-     * @param fHi Value at higher end of the interval.
-     * @param args Additional arguments.
-     */
-    public NoBracketingException(Localizable specific,
-                                 double lo, double hi,
-                                 double fLo, double fHi,
-                                 Object ... args) {
-        super(specific, Double.valueOf(lo), Double.valueOf(hi), Double.valueOf(fLo), Double.valueOf(fHi), args);
-        this.lo = lo;
-        this.hi = hi;
-        this.fLo = fLo;
-        this.fHi = fHi;
-    }
-
-    /**
-     * Get the lower end of the interval.
-     *
-     * @return the lower end.
-     */
-    public double getLo() {
-        return lo;
-    }
-    /**
-     * Get the higher end of the interval.
-     *
-     * @return the higher end.
-     */
-    public double getHi() {
-        return hi;
-    }
-    /**
-     * Get the value at the lower end of the interval.
-     *
-     * @return the value at the lower end.
-     */
-    public double getFLo() {
-        return fLo;
-    }
-    /**
-     * Get the value at the higher end of the interval.
-     *
-     * @return the value at the higher end.
-     */
-    public double getFHi() {
-        return fHi;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NoDataException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NoDataException.java b/src/main/java/org/apache/commons/math3/exception/NoDataException.java
deleted file mode 100644
index 8a72c4a..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NoDataException.java
+++ /dev/null
@@ -1,46 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when the required data is missing.
- *
- * @since 2.2
- */
-public class NoDataException extends MathIllegalArgumentException {
-
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -3629324471511904459L;
-
-    /**
-     * Construct the exception.
-     */
-    public NoDataException() {
-        this(LocalizedFormats.NO_DATA);
-    }
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Contextual information on what caused the exception.
-     */
-    public NoDataException(Localizable specific) {
-        super(specific);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NonMonotonicSequenceException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NonMonotonicSequenceException.java b/src/main/java/org/apache/commons/math3/exception/NonMonotonicSequenceException.java
deleted file mode 100644
index ab479ab..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NonMonotonicSequenceException.java
+++ /dev/null
@@ -1,120 +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.exception;
-
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when the a sequence of values is not monotonically
- * increasing or decreasing.
- *
- * @since 2.2 (name changed to "NonMonotonicSequenceException" in 3.0)
- */
-public class NonMonotonicSequenceException extends MathIllegalNumberException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 3596849179428944575L;
-    /**
-     * Direction (positive for increasing, negative for decreasing).
-     */
-    private final MathArrays.OrderDirection direction;
-    /**
-     * Whether the sequence must be strictly increasing or decreasing.
-     */
-    private final boolean strict;
-    /**
-     * Index of the wrong value.
-     */
-    private final int index;
-    /**
-     * Previous value.
-     */
-    private final Number previous;
-
-    /**
-     * Construct the exception.
-     * This constructor uses default values assuming that the sequence should
-     * have been strictly increasing.
-     *
-     * @param wrong Value that did not match the requirements.
-     * @param previous Previous value in the sequence.
-     * @param index Index of the value that did not match the requirements.
-     */
-    public NonMonotonicSequenceException(Number wrong,
-                                         Number previous,
-                                         int index) {
-        this(wrong, previous, index, MathArrays.OrderDirection.INCREASING, true);
-    }
-
-    /**
-     * Construct the exception.
-     *
-     * @param wrong Value that did not match the requirements.
-     * @param previous Previous value in the sequence.
-     * @param index Index of the value that did not match the requirements.
-     * @param direction Strictly positive for a sequence required to be
-     * increasing, negative (or zero) for a decreasing sequence.
-     * @param strict Whether the sequence must be strictly increasing or
-     * decreasing.
-     */
-    public NonMonotonicSequenceException(Number wrong,
-                                         Number previous,
-                                         int index,
-                                         MathArrays.OrderDirection direction,
-                                         boolean strict) {
-        super(direction == MathArrays.OrderDirection.INCREASING ?
-              (strict ?
-               LocalizedFormats.NOT_STRICTLY_INCREASING_SEQUENCE :
-               LocalizedFormats.NOT_INCREASING_SEQUENCE) :
-              (strict ?
-               LocalizedFormats.NOT_STRICTLY_DECREASING_SEQUENCE :
-               LocalizedFormats.NOT_DECREASING_SEQUENCE),
-              wrong, previous, Integer.valueOf(index), Integer.valueOf(index - 1));
-
-        this.direction = direction;
-        this.strict = strict;
-        this.index = index;
-        this.previous = previous;
-    }
-
-    /**
-     * @return the order direction.
-     **/
-    public MathArrays.OrderDirection getDirection() {
-        return direction;
-    }
-    /**
-     * @return {@code true} is the sequence should be strictly monotonic.
-     **/
-    public boolean getStrict() {
-        return strict;
-    }
-    /**
-     * Get the index of the wrong value.
-     *
-     * @return the current index.
-     */
-    public int getIndex() {
-        return index;
-    }
-    /**
-     * @return the previous value.
-     */
-    public Number getPrevious() {
-        return previous;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NotANumberException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NotANumberException.java b/src/main/java/org/apache/commons/math3/exception/NotANumberException.java
deleted file mode 100644
index f50d1e4..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NotANumberException.java
+++ /dev/null
@@ -1,37 +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.exception;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when a number is not a number.
- *
- * @since 3.1
- */
-public class NotANumberException extends MathIllegalNumberException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 20120906L;
-
-    /**
-     * Construct the exception.
-     */
-    public NotANumberException() {
-        super(LocalizedFormats.NAN_NOT_ALLOWED, Double.valueOf(Double.NaN));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NotFiniteNumberException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NotFiniteNumberException.java b/src/main/java/org/apache/commons/math3/exception/NotFiniteNumberException.java
deleted file mode 100644
index d4dcece..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NotFiniteNumberException.java
+++ /dev/null
@@ -1,54 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when a number is not finite.
- *
- * @since 3.0
- */
-public class NotFiniteNumberException extends MathIllegalNumberException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -6100997100383932834L;
-
-    /**
-     * Construct the exception.
-     *
-     * @param wrong Value that is infinite or NaN.
-     * @param args Optional arguments.
-     */
-    public NotFiniteNumberException(Number wrong,
-                                    Object ... args) {
-        this(LocalizedFormats.NOT_FINITE_NUMBER, wrong, args);
-    }
-
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Specific context pattern.
-     * @param wrong Value that is infinite or NaN.
-     * @param args Optional arguments.
-     */
-    public NotFiniteNumberException(Localizable specific,
-                                    Number wrong,
-                                    Object ... args) {
-        super(specific, wrong, args);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/exception/NotPositiveException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/exception/NotPositiveException.java b/src/main/java/org/apache/commons/math3/exception/NotPositiveException.java
deleted file mode 100644
index 936c996..0000000
--- a/src/main/java/org/apache/commons/math3/exception/NotPositiveException.java
+++ /dev/null
@@ -1,48 +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.exception;
-
-import org.apache.commons.math3.exception.util.Localizable;
-
-/**
- * Exception to be thrown when the argument is negative.
- *
- * @since 2.2
- */
-public class NotPositiveException extends NumberIsTooSmallException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -2250556892093726375L;
-
-    /**
-     * Construct the exception.
-     *
-     * @param value Argument.
-     */
-    public NotPositiveException(Number value) {
-        super(value, INTEGER_ZERO, true);
-    }
-    /**
-     * Construct the exception with a specific context.
-     *
-     * @param specific Specific context where the error occurred.
-     * @param value Argument.
-     */
-    public NotPositiveException(Localizable specific,
-                                Number value) {
-        super(specific, value, INTEGER_ZERO, true);
-    }
-}


[04/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/ConjugateGradient.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/ConjugateGradient.java b/src/main/java/org/apache/commons/math3/linear/ConjugateGradient.java
deleted file mode 100644
index d64b442..0000000
--- a/src/main/java/org/apache/commons/math3/linear/ConjugateGradient.java
+++ /dev/null
@@ -1,235 +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.linear;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-import org.apache.commons.math3.util.IterationManager;
-
-/**
- * <p>
- * This is an implementation of the conjugate gradient method for
- * {@link RealLinearOperator}. It follows closely the template by <a
- * href="#BARR1994">Barrett et al. (1994)</a> (figure 2.5). The linear system at
- * hand is A &middot; x = b, and the residual is r = b - A &middot; x.
- * </p>
- * <h3><a id="stopcrit">Default stopping criterion</a></h3>
- * <p>
- * A default stopping criterion is implemented. The iterations stop when || r ||
- * &le; &delta; || b ||, where b is the right-hand side vector, r the current
- * estimate of the residual, and &delta; a user-specified tolerance. It should
- * be noted that r is the so-called <em>updated</em> residual, which might
- * differ from the true residual due to rounding-off errors (see e.g. <a
- * href="#STRA2002">Strakos and Tichy, 2002</a>).
- * </p>
- * <h3>Iteration count</h3>
- * <p>
- * In the present context, an iteration should be understood as one evaluation
- * of the matrix-vector product A &middot; x. The initialization phase therefore
- * counts as one iteration.
- * </p>
- * <h3><a id="context">Exception context</a></h3>
- * <p>
- * Besides standard {@link DimensionMismatchException}, this class might throw
- * {@link NonPositiveDefiniteOperatorException} if the linear operator or
- * the preconditioner are not positive definite. In this case, the
- * {@link ExceptionContext} provides some more information
- * <ul>
- * <li>key {@code "operator"} points to the offending linear operator, say L,</li>
- * <li>key {@code "vector"} points to the offending vector, say x, such that
- * x<sup>T</sup> &middot; L &middot; x < 0.</li>
- * </ul>
- * </p>
- * <h3>References</h3>
- * <dl>
- * <dt><a id="BARR1994">Barret et al. (1994)</a></dt>
- * <dd>R. Barrett, M. Berry, T. F. Chan, J. Demmel, J. M. Donato, J. Dongarra,
- * V. Eijkhout, R. Pozo, C. Romine and H. Van der Vorst,
- * <a href="http://www.netlib.org/linalg/html_templates/Templates.html"><em>
- * Templates for the Solution of Linear Systems: Building Blocks for Iterative
- * Methods</em></a>, SIAM</dd>
- * <dt><a id="STRA2002">Strakos and Tichy (2002)
- * <dt>
- * <dd>Z. Strakos and P. Tichy, <a
- * href="http://etna.mcs.kent.edu/vol.13.2002/pp56-80.dir/pp56-80.pdf">
- * <em>On error estimation in the conjugate gradient method and why it works
- * in finite precision computations</em></a>, Electronic Transactions on
- * Numerical Analysis 13: 56-80, 2002</dd>
- * </dl>
- *
- * @since 3.0
- */
-public class ConjugateGradient
-    extends PreconditionedIterativeLinearSolver {
-
-    /** Key for the <a href="#context">exception context</a>. */
-    public static final String OPERATOR = "operator";
-
-    /** Key for the <a href="#context">exception context</a>. */
-    public static final String VECTOR = "vector";
-
-    /**
-     * {@code true} if positive-definiteness of matrix and preconditioner should
-     * be checked.
-     */
-    private boolean check;
-
-    /** The value of &delta;, for the default stopping criterion. */
-    private final double delta;
-
-    /**
-     * Creates a new instance of this class, with <a href="#stopcrit">default
-     * stopping criterion</a>.
-     *
-     * @param maxIterations the maximum number of iterations
-     * @param delta the &delta; parameter for the default stopping criterion
-     * @param check {@code true} if positive definiteness of both matrix and
-     * preconditioner should be checked
-     */
-    public ConjugateGradient(final int maxIterations, final double delta,
-                             final boolean check) {
-        super(maxIterations);
-        this.delta = delta;
-        this.check = check;
-    }
-
-    /**
-     * Creates a new instance of this class, with <a href="#stopcrit">default
-     * stopping criterion</a> and custom iteration manager.
-     *
-     * @param manager the custom iteration manager
-     * @param delta the &delta; parameter for the default stopping criterion
-     * @param check {@code true} if positive definiteness of both matrix and
-     * preconditioner should be checked
-     * @throws NullArgumentException if {@code manager} is {@code null}
-     */
-    public ConjugateGradient(final IterationManager manager,
-                             final double delta, final boolean check)
-        throws NullArgumentException {
-        super(manager);
-        this.delta = delta;
-        this.check = check;
-    }
-
-    /**
-     * Returns {@code true} if positive-definiteness should be checked for both
-     * matrix and preconditioner.
-     *
-     * @return {@code true} if the tests are to be performed
-     */
-    public final boolean getCheck() {
-        return check;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws NonPositiveDefiniteOperatorException if {@code a} or {@code m} is
-     * not positive definite
-     */
-    @Override
-    public RealVector solveInPlace(final RealLinearOperator a,
-                                   final RealLinearOperator m,
-                                   final RealVector b,
-                                   final RealVector x0)
-        throws NullArgumentException, NonPositiveDefiniteOperatorException,
-        NonSquareOperatorException, DimensionMismatchException,
-        MaxCountExceededException {
-        checkParameters(a, m, b, x0);
-        final IterationManager manager = getIterationManager();
-        // Initialization of default stopping criterion
-        manager.resetIterationCount();
-        final double rmax = delta * b.getNorm();
-        final RealVector bro = RealVector.unmodifiableRealVector(b);
-
-        // Initialization phase counts as one iteration.
-        manager.incrementIterationCount();
-        // p and x are constructed as copies of x0, since presumably, the type
-        // of x is optimized for the calculation of the matrix-vector product
-        // A.x.
-        final RealVector x = x0;
-        final RealVector xro = RealVector.unmodifiableRealVector(x);
-        final RealVector p = x.copy();
-        RealVector q = a.operate(p);
-
-        final RealVector r = b.combine(1, -1, q);
-        final RealVector rro = RealVector.unmodifiableRealVector(r);
-        double rnorm = r.getNorm();
-        RealVector z;
-        if (m == null) {
-            z = r;
-        } else {
-            z = null;
-        }
-        IterativeLinearSolverEvent evt;
-        evt = new DefaultIterativeLinearSolverEvent(this,
-            manager.getIterations(), xro, bro, rro, rnorm);
-        manager.fireInitializationEvent(evt);
-        if (rnorm <= rmax) {
-            manager.fireTerminationEvent(evt);
-            return x;
-        }
-        double rhoPrev = 0.;
-        while (true) {
-            manager.incrementIterationCount();
-            evt = new DefaultIterativeLinearSolverEvent(this,
-                manager.getIterations(), xro, bro, rro, rnorm);
-            manager.fireIterationStartedEvent(evt);
-            if (m != null) {
-                z = m.operate(r);
-            }
-            final double rhoNext = r.dotProduct(z);
-            if (check && (rhoNext <= 0.)) {
-                final NonPositiveDefiniteOperatorException e;
-                e = new NonPositiveDefiniteOperatorException();
-                final ExceptionContext context = e.getContext();
-                context.setValue(OPERATOR, m);
-                context.setValue(VECTOR, r);
-                throw e;
-            }
-            if (manager.getIterations() == 2) {
-                p.setSubVector(0, z);
-            } else {
-                p.combineToSelf(rhoNext / rhoPrev, 1., z);
-            }
-            q = a.operate(p);
-            final double pq = p.dotProduct(q);
-            if (check && (pq <= 0.)) {
-                final NonPositiveDefiniteOperatorException e;
-                e = new NonPositiveDefiniteOperatorException();
-                final ExceptionContext context = e.getContext();
-                context.setValue(OPERATOR, a);
-                context.setValue(VECTOR, p);
-                throw e;
-            }
-            final double alpha = rhoNext / pq;
-            x.combineToSelf(1., alpha, p);
-            r.combineToSelf(1., -alpha, q);
-            rhoPrev = rhoNext;
-            rnorm = r.getNorm();
-            evt = new DefaultIterativeLinearSolverEvent(this,
-                manager.getIterations(), xro, bro, rro, rnorm);
-            manager.fireIterationPerformedEvent(evt);
-            if (rnorm <= rmax) {
-                manager.fireTerminationEvent(evt);
-                return x;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/DecompositionSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/DecompositionSolver.java b/src/main/java/org/apache/commons/math3/linear/DecompositionSolver.java
deleted file mode 100644
index 50090a9..0000000
--- a/src/main/java/org/apache/commons/math3/linear/DecompositionSolver.java
+++ /dev/null
@@ -1,97 +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.linear;
-
-/**
- * Interface handling decomposition algorithms that can solve A &times; X = B.
- * <p>
- * Decomposition algorithms decompose an A matrix has a product of several specific
- * matrices from which they can solve A &times; X = B in least squares sense: they find X
- * such that ||A &times; X - B|| is minimal.
- * <p>
- * Some solvers like {@link LUDecomposition} can only find the solution for
- * square matrices and when the solution is an exact linear solution, i.e. when
- * ||A &times; X - B|| is exactly 0. Other solvers can also find solutions
- * with non-square matrix A and with non-null minimal norm. If an exact linear
- * solution exists it is also the minimal norm solution.
- *
- * @since 2.0
- */
-public interface DecompositionSolver {
-
-    /**
-     * Solve the linear equation A &times; X = B for matrices A.
-     * <p>
-     * The A matrix is implicit, it is provided by the underlying
-     * decomposition algorithm.
-     *
-     * @param b right-hand side of the equation A &times; X = B
-     * @return a vector X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if the matrices dimensions do not match.
-     * @throws SingularMatrixException if the decomposed matrix is singular.
-     */
-    RealVector solve(final RealVector b) throws SingularMatrixException;
-
-    /**
-     * Solve the linear equation A &times; X = B for matrices A.
-     * <p>
-     * The A matrix is implicit, it is provided by the underlying
-     * decomposition algorithm.
-     *
-     * @param b right-hand side of the equation A &times; X = B
-     * @return a matrix X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if the matrices dimensions do not match.
-     * @throws SingularMatrixException if the decomposed matrix is singular.
-     */
-    RealMatrix solve(final RealMatrix b) throws SingularMatrixException;
-
-    /**
-     * Check if the decomposed matrix is non-singular.
-     * @return true if the decomposed matrix is non-singular.
-     */
-    boolean isNonSingular();
-
-    /**
-     * Get the <a href="http://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_pseudoinverse">pseudo-inverse</a>
-     * of the decomposed matrix.
-     * <p>
-     * <em>This is equal to the inverse  of the decomposed matrix, if such an inverse exists.</em>
-     * <p>
-     * If no such inverse exists, then the result has properties that resemble that of an inverse.
-     * <p>
-     * In particular, in this case, if the decomposed matrix is A, then the system of equations
-     * \( A x = b \) may have no solutions, or many. If it has no solutions, then the pseudo-inverse
-     * \( A^+ \) gives the "closest" solution \( z = A^+ b \), meaning \( \left \| A z - b \right \|_2 \)
-     * is minimized. If there are many solutions, then \( z = A^+ b \) is the smallest solution,
-     * meaning \( \left \| z \right \|_2 \) is minimized.
-     * <p>
-     * Note however that some decompositions cannot compute a pseudo-inverse for all matrices.
-     * For example, the {@link LUDecomposition} is not defined for non-square matrices to begin
-     * with. The {@link QRDecomposition} can operate on non-square matrices, but will throw
-     * {@link SingularMatrixException} if the decomposed matrix is singular. Refer to the javadoc
-     * of specific decomposition implementations for more details.
-     *
-     * @return pseudo-inverse matrix (which is the inverse, if it exists),
-     * if the decomposition can pseudo-invert the decomposed matrix
-     * @throws SingularMatrixException if the decomposed matrix is singular and the decomposition
-     * can not compute a pseudo-inverse
-     */
-    RealMatrix getInverse() throws SingularMatrixException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixChangingVisitor.java
deleted file mode 100644
index 11a61fa..0000000
--- a/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixChangingVisitor.java
+++ /dev/null
@@ -1,58 +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.linear;
-
-import org.apache.commons.math3.FieldElement;
-
-/**
- * Default implementation of the {@link FieldMatrixChangingVisitor} interface.
- * <p>
- * This class is a convenience to create custom visitors without defining all
- * methods. This class provides default implementations that do nothing.
- * </p>
- *
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public class DefaultFieldMatrixChangingVisitor<T extends FieldElement<T>>
-    implements FieldMatrixChangingVisitor<T> {
-    /** Zero element of the field. */
-    private final T zero;
-
-    /** Build a new instance.
-     * @param zero additive identity of the field
-     */
-    public DefaultFieldMatrixChangingVisitor(final T zero) {
-        this.zero = zero;
-    }
-
-    /** {@inheritDoc} */
-    public void start(int rows, int columns,
-                      int startRow, int endRow, int startColumn, int endColumn) {
-    }
-
-    /** {@inheritDoc} */
-    public T visit(int row, int column, T value) {
-        return value;
-    }
-
-    /** {@inheritDoc} */
-    public T end() {
-        return zero;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixPreservingVisitor.java
deleted file mode 100644
index 97fb59b..0000000
--- a/src/main/java/org/apache/commons/math3/linear/DefaultFieldMatrixPreservingVisitor.java
+++ /dev/null
@@ -1,56 +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.linear;
-
-import org.apache.commons.math3.FieldElement;
-
-/**
- * Default implementation of the {@link FieldMatrixPreservingVisitor} interface.
- * <p>
- * This class is a convenience to create custom visitors without defining all
- * methods. This class provides default implementations that do nothing.
- * </p>
- *
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public class DefaultFieldMatrixPreservingVisitor<T extends FieldElement<T>>
-    implements FieldMatrixPreservingVisitor<T> {
-    /** Zero element of the field. */
-    private final T zero;
-
-    /** Build a new instance.
-     * @param zero additive identity of the field
-     */
-    public DefaultFieldMatrixPreservingVisitor(final T zero) {
-        this.zero = zero;
-    }
-
-    /** {@inheritDoc} */
-    public void start(int rows, int columns,
-                      int startRow, int endRow, int startColumn, int endColumn) {
-    }
-
-    /** {@inheritDoc} */
-    public void visit(int row, int column, T value) {}
-
-    /** {@inheritDoc} */
-    public T end() {
-        return zero;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/DefaultIterativeLinearSolverEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/DefaultIterativeLinearSolverEvent.java b/src/main/java/org/apache/commons/math3/linear/DefaultIterativeLinearSolverEvent.java
deleted file mode 100644
index dbced15..0000000
--- a/src/main/java/org/apache/commons/math3/linear/DefaultIterativeLinearSolverEvent.java
+++ /dev/null
@@ -1,143 +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.linear;
-
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-
-/**
- * A default concrete implementation of the abstract class
- * {@link IterativeLinearSolverEvent}.
- *
- */
-public class DefaultIterativeLinearSolverEvent extends IterativeLinearSolverEvent {
-
-    /** */
-    private static final long serialVersionUID = 20120129L;
-
-    /** The right-hand side vector. */
-    private final RealVector b;
-
-    /** The current estimate of the residual. */
-    private final RealVector r;
-
-    /** The current estimate of the norm of the residual. */
-    private final double rnorm;
-
-    /** The current estimate of the solution. */
-    private final RealVector x;
-
-    /**
-     * Creates a new instance of this class. This implementation does
-     * <em>not</em> deep copy the specified vectors {@code x}, {@code b},
-     * {@code r}. Therefore the user must make sure that these vectors are
-     * either unmodifiable views or deep copies of the same vectors actually
-     * used by the {@code source}. Failure to do so may compromise subsequent
-     * iterations of the {@code source}. If the residual vector {@code r} is
-     * {@code null}, then {@link #getResidual()} throws a
-     * {@link MathUnsupportedOperationException}, and
-     * {@link #providesResidual()} returns {@code false}.
-     *
-     * @param source the iterative solver which fired this event
-     * @param iterations the number of iterations performed at the time
-     * {@code this} event is created
-     * @param x the current estimate of the solution
-     * @param b the right-hand side vector
-     * @param r the current estimate of the residual (can be {@code null})
-     * @param rnorm the norm of the current estimate of the residual
-     */
-    public DefaultIterativeLinearSolverEvent(final Object source, final int iterations,
-        final RealVector x, final RealVector b, final RealVector r,
-        final double rnorm) {
-        super(source, iterations);
-        this.x = x;
-        this.b = b;
-        this.r = r;
-        this.rnorm = rnorm;
-    }
-
-    /**
-     * Creates a new instance of this class. This implementation does
-     * <em>not</em> deep copy the specified vectors {@code x}, {@code b}.
-     * Therefore the user must make sure that these vectors are either
-     * unmodifiable views or deep copies of the same vectors actually used by
-     * the {@code source}. Failure to do so may compromise subsequent iterations
-     * of the {@code source}. Callling {@link #getResidual()} on instances
-     * returned by this constructor throws a
-     * {@link MathUnsupportedOperationException}, while
-     * {@link #providesResidual()} returns {@code false}.
-     *
-     * @param source the iterative solver which fired this event
-     * @param iterations the number of iterations performed at the time
-     * {@code this} event is created
-     * @param x the current estimate of the solution
-     * @param b the right-hand side vector
-     * @param rnorm the norm of the current estimate of the residual
-     */
-    public DefaultIterativeLinearSolverEvent(final Object source, final int iterations,
-        final RealVector x, final RealVector b, final double rnorm) {
-        super(source, iterations);
-        this.x = x;
-        this.b = b;
-        this.r = null;
-        this.rnorm = rnorm;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getNormOfResidual() {
-        return rnorm;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * This implementation throws an {@link MathUnsupportedOperationException}
-     * if no residual vector {@code r} was provided at construction time.
-     */
-    @Override
-    public RealVector getResidual() {
-        if (r != null) {
-            return r;
-        }
-        throw new MathUnsupportedOperationException();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector getRightHandSideVector() {
-        return b;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector getSolution() {
-        return x;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * This implementation returns {@code true} if a non-{@code null} value was
-     * specified for the residual vector {@code r} at construction time.
-     *
-     * @return {@code true} if {@code r != null}
-     */
-    @Override
-    public boolean providesResidual() {
-        return r != null;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixChangingVisitor.java
deleted file mode 100644
index 64949f7..0000000
--- a/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixChangingVisitor.java
+++ /dev/null
@@ -1,44 +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.linear;
-
-/**
- * Default implementation of the {@link RealMatrixChangingVisitor} interface.
- * <p>
- * This class is a convenience to create custom visitors without defining all
- * methods. This class provides default implementations that do nothing.
- * </p>
- *
- * @since 2.0
- */
-public class DefaultRealMatrixChangingVisitor implements RealMatrixChangingVisitor {
-    /** {@inheritDoc} */
-    public void start(int rows, int columns,
-                      int startRow, int endRow, int startColumn, int endColumn) {
-    }
-
-    /** {@inheritDoc} */
-    public double visit(int row, int column, double value) {
-        return value;
-    }
-
-    /** {@inheritDoc} */
-    public double end() {
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixPreservingVisitor.java
deleted file mode 100644
index 103e85b..0000000
--- a/src/main/java/org/apache/commons/math3/linear/DefaultRealMatrixPreservingVisitor.java
+++ /dev/null
@@ -1,42 +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.linear;
-
-/**
- * Default implementation of the {@link RealMatrixPreservingVisitor} interface.
- * <p>
- * This class is a convenience to create custom visitors without defining all
- * methods. This class provides default implementations that do nothing.
- * </p>
- *
- * @since 2.0
- */
-public class DefaultRealMatrixPreservingVisitor implements RealMatrixPreservingVisitor {
-    /** {@inheritDoc} */
-    public void start(int rows, int columns,
-                      int startRow, int endRow, int startColumn, int endColumn) {
-    }
-
-    /** {@inheritDoc} */
-    public void visit(int row, int column, double value) {}
-
-    /** {@inheritDoc} */
-    public double end() {
-        return 0;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java b/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java
deleted file mode 100644
index 22ab9f1..0000000
--- a/src/main/java/org/apache/commons/math3/linear/DiagonalMatrix.java
+++ /dev/null
@@ -1,370 +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.linear;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * Implementation of a diagonal matrix.
- *
- * @since 3.1.1
- */
-public class DiagonalMatrix extends AbstractRealMatrix
-    implements Serializable {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20121229L;
-    /** Entries of the diagonal. */
-    private final double[] data;
-
-    /**
-     * Creates a matrix with the supplied dimension.
-     *
-     * @param dimension Number of rows and columns in the new matrix.
-     * @throws NotStrictlyPositiveException if the dimension is
-     * not positive.
-     */
-    public DiagonalMatrix(final int dimension)
-        throws NotStrictlyPositiveException {
-        super(dimension, dimension);
-        data = new double[dimension];
-    }
-
-    /**
-     * Creates a matrix using the input array as the underlying data.
-     * <br/>
-     * The input array is copied, not referenced.
-     *
-     * @param d Data for the new matrix.
-     */
-    public DiagonalMatrix(final double[] d) {
-        this(d, true);
-    }
-
-    /**
-     * Creates a matrix using the input array as the underlying data.
-     * <br/>
-     * If an array is created specially in order to be embedded in a
-     * this instance and not used directly, the {@code copyArray} may be
-     * set to {@code false}.
-     * This will prevent the copying and improve performance as no new
-     * array will be built and no data will be copied.
-     *
-     * @param d Data for new matrix.
-     * @param copyArray if {@code true}, the input array will be copied,
-     * otherwise it will be referenced.
-     * @exception NullArgumentException if d is null
-     */
-    public DiagonalMatrix(final double[] d, final boolean copyArray)
-        throws NullArgumentException {
-        MathUtils.checkNotNull(d);
-        data = copyArray ? d.clone() : d;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws DimensionMismatchException if the requested dimensions are not equal.
-     */
-    @Override
-    public RealMatrix createMatrix(final int rowDimension,
-                                   final int columnDimension)
-        throws NotStrictlyPositiveException,
-               DimensionMismatchException {
-        if (rowDimension != columnDimension) {
-            throw new DimensionMismatchException(rowDimension, columnDimension);
-        }
-
-        return new DiagonalMatrix(rowDimension);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealMatrix copy() {
-        return new DiagonalMatrix(data);
-    }
-
-    /**
-     * Compute the sum of {@code this} and {@code m}.
-     *
-     * @param m Matrix to be added.
-     * @return {@code this + m}.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this}.
-     */
-    public DiagonalMatrix add(final DiagonalMatrix m)
-        throws MatrixDimensionMismatchException {
-        // Safety check.
-        MatrixUtils.checkAdditionCompatible(this, m);
-
-        final int dim = getRowDimension();
-        final double[] outData = new double[dim];
-        for (int i = 0; i < dim; i++) {
-            outData[i] = data[i] + m.data[i];
-        }
-
-        return new DiagonalMatrix(outData, false);
-    }
-
-    /**
-     * Returns {@code this} minus {@code m}.
-     *
-     * @param m Matrix to be subtracted.
-     * @return {@code this - m}
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this}.
-     */
-    public DiagonalMatrix subtract(final DiagonalMatrix m)
-        throws MatrixDimensionMismatchException {
-        MatrixUtils.checkSubtractionCompatible(this, m);
-
-        final int dim = getRowDimension();
-        final double[] outData = new double[dim];
-        for (int i = 0; i < dim; i++) {
-            outData[i] = data[i] - m.data[i];
-        }
-
-        return new DiagonalMatrix(outData, false);
-    }
-
-    /**
-     * Returns the result of postmultiplying {@code this} by {@code m}.
-     *
-     * @param m matrix to postmultiply by
-     * @return {@code this * m}
-     * @throws DimensionMismatchException if
-     * {@code columnDimension(this) != rowDimension(m)}
-     */
-    public DiagonalMatrix multiply(final DiagonalMatrix m)
-        throws DimensionMismatchException {
-        MatrixUtils.checkMultiplicationCompatible(this, m);
-
-        final int dim = getRowDimension();
-        final double[] outData = new double[dim];
-        for (int i = 0; i < dim; i++) {
-            outData[i] = data[i] * m.data[i];
-        }
-
-        return new DiagonalMatrix(outData, false);
-    }
-
-    /**
-     * Returns the result of postmultiplying {@code this} by {@code m}.
-     *
-     * @param m matrix to postmultiply by
-     * @return {@code this * m}
-     * @throws DimensionMismatchException if
-     * {@code columnDimension(this) != rowDimension(m)}
-     */
-    @Override
-    public RealMatrix multiply(final RealMatrix m)
-        throws DimensionMismatchException {
-        if (m instanceof DiagonalMatrix) {
-            return multiply((DiagonalMatrix) m);
-        } else {
-            MatrixUtils.checkMultiplicationCompatible(this, m);
-            final int nRows = m.getRowDimension();
-            final int nCols = m.getColumnDimension();
-            final double[][] product = new double[nRows][nCols];
-            for (int r = 0; r < nRows; r++) {
-                for (int c = 0; c < nCols; c++) {
-                    product[r][c] = data[r] * m.getEntry(r, c);
-                }
-            }
-            return new Array2DRowRealMatrix(product, false);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[][] getData() {
-        final int dim = getRowDimension();
-        final double[][] out = new double[dim][dim];
-
-        for (int i = 0; i < dim; i++) {
-            out[i][i] = data[i];
-        }
-
-        return out;
-    }
-
-    /**
-     * Gets a reference to the underlying data array.
-     *
-     * @return 1-dimensional array of entries.
-     */
-    public double[] getDataRef() {
-        return data;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double getEntry(final int row, final int column)
-        throws OutOfRangeException {
-        MatrixUtils.checkMatrixIndex(this, row, column);
-        return row == column ? data[row] : 0;
-    }
-
-    /** {@inheritDoc}
-     * @throws NumberIsTooLargeException if {@code row != column} and value is non-zero.
-     */
-    @Override
-    public void setEntry(final int row, final int column, final double value)
-        throws OutOfRangeException, NumberIsTooLargeException {
-        if (row == column) {
-            MatrixUtils.checkRowIndex(this, row);
-            data[row] = value;
-        } else {
-            ensureZero(value);
-        }
-    }
-
-    /** {@inheritDoc}
-     * @throws NumberIsTooLargeException if {@code row != column} and increment is non-zero.
-     */
-    @Override
-    public void addToEntry(final int row,
-                           final int column,
-                           final double increment)
-        throws OutOfRangeException, NumberIsTooLargeException {
-        if (row == column) {
-            MatrixUtils.checkRowIndex(this, row);
-            data[row] += increment;
-        } else {
-            ensureZero(increment);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public void multiplyEntry(final int row,
-                              final int column,
-                              final double factor)
-        throws OutOfRangeException {
-        // we don't care about non-diagonal elements for multiplication
-        if (row == column) {
-            MatrixUtils.checkRowIndex(this, row);
-            data[row] *= factor;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getRowDimension() {
-        return data.length;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getColumnDimension() {
-        return data.length;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] operate(final double[] v)
-        throws DimensionMismatchException {
-        return multiply(new DiagonalMatrix(v, false)).getDataRef();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double[] preMultiply(final double[] v)
-        throws DimensionMismatchException {
-        return operate(v);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector preMultiply(final RealVector v) throws DimensionMismatchException {
-        final double[] vectorData;
-        if (v instanceof ArrayRealVector) {
-            vectorData = ((ArrayRealVector) v).getDataRef();
-        } else {
-            vectorData = v.toArray();
-        }
-        return MatrixUtils.createRealVector(preMultiply(vectorData));
-    }
-
-    /** Ensure a value is zero.
-     * @param value value to check
-     * @exception NumberIsTooLargeException if value is not zero
-     */
-    private void ensureZero(final double value) throws NumberIsTooLargeException {
-        if (!Precision.equals(0.0, value, 1)) {
-            throw new NumberIsTooLargeException(FastMath.abs(value), 0, true);
-        }
-    }
-
-    /**
-     * Computes the inverse of this diagonal matrix.
-     * <p>
-     * Note: this method will use a singularity threshold of 0,
-     * use {@link #inverse(double)} if a different threshold is needed.
-     *
-     * @return the inverse of {@code m}
-     * @throws SingularMatrixException if the matrix is singular
-     * @since 3.3
-     */
-    public DiagonalMatrix inverse() throws SingularMatrixException {
-        return inverse(0);
-    }
-
-    /**
-     * Computes the inverse of this diagonal matrix.
-     *
-     * @param threshold Singularity threshold.
-     * @return the inverse of {@code m}
-     * @throws SingularMatrixException if the matrix is singular
-     * @since 3.3
-     */
-    public DiagonalMatrix inverse(double threshold) throws SingularMatrixException {
-        if (isSingular(threshold)) {
-            throw new SingularMatrixException();
-        }
-
-        final double[] result = new double[data.length];
-        for (int i = 0; i < data.length; i++) {
-            result[i] = 1.0 / data[i];
-        }
-        return new DiagonalMatrix(result, false);
-    }
-
-    /** Returns whether this diagonal matrix is singular, i.e. any diagonal entry
-     * is equal to {@code 0} within the given threshold.
-     *
-     * @param threshold Singularity threshold.
-     * @return {@code true} if the matrix is singular, {@code false} otherwise
-     * @since 3.3
-     */
-    public boolean isSingular(double threshold) {
-        for (int i = 0; i < data.length; i++) {
-            if (Precision.equals(data[i], 0.0, threshold)) {
-                return true;
-            }
-        }
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/EigenDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/EigenDecomposition.java b/src/main/java/org/apache/commons/math3/linear/EigenDecomposition.java
deleted file mode 100644
index bd3819e..0000000
--- a/src/main/java/org/apache/commons/math3/linear/EigenDecomposition.java
+++ /dev/null
@@ -1,970 +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.linear;
-
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Calculates the eigen decomposition of a real matrix.
- * <p>The eigen decomposition of matrix A is a set of two matrices:
- * V and D such that A = V &times; D &times; V<sup>T</sup>.
- * A, V and D are all m &times; m matrices.</p>
- * <p>This class is similar in spirit to the <code>EigenvalueDecomposition</code>
- * class from the <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a>
- * library, with the following changes:</p>
- * <ul>
- *   <li>a {@link #getVT() getVt} method has been added,</li>
- *   <li>two {@link #getRealEigenvalue(int) getRealEigenvalue} and {@link #getImagEigenvalue(int)
- *   getImagEigenvalue} methods to pick up a single eigenvalue have been added,</li>
- *   <li>a {@link #getEigenvector(int) getEigenvector} method to pick up a single
- *   eigenvector has been added,</li>
- *   <li>a {@link #getDeterminant() getDeterminant} method has been added.</li>
- *   <li>a {@link #getSolver() getSolver} method has been added.</li>
- * </ul>
- * <p>
- * As of 3.1, this class supports general real matrices (both symmetric and non-symmetric):
- * </p>
- * <p>
- * If A is symmetric, then A = V*D*V' where the eigenvalue matrix D is diagonal and the eigenvector
- * matrix V is orthogonal, i.e. A = V.multiply(D.multiply(V.transpose())) and
- * V.multiply(V.transpose()) equals the identity matrix.
- * </p>
- * <p>
- * If A is not symmetric, then the eigenvalue matrix D is block diagonal with the real eigenvalues
- * in 1-by-1 blocks and any complex eigenvalues, lambda + i*mu, in 2-by-2 blocks:
- * <pre>
- *    [lambda, mu    ]
- *    [   -mu, lambda]
- * </pre>
- * The columns of V represent the eigenvectors in the sense that A*V = V*D,
- * i.e. A.multiply(V) equals V.multiply(D).
- * The matrix V may be badly conditioned, or even singular, so the validity of the equation
- * A = V*D*inverse(V) depends upon the condition of V.
- * </p>
- * <p>
- * This implementation is based on the paper by A. Drubrulle, R.S. Martin and
- * J.H. Wilkinson "The Implicit QL Algorithm" in Wilksinson and Reinsch (1971)
- * Handbook for automatic computation, vol. 2, Linear algebra, Springer-Verlag,
- * New-York
- * </p>
- * @see <a href="http://mathworld.wolfram.com/EigenDecomposition.html">MathWorld</a>
- * @see <a href="http://en.wikipedia.org/wiki/Eigendecomposition_of_a_matrix">Wikipedia</a>
- * @since 2.0 (changed to concrete class in 3.0)
- */
-public class EigenDecomposition {
-    /** Internally used epsilon criteria. */
-    private static final double EPSILON = 1e-12;
-    /** Maximum number of iterations accepted in the implicit QL transformation */
-    private byte maxIter = 30;
-    /** Main diagonal of the tridiagonal matrix. */
-    private double[] main;
-    /** Secondary diagonal of the tridiagonal matrix. */
-    private double[] secondary;
-    /**
-     * Transformer to tridiagonal (may be null if matrix is already
-     * tridiagonal).
-     */
-    private TriDiagonalTransformer transformer;
-    /** Real part of the realEigenvalues. */
-    private double[] realEigenvalues;
-    /** Imaginary part of the realEigenvalues. */
-    private double[] imagEigenvalues;
-    /** Eigenvectors. */
-    private ArrayRealVector[] eigenvectors;
-    /** Cached value of V. */
-    private RealMatrix cachedV;
-    /** Cached value of D. */
-    private RealMatrix cachedD;
-    /** Cached value of Vt. */
-    private RealMatrix cachedVt;
-    /** Whether the matrix is symmetric. */
-    private final boolean isSymmetric;
-
-    /**
-     * Calculates the eigen decomposition of the given real matrix.
-     * <p>
-     * Supports decomposition of a general matrix since 3.1.
-     *
-     * @param matrix Matrix to decompose.
-     * @throws MaxCountExceededException if the algorithm fails to converge.
-     * @throws MathArithmeticException if the decomposition of a general matrix
-     * results in a matrix with zero norm
-     * @since 3.1
-     */
-    public EigenDecomposition(final RealMatrix matrix)
-        throws MathArithmeticException {
-        final double symTol = 10 * matrix.getRowDimension() * matrix.getColumnDimension() * Precision.EPSILON;
-        isSymmetric = MatrixUtils.isSymmetric(matrix, symTol);
-        if (isSymmetric) {
-            transformToTridiagonal(matrix);
-            findEigenVectors(transformer.getQ().getData());
-        } else {
-            final SchurTransformer t = transformToSchur(matrix);
-            findEigenVectorsFromSchur(t);
-        }
-    }
-
-    /**
-     * Calculates the eigen decomposition of the given real matrix.
-     *
-     * @param matrix Matrix to decompose.
-     * @param splitTolerance Dummy parameter (present for backward
-     * compatibility only).
-     * @throws MathArithmeticException  if the decomposition of a general matrix
-     * results in a matrix with zero norm
-     * @throws MaxCountExceededException if the algorithm fails to converge.
-     * @deprecated in 3.1 (to be removed in 4.0) due to unused parameter
-     */
-    @Deprecated
-    public EigenDecomposition(final RealMatrix matrix,
-                              final double splitTolerance)
-        throws MathArithmeticException {
-        this(matrix);
-    }
-
-    /**
-     * Calculates the eigen decomposition of the symmetric tridiagonal
-     * matrix.  The Householder matrix is assumed to be the identity matrix.
-     *
-     * @param main Main diagonal of the symmetric tridiagonal form.
-     * @param secondary Secondary of the tridiagonal form.
-     * @throws MaxCountExceededException if the algorithm fails to converge.
-     * @since 3.1
-     */
-    public EigenDecomposition(final double[] main, final double[] secondary) {
-        isSymmetric = true;
-        this.main      = main.clone();
-        this.secondary = secondary.clone();
-        transformer    = null;
-        final int size = main.length;
-        final double[][] z = new double[size][size];
-        for (int i = 0; i < size; i++) {
-            z[i][i] = 1.0;
-        }
-        findEigenVectors(z);
-    }
-
-    /**
-     * Calculates the eigen decomposition of the symmetric tridiagonal
-     * matrix.  The Householder matrix is assumed to be the identity matrix.
-     *
-     * @param main Main diagonal of the symmetric tridiagonal form.
-     * @param secondary Secondary of the tridiagonal form.
-     * @param splitTolerance Dummy parameter (present for backward
-     * compatibility only).
-     * @throws MaxCountExceededException if the algorithm fails to converge.
-     * @deprecated in 3.1 (to be removed in 4.0) due to unused parameter
-     */
-    @Deprecated
-    public EigenDecomposition(final double[] main, final double[] secondary,
-                              final double splitTolerance) {
-        this(main, secondary);
-    }
-
-    /**
-     * Gets the matrix V of the decomposition.
-     * V is an orthogonal matrix, i.e. its transpose is also its inverse.
-     * The columns of V are the eigenvectors of the original matrix.
-     * No assumption is made about the orientation of the system axes formed
-     * by the columns of V (e.g. in a 3-dimension space, V can form a left-
-     * or right-handed system).
-     *
-     * @return the V matrix.
-     */
-    public RealMatrix getV() {
-
-        if (cachedV == null) {
-            final int m = eigenvectors.length;
-            cachedV = MatrixUtils.createRealMatrix(m, m);
-            for (int k = 0; k < m; ++k) {
-                cachedV.setColumnVector(k, eigenvectors[k]);
-            }
-        }
-        // return the cached matrix
-        return cachedV;
-    }
-
-    /**
-     * Gets the block diagonal matrix D of the decomposition.
-     * D is a block diagonal matrix.
-     * Real eigenvalues are on the diagonal while complex values are on
-     * 2x2 blocks { {real +imaginary}, {-imaginary, real} }.
-     *
-     * @return the D matrix.
-     *
-     * @see #getRealEigenvalues()
-     * @see #getImagEigenvalues()
-     */
-    public RealMatrix getD() {
-
-        if (cachedD == null) {
-            // cache the matrix for subsequent calls
-            cachedD = MatrixUtils.createRealDiagonalMatrix(realEigenvalues);
-
-            for (int i = 0; i < imagEigenvalues.length; i++) {
-                if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) > 0) {
-                    cachedD.setEntry(i, i+1, imagEigenvalues[i]);
-                } else if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) < 0) {
-                    cachedD.setEntry(i, i-1, imagEigenvalues[i]);
-                }
-            }
-        }
-        return cachedD;
-    }
-
-    /**
-     * Gets the transpose of the matrix V of the decomposition.
-     * V is an orthogonal matrix, i.e. its transpose is also its inverse.
-     * The columns of V are the eigenvectors of the original matrix.
-     * No assumption is made about the orientation of the system axes formed
-     * by the columns of V (e.g. in a 3-dimension space, V can form a left-
-     * or right-handed system).
-     *
-     * @return the transpose of the V matrix.
-     */
-    public RealMatrix getVT() {
-
-        if (cachedVt == null) {
-            final int m = eigenvectors.length;
-            cachedVt = MatrixUtils.createRealMatrix(m, m);
-            for (int k = 0; k < m; ++k) {
-                cachedVt.setRowVector(k, eigenvectors[k]);
-            }
-        }
-
-        // return the cached matrix
-        return cachedVt;
-    }
-
-    /**
-     * Returns whether the calculated eigen values are complex or real.
-     * <p>The method performs a zero check for each element of the
-     * {@link #getImagEigenvalues()} array and returns {@code true} if any
-     * element is not equal to zero.
-     *
-     * @return {@code true} if the eigen values are complex, {@code false} otherwise
-     * @since 3.1
-     */
-    public boolean hasComplexEigenvalues() {
-        for (int i = 0; i < imagEigenvalues.length; i++) {
-            if (!Precision.equals(imagEigenvalues[i], 0.0, EPSILON)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Gets a copy of the real parts of the eigenvalues of the original matrix.
-     *
-     * @return a copy of the real parts of the eigenvalues of the original matrix.
-     *
-     * @see #getD()
-     * @see #getRealEigenvalue(int)
-     * @see #getImagEigenvalues()
-     */
-    public double[] getRealEigenvalues() {
-        return realEigenvalues.clone();
-    }
-
-    /**
-     * Returns the real part of the i<sup>th</sup> eigenvalue of the original
-     * matrix.
-     *
-     * @param i index of the eigenvalue (counting from 0)
-     * @return real part of the i<sup>th</sup> eigenvalue of the original
-     * matrix.
-     *
-     * @see #getD()
-     * @see #getRealEigenvalues()
-     * @see #getImagEigenvalue(int)
-     */
-    public double getRealEigenvalue(final int i) {
-        return realEigenvalues[i];
-    }
-
-    /**
-     * Gets a copy of the imaginary parts of the eigenvalues of the original
-     * matrix.
-     *
-     * @return a copy of the imaginary parts of the eigenvalues of the original
-     * matrix.
-     *
-     * @see #getD()
-     * @see #getImagEigenvalue(int)
-     * @see #getRealEigenvalues()
-     */
-    public double[] getImagEigenvalues() {
-        return imagEigenvalues.clone();
-    }
-
-    /**
-     * Gets the imaginary part of the i<sup>th</sup> eigenvalue of the original
-     * matrix.
-     *
-     * @param i Index of the eigenvalue (counting from 0).
-     * @return the imaginary part of the i<sup>th</sup> eigenvalue of the original
-     * matrix.
-     *
-     * @see #getD()
-     * @see #getImagEigenvalues()
-     * @see #getRealEigenvalue(int)
-     */
-    public double getImagEigenvalue(final int i) {
-        return imagEigenvalues[i];
-    }
-
-    /**
-     * Gets a copy of the i<sup>th</sup> eigenvector of the original matrix.
-     *
-     * @param i Index of the eigenvector (counting from 0).
-     * @return a copy of the i<sup>th</sup> eigenvector of the original matrix.
-     * @see #getD()
-     */
-    public RealVector getEigenvector(final int i) {
-        return eigenvectors[i].copy();
-    }
-
-    /**
-     * Computes the determinant of the matrix.
-     *
-     * @return the determinant of the matrix.
-     */
-    public double getDeterminant() {
-        double determinant = 1;
-        for (double lambda : realEigenvalues) {
-            determinant *= lambda;
-        }
-        return determinant;
-    }
-
-    /**
-     * Computes the square-root of the matrix.
-     * This implementation assumes that the matrix is symmetric and positive
-     * definite.
-     *
-     * @return the square-root of the matrix.
-     * @throws MathUnsupportedOperationException if the matrix is not
-     * symmetric or not positive definite.
-     * @since 3.1
-     */
-    public RealMatrix getSquareRoot() {
-        if (!isSymmetric) {
-            throw new MathUnsupportedOperationException();
-        }
-
-        final double[] sqrtEigenValues = new double[realEigenvalues.length];
-        for (int i = 0; i < realEigenvalues.length; i++) {
-            final double eigen = realEigenvalues[i];
-            if (eigen <= 0) {
-                throw new MathUnsupportedOperationException();
-            }
-            sqrtEigenValues[i] = FastMath.sqrt(eigen);
-        }
-        final RealMatrix sqrtEigen = MatrixUtils.createRealDiagonalMatrix(sqrtEigenValues);
-        final RealMatrix v = getV();
-        final RealMatrix vT = getVT();
-
-        return v.multiply(sqrtEigen).multiply(vT);
-    }
-
-    /**
-     * Gets a solver for finding the A &times; X = B solution in exact
-     * linear sense.
-     * <p>
-     * Since 3.1, eigen decomposition of a general matrix is supported,
-     * but the {@link DecompositionSolver} only supports real eigenvalues.
-     *
-     * @return a solver
-     * @throws MathUnsupportedOperationException if the decomposition resulted in
-     * complex eigenvalues
-     */
-    public DecompositionSolver getSolver() {
-        if (hasComplexEigenvalues()) {
-            throw new MathUnsupportedOperationException();
-        }
-        return new Solver(realEigenvalues, imagEigenvalues, eigenvectors);
-    }
-
-    /** Specialized solver. */
-    private static class Solver implements DecompositionSolver {
-        /** Real part of the realEigenvalues. */
-        private double[] realEigenvalues;
-        /** Imaginary part of the realEigenvalues. */
-        private double[] imagEigenvalues;
-        /** Eigenvectors. */
-        private final ArrayRealVector[] eigenvectors;
-
-        /**
-         * Builds a solver from decomposed matrix.
-         *
-         * @param realEigenvalues Real parts of the eigenvalues.
-         * @param imagEigenvalues Imaginary parts of the eigenvalues.
-         * @param eigenvectors Eigenvectors.
-         */
-        private Solver(final double[] realEigenvalues,
-                final double[] imagEigenvalues,
-                final ArrayRealVector[] eigenvectors) {
-            this.realEigenvalues = realEigenvalues;
-            this.imagEigenvalues = imagEigenvalues;
-            this.eigenvectors = eigenvectors;
-        }
-
-        /**
-         * Solves the linear equation A &times; X = B for symmetric matrices A.
-         * <p>
-         * This method only finds exact linear solutions, i.e. solutions for
-         * which ||A &times; X - B|| is exactly 0.
-         * </p>
-         *
-         * @param b Right-hand side of the equation A &times; X = B.
-         * @return a Vector X that minimizes the two norm of A &times; X - B.
-         *
-         * @throws DimensionMismatchException if the matrices dimensions do not match.
-         * @throws SingularMatrixException if the decomposed matrix is singular.
-         */
-        public RealVector solve(final RealVector b) {
-            if (!isNonSingular()) {
-                throw new SingularMatrixException();
-            }
-
-            final int m = realEigenvalues.length;
-            if (b.getDimension() != m) {
-                throw new DimensionMismatchException(b.getDimension(), m);
-            }
-
-            final double[] bp = new double[m];
-            for (int i = 0; i < m; ++i) {
-                final ArrayRealVector v = eigenvectors[i];
-                final double[] vData = v.getDataRef();
-                final double s = v.dotProduct(b) / realEigenvalues[i];
-                for (int j = 0; j < m; ++j) {
-                    bp[j] += s * vData[j];
-                }
-            }
-
-            return new ArrayRealVector(bp, false);
-        }
-
-        /** {@inheritDoc} */
-        public RealMatrix solve(RealMatrix b) {
-
-            if (!isNonSingular()) {
-                throw new SingularMatrixException();
-            }
-
-            final int m = realEigenvalues.length;
-            if (b.getRowDimension() != m) {
-                throw new DimensionMismatchException(b.getRowDimension(), m);
-            }
-
-            final int nColB = b.getColumnDimension();
-            final double[][] bp = new double[m][nColB];
-            final double[] tmpCol = new double[m];
-            for (int k = 0; k < nColB; ++k) {
-                for (int i = 0; i < m; ++i) {
-                    tmpCol[i] = b.getEntry(i, k);
-                    bp[i][k]  = 0;
-                }
-                for (int i = 0; i < m; ++i) {
-                    final ArrayRealVector v = eigenvectors[i];
-                    final double[] vData = v.getDataRef();
-                    double s = 0;
-                    for (int j = 0; j < m; ++j) {
-                        s += v.getEntry(j) * tmpCol[j];
-                    }
-                    s /= realEigenvalues[i];
-                    for (int j = 0; j < m; ++j) {
-                        bp[j][k] += s * vData[j];
-                    }
-                }
-            }
-
-            return new Array2DRowRealMatrix(bp, false);
-
-        }
-
-        /**
-         * Checks whether the decomposed matrix is non-singular.
-         *
-         * @return true if the decomposed matrix is non-singular.
-         */
-        public boolean isNonSingular() {
-            double largestEigenvalueNorm = 0.0;
-            // Looping over all values (in case they are not sorted in decreasing
-            // order of their norm).
-            for (int i = 0; i < realEigenvalues.length; ++i) {
-                largestEigenvalueNorm = FastMath.max(largestEigenvalueNorm, eigenvalueNorm(i));
-            }
-            // Corner case: zero matrix, all exactly 0 eigenvalues
-            if (largestEigenvalueNorm == 0.0) {
-                return false;
-            }
-            for (int i = 0; i < realEigenvalues.length; ++i) {
-                // Looking for eigenvalues that are 0, where we consider anything much much smaller
-                // than the largest eigenvalue to be effectively 0.
-                if (Precision.equals(eigenvalueNorm(i) / largestEigenvalueNorm, 0, EPSILON)) {
-                    return false;
-                }
-            }
-            return true;
-        }
-
-        /**
-         * @param i which eigenvalue to find the norm of
-         * @return the norm of ith (complex) eigenvalue.
-         */
-        private double eigenvalueNorm(int i) {
-            final double re = realEigenvalues[i];
-            final double im = imagEigenvalues[i];
-            return FastMath.sqrt(re * re + im * im);
-        }
-
-        /**
-         * Get the inverse of the decomposed matrix.
-         *
-         * @return the inverse matrix.
-         * @throws SingularMatrixException if the decomposed matrix is singular.
-         */
-        public RealMatrix getInverse() {
-            if (!isNonSingular()) {
-                throw new SingularMatrixException();
-            }
-
-            final int m = realEigenvalues.length;
-            final double[][] invData = new double[m][m];
-
-            for (int i = 0; i < m; ++i) {
-                final double[] invI = invData[i];
-                for (int j = 0; j < m; ++j) {
-                    double invIJ = 0;
-                    for (int k = 0; k < m; ++k) {
-                        final double[] vK = eigenvectors[k].getDataRef();
-                        invIJ += vK[i] * vK[j] / realEigenvalues[k];
-                    }
-                    invI[j] = invIJ;
-                }
-            }
-            return MatrixUtils.createRealMatrix(invData);
-        }
-    }
-
-    /**
-     * Transforms the matrix to tridiagonal form.
-     *
-     * @param matrix Matrix to transform.
-     */
-    private void transformToTridiagonal(final RealMatrix matrix) {
-        // transform the matrix to tridiagonal
-        transformer = new TriDiagonalTransformer(matrix);
-        main = transformer.getMainDiagonalRef();
-        secondary = transformer.getSecondaryDiagonalRef();
-    }
-
-    /**
-     * Find eigenvalues and eigenvectors (Dubrulle et al., 1971)
-     *
-     * @param householderMatrix Householder matrix of the transformation
-     * to tridiagonal form.
-     */
-    private void findEigenVectors(final double[][] householderMatrix) {
-        final double[][]z = householderMatrix.clone();
-        final int n = main.length;
-        realEigenvalues = new double[n];
-        imagEigenvalues = new double[n];
-        final double[] e = new double[n];
-        for (int i = 0; i < n - 1; i++) {
-            realEigenvalues[i] = main[i];
-            e[i] = secondary[i];
-        }
-        realEigenvalues[n - 1] = main[n - 1];
-        e[n - 1] = 0;
-
-        // Determine the largest main and secondary value in absolute term.
-        double maxAbsoluteValue = 0;
-        for (int i = 0; i < n; i++) {
-            if (FastMath.abs(realEigenvalues[i]) > maxAbsoluteValue) {
-                maxAbsoluteValue = FastMath.abs(realEigenvalues[i]);
-            }
-            if (FastMath.abs(e[i]) > maxAbsoluteValue) {
-                maxAbsoluteValue = FastMath.abs(e[i]);
-            }
-        }
-        // Make null any main and secondary value too small to be significant
-        if (maxAbsoluteValue != 0) {
-            for (int i=0; i < n; i++) {
-                if (FastMath.abs(realEigenvalues[i]) <= Precision.EPSILON * maxAbsoluteValue) {
-                    realEigenvalues[i] = 0;
-                }
-                if (FastMath.abs(e[i]) <= Precision.EPSILON * maxAbsoluteValue) {
-                    e[i]=0;
-                }
-            }
-        }
-
-        for (int j = 0; j < n; j++) {
-            int its = 0;
-            int m;
-            do {
-                for (m = j; m < n - 1; m++) {
-                    double delta = FastMath.abs(realEigenvalues[m]) +
-                        FastMath.abs(realEigenvalues[m + 1]);
-                    if (FastMath.abs(e[m]) + delta == delta) {
-                        break;
-                    }
-                }
-                if (m != j) {
-                    if (its == maxIter) {
-                        throw new MaxCountExceededException(LocalizedFormats.CONVERGENCE_FAILED,
-                                                            maxIter);
-                    }
-                    its++;
-                    double q = (realEigenvalues[j + 1] - realEigenvalues[j]) / (2 * e[j]);
-                    double t = FastMath.sqrt(1 + q * q);
-                    if (q < 0.0) {
-                        q = realEigenvalues[m] - realEigenvalues[j] + e[j] / (q - t);
-                    } else {
-                        q = realEigenvalues[m] - realEigenvalues[j] + e[j] / (q + t);
-                    }
-                    double u = 0.0;
-                    double s = 1.0;
-                    double c = 1.0;
-                    int i;
-                    for (i = m - 1; i >= j; i--) {
-                        double p = s * e[i];
-                        double h = c * e[i];
-                        if (FastMath.abs(p) >= FastMath.abs(q)) {
-                            c = q / p;
-                            t = FastMath.sqrt(c * c + 1.0);
-                            e[i + 1] = p * t;
-                            s = 1.0 / t;
-                            c *= s;
-                        } else {
-                            s = p / q;
-                            t = FastMath.sqrt(s * s + 1.0);
-                            e[i + 1] = q * t;
-                            c = 1.0 / t;
-                            s *= c;
-                        }
-                        if (e[i + 1] == 0.0) {
-                            realEigenvalues[i + 1] -= u;
-                            e[m] = 0.0;
-                            break;
-                        }
-                        q = realEigenvalues[i + 1] - u;
-                        t = (realEigenvalues[i] - q) * s + 2.0 * c * h;
-                        u = s * t;
-                        realEigenvalues[i + 1] = q + u;
-                        q = c * t - h;
-                        for (int ia = 0; ia < n; ia++) {
-                            p = z[ia][i + 1];
-                            z[ia][i + 1] = s * z[ia][i] + c * p;
-                            z[ia][i] = c * z[ia][i] - s * p;
-                        }
-                    }
-                    if (t == 0.0 && i >= j) {
-                        continue;
-                    }
-                    realEigenvalues[j] -= u;
-                    e[j] = q;
-                    e[m] = 0.0;
-                }
-            } while (m != j);
-        }
-
-        //Sort the eigen values (and vectors) in increase order
-        for (int i = 0; i < n; i++) {
-            int k = i;
-            double p = realEigenvalues[i];
-            for (int j = i + 1; j < n; j++) {
-                if (realEigenvalues[j] > p) {
-                    k = j;
-                    p = realEigenvalues[j];
-                }
-            }
-            if (k != i) {
-                realEigenvalues[k] = realEigenvalues[i];
-                realEigenvalues[i] = p;
-                for (int j = 0; j < n; j++) {
-                    p = z[j][i];
-                    z[j][i] = z[j][k];
-                    z[j][k] = p;
-                }
-            }
-        }
-
-        // Determine the largest eigen value in absolute term.
-        maxAbsoluteValue = 0;
-        for (int i = 0; i < n; i++) {
-            if (FastMath.abs(realEigenvalues[i]) > maxAbsoluteValue) {
-                maxAbsoluteValue=FastMath.abs(realEigenvalues[i]);
-            }
-        }
-        // Make null any eigen value too small to be significant
-        if (maxAbsoluteValue != 0.0) {
-            for (int i=0; i < n; i++) {
-                if (FastMath.abs(realEigenvalues[i]) < Precision.EPSILON * maxAbsoluteValue) {
-                    realEigenvalues[i] = 0;
-                }
-            }
-        }
-        eigenvectors = new ArrayRealVector[n];
-        final double[] tmp = new double[n];
-        for (int i = 0; i < n; i++) {
-            for (int j = 0; j < n; j++) {
-                tmp[j] = z[j][i];
-            }
-            eigenvectors[i] = new ArrayRealVector(tmp);
-        }
-    }
-
-    /**
-     * Transforms the matrix to Schur form and calculates the eigenvalues.
-     *
-     * @param matrix Matrix to transform.
-     * @return the {@link SchurTransformer Shur transform} for this matrix
-     */
-    private SchurTransformer transformToSchur(final RealMatrix matrix) {
-        final SchurTransformer schurTransform = new SchurTransformer(matrix);
-        final double[][] matT = schurTransform.getT().getData();
-
-        realEigenvalues = new double[matT.length];
-        imagEigenvalues = new double[matT.length];
-
-        for (int i = 0; i < realEigenvalues.length; i++) {
-            if (i == (realEigenvalues.length - 1) ||
-                Precision.equals(matT[i + 1][i], 0.0, EPSILON)) {
-                realEigenvalues[i] = matT[i][i];
-            } else {
-                final double x = matT[i + 1][i + 1];
-                final double p = 0.5 * (matT[i][i] - x);
-                final double z = FastMath.sqrt(FastMath.abs(p * p + matT[i + 1][i] * matT[i][i + 1]));
-                realEigenvalues[i] = x + p;
-                imagEigenvalues[i] = z;
-                realEigenvalues[i + 1] = x + p;
-                imagEigenvalues[i + 1] = -z;
-                i++;
-            }
-        }
-        return schurTransform;
-    }
-
-    /**
-     * Performs a division of two complex numbers.
-     *
-     * @param xr real part of the first number
-     * @param xi imaginary part of the first number
-     * @param yr real part of the second number
-     * @param yi imaginary part of the second number
-     * @return result of the complex division
-     */
-    private Complex cdiv(final double xr, final double xi,
-                         final double yr, final double yi) {
-        return new Complex(xr, xi).divide(new Complex(yr, yi));
-    }
-
-    /**
-     * Find eigenvectors from a matrix transformed to Schur form.
-     *
-     * @param schur the schur transformation of the matrix
-     * @throws MathArithmeticException if the Schur form has a norm of zero
-     */
-    private void findEigenVectorsFromSchur(final SchurTransformer schur)
-        throws MathArithmeticException {
-        final double[][] matrixT = schur.getT().getData();
-        final double[][] matrixP = schur.getP().getData();
-
-        final int n = matrixT.length;
-
-        // compute matrix norm
-        double norm = 0.0;
-        for (int i = 0; i < n; i++) {
-           for (int j = FastMath.max(i - 1, 0); j < n; j++) {
-               norm += FastMath.abs(matrixT[i][j]);
-           }
-        }
-
-        // we can not handle a matrix with zero norm
-        if (Precision.equals(norm, 0.0, EPSILON)) {
-           throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-
-        // Backsubstitute to find vectors of upper triangular form
-
-        double r = 0.0;
-        double s = 0.0;
-        double z = 0.0;
-
-        for (int idx = n - 1; idx >= 0; idx--) {
-            double p = realEigenvalues[idx];
-            double q = imagEigenvalues[idx];
-
-            if (Precision.equals(q, 0.0)) {
-                // Real vector
-                int l = idx;
-                matrixT[idx][idx] = 1.0;
-                for (int i = idx - 1; i >= 0; i--) {
-                    double w = matrixT[i][i] - p;
-                    r = 0.0;
-                    for (int j = l; j <= idx; j++) {
-                        r += matrixT[i][j] * matrixT[j][idx];
-                    }
-                    if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) < 0) {
-                        z = w;
-                        s = r;
-                    } else {
-                        l = i;
-                        if (Precision.equals(imagEigenvalues[i], 0.0)) {
-                            if (w != 0.0) {
-                                matrixT[i][idx] = -r / w;
-                            } else {
-                                matrixT[i][idx] = -r / (Precision.EPSILON * norm);
-                            }
-                        } else {
-                            // Solve real equations
-                            double x = matrixT[i][i + 1];
-                            double y = matrixT[i + 1][i];
-                            q = (realEigenvalues[i] - p) * (realEigenvalues[i] - p) +
-                                imagEigenvalues[i] * imagEigenvalues[i];
-                            double t = (x * s - z * r) / q;
-                            matrixT[i][idx] = t;
-                            if (FastMath.abs(x) > FastMath.abs(z)) {
-                                matrixT[i + 1][idx] = (-r - w * t) / x;
-                            } else {
-                                matrixT[i + 1][idx] = (-s - y * t) / z;
-                            }
-                        }
-
-                        // Overflow control
-                        double t = FastMath.abs(matrixT[i][idx]);
-                        if ((Precision.EPSILON * t) * t > 1) {
-                            for (int j = i; j <= idx; j++) {
-                                matrixT[j][idx] /= t;
-                            }
-                        }
-                    }
-                }
-            } else if (q < 0.0) {
-                // Complex vector
-                int l = idx - 1;
-
-                // Last vector component imaginary so matrix is triangular
-                if (FastMath.abs(matrixT[idx][idx - 1]) > FastMath.abs(matrixT[idx - 1][idx])) {
-                    matrixT[idx - 1][idx - 1] = q / matrixT[idx][idx - 1];
-                    matrixT[idx - 1][idx]     = -(matrixT[idx][idx] - p) / matrixT[idx][idx - 1];
-                } else {
-                    final Complex result = cdiv(0.0, -matrixT[idx - 1][idx],
-                                                matrixT[idx - 1][idx - 1] - p, q);
-                    matrixT[idx - 1][idx - 1] = result.getReal();
-                    matrixT[idx - 1][idx]     = result.getImaginary();
-                }
-
-                matrixT[idx][idx - 1] = 0.0;
-                matrixT[idx][idx]     = 1.0;
-
-                for (int i = idx - 2; i >= 0; i--) {
-                    double ra = 0.0;
-                    double sa = 0.0;
-                    for (int j = l; j <= idx; j++) {
-                        ra += matrixT[i][j] * matrixT[j][idx - 1];
-                        sa += matrixT[i][j] * matrixT[j][idx];
-                    }
-                    double w = matrixT[i][i] - p;
-
-                    if (Precision.compareTo(imagEigenvalues[i], 0.0, EPSILON) < 0) {
-                        z = w;
-                        r = ra;
-                        s = sa;
-                    } else {
-                        l = i;
-                        if (Precision.equals(imagEigenvalues[i], 0.0)) {
-                            final Complex c = cdiv(-ra, -sa, w, q);
-                            matrixT[i][idx - 1] = c.getReal();
-                            matrixT[i][idx] = c.getImaginary();
-                        } else {
-                            // Solve complex equations
-                            double x = matrixT[i][i + 1];
-                            double y = matrixT[i + 1][i];
-                            double vr = (realEigenvalues[i] - p) * (realEigenvalues[i] - p) +
-                                        imagEigenvalues[i] * imagEigenvalues[i] - q * q;
-                            final double vi = (realEigenvalues[i] - p) * 2.0 * q;
-                            if (Precision.equals(vr, 0.0) && Precision.equals(vi, 0.0)) {
-                                vr = Precision.EPSILON * norm *
-                                     (FastMath.abs(w) + FastMath.abs(q) + FastMath.abs(x) +
-                                      FastMath.abs(y) + FastMath.abs(z));
-                            }
-                            final Complex c     = cdiv(x * r - z * ra + q * sa,
-                                                       x * s - z * sa - q * ra, vr, vi);
-                            matrixT[i][idx - 1] = c.getReal();
-                            matrixT[i][idx]     = c.getImaginary();
-
-                            if (FastMath.abs(x) > (FastMath.abs(z) + FastMath.abs(q))) {
-                                matrixT[i + 1][idx - 1] = (-ra - w * matrixT[i][idx - 1] +
-                                                           q * matrixT[i][idx]) / x;
-                                matrixT[i + 1][idx]     = (-sa - w * matrixT[i][idx] -
-                                                           q * matrixT[i][idx - 1]) / x;
-                            } else {
-                                final Complex c2        = cdiv(-r - y * matrixT[i][idx - 1],
-                                                               -s - y * matrixT[i][idx], z, q);
-                                matrixT[i + 1][idx - 1] = c2.getReal();
-                                matrixT[i + 1][idx]     = c2.getImaginary();
-                            }
-                        }
-
-                        // Overflow control
-                        double t = FastMath.max(FastMath.abs(matrixT[i][idx - 1]),
-                                                FastMath.abs(matrixT[i][idx]));
-                        if ((Precision.EPSILON * t) * t > 1) {
-                            for (int j = i; j <= idx; j++) {
-                                matrixT[j][idx - 1] /= t;
-                                matrixT[j][idx] /= t;
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        // Back transformation to get eigenvectors of original matrix
-        for (int j = n - 1; j >= 0; j--) {
-            for (int i = 0; i <= n - 1; i++) {
-                z = 0.0;
-                for (int k = 0; k <= FastMath.min(j, n - 1); k++) {
-                    z += matrixP[i][k] * matrixT[k][j];
-                }
-                matrixP[i][j] = z;
-            }
-        }
-
-        eigenvectors = new ArrayRealVector[n];
-        final double[] tmp = new double[n];
-        for (int i = 0; i < n; i++) {
-            for (int j = 0; j < n; j++) {
-                tmp[j] = matrixP[j][i];
-            }
-            eigenvectors[i] = new ArrayRealVector(tmp);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldDecompositionSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldDecompositionSolver.java b/src/main/java/org/apache/commons/math3/linear/FieldDecompositionSolver.java
deleted file mode 100644
index 322eb3b..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldDecompositionSolver.java
+++ /dev/null
@@ -1,75 +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.linear;
-
-import org.apache.commons.math3.FieldElement;
-
-
-/**
- * Interface handling decomposition algorithms that can solve A &times; X = B.
- * <p>Decomposition algorithms decompose an A matrix has a product of several specific
- * matrices from which they can solve A &times; X = B in least squares sense: they find X
- * such that ||A &times; X - B|| is minimal.</p>
- * <p>Some solvers like {@link FieldLUDecomposition} can only find the solution for
- * square matrices and when the solution is an exact linear solution, i.e. when
- * ||A &times; X - B|| is exactly 0. Other solvers can also find solutions
- * with non-square matrix A and with non-null minimal norm. If an exact linear
- * solution exists it is also the minimal norm solution.</p>
- *
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public interface FieldDecompositionSolver<T extends FieldElement<T>> {
-
-    /** Solve the linear equation A &times; X = B for matrices A.
-     * <p>The A matrix is implicit, it is provided by the underlying
-     * decomposition algorithm.</p>
-     * @param b right-hand side of the equation A &times; X = B
-     * @return a vector X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if the matrices dimensions do not match.
-     * @throws SingularMatrixException
-     * if the decomposed matrix is singular.
-     */
-    FieldVector<T> solve(final FieldVector<T> b);
-
-    /** Solve the linear equation A &times; X = B for matrices A.
-     * <p>The A matrix is implicit, it is provided by the underlying
-     * decomposition algorithm.</p>
-     * @param b right-hand side of the equation A &times; X = B
-     * @return a matrix X that minimizes the two norm of A &times; X - B
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if the matrices dimensions do not match.
-     * @throws SingularMatrixException
-     * if the decomposed matrix is singular.
-     */
-    FieldMatrix<T> solve(final FieldMatrix<T> b);
-
-    /**
-     * Check if the decomposed matrix is non-singular.
-     * @return true if the decomposed matrix is non-singular
-     */
-    boolean isNonSingular();
-
-    /** Get the inverse (or pseudo-inverse) of the decomposed matrix.
-     * @return inverse matrix
-     * @throws SingularMatrixException
-     * if the decomposed matrix is singular.
-     */
-    FieldMatrix<T> getInverse();
-}


[49/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java b/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java
deleted file mode 100644
index 45a3331..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java
+++ /dev/null
@@ -1,1822 +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.analysis.differentiation;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicReference;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-
-/** Class holding "compiled" computation rules for derivative structures.
- * <p>This class implements the computation rules described in Dan Kalman's paper <a
- * href="http://www1.american.edu/cas/mathstat/People/kalman/pdffiles/mmgautodiff.pdf">Doubly
- * Recursive Multivariate Automatic Differentiation</a>, Mathematics Magazine, vol. 75,
- * no. 3, June 2002. However, in order to avoid performances bottlenecks, the recursive
- * rules are "compiled" once in an unfold form. This class does this recursion unrolling
- * and stores the computation rules as simple loops with pre-computed indirection arrays.</p>
- * <p>
- * This class maps all derivative computation into single dimension arrays that hold the
- * value and partial derivatives. The class does not hold these arrays, which remains under
- * the responsibility of the caller. For each combination of number of free parameters and
- * derivation order, only one compiler is necessary, and this compiler will be used to
- * perform computations on all arrays provided to it, which can represent hundreds or
- * thousands of different parameters kept together with all theur partial derivatives.
- * </p>
- * <p>
- * The arrays on which compilers operate contain only the partial derivatives together
- * with the 0<sup>th</sup> derivative, i.e. the value. The partial derivatives are stored in
- * a compiler-specific order, which can be retrieved using methods {@link
- * #getPartialDerivativeIndex(int...) getPartialDerivativeIndex} and {@link
- * #getPartialDerivativeOrders(int)}. The value is guaranteed to be stored as the first element
- * (i.e. the {@link #getPartialDerivativeIndex(int...) getPartialDerivativeIndex} method returns
- * 0 when called with 0 for all derivation orders and {@link #getPartialDerivativeOrders(int)
- * getPartialDerivativeOrders} returns an array filled with 0 when called with 0 as the index).
- * </p>
- * <p>
- * Note that the ordering changes with number of parameters and derivation order. For example
- * given 2 parameters x and y, df/dy is stored at index 2 when derivation order is set to 1 (in
- * this case the array has three elements: f, df/dx and df/dy). If derivation order is set to
- * 2, then df/dy will be stored at index 3 (in this case the array has six elements: f, df/dx,
- * df/dxdx, df/dy, df/dxdy and df/dydy).
- * </p>
- * <p>
- * Given this structure, users can perform some simple operations like adding, subtracting
- * or multiplying constants and negating the elements by themselves, knowing if they want to
- * mutate their array or create a new array. These simple operations are not provided by
- * the compiler. The compiler provides only the more complex operations between several arrays.
- * </p>
- * <p>This class is mainly used as the engine for scalar variable {@link DerivativeStructure}.
- * It can also be used directly to hold several variables in arrays for more complex data
- * structures. User can for example store a vector of n variables depending on three x, y
- * and z free parameters in one array as follows:
- * <pre>
- *   // parameter 0 is x, parameter 1 is y, parameter 2 is z
- *   int parameters = 3;
- *   DSCompiler compiler = DSCompiler.getCompiler(parameters, order);
- *   int size = compiler.getSize();
- *
- *   // pack all elements in a single array
- *   double[] array = new double[n * size];
- *   for (int i = 0; i < n; ++i) {
- *
- *     // we know value is guaranteed to be the first element
- *     array[i * size] = v[i];
- *
- *     // we don't know where first derivatives are stored, so we ask the compiler
- *     array[i * size + compiler.getPartialDerivativeIndex(1, 0, 0) = dvOnDx[i][0];
- *     array[i * size + compiler.getPartialDerivativeIndex(0, 1, 0) = dvOnDy[i][0];
- *     array[i * size + compiler.getPartialDerivativeIndex(0, 0, 1) = dvOnDz[i][0];
- *
- *     // we let all higher order derivatives set to 0
- *
- *   }
- * </pre>
- * Then in another function, user can perform some operations on all elements stored
- * in the single array, such as a simple product of all variables:
- * <pre>
- *   // compute the product of all elements
- *   double[] product = new double[size];
- *   prod[0] = 1.0;
- *   for (int i = 0; i < n; ++i) {
- *     double[] tmp = product.clone();
- *     compiler.multiply(tmp, 0, array, i * size, product, 0);
- *   }
- *
- *   // value
- *   double p = product[0];
- *
- *   // first derivatives
- *   double dPdX = product[compiler.getPartialDerivativeIndex(1, 0, 0)];
- *   double dPdY = product[compiler.getPartialDerivativeIndex(0, 1, 0)];
- *   double dPdZ = product[compiler.getPartialDerivativeIndex(0, 0, 1)];
- *
- *   // cross derivatives (assuming order was at least 2)
- *   double dPdXdX = product[compiler.getPartialDerivativeIndex(2, 0, 0)];
- *   double dPdXdY = product[compiler.getPartialDerivativeIndex(1, 1, 0)];
- *   double dPdXdZ = product[compiler.getPartialDerivativeIndex(1, 0, 1)];
- *   double dPdYdY = product[compiler.getPartialDerivativeIndex(0, 2, 0)];
- *   double dPdYdZ = product[compiler.getPartialDerivativeIndex(0, 1, 1)];
- *   double dPdZdZ = product[compiler.getPartialDerivativeIndex(0, 0, 2)];
- * </p>
- * @see DerivativeStructure
- * @since 3.1
- */
-public class DSCompiler {
-
-    /** Array of all compilers created so far. */
-    private static AtomicReference<DSCompiler[][]> compilers =
-            new AtomicReference<DSCompiler[][]>(null);
-
-    /** Number of free parameters. */
-    private final int parameters;
-
-    /** Derivation order. */
-    private final int order;
-
-    /** Number of partial derivatives (including the single 0 order derivative element). */
-    private final int[][] sizes;
-
-    /** Indirection array for partial derivatives. */
-    private final int[][] derivativesIndirection;
-
-    /** Indirection array of the lower derivative elements. */
-    private final int[] lowerIndirection;
-
-    /** Indirection arrays for multiplication. */
-    private final int[][][] multIndirection;
-
-    /** Indirection arrays for function composition. */
-    private final int[][][] compIndirection;
-
-    /** Private constructor, reserved for the factory method {@link #getCompiler(int, int)}.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param valueCompiler compiler for the value part
-     * @param derivativeCompiler compiler for the derivative part
-     * @throws NumberIsTooLargeException if order is too large
-     */
-    private DSCompiler(final int parameters, final int order,
-                       final DSCompiler valueCompiler, final DSCompiler derivativeCompiler)
-        throws NumberIsTooLargeException {
-
-        this.parameters = parameters;
-        this.order      = order;
-        this.sizes      = compileSizes(parameters, order, valueCompiler);
-        this.derivativesIndirection =
-                compileDerivativesIndirection(parameters, order,
-                                              valueCompiler, derivativeCompiler);
-        this.lowerIndirection =
-                compileLowerIndirection(parameters, order,
-                                        valueCompiler, derivativeCompiler);
-        this.multIndirection =
-                compileMultiplicationIndirection(parameters, order,
-                                                 valueCompiler, derivativeCompiler, lowerIndirection);
-        this.compIndirection =
-                compileCompositionIndirection(parameters, order,
-                                              valueCompiler, derivativeCompiler,
-                                              sizes, derivativesIndirection);
-
-    }
-
-    /** Get the compiler for number of free parameters and order.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @return cached rules set
-     * @throws NumberIsTooLargeException if order is too large
-     */
-    public static DSCompiler getCompiler(int parameters, int order)
-        throws NumberIsTooLargeException {
-
-        // get the cached compilers
-        final DSCompiler[][] cache = compilers.get();
-        if (cache != null && cache.length > parameters &&
-            cache[parameters].length > order && cache[parameters][order] != null) {
-            // the compiler has already been created
-            return cache[parameters][order];
-        }
-
-        // we need to create more compilers
-        final int maxParameters = FastMath.max(parameters, cache == null ? 0 : cache.length);
-        final int maxOrder      = FastMath.max(order,     cache == null ? 0 : cache[0].length);
-        final DSCompiler[][] newCache = new DSCompiler[maxParameters + 1][maxOrder + 1];
-
-        if (cache != null) {
-            // preserve the already created compilers
-            for (int i = 0; i < cache.length; ++i) {
-                System.arraycopy(cache[i], 0, newCache[i], 0, cache[i].length);
-            }
-        }
-
-        // create the array in increasing diagonal order
-        for (int diag = 0; diag <= parameters + order; ++diag) {
-            for (int o = FastMath.max(0, diag - parameters); o <= FastMath.min(order, diag); ++o) {
-                final int p = diag - o;
-                if (newCache[p][o] == null) {
-                    final DSCompiler valueCompiler      = (p == 0) ? null : newCache[p - 1][o];
-                    final DSCompiler derivativeCompiler = (o == 0) ? null : newCache[p][o - 1];
-                    newCache[p][o] = new DSCompiler(p, o, valueCompiler, derivativeCompiler);
-                }
-            }
-        }
-
-        // atomically reset the cached compilers array
-        compilers.compareAndSet(cache, newCache);
-
-        return newCache[parameters][order];
-
-    }
-
-    /** Compile the sizes array.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param valueCompiler compiler for the value part
-     * @return sizes array
-     */
-    private static int[][] compileSizes(final int parameters, final int order,
-                                        final DSCompiler valueCompiler) {
-
-        final int[][] sizes = new int[parameters + 1][order + 1];
-        if (parameters == 0) {
-            Arrays.fill(sizes[0], 1);
-        } else {
-            System.arraycopy(valueCompiler.sizes, 0, sizes, 0, parameters);
-            sizes[parameters][0] = 1;
-            for (int i = 0; i < order; ++i) {
-                sizes[parameters][i + 1] = sizes[parameters][i] + sizes[parameters - 1][i + 1];
-            }
-        }
-
-        return sizes;
-
-    }
-
-    /** Compile the derivatives indirection array.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param valueCompiler compiler for the value part
-     * @param derivativeCompiler compiler for the derivative part
-     * @return derivatives indirection array
-     */
-    private static int[][] compileDerivativesIndirection(final int parameters, final int order,
-                                                      final DSCompiler valueCompiler,
-                                                      final DSCompiler derivativeCompiler) {
-
-        if (parameters == 0 || order == 0) {
-            return new int[1][parameters];
-        }
-
-        final int vSize = valueCompiler.derivativesIndirection.length;
-        final int dSize = derivativeCompiler.derivativesIndirection.length;
-        final int[][] derivativesIndirection = new int[vSize + dSize][parameters];
-
-        // set up the indices for the value part
-        for (int i = 0; i < vSize; ++i) {
-            // copy the first indices, the last one remaining set to 0
-            System.arraycopy(valueCompiler.derivativesIndirection[i], 0,
-                             derivativesIndirection[i], 0,
-                             parameters - 1);
-        }
-
-        // set up the indices for the derivative part
-        for (int i = 0; i < dSize; ++i) {
-
-            // copy the indices
-            System.arraycopy(derivativeCompiler.derivativesIndirection[i], 0,
-                             derivativesIndirection[vSize + i], 0,
-                             parameters);
-
-            // increment the derivation order for the last parameter
-            derivativesIndirection[vSize + i][parameters - 1]++;
-
-        }
-
-        return derivativesIndirection;
-
-    }
-
-    /** Compile the lower derivatives indirection array.
-     * <p>
-     * This indirection array contains the indices of all elements
-     * except derivatives for last derivation order.
-     * </p>
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param valueCompiler compiler for the value part
-     * @param derivativeCompiler compiler for the derivative part
-     * @return lower derivatives indirection array
-     */
-    private static int[] compileLowerIndirection(final int parameters, final int order,
-                                              final DSCompiler valueCompiler,
-                                              final DSCompiler derivativeCompiler) {
-
-        if (parameters == 0 || order <= 1) {
-            return new int[] { 0 };
-        }
-
-        // this is an implementation of definition 6 in Dan Kalman's paper.
-        final int vSize = valueCompiler.lowerIndirection.length;
-        final int dSize = derivativeCompiler.lowerIndirection.length;
-        final int[] lowerIndirection = new int[vSize + dSize];
-        System.arraycopy(valueCompiler.lowerIndirection, 0, lowerIndirection, 0, vSize);
-        for (int i = 0; i < dSize; ++i) {
-            lowerIndirection[vSize + i] = valueCompiler.getSize() + derivativeCompiler.lowerIndirection[i];
-        }
-
-        return lowerIndirection;
-
-    }
-
-    /** Compile the multiplication indirection array.
-     * <p>
-     * This indirection array contains the indices of all pairs of elements
-     * involved when computing a multiplication. This allows a straightforward
-     * loop-based multiplication (see {@link #multiply(double[], int, double[], int, double[], int)}).
-     * </p>
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param valueCompiler compiler for the value part
-     * @param derivativeCompiler compiler for the derivative part
-     * @param lowerIndirection lower derivatives indirection array
-     * @return multiplication indirection array
-     */
-    private static int[][][] compileMultiplicationIndirection(final int parameters, final int order,
-                                                           final DSCompiler valueCompiler,
-                                                           final DSCompiler derivativeCompiler,
-                                                           final int[] lowerIndirection) {
-
-        if ((parameters == 0) || (order == 0)) {
-            return new int[][][] { { { 1, 0, 0 } } };
-        }
-
-        // this is an implementation of definition 3 in Dan Kalman's paper.
-        final int vSize = valueCompiler.multIndirection.length;
-        final int dSize = derivativeCompiler.multIndirection.length;
-        final int[][][] multIndirection = new int[vSize + dSize][][];
-
-        System.arraycopy(valueCompiler.multIndirection, 0, multIndirection, 0, vSize);
-
-        for (int i = 0; i < dSize; ++i) {
-            final int[][] dRow = derivativeCompiler.multIndirection[i];
-            List<int[]> row = new ArrayList<int[]>(dRow.length * 2);
-            for (int j = 0; j < dRow.length; ++j) {
-                row.add(new int[] { dRow[j][0], lowerIndirection[dRow[j][1]], vSize + dRow[j][2] });
-                row.add(new int[] { dRow[j][0], vSize + dRow[j][1], lowerIndirection[dRow[j][2]] });
-            }
-
-            // combine terms with similar derivation orders
-            final List<int[]> combined = new ArrayList<int[]>(row.size());
-            for (int j = 0; j < row.size(); ++j) {
-                final int[] termJ = row.get(j);
-                if (termJ[0] > 0) {
-                    for (int k = j + 1; k < row.size(); ++k) {
-                        final int[] termK = row.get(k);
-                        if (termJ[1] == termK[1] && termJ[2] == termK[2]) {
-                            // combine termJ and termK
-                            termJ[0] += termK[0];
-                            // make sure we will skip termK later on in the outer loop
-                            termK[0] = 0;
-                        }
-                    }
-                    combined.add(termJ);
-                }
-            }
-
-            multIndirection[vSize + i] = combined.toArray(new int[combined.size()][]);
-
-        }
-
-        return multIndirection;
-
-    }
-
-    /** Compile the function composition indirection array.
-     * <p>
-     * This indirection array contains the indices of all sets of elements
-     * involved when computing a composition. This allows a straightforward
-     * loop-based composition (see {@link #compose(double[], int, double[], double[], int)}).
-     * </p>
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param valueCompiler compiler for the value part
-     * @param derivativeCompiler compiler for the derivative part
-     * @param sizes sizes array
-     * @param derivativesIndirection derivatives indirection array
-     * @return multiplication indirection array
-     * @throws NumberIsTooLargeException if order is too large
-     */
-    private static int[][][] compileCompositionIndirection(final int parameters, final int order,
-                                                           final DSCompiler valueCompiler,
-                                                           final DSCompiler derivativeCompiler,
-                                                           final int[][] sizes,
-                                                           final int[][] derivativesIndirection)
-       throws NumberIsTooLargeException {
-
-        if ((parameters == 0) || (order == 0)) {
-            return new int[][][] { { { 1, 0 } } };
-        }
-
-        final int vSize = valueCompiler.compIndirection.length;
-        final int dSize = derivativeCompiler.compIndirection.length;
-        final int[][][] compIndirection = new int[vSize + dSize][][];
-
-        // the composition rules from the value part can be reused as is
-        System.arraycopy(valueCompiler.compIndirection, 0, compIndirection, 0, vSize);
-
-        // the composition rules for the derivative part are deduced by
-        // differentiation the rules from the underlying compiler once
-        // with respect to the parameter this compiler handles and the
-        // underlying one did not handle
-        for (int i = 0; i < dSize; ++i) {
-            List<int[]> row = new ArrayList<int[]>();
-            for (int[] term : derivativeCompiler.compIndirection[i]) {
-
-                // handle term p * f_k(g(x)) * g_l1(x) * g_l2(x) * ... * g_lp(x)
-
-                // derive the first factor in the term: f_k with respect to new parameter
-                int[] derivedTermF = new int[term.length + 1];
-                derivedTermF[0] = term[0];     // p
-                derivedTermF[1] = term[1] + 1; // f_(k+1)
-                int[] orders = new int[parameters];
-                orders[parameters - 1] = 1;
-                derivedTermF[term.length] = getPartialDerivativeIndex(parameters, order, sizes, orders);  // g_1
-                for (int j = 2; j < term.length; ++j) {
-                    // convert the indices as the mapping for the current order
-                    // is different from the mapping with one less order
-                    derivedTermF[j] = convertIndex(term[j], parameters,
-                                                   derivativeCompiler.derivativesIndirection,
-                                                   parameters, order, sizes);
-                }
-                Arrays.sort(derivedTermF, 2, derivedTermF.length);
-                row.add(derivedTermF);
-
-                // derive the various g_l
-                for (int l = 2; l < term.length; ++l) {
-                    int[] derivedTermG = new int[term.length];
-                    derivedTermG[0] = term[0];
-                    derivedTermG[1] = term[1];
-                    for (int j = 2; j < term.length; ++j) {
-                        // convert the indices as the mapping for the current order
-                        // is different from the mapping with one less order
-                        derivedTermG[j] = convertIndex(term[j], parameters,
-                                                       derivativeCompiler.derivativesIndirection,
-                                                       parameters, order, sizes);
-                        if (j == l) {
-                            // derive this term
-                            System.arraycopy(derivativesIndirection[derivedTermG[j]], 0, orders, 0, parameters);
-                            orders[parameters - 1]++;
-                            derivedTermG[j] = getPartialDerivativeIndex(parameters, order, sizes, orders);
-                        }
-                    }
-                    Arrays.sort(derivedTermG, 2, derivedTermG.length);
-                    row.add(derivedTermG);
-                }
-
-            }
-
-            // combine terms with similar derivation orders
-            final List<int[]> combined = new ArrayList<int[]>(row.size());
-            for (int j = 0; j < row.size(); ++j) {
-                final int[] termJ = row.get(j);
-                if (termJ[0] > 0) {
-                    for (int k = j + 1; k < row.size(); ++k) {
-                        final int[] termK = row.get(k);
-                        boolean equals = termJ.length == termK.length;
-                        for (int l = 1; equals && l < termJ.length; ++l) {
-                            equals &= termJ[l] == termK[l];
-                        }
-                        if (equals) {
-                            // combine termJ and termK
-                            termJ[0] += termK[0];
-                            // make sure we will skip termK later on in the outer loop
-                            termK[0] = 0;
-                        }
-                    }
-                    combined.add(termJ);
-                }
-            }
-
-            compIndirection[vSize + i] = combined.toArray(new int[combined.size()][]);
-
-        }
-
-        return compIndirection;
-
-    }
-
-    /** Get the index of a partial derivative in the array.
-     * <p>
-     * If all orders are set to 0, then the 0<sup>th</sup> order derivative
-     * is returned, which is the value of the function.
-     * </p>
-     * <p>The indices of derivatives are between 0 and {@link #getSize() getSize()} - 1.
-     * Their specific order is fixed for a given compiler, but otherwise not
-     * publicly specified. There are however some simple cases which have guaranteed
-     * indices:
-     * </p>
-     * <ul>
-     *   <li>the index of 0<sup>th</sup> order derivative is always 0</li>
-     *   <li>if there is only 1 {@link #getFreeParameters() free parameter}, then the
-     *   derivatives are sorted in increasing derivation order (i.e. f at index 0, df/dp
-     *   at index 1, d<sup>2</sup>f/dp<sup>2</sup> at index 2 ...
-     *   d<sup>k</sup>f/dp<sup>k</sup> at index k),</li>
-     *   <li>if the {@link #getOrder() derivation order} is 1, then the derivatives
-     *   are sorted in increasing free parameter order (i.e. f at index 0, df/dx<sub>1</sub>
-     *   at index 1, df/dx<sub>2</sub> at index 2 ... df/dx<sub>k</sub> at index k),</li>
-     *   <li>all other cases are not publicly specified</li>
-     * </ul>
-     * <p>
-     * This method is the inverse of method {@link #getPartialDerivativeOrders(int)}
-     * </p>
-     * @param orders derivation orders with respect to each parameter
-     * @return index of the partial derivative
-     * @exception DimensionMismatchException if the numbers of parameters does not
-     * match the instance
-     * @exception NumberIsTooLargeException if sum of derivation orders is larger
-     * than the instance limits
-     * @see #getPartialDerivativeOrders(int)
-     */
-    public int getPartialDerivativeIndex(final int ... orders)
-            throws DimensionMismatchException, NumberIsTooLargeException {
-
-        // safety check
-        if (orders.length != getFreeParameters()) {
-            throw new DimensionMismatchException(orders.length, getFreeParameters());
-        }
-
-        return getPartialDerivativeIndex(parameters, order, sizes, orders);
-
-    }
-
-    /** Get the index of a partial derivative in an array.
-     * @param parameters number of free parameters
-     * @param order derivation order
-     * @param sizes sizes array
-     * @param orders derivation orders with respect to each parameter
-     * (the lenght of this array must match the number of parameters)
-     * @return index of the partial derivative
-     * @exception NumberIsTooLargeException if sum of derivation orders is larger
-     * than the instance limits
-     */
-    private static int getPartialDerivativeIndex(final int parameters, final int order,
-                                                 final int[][] sizes, final int ... orders)
-        throws NumberIsTooLargeException {
-
-        // the value is obtained by diving into the recursive Dan Kalman's structure
-        // this is theorem 2 of his paper, with recursion replaced by iteration
-        int index     = 0;
-        int m         = order;
-        int ordersSum = 0;
-        for (int i = parameters - 1; i >= 0; --i) {
-
-            // derivative order for current free parameter
-            int derivativeOrder = orders[i];
-
-            // safety check
-            ordersSum += derivativeOrder;
-            if (ordersSum > order) {
-                throw new NumberIsTooLargeException(ordersSum, order, true);
-            }
-
-            while (derivativeOrder-- > 0) {
-                // as long as we differentiate according to current free parameter,
-                // we have to skip the value part and dive into the derivative part
-                // so we add the size of the value part to the base index
-                index += sizes[i][m--];
-            }
-
-        }
-
-        return index;
-
-    }
-
-    /** Convert an index from one (parameters, order) structure to another.
-     * @param index index of a partial derivative in source derivative structure
-     * @param srcP number of free parameters in source derivative structure
-     * @param srcDerivativesIndirection derivatives indirection array for the source
-     * derivative structure
-     * @param destP number of free parameters in destination derivative structure
-     * @param destO derivation order in destination derivative structure
-     * @param destSizes sizes array for the destination derivative structure
-     * @return index of the partial derivative with the <em>same</em> characteristics
-     * in destination derivative structure
-     * @throws NumberIsTooLargeException if order is too large
-     */
-    private static int convertIndex(final int index,
-                                    final int srcP, final int[][] srcDerivativesIndirection,
-                                    final int destP, final int destO, final int[][] destSizes)
-        throws NumberIsTooLargeException {
-        int[] orders = new int[destP];
-        System.arraycopy(srcDerivativesIndirection[index], 0, orders, 0, FastMath.min(srcP, destP));
-        return getPartialDerivativeIndex(destP, destO, destSizes, orders);
-    }
-
-    /** Get the derivation orders for a specific index in the array.
-     * <p>
-     * This method is the inverse of {@link #getPartialDerivativeIndex(int...)}.
-     * </p>
-     * @param index of the partial derivative
-     * @return orders derivation orders with respect to each parameter
-     * @see #getPartialDerivativeIndex(int...)
-     */
-    public int[] getPartialDerivativeOrders(final int index) {
-        return derivativesIndirection[index];
-    }
-
-    /** Get the number of free parameters.
-     * @return number of free parameters
-     */
-    public int getFreeParameters() {
-        return parameters;
-    }
-
-    /** Get the derivation order.
-     * @return derivation order
-     */
-    public int getOrder() {
-        return order;
-    }
-
-    /** Get the array size required for holding partial derivatives data.
-     * <p>
-     * This number includes the single 0 order derivative element, which is
-     * guaranteed to be stored in the first element of the array.
-     * </p>
-     * @return array size required for holding partial derivatives data
-     */
-    public int getSize() {
-        return sizes[parameters][order];
-    }
-
-    /** Compute linear combination.
-     * The derivative structure built will be a1 * ds1 + a2 * ds2
-     * @param a1 first scale factor
-     * @param c1 first base (unscaled) component
-     * @param offset1 offset of first operand in its array
-     * @param a2 second scale factor
-     * @param c2 second base (unscaled) component
-     * @param offset2 offset of second operand in its array
-     * @param result array where result must be stored (it may be
-     * one of the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void linearCombination(final double a1, final double[] c1, final int offset1,
-                                  final double a2, final double[] c2, final int offset2,
-                                  final double[] result, final int resultOffset) {
-        for (int i = 0; i < getSize(); ++i) {
-            result[resultOffset + i] =
-                    MathArrays.linearCombination(a1, c1[offset1 + i], a2, c2[offset2 + i]);
-        }
-    }
-
-    /** Compute linear combination.
-     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
-     * @param a1 first scale factor
-     * @param c1 first base (unscaled) component
-     * @param offset1 offset of first operand in its array
-     * @param a2 second scale factor
-     * @param c2 second base (unscaled) component
-     * @param offset2 offset of second operand in its array
-     * @param a3 third scale factor
-     * @param c3 third base (unscaled) component
-     * @param offset3 offset of third operand in its array
-     * @param result array where result must be stored (it may be
-     * one of the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void linearCombination(final double a1, final double[] c1, final int offset1,
-                                  final double a2, final double[] c2, final int offset2,
-                                  final double a3, final double[] c3, final int offset3,
-                                  final double[] result, final int resultOffset) {
-        for (int i = 0; i < getSize(); ++i) {
-            result[resultOffset + i] =
-                    MathArrays.linearCombination(a1, c1[offset1 + i],
-                                                 a2, c2[offset2 + i],
-                                                 a3, c3[offset3 + i]);
-        }
-    }
-
-    /** Compute linear combination.
-     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
-     * @param a1 first scale factor
-     * @param c1 first base (unscaled) component
-     * @param offset1 offset of first operand in its array
-     * @param a2 second scale factor
-     * @param c2 second base (unscaled) component
-     * @param offset2 offset of second operand in its array
-     * @param a3 third scale factor
-     * @param c3 third base (unscaled) component
-     * @param offset3 offset of third operand in its array
-     * @param a4 fourth scale factor
-     * @param c4 fourth base (unscaled) component
-     * @param offset4 offset of fourth operand in its array
-     * @param result array where result must be stored (it may be
-     * one of the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void linearCombination(final double a1, final double[] c1, final int offset1,
-                                  final double a2, final double[] c2, final int offset2,
-                                  final double a3, final double[] c3, final int offset3,
-                                  final double a4, final double[] c4, final int offset4,
-                                  final double[] result, final int resultOffset) {
-        for (int i = 0; i < getSize(); ++i) {
-            result[resultOffset + i] =
-                    MathArrays.linearCombination(a1, c1[offset1 + i],
-                                                 a2, c2[offset2 + i],
-                                                 a3, c3[offset3 + i],
-                                                 a4, c4[offset4 + i]);
-        }
-    }
-
-    /** Perform addition of two derivative structures.
-     * @param lhs array holding left hand side of addition
-     * @param lhsOffset offset of the left hand side in its array
-     * @param rhs array right hand side of addition
-     * @param rhsOffset offset of the right hand side in its array
-     * @param result array where result must be stored (it may be
-     * one of the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void add(final double[] lhs, final int lhsOffset,
-                    final double[] rhs, final int rhsOffset,
-                    final double[] result, final int resultOffset) {
-        for (int i = 0; i < getSize(); ++i) {
-            result[resultOffset + i] = lhs[lhsOffset + i] + rhs[rhsOffset + i];
-        }
-    }
-    /** Perform subtraction of two derivative structures.
-     * @param lhs array holding left hand side of subtraction
-     * @param lhsOffset offset of the left hand side in its array
-     * @param rhs array right hand side of subtraction
-     * @param rhsOffset offset of the right hand side in its array
-     * @param result array where result must be stored (it may be
-     * one of the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void subtract(final double[] lhs, final int lhsOffset,
-                         final double[] rhs, final int rhsOffset,
-                         final double[] result, final int resultOffset) {
-        for (int i = 0; i < getSize(); ++i) {
-            result[resultOffset + i] = lhs[lhsOffset + i] - rhs[rhsOffset + i];
-        }
-    }
-
-    /** Perform multiplication of two derivative structures.
-     * @param lhs array holding left hand side of multiplication
-     * @param lhsOffset offset of the left hand side in its array
-     * @param rhs array right hand side of multiplication
-     * @param rhsOffset offset of the right hand side in its array
-     * @param result array where result must be stored (for
-     * multiplication the result array <em>cannot</em> be one of
-     * the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void multiply(final double[] lhs, final int lhsOffset,
-                         final double[] rhs, final int rhsOffset,
-                         final double[] result, final int resultOffset) {
-        for (int i = 0; i < multIndirection.length; ++i) {
-            final int[][] mappingI = multIndirection[i];
-            double r = 0;
-            for (int j = 0; j < mappingI.length; ++j) {
-                r += mappingI[j][0] *
-                     lhs[lhsOffset + mappingI[j][1]] *
-                     rhs[rhsOffset + mappingI[j][2]];
-            }
-            result[resultOffset + i] = r;
-        }
-    }
-
-    /** Perform division of two derivative structures.
-     * @param lhs array holding left hand side of division
-     * @param lhsOffset offset of the left hand side in its array
-     * @param rhs array right hand side of division
-     * @param rhsOffset offset of the right hand side in its array
-     * @param result array where result must be stored (for
-     * division the result array <em>cannot</em> be one of
-     * the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void divide(final double[] lhs, final int lhsOffset,
-                       final double[] rhs, final int rhsOffset,
-                       final double[] result, final int resultOffset) {
-        final double[] reciprocal = new double[getSize()];
-        pow(rhs, lhsOffset, -1, reciprocal, 0);
-        multiply(lhs, lhsOffset, reciprocal, 0, result, resultOffset);
-    }
-
-    /** Perform remainder of two derivative structures.
-     * @param lhs array holding left hand side of remainder
-     * @param lhsOffset offset of the left hand side in its array
-     * @param rhs array right hand side of remainder
-     * @param rhsOffset offset of the right hand side in its array
-     * @param result array where result must be stored (it may be
-     * one of the input arrays)
-     * @param resultOffset offset of the result in its array
-     */
-    public void remainder(final double[] lhs, final int lhsOffset,
-                          final double[] rhs, final int rhsOffset,
-                          final double[] result, final int resultOffset) {
-
-        // compute k such that lhs % rhs = lhs - k rhs
-        final double rem = FastMath.IEEEremainder(lhs[lhsOffset], rhs[rhsOffset]);
-        final double k   = FastMath.rint((lhs[lhsOffset] - rem) / rhs[rhsOffset]);
-
-        // set up value
-        result[resultOffset] = rem;
-
-        // set up partial derivatives
-        for (int i = 1; i < getSize(); ++i) {
-            result[resultOffset + i] = lhs[lhsOffset + i] - k * rhs[rhsOffset + i];
-        }
-
-    }
-
-    /** Compute power of a double to a derivative structure.
-     * @param a number to exponentiate
-     * @param operand array holding the power
-     * @param operandOffset offset of the power in its array
-     * @param result array where result must be stored (for
-     * power the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     * @since 3.3
-     */
-    public void pow(final double a,
-                    final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        // [a^x, ln(a) a^x, ln(a)^2 a^x,, ln(a)^3 a^x, ... ]
-        final double[] function = new double[1 + order];
-        if (a == 0) {
-            if (operand[operandOffset] == 0) {
-                function[0] = 1;
-                double infinity = Double.POSITIVE_INFINITY;
-                for (int i = 1; i < function.length; ++i) {
-                    infinity = -infinity;
-                    function[i] = infinity;
-                }
-            } else if (operand[operandOffset] < 0) {
-                Arrays.fill(function, Double.NaN);
-            }
-        } else {
-            function[0] = FastMath.pow(a, operand[operandOffset]);
-            final double lnA = FastMath.log(a);
-            for (int i = 1; i < function.length; ++i) {
-                function[i] = lnA * function[i - 1];
-            }
-        }
-
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute power of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param p power to apply
-     * @param result array where result must be stored (for
-     * power the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void pow(final double[] operand, final int operandOffset, final double p,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        // [x^p, px^(p-1), p(p-1)x^(p-2), ... ]
-        double[] function = new double[1 + order];
-        double xk = FastMath.pow(operand[operandOffset], p - order);
-        for (int i = order; i > 0; --i) {
-            function[i] = xk;
-            xk *= operand[operandOffset];
-        }
-        function[0] = xk;
-        double coefficient = p;
-        for (int i = 1; i <= order; ++i) {
-            function[i] *= coefficient;
-            coefficient *= p - i;
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute integer power of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param n power to apply
-     * @param result array where result must be stored (for
-     * power the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void pow(final double[] operand, final int operandOffset, final int n,
-                    final double[] result, final int resultOffset) {
-
-        if (n == 0) {
-            // special case, x^0 = 1 for all x
-            result[resultOffset] = 1.0;
-            Arrays.fill(result, resultOffset + 1, resultOffset + getSize(), 0);
-            return;
-        }
-
-        // create the power function value and derivatives
-        // [x^n, nx^(n-1), n(n-1)x^(n-2), ... ]
-        double[] function = new double[1 + order];
-
-        if (n > 0) {
-            // strictly positive power
-            final int maxOrder = FastMath.min(order, n);
-            double xk = FastMath.pow(operand[operandOffset], n - maxOrder);
-            for (int i = maxOrder; i > 0; --i) {
-                function[i] = xk;
-                xk *= operand[operandOffset];
-            }
-            function[0] = xk;
-        } else {
-            // strictly negative power
-            final double inv = 1.0 / operand[operandOffset];
-            double xk = FastMath.pow(inv, -n);
-            for (int i = 0; i <= order; ++i) {
-                function[i] = xk;
-                xk *= inv;
-            }
-        }
-
-        double coefficient = n;
-        for (int i = 1; i <= order; ++i) {
-            function[i] *= coefficient;
-            coefficient *= n - i;
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute power of a derivative structure.
-     * @param x array holding the base
-     * @param xOffset offset of the base in its array
-     * @param y array holding the exponent
-     * @param yOffset offset of the exponent in its array
-     * @param result array where result must be stored (for
-     * power the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void pow(final double[] x, final int xOffset,
-                    final double[] y, final int yOffset,
-                    final double[] result, final int resultOffset) {
-        final double[] logX = new double[getSize()];
-        log(x, xOffset, logX, 0);
-        final double[] yLogX = new double[getSize()];
-        multiply(logX, 0, y, yOffset, yLogX, 0);
-        exp(yLogX, 0, result, resultOffset);
-    }
-
-    /** Compute n<sup>th</sup> root of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param n order of the root
-     * @param result array where result must be stored (for
-     * n<sup>th</sup> root the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void rootN(final double[] operand, final int operandOffset, final int n,
-                      final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        // [x^(1/n), (1/n)x^((1/n)-1), (1-n)/n^2x^((1/n)-2), ... ]
-        double[] function = new double[1 + order];
-        double xk;
-        if (n == 2) {
-            function[0] = FastMath.sqrt(operand[operandOffset]);
-            xk          = 0.5 / function[0];
-        } else if (n == 3) {
-            function[0] = FastMath.cbrt(operand[operandOffset]);
-            xk          = 1.0 / (3.0 * function[0] * function[0]);
-        } else {
-            function[0] = FastMath.pow(operand[operandOffset], 1.0 / n);
-            xk          = 1.0 / (n * FastMath.pow(function[0], n - 1));
-        }
-        final double nReciprocal = 1.0 / n;
-        final double xReciprocal = 1.0 / operand[operandOffset];
-        for (int i = 1; i <= order; ++i) {
-            function[i] = xk;
-            xk *= xReciprocal * (nReciprocal - i);
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute exponential of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * exponential the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void exp(final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        Arrays.fill(function, FastMath.exp(operand[operandOffset]));
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute exp(x) - 1 of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * exponential the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void expm1(final double[] operand, final int operandOffset,
-                      final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.expm1(operand[operandOffset]);
-        Arrays.fill(function, 1, 1 + order, FastMath.exp(operand[operandOffset]));
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute natural logarithm of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * logarithm the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void log(final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.log(operand[operandOffset]);
-        if (order > 0) {
-            double inv = 1.0 / operand[operandOffset];
-            double xk  = inv;
-            for (int i = 1; i <= order; ++i) {
-                function[i] = xk;
-                xk *= -i * inv;
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Computes shifted logarithm of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * shifted logarithm the result array <em>cannot</em> be the input array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void log1p(final double[] operand, final int operandOffset,
-                      final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.log1p(operand[operandOffset]);
-        if (order > 0) {
-            double inv = 1.0 / (1.0 + operand[operandOffset]);
-            double xk  = inv;
-            for (int i = 1; i <= order; ++i) {
-                function[i] = xk;
-                xk *= -i * inv;
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Computes base 10 logarithm of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * base 10 logarithm the result array <em>cannot</em> be the input array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void log10(final double[] operand, final int operandOffset,
-                      final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.log10(operand[operandOffset]);
-        if (order > 0) {
-            double inv = 1.0 / operand[operandOffset];
-            double xk  = inv / FastMath.log(10.0);
-            for (int i = 1; i <= order; ++i) {
-                function[i] = xk;
-                xk *= -i * inv;
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute cosine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * cosine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void cos(final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.cos(operand[operandOffset]);
-        if (order > 0) {
-            function[1] = -FastMath.sin(operand[operandOffset]);
-            for (int i = 2; i <= order; ++i) {
-                function[i] = -function[i - 2];
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute sine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * sine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void sin(final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.sin(operand[operandOffset]);
-        if (order > 0) {
-            function[1] = FastMath.cos(operand[operandOffset]);
-            for (int i = 2; i <= order; ++i) {
-                function[i] = -function[i - 2];
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute tangent of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * tangent the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void tan(final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        final double[] function = new double[1 + order];
-        final double t = FastMath.tan(operand[operandOffset]);
-        function[0] = t;
-
-        if (order > 0) {
-
-            // the nth order derivative of tan has the form:
-            // dn(tan(x)/dxn = P_n(tan(x))
-            // where P_n(t) is a degree n+1 polynomial with same parity as n+1
-            // P_0(t) = t, P_1(t) = 1 + t^2, P_2(t) = 2 t (1 + t^2) ...
-            // the general recurrence relation for P_n is:
-            // P_n(x) = (1+t^2) P_(n-1)'(t)
-            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
-            final double[] p = new double[order + 2];
-            p[1] = 1;
-            final double t2 = t * t;
-            for (int n = 1; n <= order; ++n) {
-
-                // update and evaluate polynomial P_n(t)
-                double v = 0;
-                p[n + 1] = n * p[n];
-                for (int k = n + 1; k >= 0; k -= 2) {
-                    v = v * t2 + p[k];
-                    if (k > 2) {
-                        p[k - 2] = (k - 1) * p[k - 1] + (k - 3) * p[k - 3];
-                    } else if (k == 2) {
-                        p[0] = p[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= t;
-                }
-
-                function[n] = v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute arc cosine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * arc cosine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void acos(final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        final double x = operand[operandOffset];
-        function[0] = FastMath.acos(x);
-        if (order > 0) {
-            // the nth order derivative of acos has the form:
-            // dn(acos(x)/dxn = P_n(x) / [1 - x^2]^((2n-1)/2)
-            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
-            // P_1(x) = -1, P_2(x) = -x, P_3(x) = -2x^2 - 1 ...
-            // the general recurrence relation for P_n is:
-            // P_n(x) = (1-x^2) P_(n-1)'(x) + (2n-3) x P_(n-1)(x)
-            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
-            final double[] p = new double[order];
-            p[0] = -1;
-            final double x2    = x * x;
-            final double f     = 1.0 / (1 - x2);
-            double coeff = FastMath.sqrt(f);
-            function[1] = coeff * p[0];
-            for (int n = 2; n <= order; ++n) {
-
-                // update and evaluate polynomial P_n(x)
-                double v = 0;
-                p[n - 1] = (n - 1) * p[n - 2];
-                for (int k = n - 1; k >= 0; k -= 2) {
-                    v = v * x2 + p[k];
-                    if (k > 2) {
-                        p[k - 2] = (k - 1) * p[k - 1] + (2 * n - k) * p[k - 3];
-                    } else if (k == 2) {
-                        p[0] = p[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= x;
-                }
-
-                coeff *= f;
-                function[n] = coeff * v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute arc sine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * arc sine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void asin(final double[] operand, final int operandOffset,
-                    final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        final double x = operand[operandOffset];
-        function[0] = FastMath.asin(x);
-        if (order > 0) {
-            // the nth order derivative of asin has the form:
-            // dn(asin(x)/dxn = P_n(x) / [1 - x^2]^((2n-1)/2)
-            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
-            // P_1(x) = 1, P_2(x) = x, P_3(x) = 2x^2 + 1 ...
-            // the general recurrence relation for P_n is:
-            // P_n(x) = (1-x^2) P_(n-1)'(x) + (2n-3) x P_(n-1)(x)
-            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
-            final double[] p = new double[order];
-            p[0] = 1;
-            final double x2    = x * x;
-            final double f     = 1.0 / (1 - x2);
-            double coeff = FastMath.sqrt(f);
-            function[1] = coeff * p[0];
-            for (int n = 2; n <= order; ++n) {
-
-                // update and evaluate polynomial P_n(x)
-                double v = 0;
-                p[n - 1] = (n - 1) * p[n - 2];
-                for (int k = n - 1; k >= 0; k -= 2) {
-                    v = v * x2 + p[k];
-                    if (k > 2) {
-                        p[k - 2] = (k - 1) * p[k - 1] + (2 * n - k) * p[k - 3];
-                    } else if (k == 2) {
-                        p[0] = p[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= x;
-                }
-
-                coeff *= f;
-                function[n] = coeff * v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute arc tangent of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * arc tangent the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void atan(final double[] operand, final int operandOffset,
-                     final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        final double x = operand[operandOffset];
-        function[0] = FastMath.atan(x);
-        if (order > 0) {
-            // the nth order derivative of atan has the form:
-            // dn(atan(x)/dxn = Q_n(x) / (1 + x^2)^n
-            // where Q_n(x) is a degree n-1 polynomial with same parity as n-1
-            // Q_1(x) = 1, Q_2(x) = -2x, Q_3(x) = 6x^2 - 2 ...
-            // the general recurrence relation for Q_n is:
-            // Q_n(x) = (1+x^2) Q_(n-1)'(x) - 2(n-1) x Q_(n-1)(x)
-            // as per polynomial parity, we can store coefficients of both Q_(n-1) and Q_n in the same array
-            final double[] q = new double[order];
-            q[0] = 1;
-            final double x2    = x * x;
-            final double f     = 1.0 / (1 + x2);
-            double coeff = f;
-            function[1] = coeff * q[0];
-            for (int n = 2; n <= order; ++n) {
-
-                // update and evaluate polynomial Q_n(x)
-                double v = 0;
-                q[n - 1] = -n * q[n - 2];
-                for (int k = n - 1; k >= 0; k -= 2) {
-                    v = v * x2 + q[k];
-                    if (k > 2) {
-                        q[k - 2] = (k - 1) * q[k - 1] + (k - 1 - 2 * n) * q[k - 3];
-                    } else if (k == 2) {
-                        q[0] = q[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= x;
-                }
-
-                coeff *= f;
-                function[n] = coeff * v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute two arguments arc tangent of a derivative structure.
-     * @param y array holding the first operand
-     * @param yOffset offset of the first operand in its array
-     * @param x array holding the second operand
-     * @param xOffset offset of the second operand in its array
-     * @param result array where result must be stored (for
-     * two arguments arc tangent the result array <em>cannot</em>
-     * be the input array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void atan2(final double[] y, final int yOffset,
-                      final double[] x, final int xOffset,
-                      final double[] result, final int resultOffset) {
-
-        // compute r = sqrt(x^2+y^2)
-        double[] tmp1 = new double[getSize()];
-        multiply(x, xOffset, x, xOffset, tmp1, 0);      // x^2
-        double[] tmp2 = new double[getSize()];
-        multiply(y, yOffset, y, yOffset, tmp2, 0);      // y^2
-        add(tmp1, 0, tmp2, 0, tmp2, 0);                 // x^2 + y^2
-        rootN(tmp2, 0, 2, tmp1, 0);                     // r = sqrt(x^2 + y^2)
-
-        if (x[xOffset] >= 0) {
-
-            // compute atan2(y, x) = 2 atan(y / (r + x))
-            add(tmp1, 0, x, xOffset, tmp2, 0);          // r + x
-            divide(y, yOffset, tmp2, 0, tmp1, 0);       // y /(r + x)
-            atan(tmp1, 0, tmp2, 0);                     // atan(y / (r + x))
-            for (int i = 0; i < tmp2.length; ++i) {
-                result[resultOffset + i] = 2 * tmp2[i]; // 2 * atan(y / (r + x))
-            }
-
-        } else {
-
-            // compute atan2(y, x) = +/- pi - 2 atan(y / (r - x))
-            subtract(tmp1, 0, x, xOffset, tmp2, 0);     // r - x
-            divide(y, yOffset, tmp2, 0, tmp1, 0);       // y /(r - x)
-            atan(tmp1, 0, tmp2, 0);                     // atan(y / (r - x))
-            result[resultOffset] =
-                    ((tmp2[0] <= 0) ? -FastMath.PI : FastMath.PI) - 2 * tmp2[0]; // +/-pi - 2 * atan(y / (r - x))
-            for (int i = 1; i < tmp2.length; ++i) {
-                result[resultOffset + i] = -2 * tmp2[i]; // +/-pi - 2 * atan(y / (r - x))
-            }
-
-        }
-
-        // fix value to take special cases (+0/+0, +0/-0, -0/+0, -0/-0, +/-infinity) correctly
-        result[resultOffset] = FastMath.atan2(y[yOffset], x[xOffset]);
-
-    }
-
-    /** Compute hyperbolic cosine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * hyperbolic cosine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void cosh(final double[] operand, final int operandOffset,
-                     final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.cosh(operand[operandOffset]);
-        if (order > 0) {
-            function[1] = FastMath.sinh(operand[operandOffset]);
-            for (int i = 2; i <= order; ++i) {
-                function[i] = function[i - 2];
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute hyperbolic sine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * hyperbolic sine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void sinh(final double[] operand, final int operandOffset,
-                     final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        function[0] = FastMath.sinh(operand[operandOffset]);
-        if (order > 0) {
-            function[1] = FastMath.cosh(operand[operandOffset]);
-            for (int i = 2; i <= order; ++i) {
-                function[i] = function[i - 2];
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute hyperbolic tangent of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * hyperbolic tangent the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void tanh(final double[] operand, final int operandOffset,
-                     final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        final double[] function = new double[1 + order];
-        final double t = FastMath.tanh(operand[operandOffset]);
-        function[0] = t;
-
-        if (order > 0) {
-
-            // the nth order derivative of tanh has the form:
-            // dn(tanh(x)/dxn = P_n(tanh(x))
-            // where P_n(t) is a degree n+1 polynomial with same parity as n+1
-            // P_0(t) = t, P_1(t) = 1 - t^2, P_2(t) = -2 t (1 - t^2) ...
-            // the general recurrence relation for P_n is:
-            // P_n(x) = (1-t^2) P_(n-1)'(t)
-            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
-            final double[] p = new double[order + 2];
-            p[1] = 1;
-            final double t2 = t * t;
-            for (int n = 1; n <= order; ++n) {
-
-                // update and evaluate polynomial P_n(t)
-                double v = 0;
-                p[n + 1] = -n * p[n];
-                for (int k = n + 1; k >= 0; k -= 2) {
-                    v = v * t2 + p[k];
-                    if (k > 2) {
-                        p[k - 2] = (k - 1) * p[k - 1] - (k - 3) * p[k - 3];
-                    } else if (k == 2) {
-                        p[0] = p[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= t;
-                }
-
-                function[n] = v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute inverse hyperbolic cosine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * inverse hyperbolic cosine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void acosh(final double[] operand, final int operandOffset,
-                     final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        final double x = operand[operandOffset];
-        function[0] = FastMath.acosh(x);
-        if (order > 0) {
-            // the nth order derivative of acosh has the form:
-            // dn(acosh(x)/dxn = P_n(x) / [x^2 - 1]^((2n-1)/2)
-            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
-            // P_1(x) = 1, P_2(x) = -x, P_3(x) = 2x^2 + 1 ...
-            // the general recurrence relation for P_n is:
-            // P_n(x) = (x^2-1) P_(n-1)'(x) - (2n-3) x P_(n-1)(x)
-            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
-            final double[] p = new double[order];
-            p[0] = 1;
-            final double x2  = x * x;
-            final double f   = 1.0 / (x2 - 1);
-            double coeff = FastMath.sqrt(f);
-            function[1] = coeff * p[0];
-            for (int n = 2; n <= order; ++n) {
-
-                // update and evaluate polynomial P_n(x)
-                double v = 0;
-                p[n - 1] = (1 - n) * p[n - 2];
-                for (int k = n - 1; k >= 0; k -= 2) {
-                    v = v * x2 + p[k];
-                    if (k > 2) {
-                        p[k - 2] = (1 - k) * p[k - 1] + (k - 2 * n) * p[k - 3];
-                    } else if (k == 2) {
-                        p[0] = -p[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= x;
-                }
-
-                coeff *= f;
-                function[n] = coeff * v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute inverse hyperbolic sine of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * inverse hyperbolic sine the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void asinh(final double[] operand, final int operandOffset,
-                     final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        final double x = operand[operandOffset];
-        function[0] = FastMath.asinh(x);
-        if (order > 0) {
-            // the nth order derivative of asinh has the form:
-            // dn(asinh(x)/dxn = P_n(x) / [x^2 + 1]^((2n-1)/2)
-            // where P_n(x) is a degree n-1 polynomial with same parity as n-1
-            // P_1(x) = 1, P_2(x) = -x, P_3(x) = 2x^2 - 1 ...
-            // the general recurrence relation for P_n is:
-            // P_n(x) = (x^2+1) P_(n-1)'(x) - (2n-3) x P_(n-1)(x)
-            // as per polynomial parity, we can store coefficients of both P_(n-1) and P_n in the same array
-            final double[] p = new double[order];
-            p[0] = 1;
-            final double x2    = x * x;
-            final double f     = 1.0 / (1 + x2);
-            double coeff = FastMath.sqrt(f);
-            function[1] = coeff * p[0];
-            for (int n = 2; n <= order; ++n) {
-
-                // update and evaluate polynomial P_n(x)
-                double v = 0;
-                p[n - 1] = (1 - n) * p[n - 2];
-                for (int k = n - 1; k >= 0; k -= 2) {
-                    v = v * x2 + p[k];
-                    if (k > 2) {
-                        p[k - 2] = (k - 1) * p[k - 1] + (k - 2 * n) * p[k - 3];
-                    } else if (k == 2) {
-                        p[0] = p[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= x;
-                }
-
-                coeff *= f;
-                function[n] = coeff * v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute inverse hyperbolic tangent of a derivative structure.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param result array where result must be stored (for
-     * inverse hyperbolic tangent the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void atanh(final double[] operand, final int operandOffset,
-                      final double[] result, final int resultOffset) {
-
-        // create the function value and derivatives
-        double[] function = new double[1 + order];
-        final double x = operand[operandOffset];
-        function[0] = FastMath.atanh(x);
-        if (order > 0) {
-            // the nth order derivative of atanh has the form:
-            // dn(atanh(x)/dxn = Q_n(x) / (1 - x^2)^n
-            // where Q_n(x) is a degree n-1 polynomial with same parity as n-1
-            // Q_1(x) = 1, Q_2(x) = 2x, Q_3(x) = 6x^2 + 2 ...
-            // the general recurrence relation for Q_n is:
-            // Q_n(x) = (1-x^2) Q_(n-1)'(x) + 2(n-1) x Q_(n-1)(x)
-            // as per polynomial parity, we can store coefficients of both Q_(n-1) and Q_n in the same array
-            final double[] q = new double[order];
-            q[0] = 1;
-            final double x2 = x * x;
-            final double f  = 1.0 / (1 - x2);
-            double coeff = f;
-            function[1] = coeff * q[0];
-            for (int n = 2; n <= order; ++n) {
-
-                // update and evaluate polynomial Q_n(x)
-                double v = 0;
-                q[n - 1] = n * q[n - 2];
-                for (int k = n - 1; k >= 0; k -= 2) {
-                    v = v * x2 + q[k];
-                    if (k > 2) {
-                        q[k - 2] = (k - 1) * q[k - 1] + (2 * n - k + 1) * q[k - 3];
-                    } else if (k == 2) {
-                        q[0] = q[1];
-                    }
-                }
-                if ((n & 0x1) == 0) {
-                    v *= x;
-                }
-
-                coeff *= f;
-                function[n] = coeff * v;
-
-            }
-        }
-
-        // apply function composition
-        compose(operand, operandOffset, function, result, resultOffset);
-
-    }
-
-    /** Compute composition of a derivative structure by a function.
-     * @param operand array holding the operand
-     * @param operandOffset offset of the operand in its array
-     * @param f array of value and derivatives of the function at
-     * the current point (i.e. at {@code operand[operandOffset]}).
-     * @param result array where result must be stored (for
-     * composition the result array <em>cannot</em> be the input
-     * array)
-     * @param resultOffset offset of the result in its array
-     */
-    public void compose(final double[] operand, final int operandOffset, final double[] f,
-                        final double[] result, final int resultOffset) {
-        for (int i = 0; i < compIndirection.length; ++i) {
-            final int[][] mappingI = compIndirection[i];
-            double r = 0;
-            for (int j = 0; j < mappingI.length; ++j) {
-                final int[] mappingIJ = mappingI[j];
-                double product = mappingIJ[0] * f[mappingIJ[1]];
-                for (int k = 2; k < mappingIJ.length; ++k) {
-                    product *= operand[operandOffset + mappingIJ[k]];
-                }
-                r += product;
-            }
-            result[resultOffset + i] = r;
-        }
-    }
-
-    /** Evaluate Taylor expansion of a derivative structure.
-     * @param ds array holding the derivative structure
-     * @param dsOffset offset of the derivative structure in its array
-     * @param delta parameters offsets (&Delta;x, &Delta;y, ...)
-     * @return value of the Taylor expansion at x + &Delta;x, y + &Delta;y, ...
-     * @throws MathArithmeticException if factorials becomes too large
-     */
-    public double taylor(final double[] ds, final int dsOffset, final double ... delta)
-       throws MathArithmeticException {
-        double value = 0;
-        for (int i = getSize() - 1; i >= 0; --i) {
-            final int[] orders = getPartialDerivativeOrders(i);
-            double term = ds[dsOffset + i];
-            for (int k = 0; k < orders.length; ++k) {
-                if (orders[k] > 0) {
-                    try {
-                        term *= FastMath.pow(delta[k], orders[k]) /
-                        CombinatoricsUtils.factorial(orders[k]);
-                    } catch (NotPositiveException e) {
-                        // this cannot happen
-                        throw new MathInternalError(e);
-                    }
-                }
-            }
-            value += term;
-        }
-        return value;
-    }
-
-    /** Check rules set compatibility.
-     * @param compiler other compiler to check against instance
-     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
-     */
-    public void checkCompatibility(final DSCompiler compiler)
-            throws DimensionMismatchException {
-        if (parameters != compiler.parameters) {
-            throw new DimensionMismatchException(parameters, compiler.parameters);
-        }
-        if (order != compiler.order) {
-            throw new DimensionMismatchException(order, compiler.order);
-        }
-    }
-
-}


[35/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/dfp/DfpDec.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/dfp/DfpDec.java b/src/main/java/org/apache/commons/math3/dfp/DfpDec.java
deleted file mode 100644
index 20875c0..0000000
--- a/src/main/java/org/apache/commons/math3/dfp/DfpDec.java
+++ /dev/null
@@ -1,368 +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.dfp;
-
-/** Subclass of {@link Dfp} which hides the radix-10000 artifacts of the superclass.
- * This should give outward appearances of being a decimal number with DIGITS*4-3
- * decimal digits. This class can be subclassed to appear to be an arbitrary number
- * of decimal digits less than DIGITS*4-3.
- * @since 2.2
- */
-public class DfpDec extends Dfp {
-
-    /** Makes an instance with a value of zero.
-     * @param factory factory linked to this instance
-     */
-    protected DfpDec(final DfpField factory) {
-        super(factory);
-    }
-
-    /** Create an instance from a byte value.
-     * @param factory factory linked to this instance
-     * @param x value to convert to an instance
-     */
-    protected DfpDec(final DfpField factory, byte x) {
-        super(factory, x);
-    }
-
-    /** Create an instance from an int value.
-     * @param factory factory linked to this instance
-     * @param x value to convert to an instance
-     */
-    protected DfpDec(final DfpField factory, int x) {
-        super(factory, x);
-    }
-
-    /** Create an instance from a long value.
-     * @param factory factory linked to this instance
-     * @param x value to convert to an instance
-     */
-    protected DfpDec(final DfpField factory, long x) {
-        super(factory, x);
-    }
-
-    /** Create an instance from a double value.
-     * @param factory factory linked to this instance
-     * @param x value to convert to an instance
-     */
-    protected DfpDec(final DfpField factory, double x) {
-        super(factory, x);
-        round(0);
-    }
-
-    /** Copy constructor.
-     * @param d instance to copy
-     */
-    public DfpDec(final Dfp d) {
-        super(d);
-        round(0);
-    }
-
-    /** Create an instance from a String representation.
-     * @param factory factory linked to this instance
-     * @param s string representation of the instance
-     */
-    protected DfpDec(final DfpField factory, final String s) {
-        super(factory, s);
-        round(0);
-    }
-
-    /** Creates an instance with a non-finite value.
-     * @param factory factory linked to this instance
-     * @param sign sign of the Dfp to create
-     * @param nans code of the value, must be one of {@link #INFINITE},
-     * {@link #SNAN},  {@link #QNAN}
-     */
-    protected DfpDec(final DfpField factory, final byte sign, final byte nans) {
-        super(factory, sign, nans);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance() {
-        return new DfpDec(getField());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance(final byte x) {
-        return new DfpDec(getField(), x);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance(final int x) {
-        return new DfpDec(getField(), x);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance(final long x) {
-        return new DfpDec(getField(), x);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance(final double x) {
-        return new DfpDec(getField(), x);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance(final Dfp d) {
-
-        // make sure we don't mix number with different precision
-        if (getField().getRadixDigits() != d.getField().getRadixDigits()) {
-            getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            return dotrap(DfpField.FLAG_INVALID, "newInstance", d, result);
-        }
-
-        return new DfpDec(d);
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance(final String s) {
-        return new DfpDec(getField(), s);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp newInstance(final byte sign, final byte nans) {
-        return new DfpDec(getField(), sign, nans);
-    }
-
-    /** Get the number of decimal digits this class is going to represent.
-     * Default implementation returns {@link #getRadixDigits()}*4-3. Subclasses can
-     * override this to return something less.
-     * @return number of decimal digits this class is going to represent
-     */
-    protected int getDecimalDigits() {
-        return getRadixDigits() * 4 - 3;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected int round(int in) {
-
-        int msb = mant[mant.length-1];
-        if (msb == 0) {
-            // special case -- this == zero
-            return 0;
-        }
-
-        int cmaxdigits = mant.length * 4;
-        int lsbthreshold = 1000;
-        while (lsbthreshold > msb) {
-            lsbthreshold /= 10;
-            cmaxdigits --;
-        }
-
-
-        final int digits = getDecimalDigits();
-        final int lsbshift = cmaxdigits - digits;
-        final int lsd = lsbshift / 4;
-
-        lsbthreshold = 1;
-        for (int i = 0; i < lsbshift % 4; i++) {
-            lsbthreshold *= 10;
-        }
-
-        final int lsb = mant[lsd];
-
-        if (lsbthreshold <= 1 && digits == 4 * mant.length - 3) {
-            return super.round(in);
-        }
-
-        int discarded = in;  // not looking at this after this point
-        final int n;
-        if (lsbthreshold == 1) {
-            // look to the next digit for rounding
-            n = (mant[lsd-1] / 1000) % 10;
-            mant[lsd-1] %= 1000;
-            discarded |= mant[lsd-1];
-        } else {
-            n = (lsb * 10 / lsbthreshold) % 10;
-            discarded |= lsb % (lsbthreshold/10);
-        }
-
-        for (int i = 0; i < lsd; i++) {
-            discarded |= mant[i];    // need to know if there are any discarded bits
-            mant[i] = 0;
-        }
-
-        mant[lsd] = lsb / lsbthreshold * lsbthreshold;
-
-        final boolean inc;
-        switch (getField().getRoundingMode()) {
-            case ROUND_DOWN:
-                inc = false;
-                break;
-
-            case ROUND_UP:
-                inc = (n != 0) || (discarded != 0); // round up if n!=0
-                break;
-
-            case ROUND_HALF_UP:
-                inc = n >= 5;  // round half up
-                break;
-
-            case ROUND_HALF_DOWN:
-                inc = n > 5;  // round half down
-                break;
-
-            case ROUND_HALF_EVEN:
-                inc = (n > 5) ||
-                      (n == 5 && discarded != 0) ||
-                      (n == 5 && discarded == 0 && ((lsb / lsbthreshold) & 1) == 1);  // round half-even
-                break;
-
-            case ROUND_HALF_ODD:
-                inc = (n > 5) ||
-                      (n == 5 && discarded != 0) ||
-                      (n == 5 && discarded == 0 && ((lsb / lsbthreshold) & 1) == 0);  // round half-odd
-                break;
-
-            case ROUND_CEIL:
-                inc = (sign == 1) && (n != 0 || discarded != 0);  // round ceil
-                break;
-
-            case ROUND_FLOOR:
-            default:
-                inc = (sign == -1) && (n != 0 || discarded != 0);  // round floor
-                break;
-        }
-
-        if (inc) {
-            // increment if necessary
-            int rh = lsbthreshold;
-            for (int i = lsd; i < mant.length; i++) {
-                final int r = mant[i] + rh;
-                rh = r / RADIX;
-                mant[i] = r % RADIX;
-            }
-
-            if (rh != 0) {
-                shiftRight();
-                mant[mant.length-1]=rh;
-            }
-        }
-
-        // Check for exceptional cases and raise signals if necessary
-        if (exp < MIN_EXP) {
-            // Gradual Underflow
-            getField().setIEEEFlagsBits(DfpField.FLAG_UNDERFLOW);
-            return DfpField.FLAG_UNDERFLOW;
-        }
-
-        if (exp > MAX_EXP) {
-            // Overflow
-            getField().setIEEEFlagsBits(DfpField.FLAG_OVERFLOW);
-            return DfpField.FLAG_OVERFLOW;
-        }
-
-        if (n != 0 || discarded != 0) {
-            // Inexact
-            getField().setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            return DfpField.FLAG_INEXACT;
-        }
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public Dfp nextAfter(Dfp x) {
-
-        final String trapName = "nextAfter";
-
-        // make sure we don't mix number with different precision
-        if (getField().getRadixDigits() != x.getField().getRadixDigits()) {
-            getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = newInstance(getZero());
-            result.nans = QNAN;
-            return dotrap(DfpField.FLAG_INVALID, trapName, x, result);
-        }
-
-        boolean up = false;
-        Dfp result;
-        Dfp inc;
-
-        // if this is greater than x
-        if (this.lessThan(x)) {
-            up = true;
-        }
-
-        if (equals(x)) {
-            return newInstance(x);
-        }
-
-        if (lessThan(getZero())) {
-            up = !up;
-        }
-
-        if (up) {
-            inc = power10(intLog10() - getDecimalDigits() + 1);
-            inc = copysign(inc, this);
-
-            if (this.equals(getZero())) {
-                inc = power10K(MIN_EXP-mant.length-1);
-            }
-
-            if (inc.equals(getZero())) {
-                result = copysign(newInstance(getZero()), this);
-            } else {
-                result = add(inc);
-            }
-        } else {
-            inc = power10(intLog10());
-            inc = copysign(inc, this);
-
-            if (this.equals(inc)) {
-                inc = inc.divide(power10(getDecimalDigits()));
-            } else {
-                inc = inc.divide(power10(getDecimalDigits() - 1));
-            }
-
-            if (this.equals(getZero())) {
-                inc = power10K(MIN_EXP-mant.length-1);
-            }
-
-            if (inc.equals(getZero())) {
-                result = copysign(newInstance(getZero()), this);
-            } else {
-                result = subtract(inc);
-            }
-        }
-
-        if (result.classify() == INFINITE && this.classify() != INFINITE) {
-            getField().setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            result = dotrap(DfpField.FLAG_INEXACT, trapName, x, result);
-        }
-
-        if (result.equals(getZero()) && this.equals(getZero()) == false) {
-            getField().setIEEEFlagsBits(DfpField.FLAG_INEXACT);
-            result = dotrap(DfpField.FLAG_INEXACT, trapName, x, result);
-        }
-
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/dfp/DfpField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/dfp/DfpField.java b/src/main/java/org/apache/commons/math3/dfp/DfpField.java
deleted file mode 100644
index fcdec82..0000000
--- a/src/main/java/org/apache/commons/math3/dfp/DfpField.java
+++ /dev/null
@@ -1,757 +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.dfp;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-
-/** Field for Decimal floating point instances.
- * @since 2.2
- */
-public class DfpField implements Field<Dfp> {
-
-    /** Enumerate for rounding modes. */
-    public enum RoundingMode {
-
-        /** Rounds toward zero (truncation). */
-        ROUND_DOWN,
-
-        /** Rounds away from zero if discarded digit is non-zero. */
-        ROUND_UP,
-
-        /** Rounds towards nearest unless both are equidistant in which case it rounds away from zero. */
-        ROUND_HALF_UP,
-
-        /** Rounds towards nearest unless both are equidistant in which case it rounds toward zero. */
-        ROUND_HALF_DOWN,
-
-        /** Rounds towards nearest unless both are equidistant in which case it rounds toward the even neighbor.
-         * This is the default as  specified by IEEE 854-1987
-         */
-        ROUND_HALF_EVEN,
-
-        /** Rounds towards nearest unless both are equidistant in which case it rounds toward the odd neighbor.  */
-        ROUND_HALF_ODD,
-
-        /** Rounds towards positive infinity. */
-        ROUND_CEIL,
-
-        /** Rounds towards negative infinity. */
-        ROUND_FLOOR;
-
-    }
-
-    /** IEEE 854-1987 flag for invalid operation. */
-    public static final int FLAG_INVALID   =  1;
-
-    /** IEEE 854-1987 flag for division by zero. */
-    public static final int FLAG_DIV_ZERO  =  2;
-
-    /** IEEE 854-1987 flag for overflow. */
-    public static final int FLAG_OVERFLOW  =  4;
-
-    /** IEEE 854-1987 flag for underflow. */
-    public static final int FLAG_UNDERFLOW =  8;
-
-    /** IEEE 854-1987 flag for inexact result. */
-    public static final int FLAG_INEXACT   = 16;
-
-    /** High precision string representation of &radic;2. */
-    private static String sqr2String;
-
-    // Note: the static strings are set up (once) by the ctor and @GuardedBy("DfpField.class")
-
-    /** High precision string representation of &radic;2 / 2. */
-    private static String sqr2ReciprocalString;
-
-    /** High precision string representation of &radic;3. */
-    private static String sqr3String;
-
-    /** High precision string representation of &radic;3 / 3. */
-    private static String sqr3ReciprocalString;
-
-    /** High precision string representation of &pi;. */
-    private static String piString;
-
-    /** High precision string representation of e. */
-    private static String eString;
-
-    /** High precision string representation of ln(2). */
-    private static String ln2String;
-
-    /** High precision string representation of ln(5). */
-    private static String ln5String;
-
-    /** High precision string representation of ln(10). */
-    private static String ln10String;
-
-    /** The number of radix digits.
-     * Note these depend on the radix which is 10000 digits,
-     * so each one is equivalent to 4 decimal digits.
-     */
-    private final int radixDigits;
-
-    /** A {@link Dfp} with value 0. */
-    private final Dfp zero;
-
-    /** A {@link Dfp} with value 1. */
-    private final Dfp one;
-
-    /** A {@link Dfp} with value 2. */
-    private final Dfp two;
-
-    /** A {@link Dfp} with value &radic;2. */
-    private final Dfp sqr2;
-
-    /** A two elements {@link Dfp} array with value &radic;2 split in two pieces. */
-    private final Dfp[] sqr2Split;
-
-    /** A {@link Dfp} with value &radic;2 / 2. */
-    private final Dfp sqr2Reciprocal;
-
-    /** A {@link Dfp} with value &radic;3. */
-    private final Dfp sqr3;
-
-    /** A {@link Dfp} with value &radic;3 / 3. */
-    private final Dfp sqr3Reciprocal;
-
-    /** A {@link Dfp} with value &pi;. */
-    private final Dfp pi;
-
-    /** A two elements {@link Dfp} array with value &pi; split in two pieces. */
-    private final Dfp[] piSplit;
-
-    /** A {@link Dfp} with value e. */
-    private final Dfp e;
-
-    /** A two elements {@link Dfp} array with value e split in two pieces. */
-    private final Dfp[] eSplit;
-
-    /** A {@link Dfp} with value ln(2). */
-    private final Dfp ln2;
-
-    /** A two elements {@link Dfp} array with value ln(2) split in two pieces. */
-    private final Dfp[] ln2Split;
-
-    /** A {@link Dfp} with value ln(5). */
-    private final Dfp ln5;
-
-    /** A two elements {@link Dfp} array with value ln(5) split in two pieces. */
-    private final Dfp[] ln5Split;
-
-    /** A {@link Dfp} with value ln(10). */
-    private final Dfp ln10;
-
-    /** Current rounding mode. */
-    private RoundingMode rMode;
-
-    /** IEEE 854-1987 signals. */
-    private int ieeeFlags;
-
-    /** Create a factory for the specified number of radix digits.
-     * <p>
-     * Note that since the {@link Dfp} class uses 10000 as its radix, each radix
-     * digit is equivalent to 4 decimal digits. This implies that asking for
-     * 13, 14, 15 or 16 decimal digits will really lead to a 4 radix 10000 digits in
-     * all cases.
-     * </p>
-     * @param decimalDigits minimal number of decimal digits.
-     */
-    public DfpField(final int decimalDigits) {
-        this(decimalDigits, true);
-    }
-
-    /** Create a factory for the specified number of radix digits.
-     * <p>
-     * Note that since the {@link Dfp} class uses 10000 as its radix, each radix
-     * digit is equivalent to 4 decimal digits. This implies that asking for
-     * 13, 14, 15 or 16 decimal digits will really lead to a 4 radix 10000 digits in
-     * all cases.
-     * </p>
-     * @param decimalDigits minimal number of decimal digits
-     * @param computeConstants if true, the transcendental constants for the given precision
-     * must be computed (setting this flag to false is RESERVED for the internal recursive call)
-     */
-    private DfpField(final int decimalDigits, final boolean computeConstants) {
-
-        this.radixDigits = (decimalDigits < 13) ? 4 : (decimalDigits + 3) / 4;
-        this.rMode       = RoundingMode.ROUND_HALF_EVEN;
-        this.ieeeFlags   = 0;
-        this.zero        = new Dfp(this, 0);
-        this.one         = new Dfp(this, 1);
-        this.two         = new Dfp(this, 2);
-
-        if (computeConstants) {
-            // set up transcendental constants
-            synchronized (DfpField.class) {
-
-                // as a heuristic to circumvent Table-Maker's Dilemma, we set the string
-                // representation of the constants to be at least 3 times larger than the
-                // number of decimal digits, also as an attempt to really compute these
-                // constants only once, we set a minimum number of digits
-                computeStringConstants((decimalDigits < 67) ? 200 : (3 * decimalDigits));
-
-                // set up the constants at current field accuracy
-                sqr2           = new Dfp(this, sqr2String);
-                sqr2Split      = split(sqr2String);
-                sqr2Reciprocal = new Dfp(this, sqr2ReciprocalString);
-                sqr3           = new Dfp(this, sqr3String);
-                sqr3Reciprocal = new Dfp(this, sqr3ReciprocalString);
-                pi             = new Dfp(this, piString);
-                piSplit        = split(piString);
-                e              = new Dfp(this, eString);
-                eSplit         = split(eString);
-                ln2            = new Dfp(this, ln2String);
-                ln2Split       = split(ln2String);
-                ln5            = new Dfp(this, ln5String);
-                ln5Split       = split(ln5String);
-                ln10           = new Dfp(this, ln10String);
-
-            }
-        } else {
-            // dummy settings for unused constants
-            sqr2           = null;
-            sqr2Split      = null;
-            sqr2Reciprocal = null;
-            sqr3           = null;
-            sqr3Reciprocal = null;
-            pi             = null;
-            piSplit        = null;
-            e              = null;
-            eSplit         = null;
-            ln2            = null;
-            ln2Split       = null;
-            ln5            = null;
-            ln5Split       = null;
-            ln10           = null;
-        }
-
-    }
-
-    /** Get the number of radix digits of the {@link Dfp} instances built by this factory.
-     * @return number of radix digits
-     */
-    public int getRadixDigits() {
-        return radixDigits;
-    }
-
-    /** Set the rounding mode.
-     *  If not set, the default value is {@link RoundingMode#ROUND_HALF_EVEN}.
-     * @param mode desired rounding mode
-     * Note that the rounding mode is common to all {@link Dfp} instances
-     * belonging to the current {@link DfpField} in the system and will
-     * affect all future calculations.
-     */
-    public void setRoundingMode(final RoundingMode mode) {
-        rMode = mode;
-    }
-
-    /** Get the current rounding mode.
-     * @return current rounding mode
-     */
-    public RoundingMode getRoundingMode() {
-        return rMode;
-    }
-
-    /** Get the IEEE 854 status flags.
-     * @return IEEE 854 status flags
-     * @see #clearIEEEFlags()
-     * @see #setIEEEFlags(int)
-     * @see #setIEEEFlagsBits(int)
-     * @see #FLAG_INVALID
-     * @see #FLAG_DIV_ZERO
-     * @see #FLAG_OVERFLOW
-     * @see #FLAG_UNDERFLOW
-     * @see #FLAG_INEXACT
-     */
-    public int getIEEEFlags() {
-        return ieeeFlags;
-    }
-
-    /** Clears the IEEE 854 status flags.
-     * @see #getIEEEFlags()
-     * @see #setIEEEFlags(int)
-     * @see #setIEEEFlagsBits(int)
-     * @see #FLAG_INVALID
-     * @see #FLAG_DIV_ZERO
-     * @see #FLAG_OVERFLOW
-     * @see #FLAG_UNDERFLOW
-     * @see #FLAG_INEXACT
-     */
-    public void clearIEEEFlags() {
-        ieeeFlags = 0;
-    }
-
-    /** Sets the IEEE 854 status flags.
-     * @param flags desired value for the flags
-     * @see #getIEEEFlags()
-     * @see #clearIEEEFlags()
-     * @see #setIEEEFlagsBits(int)
-     * @see #FLAG_INVALID
-     * @see #FLAG_DIV_ZERO
-     * @see #FLAG_OVERFLOW
-     * @see #FLAG_UNDERFLOW
-     * @see #FLAG_INEXACT
-     */
-    public void setIEEEFlags(final int flags) {
-        ieeeFlags = flags & (FLAG_INVALID | FLAG_DIV_ZERO | FLAG_OVERFLOW | FLAG_UNDERFLOW | FLAG_INEXACT);
-    }
-
-    /** Sets some bits in the IEEE 854 status flags, without changing the already set bits.
-     * <p>
-     * Calling this method is equivalent to call {@code setIEEEFlags(getIEEEFlags() | bits)}
-     * </p>
-     * @param bits bits to set
-     * @see #getIEEEFlags()
-     * @see #clearIEEEFlags()
-     * @see #setIEEEFlags(int)
-     * @see #FLAG_INVALID
-     * @see #FLAG_DIV_ZERO
-     * @see #FLAG_OVERFLOW
-     * @see #FLAG_UNDERFLOW
-     * @see #FLAG_INEXACT
-     */
-    public void setIEEEFlagsBits(final int bits) {
-        ieeeFlags |= bits & (FLAG_INVALID | FLAG_DIV_ZERO | FLAG_OVERFLOW | FLAG_UNDERFLOW | FLAG_INEXACT);
-    }
-
-    /** Makes a {@link Dfp} with a value of 0.
-     * @return a new {@link Dfp} with a value of 0
-     */
-    public Dfp newDfp() {
-        return new Dfp(this);
-    }
-
-    /** Create an instance from a byte value.
-     * @param x value to convert to an instance
-     * @return a new {@link Dfp} with the same value as x
-     */
-    public Dfp newDfp(final byte x) {
-        return new Dfp(this, x);
-    }
-
-    /** Create an instance from an int value.
-     * @param x value to convert to an instance
-     * @return a new {@link Dfp} with the same value as x
-     */
-    public Dfp newDfp(final int x) {
-        return new Dfp(this, x);
-    }
-
-    /** Create an instance from a long value.
-     * @param x value to convert to an instance
-     * @return a new {@link Dfp} with the same value as x
-     */
-    public Dfp newDfp(final long x) {
-        return new Dfp(this, x);
-    }
-
-    /** Create an instance from a double value.
-     * @param x value to convert to an instance
-     * @return a new {@link Dfp} with the same value as x
-     */
-    public Dfp newDfp(final double x) {
-        return new Dfp(this, x);
-    }
-
-    /** Copy constructor.
-     * @param d instance to copy
-     * @return a new {@link Dfp} with the same value as d
-     */
-    public Dfp newDfp(Dfp d) {
-        return new Dfp(d);
-    }
-
-    /** Create a {@link Dfp} given a String representation.
-     * @param s string representation of the instance
-     * @return a new {@link Dfp} parsed from specified string
-     */
-    public Dfp newDfp(final String s) {
-        return new Dfp(this, s);
-    }
-
-    /** Creates a {@link Dfp} with a non-finite value.
-     * @param sign sign of the Dfp to create
-     * @param nans code of the value, must be one of {@link Dfp#INFINITE},
-     * {@link Dfp#SNAN},  {@link Dfp#QNAN}
-     * @return a new {@link Dfp} with a non-finite value
-     */
-    public Dfp newDfp(final byte sign, final byte nans) {
-        return new Dfp(this, sign, nans);
-    }
-
-    /** Get the constant 0.
-     * @return a {@link Dfp} with value 0
-     */
-    public Dfp getZero() {
-        return zero;
-    }
-
-    /** Get the constant 1.
-     * @return a {@link Dfp} with value 1
-     */
-    public Dfp getOne() {
-        return one;
-    }
-
-    /** {@inheritDoc} */
-    public Class<? extends FieldElement<Dfp>> getRuntimeClass() {
-        return Dfp.class;
-    }
-
-    /** Get the constant 2.
-     * @return a {@link Dfp} with value 2
-     */
-    public Dfp getTwo() {
-        return two;
-    }
-
-    /** Get the constant &radic;2.
-     * @return a {@link Dfp} with value &radic;2
-     */
-    public Dfp getSqr2() {
-        return sqr2;
-    }
-
-    /** Get the constant &radic;2 split in two pieces.
-     * @return a {@link Dfp} with value &radic;2 split in two pieces
-     */
-    public Dfp[] getSqr2Split() {
-        return sqr2Split.clone();
-    }
-
-    /** Get the constant &radic;2 / 2.
-     * @return a {@link Dfp} with value &radic;2 / 2
-     */
-    public Dfp getSqr2Reciprocal() {
-        return sqr2Reciprocal;
-    }
-
-    /** Get the constant &radic;3.
-     * @return a {@link Dfp} with value &radic;3
-     */
-    public Dfp getSqr3() {
-        return sqr3;
-    }
-
-    /** Get the constant &radic;3 / 3.
-     * @return a {@link Dfp} with value &radic;3 / 3
-     */
-    public Dfp getSqr3Reciprocal() {
-        return sqr3Reciprocal;
-    }
-
-    /** Get the constant &pi;.
-     * @return a {@link Dfp} with value &pi;
-     */
-    public Dfp getPi() {
-        return pi;
-    }
-
-    /** Get the constant &pi; split in two pieces.
-     * @return a {@link Dfp} with value &pi; split in two pieces
-     */
-    public Dfp[] getPiSplit() {
-        return piSplit.clone();
-    }
-
-    /** Get the constant e.
-     * @return a {@link Dfp} with value e
-     */
-    public Dfp getE() {
-        return e;
-    }
-
-    /** Get the constant e split in two pieces.
-     * @return a {@link Dfp} with value e split in two pieces
-     */
-    public Dfp[] getESplit() {
-        return eSplit.clone();
-    }
-
-    /** Get the constant ln(2).
-     * @return a {@link Dfp} with value ln(2)
-     */
-    public Dfp getLn2() {
-        return ln2;
-    }
-
-    /** Get the constant ln(2) split in two pieces.
-     * @return a {@link Dfp} with value ln(2) split in two pieces
-     */
-    public Dfp[] getLn2Split() {
-        return ln2Split.clone();
-    }
-
-    /** Get the constant ln(5).
-     * @return a {@link Dfp} with value ln(5)
-     */
-    public Dfp getLn5() {
-        return ln5;
-    }
-
-    /** Get the constant ln(5) split in two pieces.
-     * @return a {@link Dfp} with value ln(5) split in two pieces
-     */
-    public Dfp[] getLn5Split() {
-        return ln5Split.clone();
-    }
-
-    /** Get the constant ln(10).
-     * @return a {@link Dfp} with value ln(10)
-     */
-    public Dfp getLn10() {
-        return ln10;
-    }
-
-    /** Breaks a string representation up into two {@link Dfp}'s.
-     * The split is such that the sum of them is equivalent to the input string,
-     * but has higher precision than using a single Dfp.
-     * @param a string representation of the number to split
-     * @return an array of two {@link Dfp Dfp} instances which sum equals a
-     */
-    private Dfp[] split(final String a) {
-      Dfp result[] = new Dfp[2];
-      boolean leading = true;
-      int sp = 0;
-      int sig = 0;
-
-      char[] buf = new char[a.length()];
-
-      for (int i = 0; i < buf.length; i++) {
-        buf[i] = a.charAt(i);
-
-        if (buf[i] >= '1' && buf[i] <= '9') {
-            leading = false;
-        }
-
-        if (buf[i] == '.') {
-          sig += (400 - sig) % 4;
-          leading = false;
-        }
-
-        if (sig == (radixDigits / 2) * 4) {
-          sp = i;
-          break;
-        }
-
-        if (buf[i] >= '0' && buf[i] <= '9' && !leading) {
-            sig ++;
-        }
-      }
-
-      result[0] = new Dfp(this, new String(buf, 0, sp));
-
-      for (int i = 0; i < buf.length; i++) {
-        buf[i] = a.charAt(i);
-        if (buf[i] >= '0' && buf[i] <= '9' && i < sp) {
-            buf[i] = '0';
-        }
-      }
-
-      result[1] = new Dfp(this, new String(buf));
-
-      return result;
-
-    }
-
-    /** Recompute the high precision string constants.
-     * @param highPrecisionDecimalDigits precision at which the string constants mus be computed
-     */
-    private static void computeStringConstants(final int highPrecisionDecimalDigits) {
-        if (sqr2String == null || sqr2String.length() < highPrecisionDecimalDigits - 3) {
-
-            // recompute the string representation of the transcendental constants
-            final DfpField highPrecisionField = new DfpField(highPrecisionDecimalDigits, false);
-            final Dfp highPrecisionOne        = new Dfp(highPrecisionField, 1);
-            final Dfp highPrecisionTwo        = new Dfp(highPrecisionField, 2);
-            final Dfp highPrecisionThree      = new Dfp(highPrecisionField, 3);
-
-            final Dfp highPrecisionSqr2 = highPrecisionTwo.sqrt();
-            sqr2String           = highPrecisionSqr2.toString();
-            sqr2ReciprocalString = highPrecisionOne.divide(highPrecisionSqr2).toString();
-
-            final Dfp highPrecisionSqr3 = highPrecisionThree.sqrt();
-            sqr3String           = highPrecisionSqr3.toString();
-            sqr3ReciprocalString = highPrecisionOne.divide(highPrecisionSqr3).toString();
-
-            piString   = computePi(highPrecisionOne, highPrecisionTwo, highPrecisionThree).toString();
-            eString    = computeExp(highPrecisionOne, highPrecisionOne).toString();
-            ln2String  = computeLn(highPrecisionTwo, highPrecisionOne, highPrecisionTwo).toString();
-            ln5String  = computeLn(new Dfp(highPrecisionField, 5),  highPrecisionOne, highPrecisionTwo).toString();
-            ln10String = computeLn(new Dfp(highPrecisionField, 10), highPrecisionOne, highPrecisionTwo).toString();
-
-        }
-    }
-
-    /** Compute &pi; using Jonathan and Peter Borwein quartic formula.
-     * @param one constant with value 1 at desired precision
-     * @param two constant with value 2 at desired precision
-     * @param three constant with value 3 at desired precision
-     * @return &pi;
-     */
-    private static Dfp computePi(final Dfp one, final Dfp two, final Dfp three) {
-
-        Dfp sqrt2   = two.sqrt();
-        Dfp yk      = sqrt2.subtract(one);
-        Dfp four    = two.add(two);
-        Dfp two2kp3 = two;
-        Dfp ak      = two.multiply(three.subtract(two.multiply(sqrt2)));
-
-        // The formula converges quartically. This means the number of correct
-        // digits is multiplied by 4 at each iteration! Five iterations are
-        // sufficient for about 160 digits, eight iterations give about
-        // 10000 digits (this has been checked) and 20 iterations more than
-        // 160 billions of digits (this has NOT been checked).
-        // So the limit here is considered sufficient for most purposes ...
-        for (int i = 1; i < 20; i++) {
-            final Dfp ykM1 = yk;
-
-            final Dfp y2         = yk.multiply(yk);
-            final Dfp oneMinusY4 = one.subtract(y2.multiply(y2));
-            final Dfp s          = oneMinusY4.sqrt().sqrt();
-            yk = one.subtract(s).divide(one.add(s));
-
-            two2kp3 = two2kp3.multiply(four);
-
-            final Dfp p = one.add(yk);
-            final Dfp p2 = p.multiply(p);
-            ak = ak.multiply(p2.multiply(p2)).subtract(two2kp3.multiply(yk).multiply(one.add(yk).add(yk.multiply(yk))));
-
-            if (yk.equals(ykM1)) {
-                break;
-            }
-        }
-
-        return one.divide(ak);
-
-    }
-
-    /** Compute exp(a).
-     * @param a number for which we want the exponential
-     * @param one constant with value 1 at desired precision
-     * @return exp(a)
-     */
-    public static Dfp computeExp(final Dfp a, final Dfp one) {
-
-        Dfp y  = new Dfp(one);
-        Dfp py = new Dfp(one);
-        Dfp f  = new Dfp(one);
-        Dfp fi = new Dfp(one);
-        Dfp x  = new Dfp(one);
-
-        for (int i = 0; i < 10000; i++) {
-            x = x.multiply(a);
-            y = y.add(x.divide(f));
-            fi = fi.add(one);
-            f = f.multiply(fi);
-            if (y.equals(py)) {
-                break;
-            }
-            py = new Dfp(y);
-        }
-
-        return y;
-
-    }
-
-
-    /** Compute ln(a).
-     *
-     *  Let f(x) = ln(x),
-     *
-     *  We know that f'(x) = 1/x, thus from Taylor's theorem we have:
-     *
-     *           -----          n+1         n
-     *  f(x) =   \           (-1)    (x - 1)
-     *           /          ----------------    for 1 <= n <= infinity
-     *           -----             n
-     *
-     *  or
-     *                       2        3       4
-     *                   (x-1)   (x-1)    (x-1)
-     *  ln(x) =  (x-1) - ----- + ------ - ------ + ...
-     *                     2       3        4
-     *
-     *  alternatively,
-     *
-     *                  2    3   4
-     *                 x    x   x
-     *  ln(x+1) =  x - -  + - - - + ...
-     *                 2    3   4
-     *
-     *  This series can be used to compute ln(x), but it converges too slowly.
-     *
-     *  If we substitute -x for x above, we get
-     *
-     *                   2    3    4
-     *                  x    x    x
-     *  ln(1-x) =  -x - -  - -  - - + ...
-     *                  2    3    4
-     *
-     *  Note that all terms are now negative.  Because the even powered ones
-     *  absorbed the sign.  Now, subtract the series above from the previous
-     *  one to get ln(x+1) - ln(1-x).  Note the even terms cancel out leaving
-     *  only the odd ones
-     *
-     *                             3     5      7
-     *                           2x    2x     2x
-     *  ln(x+1) - ln(x-1) = 2x + --- + --- + ---- + ...
-     *                            3     5      7
-     *
-     *  By the property of logarithms that ln(a) - ln(b) = ln (a/b) we have:
-     *
-     *                                3        5        7
-     *      x+1           /          x        x        x          \
-     *  ln ----- =   2 *  |  x  +   ----  +  ----  +  ---- + ...  |
-     *      x-1           \          3        5        7          /
-     *
-     *  But now we want to find ln(a), so we need to find the value of x
-     *  such that a = (x+1)/(x-1).   This is easily solved to find that
-     *  x = (a-1)/(a+1).
-     * @param a number for which we want the exponential
-     * @param one constant with value 1 at desired precision
-     * @param two constant with value 2 at desired precision
-     * @return ln(a)
-     */
-
-    public static Dfp computeLn(final Dfp a, final Dfp one, final Dfp two) {
-
-        int den = 1;
-        Dfp x = a.add(new Dfp(a.getField(), -1)).divide(a.add(one));
-
-        Dfp y = new Dfp(x);
-        Dfp num = new Dfp(x);
-        Dfp py = new Dfp(y);
-        for (int i = 0; i < 10000; i++) {
-            num = num.multiply(x);
-            num = num.multiply(x);
-            den += 2;
-            Dfp t = num.divide(den);
-            y = y.add(t);
-            if (y.equals(py)) {
-                break;
-            }
-            py = new Dfp(y);
-        }
-
-        return y.multiply(two);
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/dfp/DfpMath.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/dfp/DfpMath.java b/src/main/java/org/apache/commons/math3/dfp/DfpMath.java
deleted file mode 100644
index 3b19cb6..0000000
--- a/src/main/java/org/apache/commons/math3/dfp/DfpMath.java
+++ /dev/null
@@ -1,967 +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.dfp;
-
-/** Mathematical routines for use with {@link Dfp}.
- * The constants are defined in {@link DfpField}
- * @since 2.2
- */
-public class DfpMath {
-
-    /** Name for traps triggered by pow. */
-    private static final String POW_TRAP = "pow";
-
-    /**
-     * Private Constructor.
-     */
-    private DfpMath() {
-    }
-
-    /** Breaks a string representation up into two dfp's.
-     * <p>The two dfp are such that the sum of them is equivalent
-     * to the input string, but has higher precision than using a
-     * single dfp. This is useful for improving accuracy of
-     * exponentiation and critical multiplies.
-     * @param field field to which the Dfp must belong
-     * @param a string representation to split
-     * @return an array of two {@link Dfp} which sum is a
-     */
-    protected static Dfp[] split(final DfpField field, final String a) {
-        Dfp result[] = new Dfp[2];
-        char[] buf;
-        boolean leading = true;
-        int sp = 0;
-        int sig = 0;
-
-        buf = new char[a.length()];
-
-        for (int i = 0; i < buf.length; i++) {
-            buf[i] = a.charAt(i);
-
-            if (buf[i] >= '1' && buf[i] <= '9') {
-                leading = false;
-            }
-
-            if (buf[i] == '.') {
-                sig += (400 - sig) % 4;
-                leading = false;
-            }
-
-            if (sig == (field.getRadixDigits() / 2) * 4) {
-                sp = i;
-                break;
-            }
-
-            if (buf[i] >= '0' && buf[i] <= '9' && !leading) {
-                sig ++;
-            }
-        }
-
-        result[0] = field.newDfp(new String(buf, 0, sp));
-
-        for (int i = 0; i < buf.length; i++) {
-            buf[i] = a.charAt(i);
-            if (buf[i] >= '0' && buf[i] <= '9' && i < sp) {
-                buf[i] = '0';
-            }
-        }
-
-        result[1] = field.newDfp(new String(buf));
-
-        return result;
-    }
-
-    /** Splits a {@link Dfp} into 2 {@link Dfp}'s such that their sum is equal to the input {@link Dfp}.
-     * @param a number to split
-     * @return two elements array containing the split number
-     */
-    protected static Dfp[] split(final Dfp a) {
-        final Dfp[] result = new Dfp[2];
-        final Dfp shift = a.multiply(a.power10K(a.getRadixDigits() / 2));
-        result[0] = a.add(shift).subtract(shift);
-        result[1] = a.subtract(result[0]);
-        return result;
-    }
-
-    /** Multiply two numbers that are split in to two pieces that are
-     *  meant to be added together.
-     *  Use binomial multiplication so ab = a0 b0 + a0 b1 + a1 b0 + a1 b1
-     *  Store the first term in result0, the rest in result1
-     *  @param a first factor of the multiplication, in split form
-     *  @param b second factor of the multiplication, in split form
-     *  @return a &times; b, in split form
-     */
-    protected static Dfp[] splitMult(final Dfp[] a, final Dfp[] b) {
-        final Dfp[] result = new Dfp[2];
-
-        result[1] = a[0].getZero();
-        result[0] = a[0].multiply(b[0]);
-
-        /* If result[0] is infinite or zero, don't compute result[1].
-         * Attempting to do so may produce NaNs.
-         */
-
-        if (result[0].classify() == Dfp.INFINITE || result[0].equals(result[1])) {
-            return result;
-        }
-
-        result[1] = a[0].multiply(b[1]).add(a[1].multiply(b[0])).add(a[1].multiply(b[1]));
-
-        return result;
-    }
-
-    /** Divide two numbers that are split in to two pieces that are meant to be added together.
-     * Inverse of split multiply above:
-     *  (a+b) / (c+d) = (a/c) + ( (bc-ad)/(c**2+cd) )
-     *  @param a dividend, in split form
-     *  @param b divisor, in split form
-     *  @return a / b, in split form
-     */
-    protected static Dfp[] splitDiv(final Dfp[] a, final Dfp[] b) {
-        final Dfp[] result;
-
-        result = new Dfp[2];
-
-        result[0] = a[0].divide(b[0]);
-        result[1] = a[1].multiply(b[0]).subtract(a[0].multiply(b[1]));
-        result[1] = result[1].divide(b[0].multiply(b[0]).add(b[0].multiply(b[1])));
-
-        return result;
-    }
-
-    /** Raise a split base to the a power.
-     * @param base number to raise
-     * @param a power
-     * @return base<sup>a</sup>
-     */
-    protected static Dfp splitPow(final Dfp[] base, int a) {
-        boolean invert = false;
-
-        Dfp[] r = new Dfp[2];
-
-        Dfp[] result = new Dfp[2];
-        result[0] = base[0].getOne();
-        result[1] = base[0].getZero();
-
-        if (a == 0) {
-            // Special case a = 0
-            return result[0].add(result[1]);
-        }
-
-        if (a < 0) {
-            // If a is less than zero
-            invert = true;
-            a = -a;
-        }
-
-        // Exponentiate by successive squaring
-        do {
-            r[0] = new Dfp(base[0]);
-            r[1] = new Dfp(base[1]);
-            int trial = 1;
-
-            int prevtrial;
-            while (true) {
-                prevtrial = trial;
-                trial *= 2;
-                if (trial > a) {
-                    break;
-                }
-                r = splitMult(r, r);
-            }
-
-            trial = prevtrial;
-
-            a -= trial;
-            result = splitMult(result, r);
-
-        } while (a >= 1);
-
-        result[0] = result[0].add(result[1]);
-
-        if (invert) {
-            result[0] = base[0].getOne().divide(result[0]);
-        }
-
-        return result[0];
-
-    }
-
-    /** Raises base to the power a by successive squaring.
-     * @param base number to raise
-     * @param a power
-     * @return base<sup>a</sup>
-     */
-    public static Dfp pow(Dfp base, int a)
-    {
-        boolean invert = false;
-
-        Dfp result = base.getOne();
-
-        if (a == 0) {
-            // Special case
-            return result;
-        }
-
-        if (a < 0) {
-            invert = true;
-            a = -a;
-        }
-
-        // Exponentiate by successive squaring
-        do {
-            Dfp r = new Dfp(base);
-            Dfp prevr;
-            int trial = 1;
-            int prevtrial;
-
-            do {
-                prevr = new Dfp(r);
-                prevtrial = trial;
-                r = r.multiply(r);
-                trial *= 2;
-            } while (a>trial);
-
-            r = prevr;
-            trial = prevtrial;
-
-            a -= trial;
-            result = result.multiply(r);
-
-        } while (a >= 1);
-
-        if (invert) {
-            result = base.getOne().divide(result);
-        }
-
-        return base.newInstance(result);
-
-    }
-
-    /** Computes e to the given power.
-     * a is broken into two parts, such that a = n+m  where n is an integer.
-     * We use pow() to compute e<sup>n</sup> and a Taylor series to compute
-     * e<sup>m</sup>.  We return e*<sup>n</sup> &times; e<sup>m</sup>
-     * @param a power at which e should be raised
-     * @return e<sup>a</sup>
-     */
-    public static Dfp exp(final Dfp a) {
-
-        final Dfp inta = a.rint();
-        final Dfp fraca = a.subtract(inta);
-
-        final int ia = inta.intValue();
-        if (ia > 2147483646) {
-            // return +Infinity
-            return a.newInstance((byte)1, Dfp.INFINITE);
-        }
-
-        if (ia < -2147483646) {
-            // return 0;
-            return a.newInstance();
-        }
-
-        final Dfp einta = splitPow(a.getField().getESplit(), ia);
-        final Dfp efraca = expInternal(fraca);
-
-        return einta.multiply(efraca);
-    }
-
-    /** Computes e to the given power.
-     * Where -1 < a < 1.  Use the classic Taylor series.  1 + x**2/2! + x**3/3! + x**4/4!  ...
-     * @param a power at which e should be raised
-     * @return e<sup>a</sup>
-     */
-    protected static Dfp expInternal(final Dfp a) {
-        Dfp y = a.getOne();
-        Dfp x = a.getOne();
-        Dfp fact = a.getOne();
-        Dfp py = new Dfp(y);
-
-        for (int i = 1; i < 90; i++) {
-            x = x.multiply(a);
-            fact = fact.divide(i);
-            y = y.add(x.multiply(fact));
-            if (y.equals(py)) {
-                break;
-            }
-            py = new Dfp(y);
-        }
-
-        return y;
-    }
-
-    /** Returns the natural logarithm of a.
-     * a is first split into three parts such that  a = (10000^h)(2^j)k.
-     * ln(a) is computed by ln(a) = ln(5)*h + ln(2)*(h+j) + ln(k)
-     * k is in the range 2/3 < k <4/3 and is passed on to a series expansion.
-     * @param a number from which logarithm is requested
-     * @return log(a)
-     */
-    public static Dfp log(Dfp a) {
-        int lr;
-        Dfp x;
-        int ix;
-        int p2 = 0;
-
-        // Check the arguments somewhat here
-        if (a.equals(a.getZero()) || a.lessThan(a.getZero()) || a.isNaN()) {
-            // negative, zero or NaN
-            a.getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            return a.dotrap(DfpField.FLAG_INVALID, "ln", a, a.newInstance((byte)1, Dfp.QNAN));
-        }
-
-        if (a.classify() == Dfp.INFINITE) {
-            return a;
-        }
-
-        x = new Dfp(a);
-        lr = x.log10K();
-
-        x = x.divide(pow(a.newInstance(10000), lr));  /* This puts x in the range 0-10000 */
-        ix = x.floor().intValue();
-
-        while (ix > 2) {
-            ix >>= 1;
-            p2++;
-        }
-
-
-        Dfp[] spx = split(x);
-        Dfp[] spy = new Dfp[2];
-        spy[0] = pow(a.getTwo(), p2);          // use spy[0] temporarily as a divisor
-        spx[0] = spx[0].divide(spy[0]);
-        spx[1] = spx[1].divide(spy[0]);
-
-        spy[0] = a.newInstance("1.33333");    // Use spy[0] for comparison
-        while (spx[0].add(spx[1]).greaterThan(spy[0])) {
-            spx[0] = spx[0].divide(2);
-            spx[1] = spx[1].divide(2);
-            p2++;
-        }
-
-        // X is now in the range of 2/3 < x < 4/3
-        Dfp[] spz = logInternal(spx);
-
-        spx[0] = a.newInstance(new StringBuilder().append(p2+4*lr).toString());
-        spx[1] = a.getZero();
-        spy = splitMult(a.getField().getLn2Split(), spx);
-
-        spz[0] = spz[0].add(spy[0]);
-        spz[1] = spz[1].add(spy[1]);
-
-        spx[0] = a.newInstance(new StringBuilder().append(4*lr).toString());
-        spx[1] = a.getZero();
-        spy = splitMult(a.getField().getLn5Split(), spx);
-
-        spz[0] = spz[0].add(spy[0]);
-        spz[1] = spz[1].add(spy[1]);
-
-        return a.newInstance(spz[0].add(spz[1]));
-
-    }
-
-    /** Computes the natural log of a number between 0 and 2.
-     *  Let f(x) = ln(x),
-     *
-     *  We know that f'(x) = 1/x, thus from Taylor's theorum we have:
-     *
-     *           -----          n+1         n
-     *  f(x) =   \           (-1)    (x - 1)
-     *           /          ----------------    for 1 <= n <= infinity
-     *           -----             n
-     *
-     *  or
-     *                       2        3       4
-     *                   (x-1)   (x-1)    (x-1)
-     *  ln(x) =  (x-1) - ----- + ------ - ------ + ...
-     *                     2       3        4
-     *
-     *  alternatively,
-     *
-     *                  2    3   4
-     *                 x    x   x
-     *  ln(x+1) =  x - -  + - - - + ...
-     *                 2    3   4
-     *
-     *  This series can be used to compute ln(x), but it converges too slowly.
-     *
-     *  If we substitute -x for x above, we get
-     *
-     *                   2    3    4
-     *                  x    x    x
-     *  ln(1-x) =  -x - -  - -  - - + ...
-     *                  2    3    4
-     *
-     *  Note that all terms are now negative.  Because the even powered ones
-     *  absorbed the sign.  Now, subtract the series above from the previous
-     *  one to get ln(x+1) - ln(1-x).  Note the even terms cancel out leaving
-     *  only the odd ones
-     *
-     *                             3     5      7
-     *                           2x    2x     2x
-     *  ln(x+1) - ln(x-1) = 2x + --- + --- + ---- + ...
-     *                            3     5      7
-     *
-     *  By the property of logarithms that ln(a) - ln(b) = ln (a/b) we have:
-     *
-     *                                3        5        7
-     *      x+1           /          x        x        x          \
-     *  ln ----- =   2 *  |  x  +   ----  +  ----  +  ---- + ...  |
-     *      x-1           \          3        5        7          /
-     *
-     *  But now we want to find ln(a), so we need to find the value of x
-     *  such that a = (x+1)/(x-1).   This is easily solved to find that
-     *  x = (a-1)/(a+1).
-     * @param a number from which logarithm is requested, in split form
-     * @return log(a)
-     */
-    protected static Dfp[] logInternal(final Dfp a[]) {
-
-        /* Now we want to compute x = (a-1)/(a+1) but this is prone to
-         * loss of precision.  So instead, compute x = (a/4 - 1/4) / (a/4 + 1/4)
-         */
-        Dfp t = a[0].divide(4).add(a[1].divide(4));
-        Dfp x = t.add(a[0].newInstance("-0.25")).divide(t.add(a[0].newInstance("0.25")));
-
-        Dfp y = new Dfp(x);
-        Dfp num = new Dfp(x);
-        Dfp py = new Dfp(y);
-        int den = 1;
-        for (int i = 0; i < 10000; i++) {
-            num = num.multiply(x);
-            num = num.multiply(x);
-            den += 2;
-            t = num.divide(den);
-            y = y.add(t);
-            if (y.equals(py)) {
-                break;
-            }
-            py = new Dfp(y);
-        }
-
-        y = y.multiply(a[0].getTwo());
-
-        return split(y);
-
-    }
-
-    /** Computes x to the y power.<p>
-     *
-     *  Uses the following method:<p>
-     *
-     *  <ol>
-     *  <li> Set u = rint(y), v = y-u
-     *  <li> Compute a = v * ln(x)
-     *  <li> Compute b = rint( a/ln(2) )
-     *  <li> Compute c = a - b*ln(2)
-     *  <li> x<sup>y</sup> = x<sup>u</sup>  *   2<sup>b</sup> * e<sup>c</sup>
-     *  </ol>
-     *  if |y| > 1e8, then we compute by exp(y*ln(x))   <p>
-     *
-     *  <b>Special Cases</b><p>
-     *  <ul>
-     *  <li>  if y is 0.0 or -0.0 then result is 1.0
-     *  <li>  if y is 1.0 then result is x
-     *  <li>  if y is NaN then result is NaN
-     *  <li>  if x is NaN and y is not zero then result is NaN
-     *  <li>  if |x| > 1.0 and y is +Infinity then result is +Infinity
-     *  <li>  if |x| < 1.0 and y is -Infinity then result is +Infinity
-     *  <li>  if |x| > 1.0 and y is -Infinity then result is +0
-     *  <li>  if |x| < 1.0 and y is +Infinity then result is +0
-     *  <li>  if |x| = 1.0 and y is +/-Infinity then result is NaN
-     *  <li>  if x = +0 and y > 0 then result is +0
-     *  <li>  if x = +Inf and y < 0 then result is +0
-     *  <li>  if x = +0 and y < 0 then result is +Inf
-     *  <li>  if x = +Inf and y > 0 then result is +Inf
-     *  <li>  if x = -0 and y > 0, finite, not odd integer then result is +0
-     *  <li>  if x = -0 and y < 0, finite, and odd integer then result is -Inf
-     *  <li>  if x = -Inf and y > 0, finite, and odd integer then result is -Inf
-     *  <li>  if x = -0 and y < 0, not finite odd integer then result is +Inf
-     *  <li>  if x = -Inf and y > 0, not finite odd integer then result is +Inf
-     *  <li>  if x < 0 and y > 0, finite, and odd integer then result is -(|x|<sup>y</sup>)
-     *  <li>  if x < 0 and y > 0, finite, and not integer then result is NaN
-     *  </ul>
-     *  @param x base to be raised
-     *  @param y power to which base should be raised
-     *  @return x<sup>y</sup>
-     */
-    public static Dfp pow(Dfp x, final Dfp y) {
-
-        // make sure we don't mix number with different precision
-        if (x.getField().getRadixDigits() != y.getField().getRadixDigits()) {
-            x.getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            final Dfp result = x.newInstance(x.getZero());
-            result.nans = Dfp.QNAN;
-            return x.dotrap(DfpField.FLAG_INVALID, POW_TRAP, x, result);
-        }
-
-        final Dfp zero = x.getZero();
-        final Dfp one  = x.getOne();
-        final Dfp two  = x.getTwo();
-        boolean invert = false;
-        int ui;
-
-        /* Check for special cases */
-        if (y.equals(zero)) {
-            return x.newInstance(one);
-        }
-
-        if (y.equals(one)) {
-            if (x.isNaN()) {
-                // Test for NaNs
-                x.getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-                return x.dotrap(DfpField.FLAG_INVALID, POW_TRAP, x, x);
-            }
-            return x;
-        }
-
-        if (x.isNaN() || y.isNaN()) {
-            // Test for NaNs
-            x.getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            return x.dotrap(DfpField.FLAG_INVALID, POW_TRAP, x, x.newInstance((byte)1, Dfp.QNAN));
-        }
-
-        // X == 0
-        if (x.equals(zero)) {
-            if (Dfp.copysign(one, x).greaterThan(zero)) {
-                // X == +0
-                if (y.greaterThan(zero)) {
-                    return x.newInstance(zero);
-                } else {
-                    return x.newInstance(x.newInstance((byte)1, Dfp.INFINITE));
-                }
-            } else {
-                // X == -0
-                if (y.classify() == Dfp.FINITE && y.rint().equals(y) && !y.remainder(two).equals(zero)) {
-                    // If y is odd integer
-                    if (y.greaterThan(zero)) {
-                        return x.newInstance(zero.negate());
-                    } else {
-                        return x.newInstance(x.newInstance((byte)-1, Dfp.INFINITE));
-                    }
-                } else {
-                    // Y is not odd integer
-                    if (y.greaterThan(zero)) {
-                        return x.newInstance(zero);
-                    } else {
-                        return x.newInstance(x.newInstance((byte)1, Dfp.INFINITE));
-                    }
-                }
-            }
-        }
-
-        if (x.lessThan(zero)) {
-            // Make x positive, but keep track of it
-            x = x.negate();
-            invert = true;
-        }
-
-        if (x.greaterThan(one) && y.classify() == Dfp.INFINITE) {
-            if (y.greaterThan(zero)) {
-                return y;
-            } else {
-                return x.newInstance(zero);
-            }
-        }
-
-        if (x.lessThan(one) && y.classify() == Dfp.INFINITE) {
-            if (y.greaterThan(zero)) {
-                return x.newInstance(zero);
-            } else {
-                return x.newInstance(Dfp.copysign(y, one));
-            }
-        }
-
-        if (x.equals(one) && y.classify() == Dfp.INFINITE) {
-            x.getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            return x.dotrap(DfpField.FLAG_INVALID, POW_TRAP, x, x.newInstance((byte)1, Dfp.QNAN));
-        }
-
-        if (x.classify() == Dfp.INFINITE) {
-            // x = +/- inf
-            if (invert) {
-                // negative infinity
-                if (y.classify() == Dfp.FINITE && y.rint().equals(y) && !y.remainder(two).equals(zero)) {
-                    // If y is odd integer
-                    if (y.greaterThan(zero)) {
-                        return x.newInstance(x.newInstance((byte)-1, Dfp.INFINITE));
-                    } else {
-                        return x.newInstance(zero.negate());
-                    }
-                } else {
-                    // Y is not odd integer
-                    if (y.greaterThan(zero)) {
-                        return x.newInstance(x.newInstance((byte)1, Dfp.INFINITE));
-                    } else {
-                        return x.newInstance(zero);
-                    }
-                }
-            } else {
-                // positive infinity
-                if (y.greaterThan(zero)) {
-                    return x;
-                } else {
-                    return x.newInstance(zero);
-                }
-            }
-        }
-
-        if (invert && !y.rint().equals(y)) {
-            x.getField().setIEEEFlagsBits(DfpField.FLAG_INVALID);
-            return x.dotrap(DfpField.FLAG_INVALID, POW_TRAP, x, x.newInstance((byte)1, Dfp.QNAN));
-        }
-
-        // End special cases
-
-        Dfp r;
-        if (y.lessThan(x.newInstance(100000000)) && y.greaterThan(x.newInstance(-100000000))) {
-            final Dfp u = y.rint();
-            ui = u.intValue();
-
-            final Dfp v = y.subtract(u);
-
-            if (v.unequal(zero)) {
-                final Dfp a = v.multiply(log(x));
-                final Dfp b = a.divide(x.getField().getLn2()).rint();
-
-                final Dfp c = a.subtract(b.multiply(x.getField().getLn2()));
-                r = splitPow(split(x), ui);
-                r = r.multiply(pow(two, b.intValue()));
-                r = r.multiply(exp(c));
-            } else {
-                r = splitPow(split(x), ui);
-            }
-        } else {
-            // very large exponent.  |y| > 1e8
-            r = exp(log(x).multiply(y));
-        }
-
-        if (invert && y.rint().equals(y) && !y.remainder(two).equals(zero)) {
-            // if y is odd integer
-            r = r.negate();
-        }
-
-        return x.newInstance(r);
-
-    }
-
-    /** Computes sin(a)  Used when 0 < a < pi/4.
-     * Uses the classic Taylor series.  x - x**3/3! + x**5/5!  ...
-     * @param a number from which sine is desired, in split form
-     * @return sin(a)
-     */
-    protected static Dfp sinInternal(Dfp a[]) {
-
-        Dfp c = a[0].add(a[1]);
-        Dfp y = c;
-        c = c.multiply(c);
-        Dfp x = y;
-        Dfp fact = a[0].getOne();
-        Dfp py = new Dfp(y);
-
-        for (int i = 3; i < 90; i += 2) {
-            x = x.multiply(c);
-            x = x.negate();
-
-            fact = fact.divide((i-1)*i);  // 1 over fact
-            y = y.add(x.multiply(fact));
-            if (y.equals(py)) {
-                break;
-            }
-            py = new Dfp(y);
-        }
-
-        return y;
-
-    }
-
-    /** Computes cos(a)  Used when 0 < a < pi/4.
-     * Uses the classic Taylor series for cosine.  1 - x**2/2! + x**4/4!  ...
-     * @param a number from which cosine is desired, in split form
-     * @return cos(a)
-     */
-    protected static Dfp cosInternal(Dfp a[]) {
-        final Dfp one = a[0].getOne();
-
-
-        Dfp x = one;
-        Dfp y = one;
-        Dfp c = a[0].add(a[1]);
-        c = c.multiply(c);
-
-        Dfp fact = one;
-        Dfp py = new Dfp(y);
-
-        for (int i = 2; i < 90; i += 2) {
-            x = x.multiply(c);
-            x = x.negate();
-
-            fact = fact.divide((i - 1) * i);  // 1 over fact
-
-            y = y.add(x.multiply(fact));
-            if (y.equals(py)) {
-                break;
-            }
-            py = new Dfp(y);
-        }
-
-        return y;
-
-    }
-
-    /** computes the sine of the argument.
-     * @param a number from which sine is desired
-     * @return sin(a)
-     */
-    public static Dfp sin(final Dfp a) {
-        final Dfp pi = a.getField().getPi();
-        final Dfp zero = a.getField().getZero();
-        boolean neg = false;
-
-        /* First reduce the argument to the range of +/- PI */
-        Dfp x = a.remainder(pi.multiply(2));
-
-        /* if x < 0 then apply identity sin(-x) = -sin(x) */
-        /* This puts x in the range 0 < x < PI            */
-        if (x.lessThan(zero)) {
-            x = x.negate();
-            neg = true;
-        }
-
-        /* Since sine(x) = sine(pi - x) we can reduce the range to
-         * 0 < x < pi/2
-         */
-
-        if (x.greaterThan(pi.divide(2))) {
-            x = pi.subtract(x);
-        }
-
-        Dfp y;
-        if (x.lessThan(pi.divide(4))) {
-            Dfp c[] = new Dfp[2];
-            c[0] = x;
-            c[1] = zero;
-
-            //y = sinInternal(c);
-            y = sinInternal(split(x));
-        } else {
-            final Dfp c[] = new Dfp[2];
-            final Dfp[] piSplit = a.getField().getPiSplit();
-            c[0] = piSplit[0].divide(2).subtract(x);
-            c[1] = piSplit[1].divide(2);
-            y = cosInternal(c);
-        }
-
-        if (neg) {
-            y = y.negate();
-        }
-
-        return a.newInstance(y);
-
-    }
-
-    /** computes the cosine of the argument.
-     * @param a number from which cosine is desired
-     * @return cos(a)
-     */
-    public static Dfp cos(Dfp a) {
-        final Dfp pi = a.getField().getPi();
-        final Dfp zero = a.getField().getZero();
-        boolean neg = false;
-
-        /* First reduce the argument to the range of +/- PI */
-        Dfp x = a.remainder(pi.multiply(2));
-
-        /* if x < 0 then apply identity cos(-x) = cos(x) */
-        /* This puts x in the range 0 < x < PI           */
-        if (x.lessThan(zero)) {
-            x = x.negate();
-        }
-
-        /* Since cos(x) = -cos(pi - x) we can reduce the range to
-         * 0 < x < pi/2
-         */
-
-        if (x.greaterThan(pi.divide(2))) {
-            x = pi.subtract(x);
-            neg = true;
-        }
-
-        Dfp y;
-        if (x.lessThan(pi.divide(4))) {
-            Dfp c[] = new Dfp[2];
-            c[0] = x;
-            c[1] = zero;
-
-            y = cosInternal(c);
-        } else {
-            final Dfp c[] = new Dfp[2];
-            final Dfp[] piSplit = a.getField().getPiSplit();
-            c[0] = piSplit[0].divide(2).subtract(x);
-            c[1] = piSplit[1].divide(2);
-            y = sinInternal(c);
-        }
-
-        if (neg) {
-            y = y.negate();
-        }
-
-        return a.newInstance(y);
-
-    }
-
-    /** computes the tangent of the argument.
-     * @param a number from which tangent is desired
-     * @return tan(a)
-     */
-    public static Dfp tan(final Dfp a) {
-        return sin(a).divide(cos(a));
-    }
-
-    /** computes the arc-tangent of the argument.
-     * @param a number from which arc-tangent is desired
-     * @return atan(a)
-     */
-    protected static Dfp atanInternal(final Dfp a) {
-
-        Dfp y = new Dfp(a);
-        Dfp x = new Dfp(y);
-        Dfp py = new Dfp(y);
-
-        for (int i = 3; i < 90; i += 2) {
-            x = x.multiply(a);
-            x = x.multiply(a);
-            x = x.negate();
-            y = y.add(x.divide(i));
-            if (y.equals(py)) {
-                break;
-            }
-            py = new Dfp(y);
-        }
-
-        return y;
-
-    }
-
-    /** computes the arc tangent of the argument
-     *
-     *  Uses the typical taylor series
-     *
-     *  but may reduce arguments using the following identity
-     * tan(x+y) = (tan(x) + tan(y)) / (1 - tan(x)*tan(y))
-     *
-     * since tan(PI/8) = sqrt(2)-1,
-     *
-     * atan(x) = atan( (x - sqrt(2) + 1) / (1+x*sqrt(2) - x) + PI/8.0
-     * @param a number from which arc-tangent is desired
-     * @return atan(a)
-     */
-    public static Dfp atan(final Dfp a) {
-        final Dfp   zero      = a.getField().getZero();
-        final Dfp   one       = a.getField().getOne();
-        final Dfp[] sqr2Split = a.getField().getSqr2Split();
-        final Dfp[] piSplit   = a.getField().getPiSplit();
-        boolean recp = false;
-        boolean neg = false;
-        boolean sub = false;
-
-        final Dfp ty = sqr2Split[0].subtract(one).add(sqr2Split[1]);
-
-        Dfp x = new Dfp(a);
-        if (x.lessThan(zero)) {
-            neg = true;
-            x = x.negate();
-        }
-
-        if (x.greaterThan(one)) {
-            recp = true;
-            x = one.divide(x);
-        }
-
-        if (x.greaterThan(ty)) {
-            Dfp sty[] = new Dfp[2];
-            sub = true;
-
-            sty[0] = sqr2Split[0].subtract(one);
-            sty[1] = sqr2Split[1];
-
-            Dfp[] xs = split(x);
-
-            Dfp[] ds = splitMult(xs, sty);
-            ds[0] = ds[0].add(one);
-
-            xs[0] = xs[0].subtract(sty[0]);
-            xs[1] = xs[1].subtract(sty[1]);
-
-            xs = splitDiv(xs, ds);
-            x = xs[0].add(xs[1]);
-
-            //x = x.subtract(ty).divide(dfp.one.add(x.multiply(ty)));
-        }
-
-        Dfp y = atanInternal(x);
-
-        if (sub) {
-            y = y.add(piSplit[0].divide(8)).add(piSplit[1].divide(8));
-        }
-
-        if (recp) {
-            y = piSplit[0].divide(2).subtract(y).add(piSplit[1].divide(2));
-        }
-
-        if (neg) {
-            y = y.negate();
-        }
-
-        return a.newInstance(y);
-
-    }
-
-    /** computes the arc-sine of the argument.
-     * @param a number from which arc-sine is desired
-     * @return asin(a)
-     */
-    public static Dfp asin(final Dfp a) {
-        return atan(a.divide(a.getOne().subtract(a.multiply(a)).sqrt()));
-    }
-
-    /** computes the arc-cosine of the argument.
-     * @param a number from which arc-cosine is desired
-     * @return acos(a)
-     */
-    public static Dfp acos(Dfp a) {
-        Dfp result;
-        boolean negative = false;
-
-        if (a.lessThan(a.getZero())) {
-            negative = true;
-        }
-
-        a = Dfp.copysign(a, a.getOne());  // absolute value
-
-        result = atan(a.getOne().subtract(a.multiply(a)).sqrt().divide(a));
-
-        if (negative) {
-            result = a.getField().getPi().subtract(result);
-        }
-
-        return a.newInstance(result);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/dfp/UnivariateDfpFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/dfp/UnivariateDfpFunction.java b/src/main/java/org/apache/commons/math3/dfp/UnivariateDfpFunction.java
deleted file mode 100644
index b627a32..0000000
--- a/src/main/java/org/apache/commons/math3/dfp/UnivariateDfpFunction.java
+++ /dev/null
@@ -1,39 +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.dfp;
-
-/**
- * An interface representing a univariate {@link Dfp} function.
- *
- */
-public interface UnivariateDfpFunction {
-
-    /**
-     * Compute the value of the function.
-     *
-     * @param x Point at which the function value should be computed.
-     * @return the value.
-     * @throws IllegalArgumentException when the activated method itself can
-     * ascertain that preconditions, specified in the API expressed at the
-     * level of the activated method, have been violated.  In the vast
-     * majority of cases where Commons-Math throws IllegalArgumentException,
-     * it is the result of argument checking of actual parameters immediately
-     * passed to a method.
-     */
-    Dfp value(Dfp x);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/dfp/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/dfp/package-info.java b/src/main/java/org/apache/commons/math3/dfp/package-info.java
deleted file mode 100644
index 42a4b48..0000000
--- a/src/main/java/org/apache/commons/math3/dfp/package-info.java
+++ /dev/null
@@ -1,88 +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.
- */
-/**
- *
- * Decimal floating point library for Java
- *
- * <p>Another floating point class.  This one is built using radix 10000
- * which is 10<sup>4</sup>, so its almost decimal.</p>
- *
- * <p>The design goals here are:
- * <ol>
- *  <li>Decimal math, or close to it</li>
- *  <li>Settable precision (but no mix between numbers using different settings)</li>
- *  <li>Portability.  Code should be keep as portable as possible.</li>
- *  <li>Performance</li>
- *  <li>Accuracy  - Results should always be +/- 1 ULP for basic
- *       algebraic operation</li>
- *  <li>Comply with IEEE 854-1987 as much as possible.
- *       (See IEEE 854-1987 notes below)</li>
- * </ol></p>
- *
- * <p>Trade offs:
- * <ol>
- *  <li>Memory foot print.  I'm using more memory than necessary to
- *       represent numbers to get better performance.</li>
- *  <li>Digits are bigger, so rounding is a greater loss.  So, if you
- *       really need 12 decimal digits, better use 4 base 10000 digits
- *       there can be one partially filled.</li>
- * </ol></p>
- *
- * <p>Numbers are represented  in the following form:
- * <pre>
- * n  =  sign &times; mant &times; (radix)<sup>exp</sup>;</p>
- * </pre>
- * where sign is &plusmn;1, mantissa represents a fractional number between
- * zero and one.  mant[0] is the least significant digit.
- * exp is in the range of -32767 to 32768</p>
- *
- * <p>IEEE 854-1987  Notes and differences</p>
- *
- * <p>IEEE 854 requires the radix to be either 2 or 10.  The radix here is
- * 10000, so that requirement is not met, but  it is possible that a
- * subclassed can be made to make it behave as a radix 10
- * number.  It is my opinion that if it looks and behaves as a radix
- * 10 number then it is one and that requirement would be met.</p>
- *
- * <p>The radix of 10000 was chosen because it should be faster to operate
- * on 4 decimal digits at once instead of one at a time.  Radix 10 behavior
- * can be realized by add an additional rounding step to ensure that
- * the number of decimal digits represented is constant.</p>
- *
- * <p>The IEEE standard specifically leaves out internal data encoding,
- * so it is reasonable to conclude that such a subclass of this radix
- * 10000 system is merely an encoding of a radix 10 system.</p>
- *
- * <p>IEEE 854 also specifies the existence of "sub-normal" numbers.  This
- * class does not contain any such entities.  The most significant radix
- * 10000 digit is always non-zero.  Instead, we support "gradual underflow"
- * by raising the underflow flag for numbers less with exponent less than
- * expMin, but don't flush to zero until the exponent reaches MIN_EXP-digits.
- * Thus the smallest number we can represent would be:
- * 1E(-(MIN_EXP-digits-1)&lowast;4),  eg, for digits=5, MIN_EXP=-32767, that would
- * be 1e-131092.</p>
- *
- * <p>IEEE 854 defines that the implied radix point lies just to the right
- * of the most significant digit and to the left of the remaining digits.
- * This implementation puts the implied radix point to the left of all
- * digits including the most significant one.  The most significant digit
- * here is the one just to the right of the radix point.  This is a fine
- * detail and is really only a matter of definition.  Any side effects of
- * this can be rendered invisible by a subclass.</p>
- *
- */
-package org.apache.commons.math3.dfp;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java b/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java
deleted file mode 100644
index 82a96c5..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/AbstractIntegerDistribution.java
+++ /dev/null
@@ -1,253 +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.distribution;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.RandomDataImpl;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Base class for integer-valued discrete distributions.  Default
- * implementations are provided for some of the methods that do not vary
- * from distribution to distribution.
- *
- */
-public abstract class AbstractIntegerDistribution implements IntegerDistribution, Serializable {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -1146319659338487221L;
-
-    /**
-     * RandomData instance used to generate samples from the distribution.
-     * @deprecated As of 3.1, to be removed in 4.0. Please use the
-     * {@link #random} instance variable instead.
-     */
-    @Deprecated
-    protected final RandomDataImpl randomData = new RandomDataImpl();
-
-    /**
-     * RNG instance used to generate samples from the distribution.
-     * @since 3.1
-     */
-    protected final RandomGenerator random;
-
-    /**
-     * @deprecated As of 3.1, to be removed in 4.0. Please use
-     * {@link #AbstractIntegerDistribution(RandomGenerator)} instead.
-     */
-    @Deprecated
-    protected AbstractIntegerDistribution() {
-        // Legacy users are only allowed to access the deprecated "randomData".
-        // New users are forbidden to use this constructor.
-        random = null;
-    }
-
-    /**
-     * @param rng Random number generator.
-     * @since 3.1
-     */
-    protected AbstractIntegerDistribution(RandomGenerator rng) {
-        random = rng;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation uses the identity
-     * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
-     */
-    public double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException {
-        if (x1 < x0) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
-                    x0, x1, true);
-        }
-        return cumulativeProbability(x1) - cumulativeProbability(x0);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation returns
-     * <ul>
-     * <li>{@link #getSupportLowerBound()} for {@code p = 0},</li>
-     * <li>{@link #getSupportUpperBound()} for {@code p = 1}, and</li>
-     * <li>{@link #solveInverseCumulativeProbability(double, int, int)} for
-     *     {@code 0 < p < 1}.</li>
-     * </ul>
-     */
-    public int inverseCumulativeProbability(final double p) throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-
-        int lower = getSupportLowerBound();
-        if (p == 0.0) {
-            return lower;
-        }
-        if (lower == Integer.MIN_VALUE) {
-            if (checkedCumulativeProbability(lower) >= p) {
-                return lower;
-            }
-        } else {
-            lower -= 1; // this ensures cumulativeProbability(lower) < p, which
-                        // is important for the solving step
-        }
-
-        int upper = getSupportUpperBound();
-        if (p == 1.0) {
-            return upper;
-        }
-
-        // use the one-sided Chebyshev inequality to narrow the bracket
-        // cf. AbstractRealDistribution.inverseCumulativeProbability(double)
-        final double mu = getNumericalMean();
-        final double sigma = FastMath.sqrt(getNumericalVariance());
-        final boolean chebyshevApplies = !(Double.isInfinite(mu) || Double.isNaN(mu) ||
-                Double.isInfinite(sigma) || Double.isNaN(sigma) || sigma == 0.0);
-        if (chebyshevApplies) {
-            double k = FastMath.sqrt((1.0 - p) / p);
-            double tmp = mu - k * sigma;
-            if (tmp > lower) {
-                lower = ((int) FastMath.ceil(tmp)) - 1;
-            }
-            k = 1.0 / k;
-            tmp = mu + k * sigma;
-            if (tmp < upper) {
-                upper = ((int) FastMath.ceil(tmp)) - 1;
-            }
-        }
-
-        return solveInverseCumulativeProbability(p, lower, upper);
-    }
-
-    /**
-     * This is a utility function used by {@link
-     * #inverseCumulativeProbability(double)}. It assumes {@code 0 < p < 1} and
-     * that the inverse cumulative probability lies in the bracket {@code
-     * (lower, upper]}. The implementation does simple bisection to find the
-     * smallest {@code p}-quantile <code>inf{x in Z | P(X<=x) >= p}</code>.
-     *
-     * @param p the cumulative probability
-     * @param lower a value satisfying {@code cumulativeProbability(lower) < p}
-     * @param upper a value satisfying {@code p <= cumulativeProbability(upper)}
-     * @return the smallest {@code p}-quantile of this distribution
-     */
-    protected int solveInverseCumulativeProbability(final double p, int lower, int upper) {
-        while (lower + 1 < upper) {
-            int xm = (lower + upper) / 2;
-            if (xm < lower || xm > upper) {
-                /*
-                 * Overflow.
-                 * There will never be an overflow in both calculation methods
-                 * for xm at the same time
-                 */
-                xm = lower + (upper - lower) / 2;
-            }
-
-            double pm = checkedCumulativeProbability(xm);
-            if (pm >= p) {
-                upper = xm;
-            } else {
-                lower = xm;
-            }
-        }
-        return upper;
-    }
-
-    /** {@inheritDoc} */
-    public void reseedRandomGenerator(long seed) {
-        random.setSeed(seed);
-        randomData.reSeed(seed);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation uses the
-     * <a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling">
-     * inversion method</a>.
-     */
-    public int sample() {
-        return inverseCumulativeProbability(random.nextDouble());
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation generates the sample by calling
-     * {@link #sample()} in a loop.
-     */
-    public int[] sample(int sampleSize) {
-        if (sampleSize <= 0) {
-            throw new NotStrictlyPositiveException(
-                    LocalizedFormats.NUMBER_OF_SAMPLES, sampleSize);
-        }
-        int[] out = new int[sampleSize];
-        for (int i = 0; i < sampleSize; i++) {
-            out[i] = sample();
-        }
-        return out;
-    }
-
-    /**
-     * Computes the cumulative probability function and checks for {@code NaN}
-     * values returned. Throws {@code MathInternalError} if the value is
-     * {@code NaN}. Rethrows any exception encountered evaluating the cumulative
-     * probability function. Throws {@code MathInternalError} if the cumulative
-     * probability function returns {@code NaN}.
-     *
-     * @param argument input value
-     * @return the cumulative probability
-     * @throws MathInternalError if the cumulative probability is {@code NaN}
-     */
-    private double checkedCumulativeProbability(int argument)
-        throws MathInternalError {
-        double result = Double.NaN;
-        result = cumulativeProbability(argument);
-        if (Double.isNaN(result)) {
-            throw new MathInternalError(LocalizedFormats
-                    .DISCRETE_CUMULATIVE_PROBABILITY_RETURNED_NAN, argument);
-        }
-        return result;
-    }
-
-    /**
-     * For a random variable {@code X} whose values are distributed according to
-     * this distribution, this method returns {@code log(P(X = x))}, where
-     * {@code log} is the natural logarithm. In other words, this method
-     * represents the logarithm of the probability mass function (PMF) for the
-     * distribution. Note that due to the floating point precision and
-     * under/overflow issues, this method will for some distributions be more
-     * precise and faster than computing the logarithm of
-     * {@link #probability(int)}.
-     * <p>
-     * The default implementation simply computes the logarithm of {@code probability(x)}.</p>
-     *
-     * @param x the point at which the PMF is evaluated
-     * @return the logarithm of the value of the probability mass function at {@code x}
-     */
-    public double logProbability(int x) {
-        return FastMath.log(probability(x));
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/AbstractMultivariateRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/AbstractMultivariateRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/AbstractMultivariateRealDistribution.java
deleted file mode 100644
index a1dfd64..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/AbstractMultivariateRealDistribution.java
+++ /dev/null
@@ -1,70 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-
-/**
- * Base class for multivariate probability distributions.
- *
- * @since 3.1
- */
-public abstract class AbstractMultivariateRealDistribution
-    implements MultivariateRealDistribution {
-    /** RNG instance used to generate samples from the distribution. */
-    protected final RandomGenerator random;
-    /** The number of dimensions or columns in the multivariate distribution. */
-    private final int dimension;
-
-    /**
-     * @param rng Random number generator.
-     * @param n Number of dimensions.
-     */
-    protected AbstractMultivariateRealDistribution(RandomGenerator rng,
-                                                   int n) {
-        random = rng;
-        dimension = n;
-    }
-
-    /** {@inheritDoc} */
-    public void reseedRandomGenerator(long seed) {
-        random.setSeed(seed);
-    }
-
-    /** {@inheritDoc} */
-    public int getDimension() {
-        return dimension;
-    }
-
-    /** {@inheritDoc} */
-    public abstract double[] sample();
-
-    /** {@inheritDoc} */
-    public double[][] sample(final int sampleSize) {
-        if (sampleSize <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
-                                                   sampleSize);
-        }
-        final double[][] out = new double[sampleSize][dimension];
-        for (int i = 0; i < sampleSize; i++) {
-            out[i] = sample();
-        }
-        return out;
-    }
-}


[25/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/OptimumImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/OptimumImpl.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/OptimumImpl.java
deleted file mode 100644
index 698f86c..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/OptimumImpl.java
+++ /dev/null
@@ -1,97 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer.Optimum;
-import org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem.Evaluation;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-
-/**
- * A pedantic implementation of {@link Optimum}.
- *
- * @since 3.3
- */
-class OptimumImpl implements Optimum {
-
-    /** abscissa and ordinate */
-    private final Evaluation value;
-    /** number of evaluations to compute this optimum */
-    private final int evaluations;
-    /** number of iterations to compute this optimum */
-    private final int iterations;
-
-    /**
-     * Construct an optimum from an evaluation and the values of the counters.
-     *
-     * @param value       the function value
-     * @param evaluations number of times the function was evaluated
-     * @param iterations  number of iterations of the algorithm
-     */
-    OptimumImpl(final Evaluation value, final int evaluations, final int iterations) {
-        this.value = value;
-        this.evaluations = evaluations;
-        this.iterations = iterations;
-    }
-
-    /* auto-generated implementations */
-
-    /** {@inheritDoc} */
-    public int getEvaluations() {
-        return evaluations;
-    }
-
-    /** {@inheritDoc} */
-    public int getIterations() {
-        return iterations;
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getCovariances(double threshold) {
-        return value.getCovariances(threshold);
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getSigma(double covarianceSingularityThreshold) {
-        return value.getSigma(covarianceSingularityThreshold);
-    }
-
-    /** {@inheritDoc} */
-    public double getRMS() {
-        return value.getRMS();
-    }
-
-    /** {@inheritDoc} */
-    public RealMatrix getJacobian() {
-        return value.getJacobian();
-    }
-
-    /** {@inheritDoc} */
-    public double getCost() {
-        return value.getCost();
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getResiduals() {
-        return value.getResiduals();
-    }
-
-    /** {@inheritDoc} */
-    public RealVector getPoint() {
-        return value.getPoint();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/ParameterValidator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/ParameterValidator.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/ParameterValidator.java
deleted file mode 100644
index d5b8529..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/ParameterValidator.java
+++ /dev/null
@@ -1,34 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.linear.RealVector;
-
-/**
- * Interface for validating a set of model parameters.
- *
- * @since 3.4
- */
-public interface ParameterValidator {
-    /**
-     * Validates the set of parameters.
-     *
-     * @param params Input parameters.
-     * @return the validated values.
-     */
-    RealVector validate(RealVector params);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.java
deleted file mode 100644
index 180e328..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/ValueAndJacobianFunction.java
+++ /dev/null
@@ -1,44 +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.fitting.leastsquares;
-
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-
-/**
- * A interface for functions that compute a vector of values and can compute their
- * derivatives (Jacobian).
- *
- * @since 3.4
- */
-public interface ValueAndJacobianFunction extends MultivariateJacobianFunction {
-    /**
-     * Compute the value.
-     *
-     * @param params Point.
-     * @return the value at the given point.
-     */
-    RealVector computeValue(final double[] params);
-
-    /**
-     * Compute the Jacobian.
-     *
-     * @param params Point.
-     * @return the Jacobian at the given point.
-     */
-    RealMatrix computeJacobian(final double[] params);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/leastsquares/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/leastsquares/package-info.java b/src/main/java/org/apache/commons/math3/fitting/leastsquares/package-info.java
deleted file mode 100644
index 98623b5..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/leastsquares/package-info.java
+++ /dev/null
@@ -1,39 +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.
- */
-
-/**
- * This package provides algorithms that minimize the residuals
- * between observations and model values.
- * The {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresOptimizer
- * least-squares optimizers} minimize the distance (called
- * <em>cost</em> or <em>&chi;<sup>2</sup></em>) between model and
- * observations.
- *
- * <br/>
- * Algorithms in this category need access to a <em>problem</em>
- * (represented by a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresProblem
- * LeastSquaresProblem}).
- * Such a model predicts a set of values which the algorithm tries to match
- * with a set of given set of observed values.
- * <br/>
- * The problem can be created progressively using a {@link
- * org.apache.commons.math3.fitting.leastsquares.LeastSquaresBuilder builder} or it can
- * be created at once using a {@link org.apache.commons.math3.fitting.leastsquares.LeastSquaresFactory
- * factory}.
- * @since 3.3
- */
-package org.apache.commons.math3.fitting.leastsquares;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fitting/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fitting/package-info.java b/src/main/java/org/apache/commons/math3/fitting/package-info.java
deleted file mode 100644
index 460e3f7..0000000
--- a/src/main/java/org/apache/commons/math3/fitting/package-info.java
+++ /dev/null
@@ -1,26 +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.
- */
-/**
- * Classes to perform curve fitting.
- *
- * Curve fitting is a special case of a least-squares problem
- * where the parameters are the coefficients of a function \( f \)
- * whose graph \( y = f(x) \) should pass through sample points, and
- * were the objective function is the squared sum of the residuals
- * \( f(x_i) - y_i \) for observed points \( (x_i, y_i) \).
- */
-package org.apache.commons.math3.fitting;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/AbstractFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/AbstractFormat.java b/src/main/java/org/apache/commons/math3/fraction/AbstractFormat.java
deleted file mode 100644
index fcb9d41..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/AbstractFormat.java
+++ /dev/null
@@ -1,209 +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.fraction;
-
-import java.io.Serializable;
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Common part shared by both {@link FractionFormat} and {@link BigFractionFormat}.
- * @since 2.0
- */
-public abstract class AbstractFormat extends NumberFormat implements Serializable {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -6981118387974191891L;
-
-    /** The format used for the denominator. */
-    private NumberFormat denominatorFormat;
-
-    /** The format used for the numerator. */
-    private NumberFormat numeratorFormat;
-
-    /**
-     * Create an improper formatting instance with the default number format
-     * for the numerator and denominator.
-     */
-    protected AbstractFormat() {
-        this(getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an improper formatting instance with a custom number format for
-     * both the numerator and denominator.
-     * @param format the custom format for both the numerator and denominator.
-     */
-    protected AbstractFormat(final NumberFormat format) {
-        this(format, (NumberFormat) format.clone());
-    }
-
-    /**
-     * Create an improper formatting instance with a custom number format for
-     * the numerator and a custom number format for the denominator.
-     * @param numeratorFormat the custom format for the numerator.
-     * @param denominatorFormat the custom format for the denominator.
-     */
-    protected AbstractFormat(final NumberFormat numeratorFormat,
-                             final NumberFormat denominatorFormat) {
-        this.numeratorFormat   = numeratorFormat;
-        this.denominatorFormat = denominatorFormat;
-    }
-
-    /**
-     * Create a default number format.  The default number format is based on
-     * {@link NumberFormat#getNumberInstance(java.util.Locale)}. The only
-     * customization is the maximum number of BigFraction digits, which is set to 0.
-     * @return the default number format.
-     */
-    protected static NumberFormat getDefaultNumberFormat() {
-        return getDefaultNumberFormat(Locale.getDefault());
-    }
-
-    /**
-     * Create a default number format.  The default number format is based on
-     * {@link NumberFormat#getNumberInstance(java.util.Locale)}. The only
-     * customization is the maximum number of BigFraction digits, which is set to 0.
-     * @param locale the specific locale used by the format.
-     * @return the default number format specific to the given locale.
-     */
-    protected static NumberFormat getDefaultNumberFormat(final Locale locale) {
-        final NumberFormat nf = NumberFormat.getNumberInstance(locale);
-        nf.setMaximumFractionDigits(0);
-        nf.setParseIntegerOnly(true);
-        return nf;
-    }
-
-    /**
-     * Access the denominator format.
-     * @return the denominator format.
-     */
-    public NumberFormat getDenominatorFormat() {
-        return denominatorFormat;
-    }
-
-    /**
-     * Access the numerator format.
-     * @return the numerator format.
-     */
-    public NumberFormat getNumeratorFormat() {
-        return numeratorFormat;
-    }
-
-    /**
-     * Modify the denominator format.
-     * @param format the new denominator format value.
-     * @throws NullArgumentException if {@code format} is {@code null}.
-     */
-    public void setDenominatorFormat(final NumberFormat format) {
-        if (format == null) {
-            throw new NullArgumentException(LocalizedFormats.DENOMINATOR_FORMAT);
-        }
-        this.denominatorFormat = format;
-    }
-
-    /**
-     * Modify the numerator format.
-     * @param format the new numerator format value.
-     * @throws NullArgumentException if {@code format} is {@code null}.
-     */
-    public void setNumeratorFormat(final NumberFormat format) {
-        if (format == null) {
-            throw new NullArgumentException(LocalizedFormats.NUMERATOR_FORMAT);
-        }
-        this.numeratorFormat = format;
-    }
-
-    /**
-     * Parses <code>source</code> until a non-whitespace character is found.
-     * @param source the string to parse
-     * @param pos input/output parsing parameter.  On output, <code>pos</code>
-     *        holds the index of the next non-whitespace character.
-     */
-    protected static void parseAndIgnoreWhitespace(final String source,
-                                                   final ParsePosition pos) {
-        parseNextCharacter(source, pos);
-        pos.setIndex(pos.getIndex() - 1);
-    }
-
-    /**
-     * Parses <code>source</code> until a non-whitespace character is found.
-     * @param source the string to parse
-     * @param pos input/output parsing parameter.
-     * @return the first non-whitespace character.
-     */
-    protected static char parseNextCharacter(final String source,
-                                             final ParsePosition pos) {
-         int index = pos.getIndex();
-         final int n = source.length();
-         char ret = 0;
-
-         if (index < n) {
-             char c;
-             do {
-                 c = source.charAt(index++);
-             } while (Character.isWhitespace(c) && index < n);
-             pos.setIndex(index);
-
-             if (index < n) {
-                 ret = c;
-             }
-         }
-
-         return ret;
-    }
-
-    /**
-     * Formats a double value as a fraction and appends the result to a StringBuffer.
-     *
-     * @param value the double value to format
-     * @param buffer StringBuffer to append to
-     * @param position On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return a reference to the appended buffer
-     * @see #format(Object, StringBuffer, FieldPosition)
-     */
-    @Override
-    public StringBuffer format(final double value,
-                               final StringBuffer buffer, final FieldPosition position) {
-        return format(Double.valueOf(value), buffer, position);
-    }
-
-
-    /**
-     * Formats a long value as a fraction and appends the result to a StringBuffer.
-     *
-     * @param value the long value to format
-     * @param buffer StringBuffer to append to
-     * @param position On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return a reference to the appended buffer
-     * @see #format(Object, StringBuffer, FieldPosition)
-     */
-    @Override
-    public StringBuffer format(final long value,
-                               final StringBuffer buffer, final FieldPosition position) {
-        return format(Long.valueOf(value), buffer, position);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/BigFraction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/BigFraction.java b/src/main/java/org/apache/commons/math3/fraction/BigFraction.java
deleted file mode 100644
index e16c593..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/BigFraction.java
+++ /dev/null
@@ -1,1147 +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.fraction;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Representation of a rational number without any overflow. This class is
- * immutable.
- *
- * @since 2.0
- */
-public class BigFraction
-    extends Number
-    implements FieldElement<BigFraction>, Comparable<BigFraction>, Serializable {
-
-    /** A fraction representing "2 / 1". */
-    public static final BigFraction TWO = new BigFraction(2);
-
-    /** A fraction representing "1". */
-    public static final BigFraction ONE = new BigFraction(1);
-
-    /** A fraction representing "0". */
-    public static final BigFraction ZERO = new BigFraction(0);
-
-    /** A fraction representing "-1 / 1". */
-    public static final BigFraction MINUS_ONE = new BigFraction(-1);
-
-    /** A fraction representing "4/5". */
-    public static final BigFraction FOUR_FIFTHS = new BigFraction(4, 5);
-
-    /** A fraction representing "1/5". */
-    public static final BigFraction ONE_FIFTH = new BigFraction(1, 5);
-
-    /** A fraction representing "1/2". */
-    public static final BigFraction ONE_HALF = new BigFraction(1, 2);
-
-    /** A fraction representing "1/4". */
-    public static final BigFraction ONE_QUARTER = new BigFraction(1, 4);
-
-    /** A fraction representing "1/3". */
-    public static final BigFraction ONE_THIRD = new BigFraction(1, 3);
-
-    /** A fraction representing "3/5". */
-    public static final BigFraction THREE_FIFTHS = new BigFraction(3, 5);
-
-    /** A fraction representing "3/4". */
-    public static final BigFraction THREE_QUARTERS = new BigFraction(3, 4);
-
-    /** A fraction representing "2/5". */
-    public static final BigFraction TWO_FIFTHS = new BigFraction(2, 5);
-
-    /** A fraction representing "2/4". */
-    public static final BigFraction TWO_QUARTERS = new BigFraction(2, 4);
-
-    /** A fraction representing "2/3". */
-    public static final BigFraction TWO_THIRDS = new BigFraction(2, 3);
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -5630213147331578515L;
-
-    /** <code>BigInteger</code> representation of 100. */
-    private static final BigInteger ONE_HUNDRED = BigInteger.valueOf(100);
-
-    /** The numerator. */
-    private final BigInteger numerator;
-
-    /** The denominator. */
-    private final BigInteger denominator;
-
-    /**
-     * <p>
-     * Create a {@link BigFraction} equivalent to the passed {@code BigInteger}, ie
-     * "num / 1".
-     * </p>
-     *
-     * @param num
-     *            the numerator.
-     */
-    public BigFraction(final BigInteger num) {
-        this(num, BigInteger.ONE);
-    }
-
-    /**
-     * Create a {@link BigFraction} given the numerator and denominator as
-     * {@code BigInteger}. The {@link BigFraction} is reduced to lowest terms.
-     *
-     * @param num the numerator, must not be {@code null}.
-     * @param den the denominator, must not be {@code null}.
-     * @throws ZeroException if the denominator is zero.
-     * @throws NullArgumentException if either of the arguments is null
-     */
-    public BigFraction(BigInteger num, BigInteger den) {
-        MathUtils.checkNotNull(num, LocalizedFormats.NUMERATOR);
-        MathUtils.checkNotNull(den, LocalizedFormats.DENOMINATOR);
-        if (BigInteger.ZERO.equals(den)) {
-            throw new ZeroException(LocalizedFormats.ZERO_DENOMINATOR);
-        }
-        if (BigInteger.ZERO.equals(num)) {
-            numerator   = BigInteger.ZERO;
-            denominator = BigInteger.ONE;
-        } else {
-
-            // reduce numerator and denominator by greatest common denominator
-            final BigInteger gcd = num.gcd(den);
-            if (BigInteger.ONE.compareTo(gcd) < 0) {
-                num = num.divide(gcd);
-                den = den.divide(gcd);
-            }
-
-            // move sign to numerator
-            if (BigInteger.ZERO.compareTo(den) > 0) {
-                num = num.negate();
-                den = den.negate();
-            }
-
-            // store the values in the final fields
-            numerator   = num;
-            denominator = den;
-
-        }
-    }
-
-    /**
-     * Create a fraction given the double value.
-     * <p>
-     * This constructor behaves <em>differently</em> from
-     * {@link #BigFraction(double, double, int)}. It converts the double value
-     * exactly, considering its internal bits representation. This works for all
-     * values except NaN and infinities and does not requires any loop or
-     * convergence threshold.
-     * </p>
-     * <p>
-     * Since this conversion is exact and since double numbers are sometimes
-     * approximated, the fraction created may seem strange in some cases. For example,
-     * calling <code>new BigFraction(1.0 / 3.0)</code> does <em>not</em> create
-     * the fraction 1/3, but the fraction 6004799503160661 / 18014398509481984
-     * because the double number passed to the constructor is not exactly 1/3
-     * (this number cannot be stored exactly in IEEE754).
-     * </p>
-     * @see #BigFraction(double, double, int)
-     * @param value the double value to convert to a fraction.
-     * @exception MathIllegalArgumentException if value is NaN or infinite
-     */
-    public BigFraction(final double value) throws MathIllegalArgumentException {
-        if (Double.isNaN(value)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.NAN_VALUE_CONVERSION);
-        }
-        if (Double.isInfinite(value)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.INFINITE_VALUE_CONVERSION);
-        }
-
-        // compute m and k such that value = m * 2^k
-        final long bits     = Double.doubleToLongBits(value);
-        final long sign     = bits & 0x8000000000000000L;
-        final long exponent = bits & 0x7ff0000000000000L;
-        long m              = bits & 0x000fffffffffffffL;
-        if (exponent != 0) {
-            // this was a normalized number, add the implicit most significant bit
-            m |= 0x0010000000000000L;
-        }
-        if (sign != 0) {
-            m = -m;
-        }
-        int k = ((int) (exponent >> 52)) - 1075;
-        while (((m & 0x001ffffffffffffeL) != 0) && ((m & 0x1) == 0)) {
-            m >>= 1;
-            ++k;
-        }
-
-        if (k < 0) {
-            numerator   = BigInteger.valueOf(m);
-            denominator = BigInteger.ZERO.flipBit(-k);
-        } else {
-            numerator   = BigInteger.valueOf(m).multiply(BigInteger.ZERO.flipBit(k));
-            denominator = BigInteger.ONE;
-        }
-
-    }
-
-    /**
-     * Create a fraction given the double value and maximum error allowed.
-     * <p>
-     * References:
-     * <ul>
-     * <li><a href="http://mathworld.wolfram.com/ContinuedFraction.html">
-     * Continued Fraction</a> equations (11) and (22)-(26)</li>
-     * </ul>
-     * </p>
-     *
-     * @param value
-     *            the double value to convert to a fraction.
-     * @param epsilon
-     *            maximum error allowed. The resulting fraction is within
-     *            <code>epsilon</code> of <code>value</code>, in absolute terms.
-     * @param maxIterations
-     *            maximum number of convergents.
-     * @throws FractionConversionException
-     *             if the continued fraction failed to converge.
-     * @see #BigFraction(double)
-     */
-    public BigFraction(final double value, final double epsilon,
-                       final int maxIterations)
-        throws FractionConversionException {
-        this(value, epsilon, Integer.MAX_VALUE, maxIterations);
-    }
-
-    /**
-     * Create a fraction given the double value and either the maximum error
-     * allowed or the maximum number of denominator digits.
-     * <p>
-     *
-     * NOTE: This constructor is called with EITHER - a valid epsilon value and
-     * the maxDenominator set to Integer.MAX_VALUE (that way the maxDenominator
-     * has no effect). OR - a valid maxDenominator value and the epsilon value
-     * set to zero (that way epsilon only has effect if there is an exact match
-     * before the maxDenominator value is reached).
-     * </p>
-     * <p>
-     *
-     * It has been done this way so that the same code can be (re)used for both
-     * scenarios. However this could be confusing to users if it were part of
-     * the public API and this constructor should therefore remain PRIVATE.
-     * </p>
-     *
-     * See JIRA issue ticket MATH-181 for more details:
-     *
-     * https://issues.apache.org/jira/browse/MATH-181
-     *
-     * @param value
-     *            the double value to convert to a fraction.
-     * @param epsilon
-     *            maximum error allowed. The resulting fraction is within
-     *            <code>epsilon</code> of <code>value</code>, in absolute terms.
-     * @param maxDenominator
-     *            maximum denominator value allowed.
-     * @param maxIterations
-     *            maximum number of convergents.
-     * @throws FractionConversionException
-     *             if the continued fraction failed to converge.
-     */
-    private BigFraction(final double value, final double epsilon,
-                        final int maxDenominator, int maxIterations)
-        throws FractionConversionException {
-        long overflow = Integer.MAX_VALUE;
-        double r0 = value;
-        long a0 = (long) FastMath.floor(r0);
-
-        if (FastMath.abs(a0) > overflow) {
-            throw new FractionConversionException(value, a0, 1l);
-        }
-
-        // check for (almost) integer arguments, which should not go
-        // to iterations.
-        if (FastMath.abs(a0 - value) < epsilon) {
-            numerator = BigInteger.valueOf(a0);
-            denominator = BigInteger.ONE;
-            return;
-        }
-
-        long p0 = 1;
-        long q0 = 0;
-        long p1 = a0;
-        long q1 = 1;
-
-        long p2 = 0;
-        long q2 = 1;
-
-        int n = 0;
-        boolean stop = false;
-        do {
-            ++n;
-            final double r1 = 1.0 / (r0 - a0);
-            final long a1 = (long) FastMath.floor(r1);
-            p2 = (a1 * p1) + p0;
-            q2 = (a1 * q1) + q0;
-            if ((p2 > overflow) || (q2 > overflow)) {
-                // in maxDenominator mode, if the last fraction was very close to the actual value
-                // q2 may overflow in the next iteration; in this case return the last one.
-                if (epsilon == 0.0 && FastMath.abs(q1) < maxDenominator) {
-                    break;
-                }
-                throw new FractionConversionException(value, p2, q2);
-            }
-
-            final double convergent = (double) p2 / (double) q2;
-            if ((n < maxIterations) &&
-                (FastMath.abs(convergent - value) > epsilon) &&
-                (q2 < maxDenominator)) {
-                p0 = p1;
-                p1 = p2;
-                q0 = q1;
-                q1 = q2;
-                a0 = a1;
-                r0 = r1;
-            } else {
-                stop = true;
-            }
-        } while (!stop);
-
-        if (n >= maxIterations) {
-            throw new FractionConversionException(value, maxIterations);
-        }
-
-        if (q2 < maxDenominator) {
-            numerator   = BigInteger.valueOf(p2);
-            denominator = BigInteger.valueOf(q2);
-        } else {
-            numerator   = BigInteger.valueOf(p1);
-            denominator = BigInteger.valueOf(q1);
-        }
-    }
-
-    /**
-     * Create a fraction given the double value and maximum denominator.
-     * <p>
-     * References:
-     * <ul>
-     * <li><a href="http://mathworld.wolfram.com/ContinuedFraction.html">
-     * Continued Fraction</a> equations (11) and (22)-(26)</li>
-     * </ul>
-     * </p>
-     *
-     * @param value
-     *            the double value to convert to a fraction.
-     * @param maxDenominator
-     *            The maximum allowed value for denominator.
-     * @throws FractionConversionException
-     *             if the continued fraction failed to converge.
-     */
-    public BigFraction(final double value, final int maxDenominator)
-        throws FractionConversionException {
-        this(value, 0, maxDenominator, 100);
-    }
-
-    /**
-     * <p>
-     * Create a {@link BigFraction} equivalent to the passed {@code int}, ie
-     * "num / 1".
-     * </p>
-     *
-     * @param num
-     *            the numerator.
-     */
-    public BigFraction(final int num) {
-        this(BigInteger.valueOf(num), BigInteger.ONE);
-    }
-
-    /**
-     * <p>
-     * Create a {@link BigFraction} given the numerator and denominator as simple
-     * {@code int}. The {@link BigFraction} is reduced to lowest terms.
-     * </p>
-     *
-     * @param num
-     *            the numerator.
-     * @param den
-     *            the denominator.
-     */
-    public BigFraction(final int num, final int den) {
-        this(BigInteger.valueOf(num), BigInteger.valueOf(den));
-    }
-
-    /**
-     * <p>
-     * Create a {@link BigFraction} equivalent to the passed long, ie "num / 1".
-     * </p>
-     *
-     * @param num
-     *            the numerator.
-     */
-    public BigFraction(final long num) {
-        this(BigInteger.valueOf(num), BigInteger.ONE);
-    }
-
-    /**
-     * <p>
-     * Create a {@link BigFraction} given the numerator and denominator as simple
-     * {@code long}. The {@link BigFraction} is reduced to lowest terms.
-     * </p>
-     *
-     * @param num
-     *            the numerator.
-     * @param den
-     *            the denominator.
-     */
-    public BigFraction(final long num, final long den) {
-        this(BigInteger.valueOf(num), BigInteger.valueOf(den));
-    }
-
-    /**
-     * <p>
-     * Creates a <code>BigFraction</code> instance with the 2 parts of a fraction
-     * Y/Z.
-     * </p>
-     *
-     * <p>
-     * Any negative signs are resolved to be on the numerator.
-     * </p>
-     *
-     * @param numerator
-     *            the numerator, for example the three in 'three sevenths'.
-     * @param denominator
-     *            the denominator, for example the seven in 'three sevenths'.
-     * @return a new fraction instance, with the numerator and denominator
-     *         reduced.
-     * @throws ArithmeticException
-     *             if the denominator is <code>zero</code>.
-     */
-    public static BigFraction getReducedFraction(final int numerator,
-                                                 final int denominator) {
-        if (numerator == 0) {
-            return ZERO; // normalize zero.
-        }
-
-        return new BigFraction(numerator, denominator);
-    }
-
-    /**
-     * <p>
-     * Returns the absolute value of this {@link BigFraction}.
-     * </p>
-     *
-     * @return the absolute value as a {@link BigFraction}.
-     */
-    public BigFraction abs() {
-        return (BigInteger.ZERO.compareTo(numerator) <= 0) ? this : negate();
-    }
-
-    /**
-     * <p>
-     * Adds the value of this fraction to the passed {@link BigInteger},
-     * returning the result in reduced form.
-     * </p>
-     *
-     * @param bg
-     *            the {@link BigInteger} to add, must'nt be <code>null</code>.
-     * @return a <code>BigFraction</code> instance with the resulting values.
-     * @throws NullArgumentException
-     *             if the {@link BigInteger} is <code>null</code>.
-     */
-    public BigFraction add(final BigInteger bg) throws NullArgumentException {
-        MathUtils.checkNotNull(bg);
-        return new BigFraction(numerator.add(denominator.multiply(bg)), denominator);
-    }
-
-    /**
-     * <p>
-     * Adds the value of this fraction to the passed {@code integer}, returning
-     * the result in reduced form.
-     * </p>
-     *
-     * @param i
-     *            the {@code integer} to add.
-     * @return a <code>BigFraction</code> instance with the resulting values.
-     */
-    public BigFraction add(final int i) {
-        return add(BigInteger.valueOf(i));
-    }
-
-    /**
-     * <p>
-     * Adds the value of this fraction to the passed {@code long}, returning
-     * the result in reduced form.
-     * </p>
-     *
-     * @param l
-     *            the {@code long} to add.
-     * @return a <code>BigFraction</code> instance with the resulting values.
-     */
-    public BigFraction add(final long l) {
-        return add(BigInteger.valueOf(l));
-    }
-
-    /**
-     * <p>
-     * Adds the value of this fraction to another, returning the result in
-     * reduced form.
-     * </p>
-     *
-     * @param fraction
-     *            the {@link BigFraction} to add, must not be <code>null</code>.
-     * @return a {@link BigFraction} instance with the resulting values.
-     * @throws NullArgumentException if the {@link BigFraction} is {@code null}.
-     */
-    public BigFraction add(final BigFraction fraction) {
-        if (fraction == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        if (ZERO.equals(fraction)) {
-            return this;
-        }
-
-        BigInteger num = null;
-        BigInteger den = null;
-
-        if (denominator.equals(fraction.denominator)) {
-            num = numerator.add(fraction.numerator);
-            den = denominator;
-        } else {
-            num = (numerator.multiply(fraction.denominator)).add((fraction.numerator).multiply(denominator));
-            den = denominator.multiply(fraction.denominator);
-        }
-        return new BigFraction(num, den);
-
-    }
-
-    /**
-     * <p>
-     * Gets the fraction as a <code>BigDecimal</code>. This calculates the
-     * fraction as the numerator divided by denominator.
-     * </p>
-     *
-     * @return the fraction as a <code>BigDecimal</code>.
-     * @throws ArithmeticException
-     *             if the exact quotient does not have a terminating decimal
-     *             expansion.
-     * @see BigDecimal
-     */
-    public BigDecimal bigDecimalValue() {
-        return new BigDecimal(numerator).divide(new BigDecimal(denominator));
-    }
-
-    /**
-     * <p>
-     * Gets the fraction as a <code>BigDecimal</code> following the passed
-     * rounding mode. This calculates the fraction as the numerator divided by
-     * denominator.
-     * </p>
-     *
-     * @param roundingMode
-     *            rounding mode to apply. see {@link BigDecimal} constants.
-     * @return the fraction as a <code>BigDecimal</code>.
-     * @throws IllegalArgumentException
-     *             if {@code roundingMode} does not represent a valid rounding
-     *             mode.
-     * @see BigDecimal
-     */
-    public BigDecimal bigDecimalValue(final int roundingMode) {
-        return new BigDecimal(numerator).divide(new BigDecimal(denominator), roundingMode);
-    }
-
-    /**
-     * <p>
-     * Gets the fraction as a <code>BigDecimal</code> following the passed scale
-     * and rounding mode. This calculates the fraction as the numerator divided
-     * by denominator.
-     * </p>
-     *
-     * @param scale
-     *            scale of the <code>BigDecimal</code> quotient to be returned.
-     *            see {@link BigDecimal} for more information.
-     * @param roundingMode
-     *            rounding mode to apply. see {@link BigDecimal} constants.
-     * @return the fraction as a <code>BigDecimal</code>.
-     * @see BigDecimal
-     */
-    public BigDecimal bigDecimalValue(final int scale, final int roundingMode) {
-        return new BigDecimal(numerator).divide(new BigDecimal(denominator), scale, roundingMode);
-    }
-
-    /**
-     * <p>
-     * Compares this object to another based on size.
-     * </p>
-     *
-     * @param object
-     *            the object to compare to, must not be <code>null</code>.
-     * @return -1 if this is less than {@code object}, +1 if this is greater
-     *         than {@code object}, 0 if they are equal.
-     * @see java.lang.Comparable#compareTo(java.lang.Object)
-     */
-    public int compareTo(final BigFraction object) {
-        BigInteger nOd = numerator.multiply(object.denominator);
-        BigInteger dOn = denominator.multiply(object.numerator);
-        return nOd.compareTo(dOn);
-    }
-
-    /**
-     * <p>
-     * Divide the value of this fraction by the passed {@code BigInteger},
-     * ie {@code this * 1 / bg}, returning the result in reduced form.
-     * </p>
-     *
-     * @param bg the {@code BigInteger} to divide by, must not be {@code null}
-     * @return a {@link BigFraction} instance with the resulting values
-     * @throws NullArgumentException if the {@code BigInteger} is {@code null}
-     * @throws MathArithmeticException if the fraction to divide by is zero
-     */
-    public BigFraction divide(final BigInteger bg) {
-        if (bg == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        if (BigInteger.ZERO.equals(bg)) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
-        }
-        return new BigFraction(numerator, denominator.multiply(bg));
-    }
-
-    /**
-     * <p>
-     * Divide the value of this fraction by the passed {@code int}, ie
-     * {@code this * 1 / i}, returning the result in reduced form.
-     * </p>
-     *
-     * @param i the {@code int} to divide by
-     * @return a {@link BigFraction} instance with the resulting values
-     * @throws MathArithmeticException if the fraction to divide by is zero
-     */
-    public BigFraction divide(final int i) {
-        return divide(BigInteger.valueOf(i));
-    }
-
-    /**
-     * <p>
-     * Divide the value of this fraction by the passed {@code long}, ie
-     * {@code this * 1 / l}, returning the result in reduced form.
-     * </p>
-     *
-     * @param l the {@code long} to divide by
-     * @return a {@link BigFraction} instance with the resulting values
-     * @throws MathArithmeticException if the fraction to divide by is zero
-     */
-    public BigFraction divide(final long l) {
-        return divide(BigInteger.valueOf(l));
-    }
-
-    /**
-     * <p>
-     * Divide the value of this fraction by another, returning the result in
-     * reduced form.
-     * </p>
-     *
-     * @param fraction Fraction to divide by, must not be {@code null}.
-     * @return a {@link BigFraction} instance with the resulting values.
-     * @throws NullArgumentException if the {@code fraction} is {@code null}.
-     * @throws MathArithmeticException if the fraction to divide by is zero
-     */
-    public BigFraction divide(final BigFraction fraction) {
-        if (fraction == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        if (BigInteger.ZERO.equals(fraction.numerator)) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
-        }
-
-        return multiply(fraction.reciprocal());
-    }
-
-    /**
-     * <p>
-     * Gets the fraction as a {@code double}. This calculates the fraction as
-     * the numerator divided by denominator.
-     * </p>
-     *
-     * @return the fraction as a {@code double}
-     * @see java.lang.Number#doubleValue()
-     */
-    @Override
-    public double doubleValue() {
-        double result = numerator.doubleValue() / denominator.doubleValue();
-        if (Double.isNaN(result)) {
-            // Numerator and/or denominator must be out of range:
-            // Calculate how far to shift them to put them in range.
-            int shift = FastMath.max(numerator.bitLength(),
-                                     denominator.bitLength()) - FastMath.getExponent(Double.MAX_VALUE);
-            result = numerator.shiftRight(shift).doubleValue() /
-                denominator.shiftRight(shift).doubleValue();
-        }
-        return result;
-    }
-
-    /**
-     * <p>
-     * Test for the equality of two fractions. If the lowest term numerator and
-     * denominators are the same for both fractions, the two fractions are
-     * considered to be equal.
-     * </p>
-     *
-     * @param other
-     *            fraction to test for equality to this fraction, can be
-     *            <code>null</code>.
-     * @return true if two fractions are equal, false if object is
-     *         <code>null</code>, not an instance of {@link BigFraction}, or not
-     *         equal to this fraction instance.
-     * @see java.lang.Object#equals(java.lang.Object)
-     */
-    @Override
-    public boolean equals(final Object other) {
-        boolean ret = false;
-
-        if (this == other) {
-            ret = true;
-        } else if (other instanceof BigFraction) {
-            BigFraction rhs = ((BigFraction) other).reduce();
-            BigFraction thisOne = this.reduce();
-            ret = thisOne.numerator.equals(rhs.numerator) && thisOne.denominator.equals(rhs.denominator);
-        }
-
-        return ret;
-    }
-
-    /**
-     * <p>
-     * Gets the fraction as a {@code float}. This calculates the fraction as
-     * the numerator divided by denominator.
-     * </p>
-     *
-     * @return the fraction as a {@code float}.
-     * @see java.lang.Number#floatValue()
-     */
-    @Override
-    public float floatValue() {
-        float result = numerator.floatValue() / denominator.floatValue();
-        if (Double.isNaN(result)) {
-            // Numerator and/or denominator must be out of range:
-            // Calculate how far to shift them to put them in range.
-            int shift = FastMath.max(numerator.bitLength(),
-                                     denominator.bitLength()) - FastMath.getExponent(Float.MAX_VALUE);
-            result = numerator.shiftRight(shift).floatValue() /
-                denominator.shiftRight(shift).floatValue();
-        }
-        return result;
-    }
-
-    /**
-     * <p>
-     * Access the denominator as a <code>BigInteger</code>.
-     * </p>
-     *
-     * @return the denominator as a <code>BigInteger</code>.
-     */
-    public BigInteger getDenominator() {
-        return denominator;
-    }
-
-    /**
-     * <p>
-     * Access the denominator as a {@code int}.
-     * </p>
-     *
-     * @return the denominator as a {@code int}.
-     */
-    public int getDenominatorAsInt() {
-        return denominator.intValue();
-    }
-
-    /**
-     * <p>
-     * Access the denominator as a {@code long}.
-     * </p>
-     *
-     * @return the denominator as a {@code long}.
-     */
-    public long getDenominatorAsLong() {
-        return denominator.longValue();
-    }
-
-    /**
-     * <p>
-     * Access the numerator as a <code>BigInteger</code>.
-     * </p>
-     *
-     * @return the numerator as a <code>BigInteger</code>.
-     */
-    public BigInteger getNumerator() {
-        return numerator;
-    }
-
-    /**
-     * <p>
-     * Access the numerator as a {@code int}.
-     * </p>
-     *
-     * @return the numerator as a {@code int}.
-     */
-    public int getNumeratorAsInt() {
-        return numerator.intValue();
-    }
-
-    /**
-     * <p>
-     * Access the numerator as a {@code long}.
-     * </p>
-     *
-     * @return the numerator as a {@code long}.
-     */
-    public long getNumeratorAsLong() {
-        return numerator.longValue();
-    }
-
-    /**
-     * <p>
-     * Gets a hashCode for the fraction.
-     * </p>
-     *
-     * @return a hash code value for this object.
-     * @see java.lang.Object#hashCode()
-     */
-    @Override
-    public int hashCode() {
-        return 37 * (37 * 17 + numerator.hashCode()) + denominator.hashCode();
-    }
-
-    /**
-     * <p>
-     * Gets the fraction as an {@code int}. This returns the whole number part
-     * of the fraction.
-     * </p>
-     *
-     * @return the whole number fraction part.
-     * @see java.lang.Number#intValue()
-     */
-    @Override
-    public int intValue() {
-        return numerator.divide(denominator).intValue();
-    }
-
-    /**
-     * <p>
-     * Gets the fraction as a {@code long}. This returns the whole number part
-     * of the fraction.
-     * </p>
-     *
-     * @return the whole number fraction part.
-     * @see java.lang.Number#longValue()
-     */
-    @Override
-    public long longValue() {
-        return numerator.divide(denominator).longValue();
-    }
-
-    /**
-     * <p>
-     * Multiplies the value of this fraction by the passed
-     * <code>BigInteger</code>, returning the result in reduced form.
-     * </p>
-     *
-     * @param bg the {@code BigInteger} to multiply by.
-     * @return a {@code BigFraction} instance with the resulting values.
-     * @throws NullArgumentException if {@code bg} is {@code null}.
-     */
-    public BigFraction multiply(final BigInteger bg) {
-        if (bg == null) {
-            throw new NullArgumentException();
-        }
-        return new BigFraction(bg.multiply(numerator), denominator);
-    }
-
-    /**
-     * <p>
-     * Multiply the value of this fraction by the passed {@code int}, returning
-     * the result in reduced form.
-     * </p>
-     *
-     * @param i
-     *            the {@code int} to multiply by.
-     * @return a {@link BigFraction} instance with the resulting values.
-     */
-    public BigFraction multiply(final int i) {
-        return multiply(BigInteger.valueOf(i));
-    }
-
-    /**
-     * <p>
-     * Multiply the value of this fraction by the passed {@code long},
-     * returning the result in reduced form.
-     * </p>
-     *
-     * @param l
-     *            the {@code long} to multiply by.
-     * @return a {@link BigFraction} instance with the resulting values.
-     */
-    public BigFraction multiply(final long l) {
-        return multiply(BigInteger.valueOf(l));
-    }
-
-    /**
-     * <p>
-     * Multiplies the value of this fraction by another, returning the result in
-     * reduced form.
-     * </p>
-     *
-     * @param fraction Fraction to multiply by, must not be {@code null}.
-     * @return a {@link BigFraction} instance with the resulting values.
-     * @throws NullArgumentException if {@code fraction} is {@code null}.
-     */
-    public BigFraction multiply(final BigFraction fraction) {
-        if (fraction == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        if (numerator.equals(BigInteger.ZERO) ||
-            fraction.numerator.equals(BigInteger.ZERO)) {
-            return ZERO;
-        }
-        return new BigFraction(numerator.multiply(fraction.numerator),
-                               denominator.multiply(fraction.denominator));
-    }
-
-    /**
-     * <p>
-     * Return the additive inverse of this fraction, returning the result in
-     * reduced form.
-     * </p>
-     *
-     * @return the negation of this fraction.
-     */
-    public BigFraction negate() {
-        return new BigFraction(numerator.negate(), denominator);
-    }
-
-    /**
-     * <p>
-     * Gets the fraction percentage as a {@code double}. This calculates the
-     * fraction as the numerator divided by denominator multiplied by 100.
-     * </p>
-     *
-     * @return the fraction percentage as a {@code double}.
-     */
-    public double percentageValue() {
-        return multiply(ONE_HUNDRED).doubleValue();
-    }
-
-    /**
-     * <p>
-     * Returns a {@code BigFraction} whose value is
-     * {@code (this<sup>exponent</sup>)}, returning the result in reduced form.
-     * </p>
-     *
-     * @param exponent
-     *            exponent to which this {@code BigFraction} is to be
-     *            raised.
-     * @return <tt>this<sup>exponent</sup></tt>.
-     */
-    public BigFraction pow(final int exponent) {
-        if (exponent < 0) {
-            return new BigFraction(denominator.pow(-exponent), numerator.pow(-exponent));
-        }
-        return new BigFraction(numerator.pow(exponent), denominator.pow(exponent));
-    }
-
-    /**
-     * <p>
-     * Returns a <code>BigFraction</code> whose value is
-     * <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form.
-     * </p>
-     *
-     * @param exponent
-     *            exponent to which this <code>BigFraction</code> is to be raised.
-     * @return <tt>this<sup>exponent</sup></tt> as a <code>BigFraction</code>.
-     */
-    public BigFraction pow(final long exponent) {
-        if (exponent < 0) {
-            return new BigFraction(ArithmeticUtils.pow(denominator, -exponent),
-                                   ArithmeticUtils.pow(numerator,   -exponent));
-        }
-        return new BigFraction(ArithmeticUtils.pow(numerator,   exponent),
-                               ArithmeticUtils.pow(denominator, exponent));
-    }
-
-    /**
-     * <p>
-     * Returns a <code>BigFraction</code> whose value is
-     * <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form.
-     * </p>
-     *
-     * @param exponent
-     *            exponent to which this <code>BigFraction</code> is to be raised.
-     * @return <tt>this<sup>exponent</sup></tt> as a <code>BigFraction</code>.
-     */
-    public BigFraction pow(final BigInteger exponent) {
-        if (exponent.compareTo(BigInteger.ZERO) < 0) {
-            final BigInteger eNeg = exponent.negate();
-            return new BigFraction(ArithmeticUtils.pow(denominator, eNeg),
-                                   ArithmeticUtils.pow(numerator,   eNeg));
-        }
-        return new BigFraction(ArithmeticUtils.pow(numerator,   exponent),
-                               ArithmeticUtils.pow(denominator, exponent));
-    }
-
-    /**
-     * <p>
-     * Returns a <code>double</code> whose value is
-     * <tt>(this<sup>exponent</sup>)</tt>, returning the result in reduced form.
-     * </p>
-     *
-     * @param exponent
-     *            exponent to which this <code>BigFraction</code> is to be raised.
-     * @return <tt>this<sup>exponent</sup></tt>.
-     */
-    public double pow(final double exponent) {
-        return FastMath.pow(numerator.doubleValue(),   exponent) /
-               FastMath.pow(denominator.doubleValue(), exponent);
-    }
-
-    /**
-     * <p>
-     * Return the multiplicative inverse of this fraction.
-     * </p>
-     *
-     * @return the reciprocal fraction.
-     */
-    public BigFraction reciprocal() {
-        return new BigFraction(denominator, numerator);
-    }
-
-    /**
-     * <p>
-     * Reduce this <code>BigFraction</code> to its lowest terms.
-     * </p>
-     *
-     * @return the reduced <code>BigFraction</code>. It doesn't change anything if
-     *         the fraction can be reduced.
-     */
-    public BigFraction reduce() {
-        final BigInteger gcd = numerator.gcd(denominator);
-        return new BigFraction(numerator.divide(gcd), denominator.divide(gcd));
-    }
-
-    /**
-     * <p>
-     * Subtracts the value of an {@link BigInteger} from the value of this
-     * {@code BigFraction}, returning the result in reduced form.
-     * </p>
-     *
-     * @param bg the {@link BigInteger} to subtract, cannot be {@code null}.
-     * @return a {@code BigFraction} instance with the resulting values.
-     * @throws NullArgumentException if the {@link BigInteger} is {@code null}.
-     */
-    public BigFraction subtract(final BigInteger bg) {
-        if (bg == null) {
-            throw new NullArgumentException();
-        }
-        return new BigFraction(numerator.subtract(denominator.multiply(bg)), denominator);
-    }
-
-    /**
-     * <p>
-     * Subtracts the value of an {@code integer} from the value of this
-     * {@code BigFraction}, returning the result in reduced form.
-     * </p>
-     *
-     * @param i the {@code integer} to subtract.
-     * @return a {@code BigFraction} instance with the resulting values.
-     */
-    public BigFraction subtract(final int i) {
-        return subtract(BigInteger.valueOf(i));
-    }
-
-    /**
-     * <p>
-     * Subtracts the value of a {@code long} from the value of this
-     * {@code BigFraction}, returning the result in reduced form.
-     * </p>
-     *
-     * @param l the {@code long} to subtract.
-     * @return a {@code BigFraction} instance with the resulting values.
-     */
-    public BigFraction subtract(final long l) {
-        return subtract(BigInteger.valueOf(l));
-    }
-
-    /**
-     * <p>
-     * Subtracts the value of another fraction from the value of this one,
-     * returning the result in reduced form.
-     * </p>
-     *
-     * @param fraction {@link BigFraction} to subtract, must not be {@code null}.
-     * @return a {@link BigFraction} instance with the resulting values
-     * @throws NullArgumentException if the {@code fraction} is {@code null}.
-     */
-    public BigFraction subtract(final BigFraction fraction) {
-        if (fraction == null) {
-            throw new NullArgumentException(LocalizedFormats.FRACTION);
-        }
-        if (ZERO.equals(fraction)) {
-            return this;
-        }
-
-        BigInteger num = null;
-        BigInteger den = null;
-        if (denominator.equals(fraction.denominator)) {
-            num = numerator.subtract(fraction.numerator);
-            den = denominator;
-        } else {
-            num = (numerator.multiply(fraction.denominator)).subtract((fraction.numerator).multiply(denominator));
-            den = denominator.multiply(fraction.denominator);
-        }
-        return new BigFraction(num, den);
-
-    }
-
-    /**
-     * <p>
-     * Returns the <code>String</code> representing this fraction, ie
-     * "num / dem" or just "num" if the denominator is one.
-     * </p>
-     *
-     * @return a string representation of the fraction.
-     * @see java.lang.Object#toString()
-     */
-    @Override
-    public String toString() {
-        String str = null;
-        if (BigInteger.ONE.equals(denominator)) {
-            str = numerator.toString();
-        } else if (BigInteger.ZERO.equals(numerator)) {
-            str = "0";
-        } else {
-            str = numerator + " / " + denominator;
-        }
-        return str;
-    }
-
-    /** {@inheritDoc} */
-    public BigFractionField getField() {
-        return BigFractionField.getInstance();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/BigFractionField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/BigFractionField.java b/src/main/java/org/apache/commons/math3/fraction/BigFractionField.java
deleted file mode 100644
index 81170f8..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/BigFractionField.java
+++ /dev/null
@@ -1,82 +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.fraction;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-
-/**
- * Representation of the fractional numbers  without any overflow field.
- * <p>
- * This class is a singleton.
- * </p>
- * @see Fraction
- * @since 2.0
- */
-public class BigFractionField implements Field<BigFraction>, Serializable  {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -1699294557189741703L;
-
-    /** Private constructor for the singleton.
-     */
-    private BigFractionField() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static BigFractionField getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public BigFraction getOne() {
-        return BigFraction.ONE;
-    }
-
-    /** {@inheritDoc} */
-    public BigFraction getZero() {
-        return BigFraction.ZERO;
-    }
-
-    /** {@inheritDoc} */
-    public Class<? extends FieldElement<BigFraction>> getRuntimeClass() {
-        return BigFraction.class;
-    }
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final BigFractionField INSTANCE = new BigFractionField();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/fraction/BigFractionFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/fraction/BigFractionFormat.java b/src/main/java/org/apache/commons/math3/fraction/BigFractionFormat.java
deleted file mode 100644
index 196dcd5..0000000
--- a/src/main/java/org/apache/commons/math3/fraction/BigFractionFormat.java
+++ /dev/null
@@ -1,287 +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.fraction;
-
-import java.io.Serializable;
-import java.math.BigInteger;
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Formats a BigFraction number in proper format or improper format.
- * <p>
- * The number format for each of the whole number, numerator and,
- * denominator can be configured.
- * </p>
- *
- * @since 2.0
- */
-public class BigFractionFormat extends AbstractFormat implements Serializable {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -2932167925527338976L;
-
-    /**
-     * Create an improper formatting instance with the default number format
-     * for the numerator and denominator.
-     */
-    public BigFractionFormat() {
-    }
-
-    /**
-     * Create an improper formatting instance with a custom number format for
-     * both the numerator and denominator.
-     * @param format the custom format for both the numerator and denominator.
-     */
-    public BigFractionFormat(final NumberFormat format) {
-        super(format);
-    }
-
-    /**
-     * Create an improper formatting instance with a custom number format for
-     * the numerator and a custom number format for the denominator.
-     * @param numeratorFormat the custom format for the numerator.
-     * @param denominatorFormat the custom format for the denominator.
-     */
-    public BigFractionFormat(final NumberFormat numeratorFormat,
-                             final NumberFormat denominatorFormat) {
-        super(numeratorFormat, denominatorFormat);
-    }
-
-    /**
-     * Get the set of locales for which complex formats are available.  This
-     * is the same set as the {@link NumberFormat} set.
-     * @return available complex format locales.
-     */
-    public static Locale[] getAvailableLocales() {
-        return NumberFormat.getAvailableLocales();
-    }
-
-    /**
-     * This static method calls formatBigFraction() on a default instance of
-     * BigFractionFormat.
-     *
-     * @param f BigFraction object to format
-     * @return A formatted BigFraction in proper form.
-     */
-    public static String formatBigFraction(final BigFraction f) {
-        return getImproperInstance().format(f);
-    }
-
-    /**
-     * Returns the default complex format for the current locale.
-     * @return the default complex format.
-     */
-    public static BigFractionFormat getImproperInstance() {
-        return getImproperInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default complex format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the complex format specific to the given locale.
-     */
-    public static BigFractionFormat getImproperInstance(final Locale locale) {
-        return new BigFractionFormat(getDefaultNumberFormat(locale));
-    }
-
-    /**
-     * Returns the default complex format for the current locale.
-     * @return the default complex format.
-     */
-    public static BigFractionFormat getProperInstance() {
-        return getProperInstance(Locale.getDefault());
-    }
-
-    /**
-     * Returns the default complex format for the given locale.
-     * @param locale the specific locale used by the format.
-     * @return the complex format specific to the given locale.
-     */
-    public static BigFractionFormat getProperInstance(final Locale locale) {
-        return new ProperBigFractionFormat(getDefaultNumberFormat(locale));
-    }
-
-    /**
-     * Formats a {@link BigFraction} object to produce a string.  The BigFraction is
-     * output in improper format.
-     *
-     * @param BigFraction the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     */
-    public StringBuffer format(final BigFraction BigFraction,
-                               final StringBuffer toAppendTo, final FieldPosition pos) {
-
-        pos.setBeginIndex(0);
-        pos.setEndIndex(0);
-
-        getNumeratorFormat().format(BigFraction.getNumerator(), toAppendTo, pos);
-        toAppendTo.append(" / ");
-        getDenominatorFormat().format(BigFraction.getDenominator(), toAppendTo, pos);
-
-        return toAppendTo;
-    }
-
-    /**
-     * Formats an object and appends the result to a StringBuffer.
-     * <code>obj</code> must be either a  {@link BigFraction} object or a
-     * {@link BigInteger} object or a {@link Number} object. Any other type of
-     * object will result in an {@link IllegalArgumentException} being thrown.
-     *
-     * @param obj the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
-     * @throws MathIllegalArgumentException if <code>obj</code> is not a valid type.
-     */
-    @Override
-    public StringBuffer format(final Object obj,
-                               final StringBuffer toAppendTo, final FieldPosition pos) {
-
-        final StringBuffer ret;
-        if (obj instanceof BigFraction) {
-            ret = format((BigFraction) obj, toAppendTo, pos);
-        } else if (obj instanceof BigInteger) {
-            ret = format(new BigFraction((BigInteger) obj), toAppendTo, pos);
-        } else if (obj instanceof Number) {
-            ret = format(new BigFraction(((Number) obj).doubleValue()),
-                         toAppendTo, pos);
-        } else {
-            throw new MathIllegalArgumentException(LocalizedFormats.CANNOT_FORMAT_OBJECT_TO_FRACTION);
-        }
-
-        return ret;
-    }
-
-    /**
-     * Parses a string to produce a {@link BigFraction} object.
-     * @param source the string to parse
-     * @return the parsed {@link BigFraction} object.
-     * @exception MathParseException if the beginning of the specified string
-     *            cannot be parsed.
-     */
-    @Override
-    public BigFraction parse(final String source) throws MathParseException {
-        final ParsePosition parsePosition = new ParsePosition(0);
-        final BigFraction result = parse(source, parsePosition);
-        if (parsePosition.getIndex() == 0) {
-            throw new MathParseException(source, parsePosition.getErrorIndex(), BigFraction.class);
-        }
-        return result;
-    }
-
-    /**
-     * Parses a string to produce a {@link BigFraction} object.
-     * This method expects the string to be formatted as an improper BigFraction.
-     * @param source the string to parse
-     * @param pos input/output parsing parameter.
-     * @return the parsed {@link BigFraction} object.
-     */
-    @Override
-    public BigFraction parse(final String source, final ParsePosition pos) {
-        final int initialIndex = pos.getIndex();
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse numerator
-        final BigInteger num = parseNextBigInteger(source, pos);
-        if (num == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        // parse '/'
-        final int startIndex = pos.getIndex();
-        final char c = parseNextCharacter(source, pos);
-        switch (c) {
-        case 0 :
-            // no '/'
-            // return num as a BigFraction
-            return new BigFraction(num);
-        case '/' :
-            // found '/', continue parsing denominator
-            break;
-        default :
-            // invalid '/'
-            // set index back to initial, error index should be the last
-            // character examined.
-            pos.setIndex(initialIndex);
-            pos.setErrorIndex(startIndex);
-            return null;
-        }
-
-        // parse whitespace
-        parseAndIgnoreWhitespace(source, pos);
-
-        // parse denominator
-        final BigInteger den = parseNextBigInteger(source, pos);
-        if (den == null) {
-            // invalid integer number
-            // set index back to initial, error index should already be set
-            // character examined.
-            pos.setIndex(initialIndex);
-            return null;
-        }
-
-        return new BigFraction(num, den);
-    }
-
-    /**
-     * Parses a string to produce a <code>BigInteger</code>.
-     * @param source the string to parse
-     * @param pos input/output parsing parameter.
-     * @return a parsed <code>BigInteger</code> or null if string does not
-     * contain a BigInteger at the specified position
-     */
-    protected BigInteger parseNextBigInteger(final String source,
-                                             final ParsePosition pos) {
-
-        final int start = pos.getIndex();
-         int end = (source.charAt(start) == '-') ? (start + 1) : start;
-         while((end < source.length()) &&
-               Character.isDigit(source.charAt(end))) {
-             ++end;
-         }
-
-         try {
-             BigInteger n = new BigInteger(source.substring(start, end));
-             pos.setIndex(end);
-             return n;
-         } catch (NumberFormatException nfe) {
-             pos.setErrorIndex(start);
-             return null;
-         }
-
-    }
-
-}


[61/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java
index 6de42a2..83023d3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java
@@ -14,12 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.TrivariateFunction;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.TrivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.TricubicSplineInterpolator;
+import org.apache.commons.math4.analysis.interpolation.TrivariateGridInterpolator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.Ignore;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolatorTest.java
index cf3b9d6..907b2ac 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/UnivariatePeriodicInterpolatorTest.java
@@ -14,14 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.Random;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
 
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.LinearInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariatePeriodicInterpolator;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java
index b58631f..301bf52 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionLagrangeFormTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunctionLagrangeForm;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonFormTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonFormTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonFormTest.java
index 215055b..b9e61d3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonFormTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionNewtonFormTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunctionNewtonForm;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java
index af0dd7e..52be305 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialFunctionTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.polynomials;
 
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java
index b353a73..255203a 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialSplineFunctionTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
+package org.apache.commons.math4.analysis.polynomials;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
index e87804b..ad13461 100644
--- a/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/polynomials/PolynomialsUtilsTest.java
@@ -14,13 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.polynomials;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.integration.IterativeLegendreGaussIntegrator;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.analysis.polynomials;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialsUtils;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
index 3a83826..1b6f278 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/BaseSecantSolverAbstractTest.java
@@ -14,15 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.XMinus5Function;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.XMinus5Function;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.AllowedSolution;
+import org.apache.commons.math4.analysis.solvers.BaseSecantSolver;
+import org.apache.commons.math4.analysis.solvers.BracketedUnivariateSolver;
+import org.apache.commons.math4.analysis.solvers.PegasusSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolverUtils;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/BisectionSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/BisectionSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/BisectionSolverTest.java
index 2023471..d92ff1c 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/BisectionSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/BisectionSolverTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.BisectionSolver;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolverTest.java
index 8ae8a13..5f6c123 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/BracketingNthOrderBrentSolverTest.java
@@ -15,14 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
-
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.solvers.AllowedSolution;
+import org.apache.commons.math4.analysis.solvers.BracketingNthOrderBrentSolver;
+import org.apache.commons.math4.analysis.solvers.NewtonRaphsonSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/BrentSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/BrentSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/BrentSolverTest.java
index 897193f..59547d0 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/BrentSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/BrentSolverTest.java
@@ -14,22 +14,24 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.MonitoredFunction;
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.function.Constant;
-import org.apache.commons.math3.analysis.function.Inverse;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Sqrt;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.MonitoredFunction;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Constant;
+import org.apache.commons.math4.analysis.function.Inverse;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.Sqrt;
+import org.apache.commons.math4.analysis.solvers.BrentSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/IllinoisSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/IllinoisSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/IllinoisSolverTest.java
index 2bc69e4..04680d9 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/IllinoisSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/IllinoisSolverTest.java
@@ -15,7 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.analysis.solvers.IllinoisSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
 
 /**
  * Test case for {@link IllinoisSolver Illinois} solver.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
index d97a8e6..6100710 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/LaguerreSolverTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.TestUtils;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.solvers.LaguerreSolver;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolver2Test.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolver2Test.java b/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolver2Test.java
index a68bb02..b11fefc 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolver2Test.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolver2Test.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Expm1;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Expm1;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.MullerSolver2;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolverTest.java
index 03ee790..e82be52 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/MullerSolverTest.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Expm1;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Expm1;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.MullerSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolverTest.java
index 3080b91..807469e 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonRaphsonSolverTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.NewtonRaphsonSolver;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java
index 7669125..e9b0896 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java
@@ -14,15 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.NewtonSolver;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/PegasusSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/PegasusSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/PegasusSolverTest.java
index 5f8fb90..d6de7a3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/PegasusSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/PegasusSolverTest.java
@@ -15,7 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.analysis.solvers.PegasusSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
 
 /**
  * Test case for {@link PegasusSolver Pegasus} solver.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolverTest.java
index 2afa3d2..8f3fece 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/RegulaFalsiSolverTest.java
@@ -15,11 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.solvers.RegulaFalsiSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/RiddersSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/RiddersSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/RiddersSolverTest.java
index afbdc59..fcff3e5 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/RiddersSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/RiddersSolverTest.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Expm1;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Expm1;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.RiddersSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/SecantSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/SecantSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/SecantSolverTest.java
index 9e0f178..59b8af9 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/SecantSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/SecantSolverTest.java
@@ -15,7 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.analysis.solvers.SecantSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
 
 /**
  * Test case for {@link SecantSolver Secant} solver.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
index 97c387e..e1ff1f2 100644
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/solvers/UnivariateSolverUtilsTest.java
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.solvers;
-
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.solvers;
+
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolverUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoBracketingException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/ComplexFieldTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/ComplexFieldTest.java b/src/test/java/org/apache/commons/math4/complex/ComplexFieldTest.java
index f2f4e5e..50462fb 100644
--- a/src/test/java/org/apache/commons/math4/complex/ComplexFieldTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/ComplexFieldTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.complex.ComplexField;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/ComplexFormatAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/ComplexFormatAbstractTest.java b/src/test/java/org/apache/commons/math4/complex/ComplexFormatAbstractTest.java
index b57c26c..608ccf6 100644
--- a/src/test/java/org/apache/commons/math4/complex/ComplexFormatAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/ComplexFormatAbstractTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.text.NumberFormat;
 import java.text.ParsePosition;
@@ -23,8 +23,9 @@ import java.util.Locale;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.complex.ComplexFormat;
+import org.apache.commons.math4.util.FastMath;
 
 public abstract class ComplexFormatAbstractTest {
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/ComplexFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/ComplexFormatTest.java b/src/test/java/org/apache/commons/math4/complex/ComplexFormatTest.java
index d1c3630..b272bd2 100644
--- a/src/test/java/org/apache/commons/math4/complex/ComplexFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/ComplexFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/ComplexTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/ComplexTest.java b/src/test/java/org/apache/commons/math4/complex/ComplexTest.java
index 9996e68..dc2e626 100644
--- a/src/test/java/org/apache/commons/math4/complex/ComplexTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/ComplexTest.java
@@ -15,14 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.util.List;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.complex.ComplexUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 
 
@@ -796,6 +799,7 @@ public class ComplexTest {
     }
 
     @Test
+    @Ignore
     public void testJava() {// TODO more debug
         System.out.println(">>testJava()");
         // FastMathTest#testExpSpecialCases() checks the following:
@@ -824,21 +828,8 @@ public class ComplexTest {
 
     @Test
     public void testExpInf4() {
-        // TODO: temp debug start
-        System.out.println(">>testExpInf4()");
-        double inf = negInfOne.getReal();
-        System.out.println("inf="+inf);
-        int intVal = (int) -inf;
-        System.out.println("intval="+intVal);
-        System.out.println("neginf<0=" + (inf < 0.0));
-        // TODO: temp debug end
-        System.out.println("expReal="+FastMath.exp(negInfOne.getReal())); // TODO temp debug
-        System.out.println("cosImag="+FastMath.cos(negInfOne.getImaginary())); // TODO temp debug
-        System.out.println("sinImag="+FastMath.sin(negInfOne.getImaginary())); // TODO temp debug
         final Complex exp = negInfOne.exp();
-        System.out.println("result="+exp); // TODO temp debug
         TestUtils.assertSame(Complex.ZERO, exp);
-        System.out.println("<<testExpInf4()"); // TODO debug
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/ComplexUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/ComplexUtilsTest.java b/src/test/java/org/apache/commons/math4/complex/ComplexUtilsTest.java
index 759ba89..77c0d43 100644
--- a/src/test/java/org/apache/commons/math4/complex/ComplexUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/ComplexUtilsTest.java
@@ -15,10 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.complex.ComplexUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/FrenchComplexFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/FrenchComplexFormatTest.java b/src/test/java/org/apache/commons/math4/complex/FrenchComplexFormatTest.java
index 2fbe831..4f9caec 100644
--- a/src/test/java/org/apache/commons/math4/complex/FrenchComplexFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/FrenchComplexFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java b/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java
index b81e260..56658e3 100644
--- a/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/QuaternionTest.java
@@ -14,15 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
 import java.util.Random;
-import org.apache.commons.math3.complex.Quaternion;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.util.FastMath;
+
+import org.apache.commons.math4.complex.Quaternion;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/complex/RootsOfUnityTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/complex/RootsOfUnityTest.java b/src/test/java/org/apache/commons/math4/complex/RootsOfUnityTest.java
index b91ffeb..6c0f91b 100644
--- a/src/test/java/org/apache/commons/math4/complex/RootsOfUnityTest.java
+++ b/src/test/java/org/apache/commons/math4/complex/RootsOfUnityTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.complex;
+package org.apache.commons.math4.complex;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.complex.RootsOfUnity;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFPTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFPTest.java b/src/test/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFPTest.java
index 4c1b512..91419c7 100644
--- a/src/test/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFPTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/BracketingNthOrderBrentSolverDFPTest.java
@@ -15,11 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
-
-import org.apache.commons.math3.analysis.solvers.AllowedSolution;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+package org.apache.commons.math4.dfp;
+
+import org.apache.commons.math4.analysis.solvers.AllowedSolution;
+import org.apache.commons.math4.dfp.BracketingNthOrderBrentSolverDFP;
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpField;
+import org.apache.commons.math4.dfp.DfpMath;
+import org.apache.commons.math4.dfp.UnivariateDfpFunction;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/dfp/Decimal10.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/Decimal10.java b/src/test/java/org/apache/commons/math4/dfp/Decimal10.java
index 25576e2..aee0568 100644
--- a/src/test/java/org/apache/commons/math4/dfp/Decimal10.java
+++ b/src/test/java/org/apache/commons/math4/dfp/Decimal10.java
@@ -15,7 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
+
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpDec;
+import org.apache.commons.math4.dfp.DfpField;
 
 public class Decimal10 extends DfpDec {
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java b/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
index fc65fd7..ead9c9e 100644
--- a/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/DfpDecTest.java
@@ -15,8 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpDec;
+import org.apache.commons.math4.dfp.DfpField;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java b/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
index 832a808..577cec7 100644
--- a/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/DfpMathTest.java
@@ -15,8 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpField;
+import org.apache.commons.math4.dfp.DfpMath;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/dfp/DfpTest.java b/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
index 236dd79..9725f36 100644
--- a/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
+++ b/src/test/java/org/apache/commons/math4/dfp/DfpTest.java
@@ -15,11 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.dfp;
+package org.apache.commons.math4.dfp;
 
-import org.apache.commons.math3.ExtendedFieldElementAbstractTest;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.ExtendedFieldElementAbstractTest;
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpField;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
index 6e140eb..52e9680 100644
--- a/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/AbstractIntegerDistributionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.AbstractIntegerDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/AbstractRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/AbstractRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/AbstractRealDistributionTest.java
index 88ea98d..d0b2761 100644
--- a/src/test/java/org/apache/commons/math4/distribution/AbstractRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/AbstractRealDistributionTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.integration.RombergIntegrator;
-import org.apache.commons.math3.analysis.integration.UnivariateIntegrator;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.integration.RombergIntegrator;
+import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
+import org.apache.commons.math4.distribution.AbstractRealDistribution;
+import org.apache.commons.math4.exception.OutOfRangeException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
index 217ae66..9c64cf9 100644
--- a/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/BetaDistributionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.BetaDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java
index d6cb294..660750e 100644
--- a/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/BinomialDistributionTest.java
@@ -11,8 +11,10 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.BinomialDistribution;
+import org.apache.commons.math4.distribution.IntegerDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/CauchyDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/CauchyDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/CauchyDistributionTest.java
index 1cfa3df..86bd0e4 100644
--- a/src/test/java/org/apache/commons/math4/distribution/CauchyDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/CauchyDistributionTest.java
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.CauchyDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/ChiSquaredDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/ChiSquaredDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/ChiSquaredDistributionTest.java
index f8bae6a..fc1ab85 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ChiSquaredDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ChiSquaredDistributionTest.java
@@ -15,8 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.ChiSquaredDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java
index 1f3edb7..6a7bbe8 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ConstantRealDistributionTest.java
@@ -15,8 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.ConstantRealDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
index dd3d069..48be05e 100644
--- a/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/EnumeratedIntegerDistributionTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.math4.distribution.EnumeratedIntegerDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java
index 961b134..af8aed3 100644
--- a/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/EnumeratedRealDistributionTest.java
@@ -14,20 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import static org.junit.Assert.assertEquals;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.Pair;
+import org.apache.commons.math4.distribution.EnumeratedDistribution;
+import org.apache.commons.math4.distribution.EnumeratedRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
index 35d6e60..ea1a14f 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ExponentialDistributionTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.ExponentialDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/FDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/FDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/FDistributionTest.java
index fe617ca..21ae3ca 100644
--- a/src/test/java/org/apache/commons/math4/distribution/FDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/FDistributionTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.FDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/GammaDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/GammaDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/GammaDistributionTest.java
index 6f5fa38..c217b9c 100644
--- a/src/test/java/org/apache/commons/math4/distribution/GammaDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/GammaDistributionTest.java
@@ -15,17 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.GammaDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -215,7 +216,7 @@ public class GammaDistributionTest extends RealDistributionAbstractTest {
      * MATH-753: large values of x or shape parameter cause density(double) to
      * overflow. Reference data is generated with the Maxima script
      * gamma-distribution.mac, which can be found in
-     * src/test/resources/org/apache/commons/math3/distribution.
+     * src/test/resources/org/apache/commons/math4/distribution.
      */
 
     private void doTestMath753(final double shape,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java
index a3def55..ba35153 100644
--- a/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/GeometricDistributionTest.java
@@ -11,8 +11,10 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.GeometricDistribution;
+import org.apache.commons.math4.distribution.IntegerDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
index c5bd075..7a06926 100644
--- a/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/GumbelDistributionTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.distribution.GumbelDistribution;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
index a5adbc2..b9b791c 100644
--- a/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/HypergeometricDistributionTest.java
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.distribution.HypergeometricDistribution;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java b/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
index f85b4b2..895428d 100644
--- a/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/IntegerDistributionAbstractTest.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.distribution.AbstractIntegerDistribution;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistributionTest.java
index 53f4ff8..eb472b7 100644
--- a/src/test/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/KolmogorovSmirnovDistributionTest.java
@@ -15,8 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.KolmogorovSmirnovDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
index eae9287..55ea7df 100644
--- a/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/LaplaceDistributionTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.distribution.LaplaceDistribution;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
index 3c32b9e..59c2d7c 100644
--- a/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/LevyDistributionTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.random.Well19937a;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.distribution.LevyDistribution;
+import org.apache.commons.math4.random.Well19937a;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/LogNormalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/LogNormalDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LogNormalDistributionTest.java
index af45686..2ea431d 100644
--- a/src/test/java/org/apache/commons/math4/distribution/LogNormalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/LogNormalDistributionTest.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.LogNormalDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
index 9caf8d5..b43daac 100644
--- a/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/LogisticsDistributionTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.distribution.LogisticDistribution;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java
index f044cbd..cd4a497 100644
--- a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalDistributionTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.stat.correlation.Covariance;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.distribution.MultivariateNormalDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.correlation.Covariance;
 
 import java.util.Random;
+
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java
index 12a23c2..8bed770 100644
--- a/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/MultivariateNormalMixtureModelDistributionTest.java
@@ -14,13 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 import java.util.List;
 import java.util.ArrayList;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.util.Pair;
+
+import org.apache.commons.math4.distribution.MixtureMultivariateRealDistribution;
+import org.apache.commons.math4.distribution.MultivariateNormalDistribution;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.util.Pair;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
index 10f7073..aa7e927 100644
--- a/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/NakagamiDistributionTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.distribution.NakagamiDistribution;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/NormalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/NormalDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/NormalDistributionTest.java
index 5a7597b..3ced97c 100644
--- a/src/test/java/org/apache/commons/math4/distribution/NormalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/NormalDistributionTest.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/ParetoDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/ParetoDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/ParetoDistributionTest.java
index b7fe74d..0c5d488 100644
--- a/src/test/java/org/apache/commons/math4/distribution/ParetoDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/ParetoDistributionTest.java
@@ -15,9 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.ParetoDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/PascalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/PascalDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/PascalDistributionTest.java
index e876232..6f2725e 100644
--- a/src/test/java/org/apache/commons/math4/distribution/PascalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/PascalDistributionTest.java
@@ -14,8 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.PascalDistribution;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java
index 63518d2..51d6252 100644
--- a/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/PoissonDistributionTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.PoissonDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
index 4fa94a9..5d1af10 100644
--- a/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/RealDistributionAbstractTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
 
 import java.util.ArrayList;
@@ -25,13 +25,15 @@ import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator;
-import org.apache.commons.math3.analysis.integration.IterativeLegendreGaussIntegrator;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.integration.BaseAbstractUnivariateIntegrator;
+import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
+import org.apache.commons.math4.distribution.AbstractRealDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java
index 2f50b70..0279394 100644
--- a/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/TDistributionTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
 import org.junit.Assert;
 import org.junit.Test;
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 /**
  * Test cases for TDistribution.
  * Extends ContinuousDistributionAbstractTest.  See class javadoc for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/distribution/TriangularDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/distribution/TriangularDistributionTest.java b/src/test/java/org/apache/commons/math4/distribution/TriangularDistributionTest.java
index 762a79b..d8027e7 100644
--- a/src/test/java/org/apache/commons/math4/distribution/TriangularDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/distribution/TriangularDistributionTest.java
@@ -15,10 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.distribution;
+package org.apache.commons.math4.distribution;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.distribution.TriangularDistribution;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 import org.junit.Assert;
 import org.junit.Test;
 


[58/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java
index 6fbbcdc..e2359a3 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SphericalPolygonsSetTest.java
@@ -14,23 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
+package org.apache.commons.math4.geometry.spherical.twod;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.geometry.enclosing.EnclosingBall;
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.random.UnitSphereRandomVectorGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.geometry.enclosing.EnclosingBall;
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane;
+import org.apache.commons.math4.geometry.partitioning.Region.Location;
+import org.apache.commons.math4.geometry.spherical.oned.ArcsSet;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.geometry.spherical.twod.Circle;
+import org.apache.commons.math4.geometry.spherical.twod.Edge;
+import org.apache.commons.math4.geometry.spherical.twod.S2Point;
+import org.apache.commons.math4.geometry.spherical.twod.Sphere2D;
+import org.apache.commons.math4.geometry.spherical.twod.SphericalPolygonsSet;
+import org.apache.commons.math4.geometry.spherical.twod.SubCircle;
+import org.apache.commons.math4.geometry.spherical.twod.Vertex;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java
index 5b1c25f..743cdbc 100644
--- a/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java
+++ b/src/test/java/org/apache/commons/math4/geometry/spherical/twod/SubCircleTest.java
@@ -14,16 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.geometry.spherical.twod;
-
-import org.apache.commons.math3.geometry.euclidean.threed.Rotation;
-import org.apache.commons.math3.geometry.euclidean.threed.Vector3D;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.Side;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane.SplitSubHyperplane;
-import org.apache.commons.math3.geometry.spherical.oned.ArcsSet;
-import org.apache.commons.math3.geometry.spherical.oned.Sphere1D;
-import org.apache.commons.math3.util.MathUtils;
+package org.apache.commons.math4.geometry.spherical.twod;
+
+import org.apache.commons.math4.geometry.euclidean.threed.Rotation;
+import org.apache.commons.math4.geometry.euclidean.threed.Vector3D;
+import org.apache.commons.math4.geometry.partitioning.RegionFactory;
+import org.apache.commons.math4.geometry.partitioning.Side;
+import org.apache.commons.math4.geometry.partitioning.SubHyperplane.SplitSubHyperplane;
+import org.apache.commons.math4.geometry.spherical.oned.ArcsSet;
+import org.apache.commons.math4.geometry.spherical.oned.Sphere1D;
+import org.apache.commons.math4.geometry.spherical.twod.Circle;
+import org.apache.commons.math4.geometry.spherical.twod.Sphere2D;
+import org.apache.commons.math4.geometry.spherical.twod.SubCircle;
+import org.apache.commons.math4.util.MathUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/Array2DRowRealMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/Array2DRowRealMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/Array2DRowRealMatrixTest.java
index 06c4b42..63300b4 100644
--- a/src/test/java/org/apache/commons/math4/linear/Array2DRowRealMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/Array2DRowRealMatrixTest.java
@@ -14,20 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
+import org.apache.commons.math4.linear.DefaultRealMatrixPreservingVisitor;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.MatrixDimensionMismatchException;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Test cases for the {@link Array2DRowRealMatrix} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java b/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java
index 05bd0bd..bc4211b 100644
--- a/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/ArrayFieldVectorTest.java
@@ -14,20 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 import java.lang.reflect.Array;
 import java.util.Arrays;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionField;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.ArrayFieldVector;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.FieldVector;
+import org.apache.commons.math4.linear.FieldVectorChangingVisitor;
+import org.apache.commons.math4.linear.FieldVectorPreservingVisitor;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/ArrayRealVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/ArrayRealVectorTest.java b/src/test/java/org/apache/commons/math4/linear/ArrayRealVectorTest.java
index 89b6812..44e7ed9 100644
--- a/src/test/java/org/apache/commons/math4/linear/ArrayRealVectorTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/ArrayRealVectorTest.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealVector;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/BiDiagonalTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/BiDiagonalTransformerTest.java b/src/test/java/org/apache/commons/math4/linear/BiDiagonalTransformerTest.java
index e2463de..b7d1669 100644
--- a/src/test/java/org/apache/commons/math4/linear/BiDiagonalTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/BiDiagonalTransformerTest.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.linear.BiDiagonalTransformer;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.linear.BiDiagonalTransformer;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java
index 193b873..48061d4 100644
--- a/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/BlockFieldMatrixTest.java
@@ -14,23 +14,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 import java.util.Random;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionField;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.ArrayFieldVector;
+import org.apache.commons.math4.linear.BlockFieldMatrix;
+import org.apache.commons.math4.linear.DefaultFieldMatrixChangingVisitor;
+import org.apache.commons.math4.linear.DefaultFieldMatrixPreservingVisitor;
+import org.apache.commons.math4.linear.FieldLUDecomposition;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.FieldVector;
+import org.apache.commons.math4.linear.MatrixDimensionMismatchException;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
 
 /**
  * Test cases for the {@link BlockFieldMatrix} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/BlockRealMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/BlockRealMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/BlockRealMatrixTest.java
index ceec98c..7d3acf1 100644
--- a/src/test/java/org/apache/commons/math4/linear/BlockRealMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/BlockRealMatrixTest.java
@@ -14,21 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 import java.util.Random;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
+import org.apache.commons.math4.linear.DefaultRealMatrixPreservingVisitor;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.MatrixDimensionMismatchException;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Test cases for the {@link BlockRealMatrix} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/CholeskyDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/CholeskyDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/CholeskyDecompositionTest.java
index eeafa7b..875ea9a 100644
--- a/src/test/java/org/apache/commons/math4/linear/CholeskyDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/CholeskyDecompositionTest.java
@@ -15,8 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
-
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.linear.CholeskyDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonPositiveDefiniteMatrixException;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.NonSymmetricMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/CholeskySolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/CholeskySolverTest.java b/src/test/java/org/apache/commons/math4/linear/CholeskySolverTest.java
index 716248f..93c192d 100644
--- a/src/test/java/org/apache/commons/math4/linear/CholeskySolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/CholeskySolverTest.java
@@ -15,9 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.CholeskyDecomposition;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/ConjugateGradientTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/ConjugateGradientTest.java b/src/test/java/org/apache/commons/math4/linear/ConjugateGradientTest.java
index b160fe3..07c2ee0 100644
--- a/src/test/java/org/apache/commons/math4/linear/ConjugateGradientTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/ConjugateGradientTest.java
@@ -14,16 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.IterationEvent;
-import org.apache.commons.math3.util.IterationListener;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.ConjugateGradient;
+import org.apache.commons.math4.linear.IterativeLinearSolver;
+import org.apache.commons.math4.linear.IterativeLinearSolverEvent;
+import org.apache.commons.math4.linear.JacobiPreconditioner;
+import org.apache.commons.math4.linear.NonPositiveDefiniteOperatorException;
+import org.apache.commons.math4.linear.NonSquareOperatorException;
+import org.apache.commons.math4.linear.PreconditionedIterativeLinearSolver;
+import org.apache.commons.math4.linear.RealLinearOperator;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.IterationEvent;
+import org.apache.commons.math4.util.IterationListener;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
index db0ef43..cd703f5 100644
--- a/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/DiagonalMatrixTest.java
@@ -14,14 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
index ce0a6d0..cf86a4c 100644
--- a/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/EigenDecompositionTest.java
@@ -15,17 +15,23 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 import java.util.Random;
 
-
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.TriDiagonalTransformer;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Precision;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java b/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
index cff8683..541a8a7 100644
--- a/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/EigenSolverTest.java
@@ -15,13 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Random;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.Precision;
-
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java
index a1fad5f..528fdeb 100644
--- a/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/FieldLUDecompositionTest.java
@@ -15,14 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionField;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.FieldLUDecomposition;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
 
 public class FieldLUDecompositionTest {
     private Fraction[][] testData = {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java b/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java
index d90dff5..03662d8 100644
--- a/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/FieldLUSolverTest.java
@@ -15,11 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionField;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.FieldDecompositionSolver;
+import org.apache.commons.math4.linear.FieldLUDecomposition;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.FieldVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.linear.SparseFieldVector;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java b/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java
index 11e4bee..72c35b7 100644
--- a/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/FieldMatrixImplTest.java
@@ -14,22 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionField;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.ArrayFieldVector;
+import org.apache.commons.math4.linear.DefaultFieldMatrixChangingVisitor;
+import org.apache.commons.math4.linear.DefaultFieldMatrixPreservingVisitor;
+import org.apache.commons.math4.linear.FieldLUDecomposition;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.FieldVector;
+import org.apache.commons.math4.linear.MatrixDimensionMismatchException;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
 
 /**
  * Test cases for the {@link Array2DRowFieldMatrix} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/FrenchRealVectorFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/FrenchRealVectorFormatTest.java b/src/test/java/org/apache/commons/math4/linear/FrenchRealVectorFormatTest.java
index 09aae68..d208c50 100644
--- a/src/test/java/org/apache/commons/math4/linear/FrenchRealVectorFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/FrenchRealVectorFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/HessenbergTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/HessenbergTransformerTest.java b/src/test/java/org/apache/commons/math4/linear/HessenbergTransformerTest.java
index ec7271b..75e3af6 100644
--- a/src/test/java/org/apache/commons/math4/linear/HessenbergTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/HessenbergTransformerTest.java
@@ -15,11 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Random;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.linear.HessenbergTransformer;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/HilbertMatrix.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/HilbertMatrix.java b/src/test/java/org/apache/commons/math4/linear/HilbertMatrix.java
index 7303d99..05bffba 100644
--- a/src/test/java/org/apache/commons/math4/linear/HilbertMatrix.java
+++ b/src/test/java/org/apache/commons/math4/linear/HilbertMatrix.java
@@ -14,9 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealLinearOperator;
+import org.apache.commons.math4.linear.RealVector;
 
 /** This class implements Hilbert Matrices as {@link RealLinearOperator}. */
 public class HilbertMatrix

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/InverseHilbertMatrix.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/InverseHilbertMatrix.java b/src/test/java/org/apache/commons/math4/linear/InverseHilbertMatrix.java
index d42759f..0eba604 100644
--- a/src/test/java/org/apache/commons/math4/linear/InverseHilbertMatrix.java
+++ b/src/test/java/org/apache/commons/math4/linear/InverseHilbertMatrix.java
@@ -14,11 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.CombinatoricsUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealLinearOperator;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.CombinatoricsUtils;
 
 /**
  * This class implements inverses of Hilbert Matrices as

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/LUDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/LUDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/LUDecompositionTest.java
index f8d610a..0eae9f6 100644
--- a/src/test/java/org/apache/commons/math4/linear/LUDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/LUDecompositionTest.java
@@ -15,8 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/LUSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/LUSolverTest.java b/src/test/java/org/apache/commons/math4/linear/LUSolverTest.java
index bf7b8b6..23d4a3e 100644
--- a/src/test/java/org/apache/commons/math4/linear/LUSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/LUSolverTest.java
@@ -15,10 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+package org.apache.commons.math4.linear;
 
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularMatrixException;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/MatrixDimensionMismatchExceptionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/MatrixDimensionMismatchExceptionTest.java b/src/test/java/org/apache/commons/math4/linear/MatrixDimensionMismatchExceptionTest.java
index acfa71d..e22e5ff 100644
--- a/src/test/java/org/apache/commons/math4/linear/MatrixDimensionMismatchExceptionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/MatrixDimensionMismatchExceptionTest.java
@@ -14,8 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
+import org.apache.commons.math4.linear.MatrixDimensionMismatchException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java b/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java
index 5c308ad..9d80d3a 100644
--- a/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/MatrixUtilsTest.java
@@ -14,18 +14,30 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.math.BigDecimal;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionConversionException;
-import org.apache.commons.math3.fraction.FractionField;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.NonSymmetricMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/OpenMapRealMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/OpenMapRealMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/OpenMapRealMatrixTest.java
index d52a880..5e7c2fb 100644
--- a/src/test/java/org/apache/commons/math4/linear/OpenMapRealMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/OpenMapRealMatrixTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.linear.OpenMapRealMatrix;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/QRDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/QRDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/QRDecompositionTest.java
index a2d93f7..e501f1d 100644
--- a/src/test/java/org/apache/commons/math4/linear/QRDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/QRDecompositionTest.java
@@ -15,11 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Random;
-import org.apache.commons.math3.linear.SingularMatrixException;
 
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
+import org.apache.commons.math4.linear.DefaultRealMatrixPreservingVisitor;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/QRSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/QRSolverTest.java b/src/test/java/org/apache/commons/math4/linear/QRSolverTest.java
index 04021c8..1b6fa72 100644
--- a/src/test/java/org/apache/commons/math4/linear/QRSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/QRSolverTest.java
@@ -15,12 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Random;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RRQRDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RRQRDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/RRQRDecompositionTest.java
index 2f894f8..8623bec 100644
--- a/src/test/java/org/apache/commons/math4/linear/RRQRDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RRQRDecompositionTest.java
@@ -15,10 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Random;
 
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
+import org.apache.commons.math4.linear.DefaultRealMatrixPreservingVisitor;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RRQRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularMatrixException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RRQRSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RRQRSolverTest.java b/src/test/java/org/apache/commons/math4/linear/RRQRSolverTest.java
index 63364c7..eb91c45 100644
--- a/src/test/java/org/apache/commons/math4/linear/RRQRSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RRQRSolverTest.java
@@ -15,12 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Random;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.DefaultRealMatrixChangingVisitor;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RRQRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularMatrixException;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatAbstractTest.java b/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatAbstractTest.java
index a054623..752808e 100644
--- a/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatAbstractTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.text.NumberFormat;
 import java.text.ParsePosition;
@@ -24,8 +24,10 @@ import java.util.Locale;
 import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.exception.MathParseException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealMatrixFormat;
 
 public abstract class RealMatrixFormatAbstractTest {
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatTest.java b/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatTest.java
index 86a1e28..1577b61 100644
--- a/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RealMatrixFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RealVectorAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RealVectorAbstractTest.java b/src/test/java/org/apache/commons/math4/linear/RealVectorAbstractTest.java
index ac8cb8c..b49301c 100644
--- a/src/test/java/org/apache/commons/math4/linear/RealVectorAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RealVectorAbstractTest.java
@@ -14,46 +14,51 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Abs;
-import org.apache.commons.math3.analysis.function.Acos;
-import org.apache.commons.math3.analysis.function.Asin;
-import org.apache.commons.math3.analysis.function.Atan;
-import org.apache.commons.math3.analysis.function.Cbrt;
-import org.apache.commons.math3.analysis.function.Ceil;
-import org.apache.commons.math3.analysis.function.Cos;
-import org.apache.commons.math3.analysis.function.Cosh;
-import org.apache.commons.math3.analysis.function.Exp;
-import org.apache.commons.math3.analysis.function.Expm1;
-import org.apache.commons.math3.analysis.function.Floor;
-import org.apache.commons.math3.analysis.function.Inverse;
-import org.apache.commons.math3.analysis.function.Log;
-import org.apache.commons.math3.analysis.function.Log10;
-import org.apache.commons.math3.analysis.function.Log1p;
-import org.apache.commons.math3.analysis.function.Power;
-import org.apache.commons.math3.analysis.function.Rint;
-import org.apache.commons.math3.analysis.function.Signum;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Sinh;
-import org.apache.commons.math3.analysis.function.Sqrt;
-import org.apache.commons.math3.analysis.function.Tan;
-import org.apache.commons.math3.analysis.function.Tanh;
-import org.apache.commons.math3.analysis.function.Ulp;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Abs;
+import org.apache.commons.math4.analysis.function.Acos;
+import org.apache.commons.math4.analysis.function.Asin;
+import org.apache.commons.math4.analysis.function.Atan;
+import org.apache.commons.math4.analysis.function.Cbrt;
+import org.apache.commons.math4.analysis.function.Ceil;
+import org.apache.commons.math4.analysis.function.Cos;
+import org.apache.commons.math4.analysis.function.Cosh;
+import org.apache.commons.math4.analysis.function.Exp;
+import org.apache.commons.math4.analysis.function.Expm1;
+import org.apache.commons.math4.analysis.function.Floor;
+import org.apache.commons.math4.analysis.function.Inverse;
+import org.apache.commons.math4.analysis.function.Log;
+import org.apache.commons.math4.analysis.function.Log10;
+import org.apache.commons.math4.analysis.function.Log1p;
+import org.apache.commons.math4.analysis.function.Power;
+import org.apache.commons.math4.analysis.function.Rint;
+import org.apache.commons.math4.analysis.function.Signum;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.Sinh;
+import org.apache.commons.math4.analysis.function.Sqrt;
+import org.apache.commons.math4.analysis.function.Tan;
+import org.apache.commons.math4.analysis.function.Tanh;
+import org.apache.commons.math4.analysis.function.Ulp;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.linear.OpenMapRealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.RealVectorChangingVisitor;
+import org.apache.commons.math4.linear.RealVectorPreservingVisitor;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RealVectorFormatAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RealVectorFormatAbstractTest.java b/src/test/java/org/apache/commons/math4/linear/RealVectorFormatAbstractTest.java
index c1a3d74..49f117b 100644
--- a/src/test/java/org/apache/commons/math4/linear/RealVectorFormatAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RealVectorFormatAbstractTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.text.NumberFormat;
 import java.text.ParsePosition;
@@ -23,8 +23,9 @@ import java.util.Locale;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.exception.MathParseException;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealVectorFormat;
 
 public abstract class RealVectorFormatAbstractTest {
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RealVectorFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RealVectorFormatTest.java b/src/test/java/org/apache/commons/math4/linear/RealVectorFormatTest.java
index fb21a0f..483e55e 100644
--- a/src/test/java/org/apache/commons/math4/linear/RealVectorFormatTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RealVectorFormatTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Locale;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RealVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RealVectorTest.java b/src/test/java/org/apache/commons/math4/linear/RealVectorTest.java
index 1412a09..f4d46fa 100644
--- a/src/test/java/org/apache/commons/math4/linear/RealVectorTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RealVectorTest.java
@@ -15,11 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Iterator;
 
-import org.apache.commons.math3.linear.RealVector.Entry;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.RealVector.Entry;
 import org.junit.Assert;
 import org.junit.Ignore;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/RectangularCholeskyDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/RectangularCholeskyDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/RectangularCholeskyDecompositionTest.java
index fa43eac..42e2f2d 100644
--- a/src/test/java/org/apache/commons/math4/linear/RectangularCholeskyDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/RectangularCholeskyDecompositionTest.java
@@ -15,8 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RectangularCholeskyDecomposition;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SchurTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SchurTransformerTest.java b/src/test/java/org/apache/commons/math4/linear/SchurTransformerTest.java
index d40a1ba..4c645fb 100644
--- a/src/test/java/org/apache/commons/math4/linear/SchurTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SchurTransformerTest.java
@@ -15,11 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Random;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SchurTransformer;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SingularValueDecompositionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SingularValueDecompositionTest.java b/src/test/java/org/apache/commons/math4/linear/SingularValueDecompositionTest.java
index 40c33a7..2848aa2 100644
--- a/src/test/java/org/apache/commons/math4/linear/SingularValueDecompositionTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SingularValueDecompositionTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.io.BufferedReader;
 import java.io.DataInputStream;
@@ -23,6 +23,10 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.Random;
 
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularValueDecomposition;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SingularValueSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SingularValueSolverTest.java b/src/test/java/org/apache/commons/math4/linear/SingularValueSolverTest.java
index 9757cb7..b01332a 100644
--- a/src/test/java/org/apache/commons/math4/linear/SingularValueSolverTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SingularValueSolverTest.java
@@ -15,10 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SingularValueDecomposition;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java
index 7591eaa..caab6a6 100644
--- a/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SparseFieldMatrixTest.java
@@ -14,20 +14,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionConversionException;
-import org.apache.commons.math3.fraction.FractionField;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.ArrayFieldVector;
+import org.apache.commons.math4.linear.FieldLUDecomposition;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.FieldVector;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.SparseFieldMatrix;
 
 /**
  * Test cases for the {@link SparseFieldMatrix} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java b/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java
index 3b4c096..3a607f4 100644
--- a/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SparseFieldVectorTest.java
@@ -14,17 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.fraction.FractionConversionException;
-import org.apache.commons.math3.fraction.FractionField;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.fraction.Fraction;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.fraction.FractionField;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.FieldVector;
+import org.apache.commons.math4.linear.FieldVectorChangingVisitor;
+import org.apache.commons.math4.linear.FieldVectorPreservingVisitor;
+import org.apache.commons.math4.linear.SparseFieldVector;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SparseRealMatrixTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SparseRealMatrixTest.java b/src/test/java/org/apache/commons/math4/linear/SparseRealMatrixTest.java
index f54075d..9a1afa4 100644
--- a/src/test/java/org/apache/commons/math4/linear/SparseRealMatrixTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SparseRealMatrixTest.java
@@ -14,17 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import org.junit.Test;
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.OpenMapRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * Test cases for the {@link OpenMapRealMatrix} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SparseRealVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SparseRealVectorTest.java b/src/test/java/org/apache/commons/math4/linear/SparseRealVectorTest.java
index 6b08423..58491b7 100644
--- a/src/test/java/org/apache/commons/math4/linear/SparseRealVectorTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SparseRealVectorTest.java
@@ -14,29 +14,31 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Abs;
-import org.apache.commons.math3.analysis.function.Acos;
-import org.apache.commons.math3.analysis.function.Asin;
-import org.apache.commons.math3.analysis.function.Atan;
-import org.apache.commons.math3.analysis.function.Cbrt;
-import org.apache.commons.math3.analysis.function.Ceil;
-import org.apache.commons.math3.analysis.function.Cos;
-import org.apache.commons.math3.analysis.function.Cosh;
-import org.apache.commons.math3.analysis.function.Exp;
-import org.apache.commons.math3.analysis.function.Expm1;
-import org.apache.commons.math3.analysis.function.Floor;
-import org.apache.commons.math3.analysis.function.Log1p;
-import org.apache.commons.math3.analysis.function.Power;
-import org.apache.commons.math3.analysis.function.Rint;
-import org.apache.commons.math3.analysis.function.Signum;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Sinh;
-import org.apache.commons.math3.analysis.function.Sqrt;
-import org.apache.commons.math3.analysis.function.Tan;
-import org.apache.commons.math3.analysis.function.Tanh;
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Abs;
+import org.apache.commons.math4.analysis.function.Acos;
+import org.apache.commons.math4.analysis.function.Asin;
+import org.apache.commons.math4.analysis.function.Atan;
+import org.apache.commons.math4.analysis.function.Cbrt;
+import org.apache.commons.math4.analysis.function.Ceil;
+import org.apache.commons.math4.analysis.function.Cos;
+import org.apache.commons.math4.analysis.function.Cosh;
+import org.apache.commons.math4.analysis.function.Exp;
+import org.apache.commons.math4.analysis.function.Expm1;
+import org.apache.commons.math4.analysis.function.Floor;
+import org.apache.commons.math4.analysis.function.Log1p;
+import org.apache.commons.math4.analysis.function.Power;
+import org.apache.commons.math4.analysis.function.Rint;
+import org.apache.commons.math4.analysis.function.Signum;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.Sinh;
+import org.apache.commons.math4.analysis.function.Sqrt;
+import org.apache.commons.math4.analysis.function.Tan;
+import org.apache.commons.math4.analysis.function.Tanh;
+import org.apache.commons.math4.linear.OpenMapRealVector;
+import org.apache.commons.math4.linear.RealVector;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/SymmLQTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/SymmLQTest.java b/src/test/java/org/apache/commons/math4/linear/SymmLQTest.java
index bc2cd7e..5934b58 100644
--- a/src/test/java/org/apache/commons/math4/linear/SymmLQTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/SymmLQTest.java
@@ -14,14 +14,28 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.IterationEvent;
-import org.apache.commons.math3.util.IterationListener;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.IterativeLinearSolver;
+import org.apache.commons.math4.linear.IterativeLinearSolverEvent;
+import org.apache.commons.math4.linear.JacobiPreconditioner;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.NonPositiveDefiniteOperatorException;
+import org.apache.commons.math4.linear.NonSelfAdjointOperatorException;
+import org.apache.commons.math4.linear.NonSquareOperatorException;
+import org.apache.commons.math4.linear.PreconditionedIterativeLinearSolver;
+import org.apache.commons.math4.linear.RealLinearOperator;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.SymmLQ;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.IterationEvent;
+import org.apache.commons.math4.util.IterationListener;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/TriDiagonalTransformerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/TriDiagonalTransformerTest.java b/src/test/java/org/apache/commons/math4/linear/TriDiagonalTransformerTest.java
index b55265b..65b6d94 100644
--- a/src/test/java/org/apache/commons/math4/linear/TriDiagonalTransformerTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/TriDiagonalTransformerTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.util.FastMath;
-
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.TriDiagonalTransformer;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/UnmodifiableArrayRealVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/UnmodifiableArrayRealVectorTest.java b/src/test/java/org/apache/commons/math4/linear/UnmodifiableArrayRealVectorTest.java
index 88984dd..ef6a697 100644
--- a/src/test/java/org/apache/commons/math4/linear/UnmodifiableArrayRealVectorTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/UnmodifiableArrayRealVectorTest.java
@@ -14,7 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * This is an implementation of {@link UnmodifiableRealVectorAbstractTest} for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/UnmodifiableOpenMapRealVectorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/UnmodifiableOpenMapRealVectorTest.java b/src/test/java/org/apache/commons/math4/linear/UnmodifiableOpenMapRealVectorTest.java
index 4b3b53e..4e67150 100644
--- a/src/test/java/org/apache/commons/math4/linear/UnmodifiableOpenMapRealVectorTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/UnmodifiableOpenMapRealVectorTest.java
@@ -15,7 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
+
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.OpenMapRealVector;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * This is an implementation of {@link UnmodifiableRealVectorAbstractTest} for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java b/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java
index a2bdf33..9930801 100644
--- a/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/linear/UnmodifiableRealVectorAbstractTest.java
@@ -14,7 +14,7 @@
  * License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.commons.math3.linear;
+package org.apache.commons.math4.linear;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -23,11 +23,14 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.linear.RealVector.Entry;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.linear.RealVector.Entry;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java
index 497459f..06e28c9 100644
--- a/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/clustering/DBSCANClustererTest.java
@@ -14,13 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.ml.clustering.Cluster;
+import org.apache.commons.math4.ml.clustering.DBSCANClusterer;
+import org.apache.commons.math4.ml.clustering.DoublePoint;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java
index 885b9c2..a46c01e 100644
--- a/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/clustering/FuzzyKMeansClustererTest.java
@@ -14,18 +14,22 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.ml.distance.CanberraDistance;
-import org.apache.commons.math3.ml.distance.DistanceMeasure;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.ml.clustering.CentroidCluster;
+import org.apache.commons.math4.ml.clustering.Cluster;
+import org.apache.commons.math4.ml.clustering.DoublePoint;
+import org.apache.commons.math4.ml.clustering.FuzzyKMeansClusterer;
+import org.apache.commons.math4.ml.distance.CanberraDistance;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
 import org.hamcrest.CoreMatchers;
 import org.junit.Assert;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java
index 3d3416d..31d4288 100644
--- a/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/clustering/KMeansPlusPlusClustererTest.java
@@ -15,17 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.ml.clustering.CentroidCluster;
+import org.apache.commons.math4.ml.clustering.Cluster;
+import org.apache.commons.math4.ml.clustering.DoublePoint;
+import org.apache.commons.math4.ml.clustering.KMeansPlusPlusClusterer;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java
index 23d178a..cf4ec54 100644
--- a/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/clustering/MultiKMeansPlusPlusClustererTest.java
@@ -15,12 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering;
+package org.apache.commons.math4.ml.clustering;
 
 
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.commons.math4.ml.clustering.CentroidCluster;
+import org.apache.commons.math4.ml.clustering.Clusterable;
+import org.apache.commons.math4.ml.clustering.DoublePoint;
+import org.apache.commons.math4.ml.clustering.KMeansPlusPlusClusterer;
+import org.apache.commons.math4.ml.clustering.MultiKMeansPlusPlusClusterer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java b/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java
index a92256d..4dde78f 100644
--- a/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/clustering/evaluation/SumOfClusterVariancesTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ml.clustering.evaluation;
+package org.apache.commons.math4.ml.clustering.evaluation;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -24,9 +24,11 @@ import static org.junit.Assert.assertTrue;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.ml.clustering.Cluster;
-import org.apache.commons.math3.ml.clustering.DoublePoint;
-import org.apache.commons.math3.ml.distance.EuclideanDistance;
+import org.apache.commons.math4.ml.clustering.Cluster;
+import org.apache.commons.math4.ml.clustering.DoublePoint;
+import org.apache.commons.math4.ml.clustering.evaluation.ClusterEvaluator;
+import org.apache.commons.math4.ml.clustering.evaluation.SumOfClusterVariances;
+import org.apache.commons.math4.ml.distance.EuclideanDistance;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ml/distance/CanberraDistanceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ml/distance/CanberraDistanceTest.java b/src/test/java/org/apache/commons/math4/ml/distance/CanberraDistanceTest.java
index 339e517..2096303 100644
--- a/src/test/java/org/apache/commons/math4/ml/distance/CanberraDistanceTest.java
+++ b/src/test/java/org/apache/commons/math4/ml/distance/CanberraDistanceTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.ml.distance;
+package org.apache.commons.math4.ml.distance;
 
+import org.apache.commons.math4.ml.distance.CanberraDistance;
+import org.apache.commons.math4.ml.distance.DistanceMeasure;
 import org.junit.Assert;
 import org.junit.Test;
 


[02/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java b/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java
deleted file mode 100644
index 97bd8b7..0000000
--- a/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolver.java
+++ /dev/null
@@ -1,173 +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.linear;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.IterationManager;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * This abstract class defines an iterative solver for the linear system A
- * &middot; x = b. In what follows, the <em>residual</em> r is defined as r = b
- * - A &middot; x, where A is the linear operator of the linear system, b is the
- * right-hand side vector, and x the current estimate of the solution.
- *
- * @since 3.0
- */
-public abstract class IterativeLinearSolver {
-
-    /** The object in charge of managing the iterations. */
-    private final IterationManager manager;
-
-    /**
-     * Creates a new instance of this class, with default iteration manager.
-     *
-     * @param maxIterations the maximum number of iterations
-     */
-    public IterativeLinearSolver(final int maxIterations) {
-        this.manager = new IterationManager(maxIterations);
-    }
-
-    /**
-     * Creates a new instance of this class, with custom iteration manager.
-     *
-     * @param manager the custom iteration manager
-     * @throws NullArgumentException if {@code manager} is {@code null}
-     */
-    public IterativeLinearSolver(final IterationManager manager)
-        throws NullArgumentException {
-        MathUtils.checkNotNull(manager);
-        this.manager = manager;
-    }
-
-    /**
-     * Performs all dimension checks on the parameters of
-     * {@link #solve(RealLinearOperator, RealVector, RealVector) solve} and
-     * {@link #solveInPlace(RealLinearOperator, RealVector, RealVector) solveInPlace},
-     * and throws an exception if one of the checks fails.
-     *
-     * @param a the linear operator A of the system
-     * @param b the right-hand side vector
-     * @param x0 the initial guess of the solution
-     * @throws NullArgumentException if one of the parameters is {@code null}
-     * @throws NonSquareOperatorException if {@code a} is not square
-     * @throws DimensionMismatchException if {@code b} or {@code x0} have
-     * dimensions inconsistent with {@code a}
-     */
-    protected static void checkParameters(final RealLinearOperator a,
-        final RealVector b, final RealVector x0) throws
-        NullArgumentException, NonSquareOperatorException,
-        DimensionMismatchException {
-        MathUtils.checkNotNull(a);
-        MathUtils.checkNotNull(b);
-        MathUtils.checkNotNull(x0);
-        if (a.getRowDimension() != a.getColumnDimension()) {
-            throw new NonSquareOperatorException(a.getRowDimension(),
-                                                       a.getColumnDimension());
-        }
-        if (b.getDimension() != a.getRowDimension()) {
-            throw new DimensionMismatchException(b.getDimension(),
-                                                 a.getRowDimension());
-        }
-        if (x0.getDimension() != a.getColumnDimension()) {
-            throw new DimensionMismatchException(x0.getDimension(),
-                                                 a.getColumnDimension());
-        }
-    }
-
-    /**
-     * Returns the iteration manager attached to this solver.
-     *
-     * @return the manager
-     */
-    public IterationManager getIterationManager() {
-        return manager;
-    }
-
-    /**
-     * Returns an estimate of the solution to the linear system A &middot; x =
-     * b.
-     *
-     * @param a the linear operator A of the system
-     * @param b the right-hand side vector
-     * @return a new vector containing the solution
-     * @throws NullArgumentException if one of the parameters is {@code null}
-     * @throws NonSquareOperatorException if {@code a} is not square
-     * @throws DimensionMismatchException if {@code b} has dimensions
-     * inconsistent with {@code a}
-     * @throws MaxCountExceededException at exhaustion of the iteration count,
-     * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction of the {@link IterationManager}
-     */
-    public RealVector solve(final RealLinearOperator a, final RealVector b)
-        throws NullArgumentException, NonSquareOperatorException,
-        DimensionMismatchException, MaxCountExceededException {
-        MathUtils.checkNotNull(a);
-        final RealVector x = new ArrayRealVector(a.getColumnDimension());
-        x.set(0.);
-        return solveInPlace(a, b, x);
-    }
-
-    /**
-     * Returns an estimate of the solution to the linear system A &middot; x =
-     * b.
-     *
-     * @param a the linear operator A of the system
-     * @param b the right-hand side vector
-     * @param x0 the initial guess of the solution
-     * @return a new vector containing the solution
-     * @throws NullArgumentException if one of the parameters is {@code null}
-     * @throws NonSquareOperatorException if {@code a} is not square
-     * @throws DimensionMismatchException if {@code b} or {@code x0} have
-     * dimensions inconsistent with {@code a}
-     * @throws MaxCountExceededException at exhaustion of the iteration count,
-     * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction of the {@link IterationManager}
-     */
-    public RealVector solve(RealLinearOperator a, RealVector b, RealVector x0)
-        throws NullArgumentException, NonSquareOperatorException,
-        DimensionMismatchException, MaxCountExceededException {
-        MathUtils.checkNotNull(x0);
-        return solveInPlace(a, b, x0.copy());
-    }
-
-    /**
-     * Returns an estimate of the solution to the linear system A &middot; x =
-     * b. The solution is computed in-place (initial guess is modified).
-     *
-     * @param a the linear operator A of the system
-     * @param b the right-hand side vector
-     * @param x0 initial guess of the solution
-     * @return a reference to {@code x0} (shallow copy) updated with the
-     * solution
-     * @throws NullArgumentException if one of the parameters is {@code null}
-     * @throws NonSquareOperatorException if {@code a} is not square
-     * @throws DimensionMismatchException if {@code b} or {@code x0} have
-     * dimensions inconsistent with {@code a}
-     * @throws MaxCountExceededException at exhaustion of the iteration count,
-     * unless a custom
-     * {@link org.apache.commons.math3.util.Incrementor.MaxCountExceededCallback callback}
-     * has been set at construction of the {@link IterationManager}
-     */
-    public abstract RealVector solveInPlace(RealLinearOperator a, RealVector b,
-        RealVector x0) throws NullArgumentException, NonSquareOperatorException,
-        DimensionMismatchException, MaxCountExceededException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolverEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolverEvent.java b/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolverEvent.java
deleted file mode 100644
index 780068c..0000000
--- a/src/main/java/org/apache/commons/math3/linear/IterativeLinearSolverEvent.java
+++ /dev/null
@@ -1,115 +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.linear;
-
-import org.apache.commons.math3.util.IterationEvent;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-
-/**
- * This is the base class for all events occurring during the iterations of a
- * {@link IterativeLinearSolver}.
- *
- * @since 3.0
- */
-public abstract class IterativeLinearSolverEvent
-    extends IterationEvent {
-    /** Serialization identifier. */
-    private static final long serialVersionUID = 20120129L;
-
-    /**
-     * Creates a new instance of this class.
-     *
-     * @param source the iterative algorithm on which the event initially
-     * occurred
-     * @param iterations the number of iterations performed at the time
-     * {@code this} event is created
-     */
-    public IterativeLinearSolverEvent(final Object source, final int iterations) {
-        super(source, iterations);
-    }
-
-    /**
-     * Returns the current right-hand side of the linear system to be solved.
-     * This method should return an unmodifiable view, or a deep copy of the
-     * actual right-hand side vector, in order not to compromise subsequent
-     * iterations of the source {@link IterativeLinearSolver}.
-     *
-     * @return the right-hand side vector, b
-     */
-    public abstract RealVector getRightHandSideVector();
-
-    /**
-     * Returns the norm of the residual. The returned value is not required to
-     * be <em>exact</em>. Instead, the norm of the so-called <em>updated</em>
-     * residual (if available) should be returned. For example, the
-     * {@link ConjugateGradient conjugate gradient} method computes a sequence
-     * of residuals, the norm of which is cheap to compute. However, due to
-     * accumulation of round-off errors, this residual might differ from the
-     * true residual after some iterations. See e.g. A. Greenbaum and
-     * Z. Strakos, <em>Predicting the Behavior of Finite Precision Lanzos and
-     * Conjugate Gradient Computations</em>, Technical Report 538, Department of
-     * Computer Science, New York University, 1991 (available
-     * <a href="http://www.archive.org/details/predictingbehavi00gree">here</a>).
-     *
-     * @return the norm of the residual, ||r||
-     */
-    public abstract double getNormOfResidual();
-
-    /**
-     * <p>
-     * Returns the residual. This is an optional operation, as all iterative
-     * linear solvers do not provide cheap estimate of the updated residual
-     * vector, in which case
-     * </p>
-     * <ul>
-     * <li>this method should throw a
-     * {@link MathUnsupportedOperationException},</li>
-     * <li>{@link #providesResidual()} returns {@code false}.</li>
-     * </ul>
-     * <p>
-     * The default implementation throws a
-     * {@link MathUnsupportedOperationException}. If this method is overriden,
-     * then {@link #providesResidual()} should be overriden as well.
-     * </p>
-     *
-     * @return the updated residual, r
-     */
-    public RealVector getResidual() {
-        throw new MathUnsupportedOperationException();
-    }
-
-    /**
-     * Returns the current estimate of the solution to the linear system to be
-     * solved. This method should return an unmodifiable view, or a deep copy of
-     * the actual current solution, in order not to compromise subsequent
-     * iterations of the source {@link IterativeLinearSolver}.
-     *
-     * @return the solution, x
-     */
-    public abstract RealVector getSolution();
-
-    /**
-     * Returns {@code true} if {@link #getResidual()} is supported. The default
-     * implementation returns {@code false}.
-     *
-     * @return {@code false} if {@link #getResidual()} throws a
-     * {@link MathUnsupportedOperationException}
-     */
-    public boolean providesResidual() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java b/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java
deleted file mode 100644
index 1506fe5..0000000
--- a/src/main/java/org/apache/commons/math3/linear/JacobiPreconditioner.java
+++ /dev/null
@@ -1,135 +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.linear;
-
-import org.apache.commons.math3.analysis.function.Sqrt;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * This class implements the standard Jacobi (diagonal) preconditioner. For a
- * matrix A<sub>ij</sub>, this preconditioner is
- * M = diag(1 / A<sub>11</sub>, 1 / A<sub>22</sub>, &hellip;).
- *
- * @since 3.0
- */
-public class JacobiPreconditioner extends RealLinearOperator {
-
-    /** The diagonal coefficients of the preconditioner. */
-    private final ArrayRealVector diag;
-
-    /**
-     * Creates a new instance of this class.
-     *
-     * @param diag the diagonal coefficients of the linear operator to be
-     * preconditioned
-     * @param deep {@code true} if a deep copy of the above array should be
-     * performed
-     */
-    public JacobiPreconditioner(final double[] diag, final boolean deep) {
-        this.diag = new ArrayRealVector(diag, deep);
-    }
-
-    /**
-     * Creates a new instance of this class. This method extracts the diagonal
-     * coefficients of the specified linear operator. If {@code a} does not
-     * extend {@link AbstractRealMatrix}, then the coefficients of the
-     * underlying matrix are not accessible, coefficient extraction is made by
-     * matrix-vector products with the basis vectors (and might therefore take
-     * some time). With matrices, direct entry access is carried out.
-     *
-     * @param a the linear operator for which the preconditioner should be built
-     * @return the diagonal preconditioner made of the inverse of the diagonal
-     * coefficients of the specified linear operator
-     * @throws NonSquareOperatorException if {@code a} is not square
-     */
-    public static JacobiPreconditioner create(final RealLinearOperator a)
-        throws NonSquareOperatorException {
-        final int n = a.getColumnDimension();
-        if (a.getRowDimension() != n) {
-            throw new NonSquareOperatorException(a.getRowDimension(), n);
-        }
-        final double[] diag = new double[n];
-        if (a instanceof AbstractRealMatrix) {
-            final AbstractRealMatrix m = (AbstractRealMatrix) a;
-            for (int i = 0; i < n; i++) {
-                diag[i] = m.getEntry(i, i);
-            }
-        } else {
-            final ArrayRealVector x = new ArrayRealVector(n);
-            for (int i = 0; i < n; i++) {
-                x.set(0.);
-                x.setEntry(i, 1.);
-                diag[i] = a.operate(x).getEntry(i);
-            }
-        }
-        return new JacobiPreconditioner(diag, false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getColumnDimension() {
-        return diag.getDimension();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int getRowDimension() {
-        return diag.getDimension();
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public RealVector operate(final RealVector x) {
-        // Dimension check is carried out by ebeDivide
-        return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(),
-                                                        diag.toArray()),
-                                   false);
-    }
-
-    /**
-     * Returns the square root of {@code this} diagonal operator. More
-     * precisely, this method returns
-     * P = diag(1 / &radic;A<sub>11</sub>, 1 / &radic;A<sub>22</sub>, &hellip;).
-     *
-     * @return the square root of {@code this} preconditioner
-     * @since 3.1
-     */
-    public RealLinearOperator sqrt() {
-        final RealVector sqrtDiag = diag.map(new Sqrt());
-        return new RealLinearOperator() {
-            /** {@inheritDoc} */
-            @Override
-            public RealVector operate(final RealVector x) {
-                return new ArrayRealVector(MathArrays.ebeDivide(x.toArray(),
-                                                                sqrtDiag.toArray()),
-                                           false);
-            }
-
-            /** {@inheritDoc} */
-            @Override
-            public int getRowDimension() {
-                return sqrtDiag.getDimension();
-            }
-
-            /** {@inheritDoc} */
-            @Override
-            public int getColumnDimension() {
-                return sqrtDiag.getDimension();
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java b/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java
deleted file mode 100644
index 368bc30..0000000
--- a/src/main/java/org/apache/commons/math3/linear/LUDecomposition.java
+++ /dev/null
@@ -1,390 +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.linear;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Calculates the LUP-decomposition of a square matrix.
- * <p>The LUP-decomposition of a matrix A consists of three matrices L, U and
- * P that satisfy: P&times;A = L&times;U. L is lower triangular (with unit
- * diagonal terms), U is upper triangular and P is a permutation matrix. All
- * matrices are m&times;m.</p>
- * <p>As shown by the presence of the P matrix, this decomposition is
- * implemented using partial pivoting.</p>
- * <p>This class is based on the class with similar name from the
- * <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a> library.</p>
- * <ul>
- *   <li>a {@link #getP() getP} method has been added,</li>
- *   <li>the {@code det} method has been renamed as {@link #getDeterminant()
- *   getDeterminant},</li>
- *   <li>the {@code getDoublePivot} method has been removed (but the int based
- *   {@link #getPivot() getPivot} method has been kept),</li>
- *   <li>the {@code solve} and {@code isNonSingular} methods have been replaced
- *   by a {@link #getSolver() getSolver} method and the equivalent methods
- *   provided by the returned {@link DecompositionSolver}.</li>
- * </ul>
- *
- * @see <a href="http://mathworld.wolfram.com/LUDecomposition.html">MathWorld</a>
- * @see <a href="http://en.wikipedia.org/wiki/LU_decomposition">Wikipedia</a>
- * @since 2.0 (changed to concrete class in 3.0)
- */
-public class LUDecomposition {
-    /** Default bound to determine effective singularity in LU decomposition. */
-    private static final double DEFAULT_TOO_SMALL = 1e-11;
-    /** Entries of LU decomposition. */
-    private final double[][] lu;
-    /** Pivot permutation associated with LU decomposition. */
-    private final int[] pivot;
-    /** Parity of the permutation associated with the LU decomposition. */
-    private boolean even;
-    /** Singularity indicator. */
-    private boolean singular;
-    /** Cached value of L. */
-    private RealMatrix cachedL;
-    /** Cached value of U. */
-    private RealMatrix cachedU;
-    /** Cached value of P. */
-    private RealMatrix cachedP;
-
-    /**
-     * Calculates the LU-decomposition of the given matrix.
-     * This constructor uses 1e-11 as default value for the singularity
-     * threshold.
-     *
-     * @param matrix Matrix to decompose.
-     * @throws NonSquareMatrixException if matrix is not square.
-     */
-    public LUDecomposition(RealMatrix matrix) {
-        this(matrix, DEFAULT_TOO_SMALL);
-    }
-
-    /**
-     * Calculates the LU-decomposition of the given matrix.
-     * @param matrix The matrix to decompose.
-     * @param singularityThreshold threshold (based on partial row norm)
-     * under which a matrix is considered singular
-     * @throws NonSquareMatrixException if matrix is not square
-     */
-    public LUDecomposition(RealMatrix matrix, double singularityThreshold) {
-        if (!matrix.isSquare()) {
-            throw new NonSquareMatrixException(matrix.getRowDimension(),
-                                               matrix.getColumnDimension());
-        }
-
-        final int m = matrix.getColumnDimension();
-        lu = matrix.getData();
-        pivot = new int[m];
-        cachedL = null;
-        cachedU = null;
-        cachedP = null;
-
-        // Initialize permutation array and parity
-        for (int row = 0; row < m; row++) {
-            pivot[row] = row;
-        }
-        even     = true;
-        singular = false;
-
-        // Loop over columns
-        for (int col = 0; col < m; col++) {
-
-            // upper
-            for (int row = 0; row < col; row++) {
-                final double[] luRow = lu[row];
-                double sum = luRow[col];
-                for (int i = 0; i < row; i++) {
-                    sum -= luRow[i] * lu[i][col];
-                }
-                luRow[col] = sum;
-            }
-
-            // lower
-            int max = col; // permutation row
-            double largest = Double.NEGATIVE_INFINITY;
-            for (int row = col; row < m; row++) {
-                final double[] luRow = lu[row];
-                double sum = luRow[col];
-                for (int i = 0; i < col; i++) {
-                    sum -= luRow[i] * lu[i][col];
-                }
-                luRow[col] = sum;
-
-                // maintain best permutation choice
-                if (FastMath.abs(sum) > largest) {
-                    largest = FastMath.abs(sum);
-                    max = row;
-                }
-            }
-
-            // Singularity check
-            if (FastMath.abs(lu[max][col]) < singularityThreshold) {
-                singular = true;
-                return;
-            }
-
-            // Pivot if necessary
-            if (max != col) {
-                double tmp = 0;
-                final double[] luMax = lu[max];
-                final double[] luCol = lu[col];
-                for (int i = 0; i < m; i++) {
-                    tmp = luMax[i];
-                    luMax[i] = luCol[i];
-                    luCol[i] = tmp;
-                }
-                int temp = pivot[max];
-                pivot[max] = pivot[col];
-                pivot[col] = temp;
-                even = !even;
-            }
-
-            // Divide the lower elements by the "winning" diagonal elt.
-            final double luDiag = lu[col][col];
-            for (int row = col + 1; row < m; row++) {
-                lu[row][col] /= luDiag;
-            }
-        }
-    }
-
-    /**
-     * Returns the matrix L of the decomposition.
-     * <p>L is a lower-triangular matrix</p>
-     * @return the L matrix (or null if decomposed matrix is singular)
-     */
-    public RealMatrix getL() {
-        if ((cachedL == null) && !singular) {
-            final int m = pivot.length;
-            cachedL = MatrixUtils.createRealMatrix(m, m);
-            for (int i = 0; i < m; ++i) {
-                final double[] luI = lu[i];
-                for (int j = 0; j < i; ++j) {
-                    cachedL.setEntry(i, j, luI[j]);
-                }
-                cachedL.setEntry(i, i, 1.0);
-            }
-        }
-        return cachedL;
-    }
-
-    /**
-     * Returns the matrix U of the decomposition.
-     * <p>U is an upper-triangular matrix</p>
-     * @return the U matrix (or null if decomposed matrix is singular)
-     */
-    public RealMatrix getU() {
-        if ((cachedU == null) && !singular) {
-            final int m = pivot.length;
-            cachedU = MatrixUtils.createRealMatrix(m, m);
-            for (int i = 0; i < m; ++i) {
-                final double[] luI = lu[i];
-                for (int j = i; j < m; ++j) {
-                    cachedU.setEntry(i, j, luI[j]);
-                }
-            }
-        }
-        return cachedU;
-    }
-
-    /**
-     * Returns the P rows permutation matrix.
-     * <p>P is a sparse matrix with exactly one element set to 1.0 in
-     * each row and each column, all other elements being set to 0.0.</p>
-     * <p>The positions of the 1 elements are given by the {@link #getPivot()
-     * pivot permutation vector}.</p>
-     * @return the P rows permutation matrix (or null if decomposed matrix is singular)
-     * @see #getPivot()
-     */
-    public RealMatrix getP() {
-        if ((cachedP == null) && !singular) {
-            final int m = pivot.length;
-            cachedP = MatrixUtils.createRealMatrix(m, m);
-            for (int i = 0; i < m; ++i) {
-                cachedP.setEntry(i, pivot[i], 1.0);
-            }
-        }
-        return cachedP;
-    }
-
-    /**
-     * Returns the pivot permutation vector.
-     * @return the pivot permutation vector
-     * @see #getP()
-     */
-    public int[] getPivot() {
-        return pivot.clone();
-    }
-
-    /**
-     * Return the determinant of the matrix
-     * @return determinant of the matrix
-     */
-    public double getDeterminant() {
-        if (singular) {
-            return 0;
-        } else {
-            final int m = pivot.length;
-            double determinant = even ? 1 : -1;
-            for (int i = 0; i < m; i++) {
-                determinant *= lu[i][i];
-            }
-            return determinant;
-        }
-    }
-
-    /**
-     * Get a solver for finding the A &times; X = B solution in exact linear
-     * sense.
-     * @return a solver
-     */
-    public DecompositionSolver getSolver() {
-        return new Solver(lu, pivot, singular);
-    }
-
-    /** Specialized solver. */
-    private static class Solver implements DecompositionSolver {
-
-        /** Entries of LU decomposition. */
-        private final double[][] lu;
-
-        /** Pivot permutation associated with LU decomposition. */
-        private final int[] pivot;
-
-        /** Singularity indicator. */
-        private final boolean singular;
-
-        /**
-         * Build a solver from decomposed matrix.
-         * @param lu entries of LU decomposition
-         * @param pivot pivot permutation associated with LU decomposition
-         * @param singular singularity indicator
-         */
-        private Solver(final double[][] lu, final int[] pivot, final boolean singular) {
-            this.lu       = lu;
-            this.pivot    = pivot;
-            this.singular = singular;
-        }
-
-        /** {@inheritDoc} */
-        public boolean isNonSingular() {
-            return !singular;
-        }
-
-        /** {@inheritDoc} */
-        public RealVector solve(RealVector b) {
-            final int m = pivot.length;
-            if (b.getDimension() != m) {
-                throw new DimensionMismatchException(b.getDimension(), m);
-            }
-            if (singular) {
-                throw new SingularMatrixException();
-            }
-
-            final double[] bp = new double[m];
-
-            // Apply permutations to b
-            for (int row = 0; row < m; row++) {
-                bp[row] = b.getEntry(pivot[row]);
-            }
-
-            // Solve LY = b
-            for (int col = 0; col < m; col++) {
-                final double bpCol = bp[col];
-                for (int i = col + 1; i < m; i++) {
-                    bp[i] -= bpCol * lu[i][col];
-                }
-            }
-
-            // Solve UX = Y
-            for (int col = m - 1; col >= 0; col--) {
-                bp[col] /= lu[col][col];
-                final double bpCol = bp[col];
-                for (int i = 0; i < col; i++) {
-                    bp[i] -= bpCol * lu[i][col];
-                }
-            }
-
-            return new ArrayRealVector(bp, false);
-        }
-
-        /** {@inheritDoc} */
-        public RealMatrix solve(RealMatrix b) {
-
-            final int m = pivot.length;
-            if (b.getRowDimension() != m) {
-                throw new DimensionMismatchException(b.getRowDimension(), m);
-            }
-            if (singular) {
-                throw new SingularMatrixException();
-            }
-
-            final int nColB = b.getColumnDimension();
-
-            // Apply permutations to b
-            final double[][] bp = new double[m][nColB];
-            for (int row = 0; row < m; row++) {
-                final double[] bpRow = bp[row];
-                final int pRow = pivot[row];
-                for (int col = 0; col < nColB; col++) {
-                    bpRow[col] = b.getEntry(pRow, col);
-                }
-            }
-
-            // Solve LY = b
-            for (int col = 0; col < m; col++) {
-                final double[] bpCol = bp[col];
-                for (int i = col + 1; i < m; i++) {
-                    final double[] bpI = bp[i];
-                    final double luICol = lu[i][col];
-                    for (int j = 0; j < nColB; j++) {
-                        bpI[j] -= bpCol[j] * luICol;
-                    }
-                }
-            }
-
-            // Solve UX = Y
-            for (int col = m - 1; col >= 0; col--) {
-                final double[] bpCol = bp[col];
-                final double luDiag = lu[col][col];
-                for (int j = 0; j < nColB; j++) {
-                    bpCol[j] /= luDiag;
-                }
-                for (int i = 0; i < col; i++) {
-                    final double[] bpI = bp[i];
-                    final double luICol = lu[i][col];
-                    for (int j = 0; j < nColB; j++) {
-                        bpI[j] -= bpCol[j] * luICol;
-                    }
-                }
-            }
-
-            return new Array2DRowRealMatrix(bp, false);
-        }
-
-        /**
-         * Get the inverse of the decomposed matrix.
-         *
-         * @return the inverse matrix.
-         * @throws SingularMatrixException if the decomposed matrix is singular.
-         */
-        public RealMatrix getInverse() {
-            return solve(MatrixUtils.createRealIdentityMatrix(pivot.length));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/MatrixDimensionMismatchException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/MatrixDimensionMismatchException.java b/src/main/java/org/apache/commons/math3/linear/MatrixDimensionMismatchException.java
deleted file mode 100644
index effbf11..0000000
--- a/src/main/java/org/apache/commons/math3/linear/MatrixDimensionMismatchException.java
+++ /dev/null
@@ -1,73 +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.linear;
-
-import org.apache.commons.math3.exception.MultiDimensionMismatchException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when either the number of rows or the number of
- * columns of a matrix do not match the expected values.
- *
- * @since 3.0
- */
-public class MatrixDimensionMismatchException extends MultiDimensionMismatchException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -8415396756375798143L;
-
-    /**
-     * Construct an exception from the mismatched dimensions.
-     *
-     * @param wrongRowDim Wrong row dimension.
-     * @param wrongColDim Wrong column dimension.
-     * @param expectedRowDim Expected row dimension.
-     * @param expectedColDim Expected column dimension.
-     */
-    public MatrixDimensionMismatchException(int wrongRowDim,
-                                            int wrongColDim,
-                                            int expectedRowDim,
-                                            int expectedColDim) {
-        super(LocalizedFormats.DIMENSIONS_MISMATCH_2x2,
-              new Integer[] { wrongRowDim, wrongColDim },
-              new Integer[] { expectedRowDim, expectedColDim });
-    }
-
-    /**
-     * @return the expected row dimension.
-     */
-    public int getWrongRowDimension() {
-        return getWrongDimension(0);
-    }
-    /**
-     * @return the expected row dimension.
-     */
-    public int getExpectedRowDimension() {
-        return getExpectedDimension(0);
-    }
-    /**
-     * @return the wrong column dimension.
-     */
-    public int getWrongColumnDimension() {
-        return getWrongDimension(1);
-    }
-    /**
-     * @return the expected column dimension.
-     */
-    public int getExpectedColumnDimension() {
-        return getExpectedDimension(1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/MatrixUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/MatrixUtils.java b/src/main/java/org/apache/commons/math3/linear/MatrixUtils.java
deleted file mode 100644
index 23c11e0..0000000
--- a/src/main/java/org/apache/commons/math3/linear/MatrixUtils.java
+++ /dev/null
@@ -1,1119 +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.linear;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.util.Arrays;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.fraction.Fraction;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * A collection of static methods that operate on or return matrices.
- *
- */
-public class MatrixUtils {
-
-    /**
-     * The default format for {@link RealMatrix} objects.
-     * @since 3.1
-     */
-    public static final RealMatrixFormat DEFAULT_FORMAT = RealMatrixFormat.getInstance();
-
-    /**
-     * A format for {@link RealMatrix} objects compatible with octave.
-     * @since 3.1
-     */
-    public static final RealMatrixFormat OCTAVE_FORMAT = new RealMatrixFormat("[", "]", "", "", "; ", ", ");
-
-    /**
-     * Private constructor.
-     */
-    private MatrixUtils() {
-        super();
-    }
-
-    /**
-     * Returns a {@link RealMatrix} with specified dimensions.
-     * <p>The type of matrix returned depends on the dimension. Below
-     * 2<sup>12</sup> elements (i.e. 4096 elements or 64&times;64 for a
-     * square matrix) which can be stored in a 32kB array, a {@link
-     * Array2DRowRealMatrix} instance is built. Above this threshold a {@link
-     * BlockRealMatrix} instance is built.</p>
-     * <p>The matrix elements are all set to 0.0.</p>
-     * @param rows number of rows of the matrix
-     * @param columns number of columns of the matrix
-     * @return  RealMatrix with specified dimensions
-     * @see #createRealMatrix(double[][])
-     */
-    public static RealMatrix createRealMatrix(final int rows, final int columns) {
-        return (rows * columns <= 4096) ?
-                new Array2DRowRealMatrix(rows, columns) : new BlockRealMatrix(rows, columns);
-    }
-
-    /**
-     * Returns a {@link FieldMatrix} with specified dimensions.
-     * <p>The type of matrix returned depends on the dimension. Below
-     * 2<sup>12</sup> elements (i.e. 4096 elements or 64&times;64 for a
-     * square matrix), a {@link FieldMatrix} instance is built. Above
-     * this threshold a {@link BlockFieldMatrix} instance is built.</p>
-     * <p>The matrix elements are all set to field.getZero().</p>
-     * @param <T> the type of the field elements
-     * @param field field to which the matrix elements belong
-     * @param rows number of rows of the matrix
-     * @param columns number of columns of the matrix
-     * @return  FieldMatrix with specified dimensions
-     * @see #createFieldMatrix(FieldElement[][])
-     * @since 2.0
-     */
-    public static <T extends FieldElement<T>> FieldMatrix<T> createFieldMatrix(final Field<T> field,
-                                                                               final int rows,
-                                                                               final int columns) {
-        return (rows * columns <= 4096) ?
-                new Array2DRowFieldMatrix<T>(field, rows, columns) : new BlockFieldMatrix<T>(field, rows, columns);
-    }
-
-    /**
-     * Returns a {@link RealMatrix} whose entries are the the values in the
-     * the input array.
-     * <p>The type of matrix returned depends on the dimension. Below
-     * 2<sup>12</sup> elements (i.e. 4096 elements or 64&times;64 for a
-     * square matrix) which can be stored in a 32kB array, a {@link
-     * Array2DRowRealMatrix} instance is built. Above this threshold a {@link
-     * BlockRealMatrix} instance is built.</p>
-     * <p>The input array is copied, not referenced.</p>
-     *
-     * @param data input array
-     * @return  RealMatrix containing the values of the array
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if {@code data} is not rectangular (not all rows have the same length).
-     * @throws NoDataException if a row or column is empty.
-     * @throws NullArgumentException if either {@code data} or {@code data[0]}
-     * is {@code null}.
-     * @throws DimensionMismatchException if {@code data} is not rectangular.
-     * @see #createRealMatrix(int, int)
-     */
-    public static RealMatrix createRealMatrix(double[][] data)
-        throws NullArgumentException, DimensionMismatchException,
-        NoDataException {
-        if (data == null ||
-            data[0] == null) {
-            throw new NullArgumentException();
-        }
-        return (data.length * data[0].length <= 4096) ?
-                new Array2DRowRealMatrix(data) : new BlockRealMatrix(data);
-    }
-
-    /**
-     * Returns a {@link FieldMatrix} whose entries are the the values in the
-     * the input array.
-     * <p>The type of matrix returned depends on the dimension. Below
-     * 2<sup>12</sup> elements (i.e. 4096 elements or 64&times;64 for a
-     * square matrix), a {@link FieldMatrix} instance is built. Above
-     * this threshold a {@link BlockFieldMatrix} instance is built.</p>
-     * <p>The input array is copied, not referenced.</p>
-     * @param <T> the type of the field elements
-     * @param data input array
-     * @return a matrix containing the values of the array.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
-     * if {@code data} is not rectangular (not all rows have the same length).
-     * @throws NoDataException if a row or column is empty.
-     * @throws NullArgumentException if either {@code data} or {@code data[0]}
-     * is {@code null}.
-     * @see #createFieldMatrix(Field, int, int)
-     * @since 2.0
-     */
-    public static <T extends FieldElement<T>> FieldMatrix<T> createFieldMatrix(T[][] data)
-        throws DimensionMismatchException, NoDataException, NullArgumentException {
-        if (data == null ||
-            data[0] == null) {
-            throw new NullArgumentException();
-        }
-        return (data.length * data[0].length <= 4096) ?
-                new Array2DRowFieldMatrix<T>(data) : new BlockFieldMatrix<T>(data);
-    }
-
-    /**
-     * Returns <code>dimension x dimension</code> identity matrix.
-     *
-     * @param dimension dimension of identity matrix to generate
-     * @return identity matrix
-     * @throws IllegalArgumentException if dimension is not positive
-     * @since 1.1
-     */
-    public static RealMatrix createRealIdentityMatrix(int dimension) {
-        final RealMatrix m = createRealMatrix(dimension, dimension);
-        for (int i = 0; i < dimension; ++i) {
-            m.setEntry(i, i, 1.0);
-        }
-        return m;
-    }
-
-    /**
-     * Returns <code>dimension x dimension</code> identity matrix.
-     *
-     * @param <T> the type of the field elements
-     * @param field field to which the elements belong
-     * @param dimension dimension of identity matrix to generate
-     * @return identity matrix
-     * @throws IllegalArgumentException if dimension is not positive
-     * @since 2.0
-     */
-    public static <T extends FieldElement<T>> FieldMatrix<T>
-        createFieldIdentityMatrix(final Field<T> field, final int dimension) {
-        final T zero = field.getZero();
-        final T one  = field.getOne();
-        final T[][] d = MathArrays.buildArray(field, dimension, dimension);
-        for (int row = 0; row < dimension; row++) {
-            final T[] dRow = d[row];
-            Arrays.fill(dRow, zero);
-            dRow[row] = one;
-        }
-        return new Array2DRowFieldMatrix<T>(field, d, false);
-    }
-
-    /**
-     * Returns a diagonal matrix with specified elements.
-     *
-     * @param diagonal diagonal elements of the matrix (the array elements
-     * will be copied)
-     * @return diagonal matrix
-     * @since 2.0
-     */
-    public static RealMatrix createRealDiagonalMatrix(final double[] diagonal) {
-        final RealMatrix m = createRealMatrix(diagonal.length, diagonal.length);
-        for (int i = 0; i < diagonal.length; ++i) {
-            m.setEntry(i, i, diagonal[i]);
-        }
-        return m;
-    }
-
-    /**
-     * Returns a diagonal matrix with specified elements.
-     *
-     * @param <T> the type of the field elements
-     * @param diagonal diagonal elements of the matrix (the array elements
-     * will be copied)
-     * @return diagonal matrix
-     * @since 2.0
-     */
-    public static <T extends FieldElement<T>> FieldMatrix<T>
-        createFieldDiagonalMatrix(final T[] diagonal) {
-        final FieldMatrix<T> m =
-            createFieldMatrix(diagonal[0].getField(), diagonal.length, diagonal.length);
-        for (int i = 0; i < diagonal.length; ++i) {
-            m.setEntry(i, i, diagonal[i]);
-        }
-        return m;
-    }
-
-    /**
-     * Creates a {@link RealVector} using the data from the input array.
-     *
-     * @param data the input data
-     * @return a data.length RealVector
-     * @throws NoDataException if {@code data} is empty.
-     * @throws NullArgumentException if {@code data} is {@code null}.
-     */
-    public static RealVector createRealVector(double[] data)
-        throws NoDataException, NullArgumentException {
-        if (data == null) {
-            throw new NullArgumentException();
-        }
-        return new ArrayRealVector(data, true);
-    }
-
-    /**
-     * Creates a {@link FieldVector} using the data from the input array.
-     *
-     * @param <T> the type of the field elements
-     * @param data the input data
-     * @return a data.length FieldVector
-     * @throws NoDataException if {@code data} is empty.
-     * @throws NullArgumentException if {@code data} is {@code null}.
-     * @throws ZeroException if {@code data} has 0 elements
-     */
-    public static <T extends FieldElement<T>> FieldVector<T> createFieldVector(final T[] data)
-        throws NoDataException, NullArgumentException, ZeroException {
-        if (data == null) {
-            throw new NullArgumentException();
-        }
-        if (data.length == 0) {
-            throw new ZeroException(LocalizedFormats.VECTOR_MUST_HAVE_AT_LEAST_ONE_ELEMENT);
-        }
-        return new ArrayFieldVector<T>(data[0].getField(), data, true);
-    }
-
-    /**
-     * Create a row {@link RealMatrix} using the data from the input
-     * array.
-     *
-     * @param rowData the input row data
-     * @return a 1 x rowData.length RealMatrix
-     * @throws NoDataException if {@code rowData} is empty.
-     * @throws NullArgumentException if {@code rowData} is {@code null}.
-     */
-    public static RealMatrix createRowRealMatrix(double[] rowData)
-        throws NoDataException, NullArgumentException {
-        if (rowData == null) {
-            throw new NullArgumentException();
-        }
-        final int nCols = rowData.length;
-        final RealMatrix m = createRealMatrix(1, nCols);
-        for (int i = 0; i < nCols; ++i) {
-            m.setEntry(0, i, rowData[i]);
-        }
-        return m;
-    }
-
-    /**
-     * Create a row {@link FieldMatrix} using the data from the input
-     * array.
-     *
-     * @param <T> the type of the field elements
-     * @param rowData the input row data
-     * @return a 1 x rowData.length FieldMatrix
-     * @throws NoDataException if {@code rowData} is empty.
-     * @throws NullArgumentException if {@code rowData} is {@code null}.
-     */
-    public static <T extends FieldElement<T>> FieldMatrix<T>
-        createRowFieldMatrix(final T[] rowData)
-        throws NoDataException, NullArgumentException {
-        if (rowData == null) {
-            throw new NullArgumentException();
-        }
-        final int nCols = rowData.length;
-        if (nCols == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_COLUMN);
-        }
-        final FieldMatrix<T> m = createFieldMatrix(rowData[0].getField(), 1, nCols);
-        for (int i = 0; i < nCols; ++i) {
-            m.setEntry(0, i, rowData[i]);
-        }
-        return m;
-    }
-
-    /**
-     * Creates a column {@link RealMatrix} using the data from the input
-     * array.
-     *
-     * @param columnData  the input column data
-     * @return a columnData x 1 RealMatrix
-     * @throws NoDataException if {@code columnData} is empty.
-     * @throws NullArgumentException if {@code columnData} is {@code null}.
-     */
-    public static RealMatrix createColumnRealMatrix(double[] columnData)
-        throws NoDataException, NullArgumentException {
-        if (columnData == null) {
-            throw new NullArgumentException();
-        }
-        final int nRows = columnData.length;
-        final RealMatrix m = createRealMatrix(nRows, 1);
-        for (int i = 0; i < nRows; ++i) {
-            m.setEntry(i, 0, columnData[i]);
-        }
-        return m;
-    }
-
-    /**
-     * Creates a column {@link FieldMatrix} using the data from the input
-     * array.
-     *
-     * @param <T> the type of the field elements
-     * @param columnData  the input column data
-     * @return a columnData x 1 FieldMatrix
-     * @throws NoDataException if {@code data} is empty.
-     * @throws NullArgumentException if {@code columnData} is {@code null}.
-     */
-    public static <T extends FieldElement<T>> FieldMatrix<T>
-        createColumnFieldMatrix(final T[] columnData)
-        throws NoDataException, NullArgumentException {
-        if (columnData == null) {
-            throw new NullArgumentException();
-        }
-        final int nRows = columnData.length;
-        if (nRows == 0) {
-            throw new NoDataException(LocalizedFormats.AT_LEAST_ONE_ROW);
-        }
-        final FieldMatrix<T> m = createFieldMatrix(columnData[0].getField(), nRows, 1);
-        for (int i = 0; i < nRows; ++i) {
-            m.setEntry(i, 0, columnData[i]);
-        }
-        return m;
-    }
-
-    /**
-     * Checks whether a matrix is symmetric, within a given relative tolerance.
-     *
-     * @param matrix Matrix to check.
-     * @param relativeTolerance Tolerance of the symmetry check.
-     * @param raiseException If {@code true}, an exception will be raised if
-     * the matrix is not symmetric.
-     * @return {@code true} if {@code matrix} is symmetric.
-     * @throws NonSquareMatrixException if the matrix is not square.
-     * @throws NonSymmetricMatrixException if the matrix is not symmetric.
-     */
-    private static boolean isSymmetricInternal(RealMatrix matrix,
-                                               double relativeTolerance,
-                                               boolean raiseException) {
-        final int rows = matrix.getRowDimension();
-        if (rows != matrix.getColumnDimension()) {
-            if (raiseException) {
-                throw new NonSquareMatrixException(rows, matrix.getColumnDimension());
-            } else {
-                return false;
-            }
-        }
-        for (int i = 0; i < rows; i++) {
-            for (int j = i + 1; j < rows; j++) {
-                final double mij = matrix.getEntry(i, j);
-                final double mji = matrix.getEntry(j, i);
-                if (FastMath.abs(mij - mji) >
-                    FastMath.max(FastMath.abs(mij), FastMath.abs(mji)) * relativeTolerance) {
-                    if (raiseException) {
-                        throw new NonSymmetricMatrixException(i, j, relativeTolerance);
-                    } else {
-                        return false;
-                    }
-                }
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Checks whether a matrix is symmetric.
-     *
-     * @param matrix Matrix to check.
-     * @param eps Relative tolerance.
-     * @throws NonSquareMatrixException if the matrix is not square.
-     * @throws NonSymmetricMatrixException if the matrix is not symmetric.
-     * @since 3.1
-     */
-    public static void checkSymmetric(RealMatrix matrix,
-                                      double eps) {
-        isSymmetricInternal(matrix, eps, true);
-    }
-
-    /**
-     * Checks whether a matrix is symmetric.
-     *
-     * @param matrix Matrix to check.
-     * @param eps Relative tolerance.
-     * @return {@code true} if {@code matrix} is symmetric.
-     * @since 3.1
-     */
-    public static boolean isSymmetric(RealMatrix matrix,
-                                      double eps) {
-        return isSymmetricInternal(matrix, eps, false);
-    }
-
-    /**
-     * Check if matrix indices are valid.
-     *
-     * @param m Matrix.
-     * @param row Row index to check.
-     * @param column Column index to check.
-     * @throws OutOfRangeException if {@code row} or {@code column} is not
-     * a valid index.
-     */
-    public static void checkMatrixIndex(final AnyMatrix m,
-                                        final int row, final int column)
-        throws OutOfRangeException {
-        checkRowIndex(m, row);
-        checkColumnIndex(m, column);
-    }
-
-    /**
-     * Check if a row index is valid.
-     *
-     * @param m Matrix.
-     * @param row Row index to check.
-     * @throws OutOfRangeException if {@code row} is not a valid index.
-     */
-    public static void checkRowIndex(final AnyMatrix m, final int row)
-        throws OutOfRangeException {
-        if (row < 0 ||
-            row >= m.getRowDimension()) {
-            throw new OutOfRangeException(LocalizedFormats.ROW_INDEX,
-                                          row, 0, m.getRowDimension() - 1);
-        }
-    }
-
-    /**
-     * Check if a column index is valid.
-     *
-     * @param m Matrix.
-     * @param column Column index to check.
-     * @throws OutOfRangeException if {@code column} is not a valid index.
-     */
-    public static void checkColumnIndex(final AnyMatrix m, final int column)
-        throws OutOfRangeException {
-        if (column < 0 || column >= m.getColumnDimension()) {
-            throw new OutOfRangeException(LocalizedFormats.COLUMN_INDEX,
-                                           column, 0, m.getColumnDimension() - 1);
-        }
-    }
-
-    /**
-     * Check if submatrix ranges indices are valid.
-     * Rows and columns are indicated counting from 0 to {@code n - 1}.
-     *
-     * @param m Matrix.
-     * @param startRow Initial row index.
-     * @param endRow Final row index.
-     * @param startColumn Initial column index.
-     * @param endColumn Final column index.
-     * @throws OutOfRangeException if the indices are invalid.
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     */
-    public static void checkSubMatrixIndex(final AnyMatrix m,
-                                           final int startRow, final int endRow,
-                                           final int startColumn, final int endColumn)
-        throws NumberIsTooSmallException, OutOfRangeException {
-        checkRowIndex(m, startRow);
-        checkRowIndex(m, endRow);
-        if (endRow < startRow) {
-            throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_ROW_AFTER_FINAL_ROW,
-                                                endRow, startRow, false);
-        }
-
-        checkColumnIndex(m, startColumn);
-        checkColumnIndex(m, endColumn);
-        if (endColumn < startColumn) {
-            throw new NumberIsTooSmallException(LocalizedFormats.INITIAL_COLUMN_AFTER_FINAL_COLUMN,
-                                                endColumn, startColumn, false);
-        }
-
-
-    }
-
-    /**
-     * Check if submatrix ranges indices are valid.
-     * Rows and columns are indicated counting from 0 to n-1.
-     *
-     * @param m Matrix.
-     * @param selectedRows Array of row indices.
-     * @param selectedColumns Array of column indices.
-     * @throws NullArgumentException if {@code selectedRows} or
-     * {@code selectedColumns} are {@code null}.
-     * @throws NoDataException if the row or column selections are empty (zero
-     * length).
-     * @throws OutOfRangeException if row or column selections are not valid.
-     */
-    public static void checkSubMatrixIndex(final AnyMatrix m,
-                                           final int[] selectedRows,
-                                           final int[] selectedColumns)
-        throws NoDataException, NullArgumentException, OutOfRangeException {
-        if (selectedRows == null) {
-            throw new NullArgumentException();
-        }
-        if (selectedColumns == null) {
-            throw new NullArgumentException();
-        }
-        if (selectedRows.length == 0) {
-            throw new NoDataException(LocalizedFormats.EMPTY_SELECTED_ROW_INDEX_ARRAY);
-        }
-        if (selectedColumns.length == 0) {
-            throw new NoDataException(LocalizedFormats.EMPTY_SELECTED_COLUMN_INDEX_ARRAY);
-        }
-
-        for (final int row : selectedRows) {
-            checkRowIndex(m, row);
-        }
-        for (final int column : selectedColumns) {
-            checkColumnIndex(m, column);
-        }
-    }
-
-    /**
-     * Check if matrices are addition compatible.
-     *
-     * @param left Left hand side matrix.
-     * @param right Right hand side matrix.
-     * @throws MatrixDimensionMismatchException if the matrices are not addition
-     * compatible.
-     */
-    public static void checkAdditionCompatible(final AnyMatrix left, final AnyMatrix right)
-        throws MatrixDimensionMismatchException {
-        if ((left.getRowDimension()    != right.getRowDimension()) ||
-            (left.getColumnDimension() != right.getColumnDimension())) {
-            throw new MatrixDimensionMismatchException(left.getRowDimension(), left.getColumnDimension(),
-                                                       right.getRowDimension(), right.getColumnDimension());
-        }
-    }
-
-    /**
-     * Check if matrices are subtraction compatible
-     *
-     * @param left Left hand side matrix.
-     * @param right Right hand side matrix.
-     * @throws MatrixDimensionMismatchException if the matrices are not addition
-     * compatible.
-     */
-    public static void checkSubtractionCompatible(final AnyMatrix left, final AnyMatrix right)
-        throws MatrixDimensionMismatchException {
-        if ((left.getRowDimension()    != right.getRowDimension()) ||
-            (left.getColumnDimension() != right.getColumnDimension())) {
-            throw new MatrixDimensionMismatchException(left.getRowDimension(), left.getColumnDimension(),
-                                                       right.getRowDimension(), right.getColumnDimension());
-        }
-    }
-
-    /**
-     * Check if matrices are multiplication compatible
-     *
-     * @param left Left hand side matrix.
-     * @param right Right hand side matrix.
-     * @throws DimensionMismatchException if matrices are not multiplication
-     * compatible.
-     */
-    public static void checkMultiplicationCompatible(final AnyMatrix left, final AnyMatrix right)
-        throws DimensionMismatchException {
-
-        if (left.getColumnDimension() != right.getRowDimension()) {
-            throw new DimensionMismatchException(left.getColumnDimension(),
-                                                 right.getRowDimension());
-        }
-    }
-
-    /**
-     * Convert a {@link FieldMatrix}/{@link Fraction} matrix to a {@link RealMatrix}.
-     * @param m Matrix to convert.
-     * @return the converted matrix.
-     */
-    public static Array2DRowRealMatrix fractionMatrixToRealMatrix(final FieldMatrix<Fraction> m) {
-        final FractionMatrixConverter converter = new FractionMatrixConverter();
-        m.walkInOptimizedOrder(converter);
-        return converter.getConvertedMatrix();
-    }
-
-    /** Converter for {@link FieldMatrix}/{@link Fraction}. */
-    private static class FractionMatrixConverter extends DefaultFieldMatrixPreservingVisitor<Fraction> {
-        /** Converted array. */
-        private double[][] data;
-        /** Simple constructor. */
-        public FractionMatrixConverter() {
-            super(Fraction.ZERO);
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public void start(int rows, int columns,
-                          int startRow, int endRow, int startColumn, int endColumn) {
-            data = new double[rows][columns];
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public void visit(int row, int column, Fraction value) {
-            data[row][column] = value.doubleValue();
-        }
-
-        /**
-         * Get the converted matrix.
-         *
-         * @return the converted matrix.
-         */
-        Array2DRowRealMatrix getConvertedMatrix() {
-            return new Array2DRowRealMatrix(data, false);
-        }
-
-    }
-
-    /**
-     * Convert a {@link FieldMatrix}/{@link BigFraction} matrix to a {@link RealMatrix}.
-     *
-     * @param m Matrix to convert.
-     * @return the converted matrix.
-     */
-    public static Array2DRowRealMatrix bigFractionMatrixToRealMatrix(final FieldMatrix<BigFraction> m) {
-        final BigFractionMatrixConverter converter = new BigFractionMatrixConverter();
-        m.walkInOptimizedOrder(converter);
-        return converter.getConvertedMatrix();
-    }
-
-    /** Converter for {@link FieldMatrix}/{@link BigFraction}. */
-    private static class BigFractionMatrixConverter extends DefaultFieldMatrixPreservingVisitor<BigFraction> {
-        /** Converted array. */
-        private double[][] data;
-        /** Simple constructor. */
-        public BigFractionMatrixConverter() {
-            super(BigFraction.ZERO);
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public void start(int rows, int columns,
-                          int startRow, int endRow, int startColumn, int endColumn) {
-            data = new double[rows][columns];
-        }
-
-        /** {@inheritDoc} */
-        @Override
-        public void visit(int row, int column, BigFraction value) {
-            data[row][column] = value.doubleValue();
-        }
-
-        /**
-         * Get the converted matrix.
-         *
-         * @return the converted matrix.
-         */
-        Array2DRowRealMatrix getConvertedMatrix() {
-            return new Array2DRowRealMatrix(data, false);
-        }
-    }
-
-    /** Serialize a {@link RealVector}.
-     * <p>
-     * This method is intended to be called from within a private
-     * <code>writeObject</code> method (after a call to
-     * <code>oos.defaultWriteObject()</code>) in a class that has a
-     * {@link RealVector} field, which should be declared <code>transient</code>.
-     * This way, the default handling does not serialize the vector (the {@link
-     * RealVector} interface is not serializable by default) but this method does
-     * serialize it specifically.
-     * </p>
-     * <p>
-     * The following example shows how a simple class with a name and a real vector
-     * should be written:
-     * <pre><code>
-     * public class NamedVector implements Serializable {
-     *
-     *     private final String name;
-     *     private final transient RealVector coefficients;
-     *
-     *     // omitted constructors, getters ...
-     *
-     *     private void writeObject(ObjectOutputStream oos) throws IOException {
-     *         oos.defaultWriteObject();  // takes care of name field
-     *         MatrixUtils.serializeRealVector(coefficients, oos);
-     *     }
-     *
-     *     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
-     *         ois.defaultReadObject();  // takes care of name field
-     *         MatrixUtils.deserializeRealVector(this, "coefficients", ois);
-     *     }
-     *
-     * }
-     * </code></pre>
-     * </p>
-     *
-     * @param vector real vector to serialize
-     * @param oos stream where the real vector should be written
-     * @exception IOException if object cannot be written to stream
-     * @see #deserializeRealVector(Object, String, ObjectInputStream)
-     */
-    public static void serializeRealVector(final RealVector vector,
-                                           final ObjectOutputStream oos)
-        throws IOException {
-        final int n = vector.getDimension();
-        oos.writeInt(n);
-        for (int i = 0; i < n; ++i) {
-            oos.writeDouble(vector.getEntry(i));
-        }
-    }
-
-    /** Deserialize  a {@link RealVector} field in a class.
-     * <p>
-     * This method is intended to be called from within a private
-     * <code>readObject</code> method (after a call to
-     * <code>ois.defaultReadObject()</code>) in a class that has a
-     * {@link RealVector} field, which should be declared <code>transient</code>.
-     * This way, the default handling does not deserialize the vector (the {@link
-     * RealVector} interface is not serializable by default) but this method does
-     * deserialize it specifically.
-     * </p>
-     * @param instance instance in which the field must be set up
-     * @param fieldName name of the field within the class (may be private and final)
-     * @param ois stream from which the real vector should be read
-     * @exception ClassNotFoundException if a class in the stream cannot be found
-     * @exception IOException if object cannot be read from the stream
-     * @see #serializeRealVector(RealVector, ObjectOutputStream)
-     */
-    public static void deserializeRealVector(final Object instance,
-                                             final String fieldName,
-                                             final ObjectInputStream ois)
-      throws ClassNotFoundException, IOException {
-        try {
-
-            // read the vector data
-            final int n = ois.readInt();
-            final double[] data = new double[n];
-            for (int i = 0; i < n; ++i) {
-                data[i] = ois.readDouble();
-            }
-
-            // create the instance
-            final RealVector vector = new ArrayRealVector(data, false);
-
-            // set up the field
-            final java.lang.reflect.Field f =
-                instance.getClass().getDeclaredField(fieldName);
-            f.setAccessible(true);
-            f.set(instance, vector);
-
-        } catch (NoSuchFieldException nsfe) {
-            IOException ioe = new IOException();
-            ioe.initCause(nsfe);
-            throw ioe;
-        } catch (IllegalAccessException iae) {
-            IOException ioe = new IOException();
-            ioe.initCause(iae);
-            throw ioe;
-        }
-
-    }
-
-    /** Serialize a {@link RealMatrix}.
-     * <p>
-     * This method is intended to be called from within a private
-     * <code>writeObject</code> method (after a call to
-     * <code>oos.defaultWriteObject()</code>) in a class that has a
-     * {@link RealMatrix} field, which should be declared <code>transient</code>.
-     * This way, the default handling does not serialize the matrix (the {@link
-     * RealMatrix} interface is not serializable by default) but this method does
-     * serialize it specifically.
-     * </p>
-     * <p>
-     * The following example shows how a simple class with a name and a real matrix
-     * should be written:
-     * <pre><code>
-     * public class NamedMatrix implements Serializable {
-     *
-     *     private final String name;
-     *     private final transient RealMatrix coefficients;
-     *
-     *     // omitted constructors, getters ...
-     *
-     *     private void writeObject(ObjectOutputStream oos) throws IOException {
-     *         oos.defaultWriteObject();  // takes care of name field
-     *         MatrixUtils.serializeRealMatrix(coefficients, oos);
-     *     }
-     *
-     *     private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
-     *         ois.defaultReadObject();  // takes care of name field
-     *         MatrixUtils.deserializeRealMatrix(this, "coefficients", ois);
-     *     }
-     *
-     * }
-     * </code></pre>
-     * </p>
-     *
-     * @param matrix real matrix to serialize
-     * @param oos stream where the real matrix should be written
-     * @exception IOException if object cannot be written to stream
-     * @see #deserializeRealMatrix(Object, String, ObjectInputStream)
-     */
-    public static void serializeRealMatrix(final RealMatrix matrix,
-                                           final ObjectOutputStream oos)
-        throws IOException {
-        final int n = matrix.getRowDimension();
-        final int m = matrix.getColumnDimension();
-        oos.writeInt(n);
-        oos.writeInt(m);
-        for (int i = 0; i < n; ++i) {
-            for (int j = 0; j < m; ++j) {
-                oos.writeDouble(matrix.getEntry(i, j));
-            }
-        }
-    }
-
-    /** Deserialize  a {@link RealMatrix} field in a class.
-     * <p>
-     * This method is intended to be called from within a private
-     * <code>readObject</code> method (after a call to
-     * <code>ois.defaultReadObject()</code>) in a class that has a
-     * {@link RealMatrix} field, which should be declared <code>transient</code>.
-     * This way, the default handling does not deserialize the matrix (the {@link
-     * RealMatrix} interface is not serializable by default) but this method does
-     * deserialize it specifically.
-     * </p>
-     * @param instance instance in which the field must be set up
-     * @param fieldName name of the field within the class (may be private and final)
-     * @param ois stream from which the real matrix should be read
-     * @exception ClassNotFoundException if a class in the stream cannot be found
-     * @exception IOException if object cannot be read from the stream
-     * @see #serializeRealMatrix(RealMatrix, ObjectOutputStream)
-     */
-    public static void deserializeRealMatrix(final Object instance,
-                                             final String fieldName,
-                                             final ObjectInputStream ois)
-      throws ClassNotFoundException, IOException {
-        try {
-
-            // read the matrix data
-            final int n = ois.readInt();
-            final int m = ois.readInt();
-            final double[][] data = new double[n][m];
-            for (int i = 0; i < n; ++i) {
-                final double[] dataI = data[i];
-                for (int j = 0; j < m; ++j) {
-                    dataI[j] = ois.readDouble();
-                }
-            }
-
-            // create the instance
-            final RealMatrix matrix = new Array2DRowRealMatrix(data, false);
-
-            // set up the field
-            final java.lang.reflect.Field f =
-                instance.getClass().getDeclaredField(fieldName);
-            f.setAccessible(true);
-            f.set(instance, matrix);
-
-        } catch (NoSuchFieldException nsfe) {
-            IOException ioe = new IOException();
-            ioe.initCause(nsfe);
-            throw ioe;
-        } catch (IllegalAccessException iae) {
-            IOException ioe = new IOException();
-            ioe.initCause(iae);
-            throw ioe;
-        }
-    }
-
-    /**Solve  a  system of composed of a Lower Triangular Matrix
-     * {@link RealMatrix}.
-     * <p>
-     * This method is called to solve systems of equations which are
-     * of the lower triangular form. The matrix {@link RealMatrix}
-     * is assumed, though not checked, to be in lower triangular form.
-     * The vector {@link RealVector} is overwritten with the solution.
-     * The matrix is checked that it is square and its dimensions match
-     * the length of the vector.
-     * </p>
-     * @param rm RealMatrix which is lower triangular
-     * @param b  RealVector this is overwritten
-     * @throws DimensionMismatchException if the matrix and vector are not
-     * conformable
-     * @throws NonSquareMatrixException if the matrix {@code rm} is not square
-     * @throws MathArithmeticException if the absolute value of one of the diagonal
-     * coefficient of {@code rm} is lower than {@link Precision#SAFE_MIN}
-     */
-    public static void solveLowerTriangularSystem(RealMatrix rm, RealVector b)
-        throws DimensionMismatchException, MathArithmeticException,
-        NonSquareMatrixException {
-        if ((rm == null) || (b == null) || ( rm.getRowDimension() != b.getDimension())) {
-            throw new DimensionMismatchException(
-                    (rm == null) ? 0 : rm.getRowDimension(),
-                    (b == null) ? 0 : b.getDimension());
-        }
-        if( rm.getColumnDimension() != rm.getRowDimension() ){
-            throw new NonSquareMatrixException(rm.getRowDimension(),
-                                               rm.getColumnDimension());
-        }
-        int rows = rm.getRowDimension();
-        for( int i = 0 ; i < rows ; i++ ){
-            double diag = rm.getEntry(i, i);
-            if( FastMath.abs(diag) < Precision.SAFE_MIN ){
-                throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
-            }
-            double bi = b.getEntry(i)/diag;
-            b.setEntry(i,  bi );
-            for( int j = i+1; j< rows; j++ ){
-                b.setEntry(j, b.getEntry(j)-bi*rm.getEntry(j,i)  );
-            }
-        }
-    }
-
-    /** Solver a  system composed  of an Upper Triangular Matrix
-     * {@link RealMatrix}.
-     * <p>
-     * This method is called to solve systems of equations which are
-     * of the lower triangular form. The matrix {@link RealMatrix}
-     * is assumed, though not checked, to be in upper triangular form.
-     * The vector {@link RealVector} is overwritten with the solution.
-     * The matrix is checked that it is square and its dimensions match
-     * the length of the vector.
-     * </p>
-     * @param rm RealMatrix which is upper triangular
-     * @param b  RealVector this is overwritten
-     * @throws DimensionMismatchException if the matrix and vector are not
-     * conformable
-     * @throws NonSquareMatrixException if the matrix {@code rm} is not
-     * square
-     * @throws MathArithmeticException if the absolute value of one of the diagonal
-     * coefficient of {@code rm} is lower than {@link Precision#SAFE_MIN}
-     */
-    public static void solveUpperTriangularSystem(RealMatrix rm, RealVector b)
-        throws DimensionMismatchException, MathArithmeticException,
-        NonSquareMatrixException {
-        if ((rm == null) || (b == null) || ( rm.getRowDimension() != b.getDimension())) {
-            throw new DimensionMismatchException(
-                    (rm == null) ? 0 : rm.getRowDimension(),
-                    (b == null) ? 0 : b.getDimension());
-        }
-        if( rm.getColumnDimension() != rm.getRowDimension() ){
-            throw new NonSquareMatrixException(rm.getRowDimension(),
-                                               rm.getColumnDimension());
-        }
-        int rows = rm.getRowDimension();
-        for( int i = rows-1 ; i >-1 ; i-- ){
-            double diag = rm.getEntry(i, i);
-            if( FastMath.abs(diag) < Precision.SAFE_MIN ){
-                throw new MathArithmeticException(LocalizedFormats.ZERO_DENOMINATOR);
-            }
-            double bi = b.getEntry(i)/diag;
-            b.setEntry(i,  bi );
-            for( int j = i-1; j>-1; j-- ){
-                b.setEntry(j, b.getEntry(j)-bi*rm.getEntry(j,i)  );
-            }
-        }
-    }
-
-    /**
-     * Computes the inverse of the given matrix by splitting it into
-     * 4 sub-matrices.
-     *
-     * @param m Matrix whose inverse must be computed.
-     * @param splitIndex Index that determines the "split" line and
-     * column.
-     * The element corresponding to this index will part of the
-     * upper-left sub-matrix.
-     * @return the inverse of {@code m}.
-     * @throws NonSquareMatrixException if {@code m} is not square.
-     */
-    public static RealMatrix blockInverse(RealMatrix m,
-                                          int splitIndex) {
-        final int n = m.getRowDimension();
-        if (m.getColumnDimension() != n) {
-            throw new NonSquareMatrixException(m.getRowDimension(),
-                                               m.getColumnDimension());
-        }
-
-        final int splitIndex1 = splitIndex + 1;
-
-        final RealMatrix a = m.getSubMatrix(0, splitIndex, 0, splitIndex);
-        final RealMatrix b = m.getSubMatrix(0, splitIndex, splitIndex1, n - 1);
-        final RealMatrix c = m.getSubMatrix(splitIndex1, n - 1, 0, splitIndex);
-        final RealMatrix d = m.getSubMatrix(splitIndex1, n - 1, splitIndex1, n - 1);
-
-        final SingularValueDecomposition aDec = new SingularValueDecomposition(a);
-        final DecompositionSolver aSolver = aDec.getSolver();
-        if (!aSolver.isNonSingular()) {
-            throw new SingularMatrixException();
-        }
-        final RealMatrix aInv = aSolver.getInverse();
-
-        final SingularValueDecomposition dDec = new SingularValueDecomposition(d);
-        final DecompositionSolver dSolver = dDec.getSolver();
-        if (!dSolver.isNonSingular()) {
-            throw new SingularMatrixException();
-        }
-        final RealMatrix dInv = dSolver.getInverse();
-
-        final RealMatrix tmp1 = a.subtract(b.multiply(dInv).multiply(c));
-        final SingularValueDecomposition tmp1Dec = new SingularValueDecomposition(tmp1);
-        final DecompositionSolver tmp1Solver = tmp1Dec.getSolver();
-        if (!tmp1Solver.isNonSingular()) {
-            throw new SingularMatrixException();
-        }
-        final RealMatrix result00 = tmp1Solver.getInverse();
-
-        final RealMatrix tmp2 = d.subtract(c.multiply(aInv).multiply(b));
-        final SingularValueDecomposition tmp2Dec = new SingularValueDecomposition(tmp2);
-        final DecompositionSolver tmp2Solver = tmp2Dec.getSolver();
-        if (!tmp2Solver.isNonSingular()) {
-            throw new SingularMatrixException();
-        }
-        final RealMatrix result11 = tmp2Solver.getInverse();
-
-        final RealMatrix result01 = aInv.multiply(b).multiply(result11).scalarMultiply(-1);
-        final RealMatrix result10 = dInv.multiply(c).multiply(result00).scalarMultiply(-1);
-
-        final RealMatrix result = new Array2DRowRealMatrix(n, n);
-        result.setSubMatrix(result00.getData(), 0, 0);
-        result.setSubMatrix(result01.getData(), 0, splitIndex1);
-        result.setSubMatrix(result10.getData(), splitIndex1, 0);
-        result.setSubMatrix(result11.getData(), splitIndex1, splitIndex1);
-
-        return result;
-    }
-
-    /**
-     * Computes the inverse of the given matrix.
-     * <p>
-     * By default, the inverse of the matrix is computed using the QR-decomposition,
-     * unless a more efficient method can be determined for the input matrix.
-     * <p>
-     * Note: this method will use a singularity threshold of 0,
-     * use {@link #inverse(RealMatrix, double)} if a different threshold is needed.
-     *
-     * @param matrix Matrix whose inverse shall be computed
-     * @return the inverse of {@code matrix}
-     * @throws NullArgumentException if {@code matrix} is {@code null}
-     * @throws SingularMatrixException if m is singular
-     * @throws NonSquareMatrixException if matrix is not square
-     * @since 3.3
-     */
-    public static RealMatrix inverse(RealMatrix matrix)
-            throws NullArgumentException, SingularMatrixException, NonSquareMatrixException {
-        return inverse(matrix, 0);
-    }
-
-    /**
-     * Computes the inverse of the given matrix.
-     * <p>
-     * By default, the inverse of the matrix is computed using the QR-decomposition,
-     * unless a more efficient method can be determined for the input matrix.
-     *
-     * @param matrix Matrix whose inverse shall be computed
-     * @param threshold Singularity threshold
-     * @return the inverse of {@code m}
-     * @throws NullArgumentException if {@code matrix} is {@code null}
-     * @throws SingularMatrixException if matrix is singular
-     * @throws NonSquareMatrixException if matrix is not square
-     * @since 3.3
-     */
-    public static RealMatrix inverse(RealMatrix matrix, double threshold)
-            throws NullArgumentException, SingularMatrixException, NonSquareMatrixException {
-
-        MathUtils.checkNotNull(matrix);
-
-        if (!matrix.isSquare()) {
-            throw new NonSquareMatrixException(matrix.getRowDimension(),
-                                               matrix.getColumnDimension());
-        }
-
-        if (matrix instanceof DiagonalMatrix) {
-            return ((DiagonalMatrix) matrix).inverse(threshold);
-        } else {
-            QRDecomposition decomposition = new QRDecomposition(matrix, threshold);
-            return decomposition.getSolver().getInverse();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteMatrixException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteMatrixException.java b/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteMatrixException.java
deleted file mode 100644
index a0fbf17..0000000
--- a/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteMatrixException.java
+++ /dev/null
@@ -1,73 +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.linear;
-
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.util.ExceptionContext;
-
-/**
- * Exception to be thrown when a positive definite matrix is expected.
- *
- * @since 3.0
- */
-public class NonPositiveDefiniteMatrixException extends NumberIsTooSmallException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 1641613838113738061L;
-    /** Index (diagonal element). */
-    private final int index;
-    /** Threshold. */
-    private final double threshold;
-
-    /**
-     * Construct an exception.
-     *
-     * @param wrong Value that fails the positivity check.
-     * @param index Row (and column) index.
-     * @param threshold Absolute positivity threshold.
-     */
-    public NonPositiveDefiniteMatrixException(double wrong,
-                                              int index,
-                                              double threshold) {
-        super(wrong, threshold, false);
-        this.index = index;
-        this.threshold = threshold;
-
-        final ExceptionContext context = getContext();
-        context.addMessage(LocalizedFormats.NOT_POSITIVE_DEFINITE_MATRIX);
-        context.addMessage(LocalizedFormats.ARRAY_ELEMENT, wrong, index);
-    }
-
-    /**
-     * @return the row index.
-     */
-    public int getRow() {
-        return index;
-    }
-    /**
-     * @return the column index.
-     */
-    public int getColumn() {
-        return index;
-    }
-    /**
-     * @return the absolute positivity threshold.
-     */
-    public double getThreshold() {
-        return threshold;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteOperatorException.java b/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteOperatorException.java
deleted file mode 100644
index f322218..0000000
--- a/src/main/java/org/apache/commons/math3/linear/NonPositiveDefiniteOperatorException.java
+++ /dev/null
@@ -1,43 +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.linear;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Exception to be thrown when a symmetric, definite positive
- * {@link RealLinearOperator} is expected.
- * Since the coefficients of the matrix are not accessible, the most
- * general definition is used to check that {@code A} is not positive
- * definite, i.e.  there exists {@code x} such that {@code x' A x <= 0}.
- * In the terminology of this exception, {@code A} is the "offending"
- * linear operator and {@code x} the "offending" vector.
- *
- * @since 3.0
- */
-public class NonPositiveDefiniteOperatorException
-    extends MathIllegalArgumentException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = 917034489420549847L;
-
-    /** Creates a new instance of this class. */
-    public NonPositiveDefiniteOperatorException() {
-        super(LocalizedFormats.NON_POSITIVE_DEFINITE_OPERATOR);
-    }
-}


[66/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java
index 5f2b95a..8ab7b0f 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FirstMoment.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Computes the first moment (arithmetic mean).  Uses the definitional formula:

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FourthMoment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FourthMoment.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FourthMoment.java
index cf9d8ef..d7d07df 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FourthMoment.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/FourthMoment.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Computes a statistic related to the Fourth Central Moment.  Specifically,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java
index bfee9df..41c58b9 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMean.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfLogs;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfLogs;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Returns the <a href="http://www.xycoon.com/geometric_mean.htm">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java
index be04fbe..4970058 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Kurtosis.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java
index aac3d78..94c58a2 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Mean.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.WeightedEvaluation;
-import org.apache.commons.math3.stat.descriptive.summary.Sum;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.WeightedEvaluation;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>Computes the arithmetic mean of a set of values. Uses the definitional

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SecondMoment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SecondMoment.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SecondMoment.java
index 12715c0..e617ada 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SecondMoment.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SecondMoment.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Computes a statistic related to the Second Central Moment.  Specifically,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SemiVariance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SemiVariance.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SemiVariance.java
index 563119a..10c8659 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SemiVariance.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/SemiVariance.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractUnivariateStatistic;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractUnivariateStatistic;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>Computes the semivariance of a set of values with respect to a given cutoff value.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java
index 9ecb0dd..db3d9f4 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Skewness.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Computes the skewness of the available values.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java
index a6248c5..5847b13 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/StandardDeviation.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Computes the sample standard deviation.  The standard deviation

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMoment.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMoment.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMoment.java
index 2c5331d..ba74055 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMoment.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/ThirdMoment.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathUtils;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java
index 1ba48e9..b1cf852 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/Variance.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.WeightedEvaluation;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.WeightedEvaluation;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Computes the variance of the available values.  By default, the unbiased

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovariance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovariance.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovariance.java
index 7f6f903..cf27522 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovariance.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialCovariance.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  * Returns the covariance matrix of the available vectors.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMean.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMean.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMean.java
index e06b3bc..cdc5a26 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMean.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/VectorialMean.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /**
  * Returns the arithmetic mean of the available vectors.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/moment/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/package-info.java b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/package-info.java
index e23ead7..48d3ef1 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/moment/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/moment/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Summary statistics based on moments.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/package-info.java b/src/main/java/org/apache/commons/math4/stat/descriptive/package-info.java
index 92fa5b3..dd73f99 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/package-info.java
@@ -41,4 +41,4 @@
  *        </code>
  *
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java
index 75f145f..e76e68a 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Max.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Returns the maximum of the available values.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Median.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Median.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Median.java
index 6350a0b..4aa10bf 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Median.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Median.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
-import org.apache.commons.math3.util.KthSelector;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.util.KthSelector;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java
index c87e6f1..a0ddf86 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Min.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Returns the minimum of the available values.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
index 3c82195..79df284 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/PSquarePercentile.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -26,18 +26,18 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.interpolation.LinearInterpolator;
-import org.apache.commons.math3.analysis.interpolation.NevilleInterpolator;
-import org.apache.commons.math3.analysis.interpolation.UnivariateInterpolator;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.LinearInterpolator;
+import org.apache.commons.math4.analysis.interpolation.NevilleInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * A {@link StorelessUnivariateStatistic} estimating percentiles using the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
index 69628f2..499123d 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/Percentile.java
@@ -14,26 +14,26 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;
 
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.BitSet;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.AbstractUnivariateStatistic;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.KthSelector;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.MedianOf3PivotingStrategy;
-import org.apache.commons.math3.util.PivotingStrategyInterface;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.AbstractUnivariateStatistic;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.KthSelector;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.MedianOf3PivotingStrategy;
+import org.apache.commons.math4.util.PivotingStrategyInterface;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Provides percentile computation.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/rank/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/package-info.java b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/package-info.java
index da37b37..3d8d99a 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/rank/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/rank/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Summary statistics based on ranks.
  */
-package org.apache.commons.math3.stat.descriptive.rank;
+package org.apache.commons.math4.stat.descriptive.rank;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java
index 7d313a5..dfbf613 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Product.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.WeightedEvaluation;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.WeightedEvaluation;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Returns the product of the available values.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java
index e12b6a1..6205d2a 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/Sum.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.MathUtils;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java
index 19718af..57f725c 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfLogs.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Returns the sum of the natural logs for this collection of values.
  * <p>
- * Uses {@link org.apache.commons.math3.util.FastMath#log(double)} to compute the logs.
+ * Uses {@link org.apache.commons.math4.util.FastMath#log(double)} to compute the logs.
  * Therefore,
  * <ul>
  * <li>If any of values are &lt; 0, the result is <code>NaN.</code></li>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java
index 161d8c8..68c589b 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/SumOfSquares.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.AbstractStorelessUnivariateStatistic;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.descriptive.AbstractStorelessUnivariateStatistic;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Returns the sum of the squares of the available values.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/summary/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/package-info.java b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/package-info.java
index 2f07145..28e7c76 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/summary/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/summary/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Other summary statistics.
  */
-package org.apache.commons.math3.stat.descriptive.summary;
+package org.apache.commons.math4.stat.descriptive.summary;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/AlternativeHypothesis.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/AlternativeHypothesis.java b/src/main/java/org/apache/commons/math4/stat/inference/AlternativeHypothesis.java
index 527067e..3fb170d 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/AlternativeHypothesis.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/AlternativeHypothesis.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
 /**
  * Represents an alternative hypothesis for a hypothesis test.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/BinomialTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/BinomialTest.java b/src/main/java/org/apache/commons/math4/stat/inference/BinomialTest.java
index 2efe091..7b6ca26 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/BinomialTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/BinomialTest.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
-import org.apache.commons.math3.distribution.BinomialDistribution;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.distribution.BinomialDistribution;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Implements binomial test statistics.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/ChiSquareTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/ChiSquareTest.java b/src/main/java/org/apache/commons/math4/stat/inference/ChiSquareTest.java
index 7e97ac1..fead59e 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/ChiSquareTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/ChiSquareTest.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
-
-import org.apache.commons.math3.distribution.ChiSquaredDistribution;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+package org.apache.commons.math4.stat.inference;
+
+import org.apache.commons.math4.distribution.ChiSquaredDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Implements Chi-Square test statistics.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/GTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/GTest.java b/src/main/java/org/apache/commons/math4/stat/inference/GTest.java
index de1fbe3..2495804 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/GTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/GTest.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
-import org.apache.commons.math3.distribution.ChiSquaredDistribution;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.distribution.ChiSquaredDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Implements <a href="http://en.wikipedia.org/wiki/G-test">G Test</a>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
index 131d0c6..fbea82f 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.java
@@ -15,35 +15,35 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
 import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.Iterator;
 
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.TooManyIterationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.fraction.BigFractionField;
-import org.apache.commons.math3.fraction.FractionConversionException;
-import org.apache.commons.math3.linear.Array2DRowFieldMatrix;
-import org.apache.commons.math3.linear.FieldMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-
-import static org.apache.commons.math3.util.MathUtils.PI_SQUARED;
-import static org.apache.commons.math3.util.FastMath.PI;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.TooManyIterationsException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.fraction.BigFractionField;
+import org.apache.commons.math4.fraction.FractionConversionException;
+import org.apache.commons.math4.linear.Array2DRowFieldMatrix;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+
+import static org.apache.commons.math4.util.FastMath.PI;
+import static org.apache.commons.math4.util.MathUtils.PI_SQUARED;
 
 /**
  * Implementation of the <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test">
@@ -358,13 +358,13 @@ public class KolmogorovSmirnovTest {
      * Calculates \(P(D_n < d)\) using the method described in [1] with quick decisions for extreme
      * values given in [2] (see above). The result is not exact as with
      * {@link #cdfExact(double, int)} because calculations are based on
-     * {@code double} rather than {@link org.apache.commons.math3.fraction.BigFraction}.
+     * {@code double} rather than {@link org.apache.commons.math4.fraction.BigFraction}.
      *
      * @param d statistic
      * @param n sample size
      * @return \(P(D_n < d)\)
      * @throws MathArithmeticException if algorithm fails to convert {@code h} to a
-     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k
+     *         {@link org.apache.commons.math4.fraction.BigFraction} in expressing {@code d} as \((k
      *         - h) / m\) for integer {@code k, m} and \(0 \le h < 1\)
      */
     public double cdf(double d, int n)
@@ -383,7 +383,7 @@ public class KolmogorovSmirnovTest {
      * @param n sample size
      * @return \(P(D_n < d)\)
      * @throws MathArithmeticException if the algorithm fails to convert {@code h} to a
-     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k
+     *         {@link org.apache.commons.math4.fraction.BigFraction} in expressing {@code d} as \((k
      *         - h) / m\) for integer {@code k, m} and \(0 \le h < 1\)
      */
     public double cdfExact(double d, int n)
@@ -398,13 +398,13 @@ public class KolmogorovSmirnovTest {
      * @param d statistic
      * @param n sample size
      * @param exact whether the probability should be calculated exact using
-     *        {@link org.apache.commons.math3.fraction.BigFraction} everywhere at the expense of
+     *        {@link org.apache.commons.math4.fraction.BigFraction} everywhere at the expense of
      *        very slow execution time, or if {@code double} should be used convenient places to
      *        gain speed. Almost never choose {@code true} in real applications unless you are very
      *        sure; {@code true} is almost solely for verification purposes.
      * @return \(P(D_n < d)\)
      * @throws MathArithmeticException if algorithm fails to convert {@code h} to a
-     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k
+     *         {@link org.apache.commons.math4.fraction.BigFraction} in expressing {@code d} as \((k
      *         - h) / m\) for integer {@code k, m} and \(0 \le h < 1\).
      */
     public double cdf(double d, int n, boolean exact)
@@ -439,14 +439,14 @@ public class KolmogorovSmirnovTest {
 
     /**
      * Calculates the exact value of {@code P(D_n < d)} using the method described in [1] (reference
-     * in class javadoc above) and {@link org.apache.commons.math3.fraction.BigFraction} (see
+     * in class javadoc above) and {@link org.apache.commons.math4.fraction.BigFraction} (see
      * above).
      *
      * @param d statistic
      * @param n sample size
      * @return the two-sided probability of \(P(D_n < d)\)
      * @throws MathArithmeticException if algorithm fails to convert {@code h} to a
-     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k
+     *         {@link org.apache.commons.math4.fraction.BigFraction} in expressing {@code d} as \((k
      *         - h) / m\) for integer {@code k, m} and \(0 \le h < 1\).
      */
     private double exactK(double d, int n)
@@ -642,7 +642,7 @@ public class KolmogorovSmirnovTest {
      * @return H matrix
      * @throws NumberIsTooLargeException if fractional part is greater than 1
      * @throws FractionConversionException if algorithm fails to convert {@code h} to a
-     *         {@link org.apache.commons.math3.fraction.BigFraction} in expressing {@code d} as \((k
+     *         {@link org.apache.commons.math4.fraction.BigFraction} in expressing {@code d} as \((k
      *         - h) / m\) for integer {@code k, m} and \(0 <= h < 1\).
      */
     private FieldMatrix<BigFraction> createExactH(double d, int n)

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/MannWhitneyUTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/MannWhitneyUTest.java b/src/main/java/org/apache/commons/math4/stat/inference/MannWhitneyUTest.java
index 82fddb3..3fa34a3 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/MannWhitneyUTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/MannWhitneyUTest.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
-
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
-import org.apache.commons.math3.stat.ranking.NaturalRanking;
-import org.apache.commons.math3.stat.ranking.TiesStrategy;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.stat.inference;
+
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.stat.ranking.NaturalRanking;
+import org.apache.commons.math4.stat.ranking.TiesStrategy;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * An implementation of the Mann-Whitney U test (also called Wilcoxon rank-sum test).

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java b/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java
index d0c5fc1..90f4e96 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/OneWayAnova.java
@@ -14,20 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
-import org.apache.commons.math3.distribution.FDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.distribution.FDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implements one-way ANOVA (analysis of variance) statistics.
@@ -35,9 +35,9 @@ import org.apache.commons.math3.util.MathUtils;
  * <p> Tests for differences between two or more categories of univariate data
  * (for example, the body mass index of accountants, lawyers, doctors and
  * computer programmers).  When two categories are given, this is equivalent to
- * the {@link org.apache.commons.math3.stat.inference.TTest}.
+ * the {@link org.apache.commons.math4.stat.inference.TTest}.
  * </p><p>
- * Uses the {@link org.apache.commons.math3.distribution.FDistribution
+ * Uses the {@link org.apache.commons.math4.distribution.FDistribution
  * commons-math F Distribution implementation} to estimate exact p-values.</p>
  * <p>This implementation is based on a description at
  * http://faculty.vassar.edu/lowry/ch13pt1.html</p>
@@ -103,7 +103,7 @@ public class OneWayAnova {
      * <code>categoryData</code> collection and each of these arrays must
      * contain at least two values.</li></ul></p><p>
      * This implementation uses the
-     * {@link org.apache.commons.math3.distribution.FDistribution
+     * {@link org.apache.commons.math4.distribution.FDistribution
      * commons-math F Distribution implementation} to estimate the exact
      * p-value, using the formula<pre>
      *   p = 1 - cumulativeProbability(F)</pre>
@@ -142,7 +142,7 @@ public class OneWayAnova {
      * <code>categoryData</code> collection and each of these statistics must
      * contain at least two values.</li></ul></p><p>
      * This implementation uses the
-     * {@link org.apache.commons.math3.distribution.FDistribution
+     * {@link org.apache.commons.math4.distribution.FDistribution
      * commons-math F Distribution implementation} to estimate the exact
      * p-value, using the formula<pre>
      *   p = 1 - cumulativeProbability(F)</pre>
@@ -223,7 +223,7 @@ public class OneWayAnova {
      * <li>alpha must be strictly greater than 0 and less than or equal to 0.5.
      * </li></ul></p><p>
      * This implementation uses the
-     * {@link org.apache.commons.math3.distribution.FDistribution
+     * {@link org.apache.commons.math4.distribution.FDistribution
      * commons-math F Distribution implementation} to estimate the exact
      * p-value, using the formula<pre>
      *   p = 1 - cumulativeProbability(F)</pre>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/TTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/TTest.java b/src/main/java/org/apache/commons/math4/stat/inference/TTest.java
index b0f76f6..2168099 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/TTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/TTest.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
-
-import org.apache.commons.math3.distribution.TDistribution;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.StatUtils;
-import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.stat.inference;
+
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.StatUtils;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * An implementation for Student's t-tests.
@@ -51,7 +51,7 @@ import org.apache.commons.math3.util.FastMath;
  * <p>
  * Input to tests can be either <code>double[]</code> arrays or
  * {@link StatisticalSummary} instances.</p><p>
- * Uses commons-math {@link org.apache.commons.math3.distribution.TDistribution}
+ * Uses commons-math {@link org.apache.commons.math4.distribution.TDistribution}
  * implementation to estimate exact p-values.</p>
  *
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java b/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java
index a92fb19..a2bcb3f 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/TestUtils.java
@@ -14,23 +14,23 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
 
 /**
  * A collection of static methods to create inference test instances or to
@@ -65,7 +65,7 @@ public class TestUtils  {
     // CHECKSTYLE: stop JavadocMethodCheck
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#homoscedasticT(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticT(double[], double[])
      */
     public static double homoscedasticT(final double[] sample1, final double[] sample2)
         throws NullArgumentException, NumberIsTooSmallException {
@@ -73,7 +73,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#homoscedasticT(org.apache.commons.math3.stat.descriptive.StatisticalSummary, org.apache.commons.math3.stat.descriptive.StatisticalSummary)
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticT(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
      */
     public static double homoscedasticT(final StatisticalSummary sampleStats1,
                                         final StatisticalSummary sampleStats2)
@@ -82,7 +82,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#homoscedasticTTest(double[], double[], double)
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(double[], double[], double)
      */
     public static boolean homoscedasticTTest(final double[] sample1, final double[] sample2,
                                              final double alpha)
@@ -92,7 +92,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#homoscedasticTTest(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(double[], double[])
      */
     public static double homoscedasticTTest(final double[] sample1, final double[] sample2)
         throws NullArgumentException, NumberIsTooSmallException, MaxCountExceededException {
@@ -100,7 +100,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#homoscedasticTTest(org.apache.commons.math3.stat.descriptive.StatisticalSummary, org.apache.commons.math3.stat.descriptive.StatisticalSummary)
+     * @see org.apache.commons.math4.stat.inference.TTest#homoscedasticTTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
      */
     public static double homoscedasticTTest(final StatisticalSummary sampleStats1,
                                             final StatisticalSummary sampleStats2)
@@ -109,7 +109,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#pairedT(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#pairedT(double[], double[])
      */
     public static double pairedT(final double[] sample1, final double[] sample2)
         throws NullArgumentException, NoDataException,
@@ -118,7 +118,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#pairedTTest(double[], double[], double)
+     * @see org.apache.commons.math4.stat.inference.TTest#pairedTTest(double[], double[], double)
      */
     public static boolean pairedTTest(final double[] sample1, final double[] sample2,
                                       final double alpha)
@@ -128,7 +128,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#pairedTTest(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#pairedTTest(double[], double[])
      */
     public static double pairedTTest(final double[] sample1, final double[] sample2)
         throws NullArgumentException, NoDataException, DimensionMismatchException,
@@ -137,7 +137,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#t(double, double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#t(double, double[])
      */
     public static double t(final double mu, final double[] observed)
         throws NullArgumentException, NumberIsTooSmallException {
@@ -145,7 +145,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#t(double, org.apache.commons.math3.stat.descriptive.StatisticalSummary)
+     * @see org.apache.commons.math4.stat.inference.TTest#t(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
      */
     public static double t(final double mu, final StatisticalSummary sampleStats)
         throws NullArgumentException, NumberIsTooSmallException {
@@ -153,7 +153,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#t(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#t(double[], double[])
      */
     public static double t(final double[] sample1, final double[] sample2)
         throws NullArgumentException, NumberIsTooSmallException {
@@ -161,7 +161,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#t(org.apache.commons.math3.stat.descriptive.StatisticalSummary, org.apache.commons.math3.stat.descriptive.StatisticalSummary)
+     * @see org.apache.commons.math4.stat.inference.TTest#t(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
      */
     public static double t(final StatisticalSummary sampleStats1,
                            final StatisticalSummary sampleStats2)
@@ -170,7 +170,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(double, double[], double)
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, double[], double)
      */
     public static boolean tTest(final double mu, final double[] sample, final double alpha)
         throws NullArgumentException, NumberIsTooSmallException,
@@ -179,7 +179,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(double, double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, double[])
      */
     public static double tTest(final double mu, final double[] sample)
         throws NullArgumentException, NumberIsTooSmallException,
@@ -188,7 +188,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(double, org.apache.commons.math3.stat.descriptive.StatisticalSummary, double)
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary, double)
      */
     public static boolean tTest(final double mu, final StatisticalSummary sampleStats,
                                 final double alpha)
@@ -198,7 +198,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(double, org.apache.commons.math3.stat.descriptive.StatisticalSummary)
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
      */
     public static double tTest(final double mu, final StatisticalSummary sampleStats)
         throws NullArgumentException, NumberIsTooSmallException,
@@ -207,7 +207,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(double[], double[], double)
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double[], double[], double)
      */
     public static boolean tTest(final double[] sample1, final double[] sample2,
                                 final double alpha)
@@ -217,7 +217,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(double[], double[])
      */
     public static double tTest(final double[] sample1, final double[] sample2)
         throws NullArgumentException, NumberIsTooSmallException,
@@ -226,7 +226,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(org.apache.commons.math3.stat.descriptive.StatisticalSummary, org.apache.commons.math3.stat.descriptive.StatisticalSummary, double)
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary, double)
      */
     public static boolean tTest(final StatisticalSummary sampleStats1,
                                 final StatisticalSummary sampleStats2,
@@ -237,7 +237,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.TTest#tTest(org.apache.commons.math3.stat.descriptive.StatisticalSummary, org.apache.commons.math3.stat.descriptive.StatisticalSummary)
+     * @see org.apache.commons.math4.stat.inference.TTest#tTest(org.apache.commons.math4.stat.descriptive.StatisticalSummary, org.apache.commons.math4.stat.descriptive.StatisticalSummary)
      */
     public static double tTest(final StatisticalSummary sampleStats1,
                                final StatisticalSummary sampleStats2)
@@ -247,7 +247,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquare(double[], long[])
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquare(double[], long[])
      */
     public static double chiSquare(final double[] expected, final long[] observed)
         throws NotPositiveException, NotStrictlyPositiveException,
@@ -256,7 +256,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquare(long[][])
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquare(long[][])
      */
     public static double chiSquare(final long[][] counts)
         throws NullArgumentException, NotPositiveException,
@@ -265,7 +265,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquareTest(double[], long[], double)
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(double[], long[], double)
      */
     public static boolean chiSquareTest(final double[] expected, final long[] observed,
                                         final double alpha)
@@ -275,7 +275,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquareTest(double[], long[])
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(double[], long[])
      */
     public static double chiSquareTest(final double[] expected, final long[] observed)
         throws NotPositiveException, NotStrictlyPositiveException,
@@ -284,7 +284,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquareTest(long[][], double)
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(long[][], double)
      */
     public static boolean chiSquareTest(final long[][] counts, final double alpha)
         throws NullArgumentException, DimensionMismatchException,
@@ -293,7 +293,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquareTest(long[][])
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTest(long[][])
      */
     public static double chiSquareTest(final long[][] counts)
         throws NullArgumentException, DimensionMismatchException,
@@ -302,7 +302,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquareDataSetsComparison(long[], long[])
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareDataSetsComparison(long[], long[])
      *
      * @since 1.2
      */
@@ -313,7 +313,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[])
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[])
      *
      * @since 1.2
      */
@@ -325,7 +325,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[], double)
+     * @see org.apache.commons.math4.stat.inference.ChiSquareTest#chiSquareTestDataSetsComparison(long[], long[], double)
      *
      * @since 1.2
      */
@@ -338,7 +338,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.OneWayAnova#anovaFValue(Collection)
+     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaFValue(Collection)
      *
      * @since 1.2
      */
@@ -348,7 +348,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.OneWayAnova#anovaPValue(Collection)
+     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaPValue(Collection)
      *
      * @since 1.2
      */
@@ -359,7 +359,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.OneWayAnova#anovaTest(Collection,double)
+     * @see org.apache.commons.math4.stat.inference.OneWayAnova#anovaTest(Collection,double)
      *
      * @since 1.2
      */
@@ -371,7 +371,7 @@ public class TestUtils  {
     }
 
      /**
-     * @see org.apache.commons.math3.stat.inference.GTest#g(double[], long[])
+     * @see org.apache.commons.math4.stat.inference.GTest#g(double[], long[])
      * @since 3.1
      */
     public static double g(final double[] expected, final long[] observed)
@@ -381,7 +381,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.GTest#gTest( double[],  long[] )
+     * @see org.apache.commons.math4.stat.inference.GTest#gTest( double[],  long[] )
      * @since 3.1
      */
     public static double gTest(final double[] expected, final long[] observed)
@@ -391,7 +391,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.GTest#gTestIntrinsic(double[], long[] )
+     * @see org.apache.commons.math4.stat.inference.GTest#gTestIntrinsic(double[], long[] )
      * @since 3.1
      */
     public static double gTestIntrinsic(final double[] expected, final long[] observed)
@@ -401,7 +401,7 @@ public class TestUtils  {
     }
 
      /**
-     * @see org.apache.commons.math3.stat.inference.GTest#gTest( double[],long[],double)
+     * @see org.apache.commons.math4.stat.inference.GTest#gTest( double[],long[],double)
      * @since 3.1
      */
     public static boolean gTest(final double[] expected, final long[] observed,
@@ -412,7 +412,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.GTest#gDataSetsComparison(long[], long[])
+     * @see org.apache.commons.math4.stat.inference.GTest#gDataSetsComparison(long[], long[])
      * @since 3.1
      */
     public static double gDataSetsComparison(final long[] observed1,
@@ -422,7 +422,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.GTest#rootLogLikelihoodRatio(long, long, long, long)
+     * @see org.apache.commons.math4.stat.inference.GTest#rootLogLikelihoodRatio(long, long, long, long)
      * @since 3.1
      */
     public static double rootLogLikelihoodRatio(final long k11, final long k12, final long k21, final long k22)
@@ -432,7 +432,7 @@ public class TestUtils  {
 
 
     /**
-     * @see org.apache.commons.math3.stat.inference.GTest#gTestDataSetsComparison(long[], long[])
+     * @see org.apache.commons.math4.stat.inference.GTest#gTestDataSetsComparison(long[], long[])
      * @since 3.1
      */
     public static double gTestDataSetsComparison(final long[] observed1,
@@ -443,7 +443,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.GTest#gTestDataSetsComparison(long[],long[],double)
+     * @see org.apache.commons.math4.stat.inference.GTest#gTestDataSetsComparison(long[],long[],double)
      * @since 3.1
      */
     public static boolean gTestDataSetsComparison(final long[] observed1,
@@ -455,7 +455,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(RealDistribution, double[])
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(RealDistribution, double[])
      * @since 3.3
      */
     public static double kolmogorovSmirnovStatistic(RealDistribution dist, double[] data)
@@ -464,7 +464,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[])
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[])
      * @since 3.3
      */
     public static double kolmogorovSmirnovTest(RealDistribution dist, double[] data)
@@ -473,7 +473,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], boolean)
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], boolean)
      * @since 3.3
      */
     public static double kolmogorovSmirnovTest(RealDistribution dist, double[] data, boolean strict)
@@ -482,7 +482,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], double)
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(RealDistribution, double[], double)
      * @since 3.3
      */
     public static boolean kolmogorovSmirnovTest(RealDistribution dist, double[] data, double alpha)
@@ -491,7 +491,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovStatistic(double[], double[])
      * @since 3.3
      */
     public static double kolmogorovSmirnovStatistic(double[] x, double[] y)
@@ -500,7 +500,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[])
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[])
      * @since 3.3
      */
     public static double kolmogorovSmirnovTest(double[] x, double[] y)
@@ -509,7 +509,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[], boolean)
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#kolmogorovSmirnovTest(double[], double[], boolean)
      * @since 3.3
      */
     public static double kolmogorovSmirnovTest(double[] x, double[] y, boolean strict)
@@ -518,7 +518,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#exactP(double, int, int, boolean)
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#exactP(double, int, int, boolean)
      * @since 3.3
      */
     public static double exactP(double d, int m, int n, boolean strict) {
@@ -526,7 +526,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#approximateP(double, int, int)
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#approximateP(double, int, int)
      * @since 3.3
      */
     public static double approximateP(double d, int n, int m) {
@@ -534,7 +534,7 @@ public class TestUtils  {
     }
 
     /**
-     * @see org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest#monteCarloP(double, int, int, boolean, int)
+     * @see org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest#monteCarloP(double, int, int, boolean, int)
      * @since 3.3
      */
     public static double monteCarloP(double d, int n, int m, boolean strict, int iterations) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTest.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTest.java b/src/main/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTest.java
index bd4d7e2..2bd303c 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTest.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTest.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.inference;
-
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
-import org.apache.commons.math3.stat.ranking.NaturalRanking;
-import org.apache.commons.math3.stat.ranking.TiesStrategy;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.stat.inference;
+
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.stat.ranking.NaturalRanking;
+import org.apache.commons.math4.stat.ranking.TiesStrategy;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * An implementation of the Wilcoxon signed-rank test.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/inference/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/inference/package-info.java b/src/main/java/org/apache/commons/math4/stat/inference/package-info.java
index a36a080..ed7b486 100644
--- a/src/main/java/org/apache/commons/math4/stat/inference/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/inference/package-info.java
@@ -19,4 +19,4 @@
  *      Classes providing hypothesis testing.
  *
  */
-package org.apache.commons.math3.stat.inference;
+package org.apache.commons.math4.stat.inference;


[03/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldLUDecomposition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldLUDecomposition.java b/src/main/java/org/apache/commons/math3/linear/FieldLUDecomposition.java
deleted file mode 100644
index 4aa80ed..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldLUDecomposition.java
+++ /dev/null
@@ -1,444 +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.linear;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * Calculates the LUP-decomposition of a square matrix.
- * <p>The LUP-decomposition of a matrix A consists of three matrices
- * L, U and P that satisfy: PA = LU, L is lower triangular, and U is
- * upper triangular and P is a permutation matrix. All matrices are
- * m&times;m.</p>
- * <p>Since {@link FieldElement field elements} do not provide an ordering
- * operator, the permutation matrix is computed here only in order to avoid
- * a zero pivot element, no attempt is done to get the largest pivot
- * element.</p>
- * <p>This class is based on the class with similar name from the
- * <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a> library.</p>
- * <ul>
- *   <li>a {@link #getP() getP} method has been added,</li>
- *   <li>the {@code det} method has been renamed as {@link #getDeterminant()
- *   getDeterminant},</li>
- *   <li>the {@code getDoublePivot} method has been removed (but the int based
- *   {@link #getPivot() getPivot} method has been kept),</li>
- *   <li>the {@code solve} and {@code isNonSingular} methods have been replaced
- *   by a {@link #getSolver() getSolver} method and the equivalent methods
- *   provided by the returned {@link DecompositionSolver}.</li>
- * </ul>
- *
- * @param <T> the type of the field elements
- * @see <a href="http://mathworld.wolfram.com/LUDecomposition.html">MathWorld</a>
- * @see <a href="http://en.wikipedia.org/wiki/LU_decomposition">Wikipedia</a>
- * @since 2.0 (changed to concrete class in 3.0)
- */
-public class FieldLUDecomposition<T extends FieldElement<T>> {
-
-    /** Field to which the elements belong. */
-    private final Field<T> field;
-
-    /** Entries of LU decomposition. */
-    private T[][] lu;
-
-    /** Pivot permutation associated with LU decomposition. */
-    private int[] pivot;
-
-    /** Parity of the permutation associated with the LU decomposition. */
-    private boolean even;
-
-    /** Singularity indicator. */
-    private boolean singular;
-
-    /** Cached value of L. */
-    private FieldMatrix<T> cachedL;
-
-    /** Cached value of U. */
-    private FieldMatrix<T> cachedU;
-
-    /** Cached value of P. */
-    private FieldMatrix<T> cachedP;
-
-    /**
-     * Calculates the LU-decomposition of the given matrix.
-     * @param matrix The matrix to decompose.
-     * @throws NonSquareMatrixException if matrix is not square
-     */
-    public FieldLUDecomposition(FieldMatrix<T> matrix) {
-        if (!matrix.isSquare()) {
-            throw new NonSquareMatrixException(matrix.getRowDimension(),
-                                               matrix.getColumnDimension());
-        }
-
-        final int m = matrix.getColumnDimension();
-        field = matrix.getField();
-        lu = matrix.getData();
-        pivot = new int[m];
-        cachedL = null;
-        cachedU = null;
-        cachedP = null;
-
-        // Initialize permutation array and parity
-        for (int row = 0; row < m; row++) {
-            pivot[row] = row;
-        }
-        even     = true;
-        singular = false;
-
-        // Loop over columns
-        for (int col = 0; col < m; col++) {
-
-            T sum = field.getZero();
-
-            // upper
-            for (int row = 0; row < col; row++) {
-                final T[] luRow = lu[row];
-                sum = luRow[col];
-                for (int i = 0; i < row; i++) {
-                    sum = sum.subtract(luRow[i].multiply(lu[i][col]));
-                }
-                luRow[col] = sum;
-            }
-
-            // lower
-            int nonZero = col; // permutation row
-            for (int row = col; row < m; row++) {
-                final T[] luRow = lu[row];
-                sum = luRow[col];
-                for (int i = 0; i < col; i++) {
-                    sum = sum.subtract(luRow[i].multiply(lu[i][col]));
-                }
-                luRow[col] = sum;
-
-                if (lu[nonZero][col].equals(field.getZero())) {
-                    // try to select a better permutation choice
-                    ++nonZero;
-                }
-            }
-
-            // Singularity check
-            if (nonZero >= m) {
-                singular = true;
-                return;
-            }
-
-            // Pivot if necessary
-            if (nonZero != col) {
-                T tmp = field.getZero();
-                for (int i = 0; i < m; i++) {
-                    tmp = lu[nonZero][i];
-                    lu[nonZero][i] = lu[col][i];
-                    lu[col][i] = tmp;
-                }
-                int temp = pivot[nonZero];
-                pivot[nonZero] = pivot[col];
-                pivot[col] = temp;
-                even = !even;
-            }
-
-            // Divide the lower elements by the "winning" diagonal elt.
-            final T luDiag = lu[col][col];
-            for (int row = col + 1; row < m; row++) {
-                final T[] luRow = lu[row];
-                luRow[col] = luRow[col].divide(luDiag);
-            }
-        }
-
-    }
-
-    /**
-     * Returns the matrix L of the decomposition.
-     * <p>L is a lower-triangular matrix</p>
-     * @return the L matrix (or null if decomposed matrix is singular)
-     */
-    public FieldMatrix<T> getL() {
-        if ((cachedL == null) && !singular) {
-            final int m = pivot.length;
-            cachedL = new Array2DRowFieldMatrix<T>(field, m, m);
-            for (int i = 0; i < m; ++i) {
-                final T[] luI = lu[i];
-                for (int j = 0; j < i; ++j) {
-                    cachedL.setEntry(i, j, luI[j]);
-                }
-                cachedL.setEntry(i, i, field.getOne());
-            }
-        }
-        return cachedL;
-    }
-
-    /**
-     * Returns the matrix U of the decomposition.
-     * <p>U is an upper-triangular matrix</p>
-     * @return the U matrix (or null if decomposed matrix is singular)
-     */
-    public FieldMatrix<T> getU() {
-        if ((cachedU == null) && !singular) {
-            final int m = pivot.length;
-            cachedU = new Array2DRowFieldMatrix<T>(field, m, m);
-            for (int i = 0; i < m; ++i) {
-                final T[] luI = lu[i];
-                for (int j = i; j < m; ++j) {
-                    cachedU.setEntry(i, j, luI[j]);
-                }
-            }
-        }
-        return cachedU;
-    }
-
-    /**
-     * Returns the P rows permutation matrix.
-     * <p>P is a sparse matrix with exactly one element set to 1.0 in
-     * each row and each column, all other elements being set to 0.0.</p>
-     * <p>The positions of the 1 elements are given by the {@link #getPivot()
-     * pivot permutation vector}.</p>
-     * @return the P rows permutation matrix (or null if decomposed matrix is singular)
-     * @see #getPivot()
-     */
-    public FieldMatrix<T> getP() {
-        if ((cachedP == null) && !singular) {
-            final int m = pivot.length;
-            cachedP = new Array2DRowFieldMatrix<T>(field, m, m);
-            for (int i = 0; i < m; ++i) {
-                cachedP.setEntry(i, pivot[i], field.getOne());
-            }
-        }
-        return cachedP;
-    }
-
-    /**
-     * Returns the pivot permutation vector.
-     * @return the pivot permutation vector
-     * @see #getP()
-     */
-    public int[] getPivot() {
-        return pivot.clone();
-    }
-
-    /**
-     * Return the determinant of the matrix.
-     * @return determinant of the matrix
-     */
-    public T getDeterminant() {
-        if (singular) {
-            return field.getZero();
-        } else {
-            final int m = pivot.length;
-            T determinant = even ? field.getOne() : field.getZero().subtract(field.getOne());
-            for (int i = 0; i < m; i++) {
-                determinant = determinant.multiply(lu[i][i]);
-            }
-            return determinant;
-        }
-    }
-
-    /**
-     * Get a solver for finding the A &times; X = B solution in exact linear sense.
-     * @return a solver
-     */
-    public FieldDecompositionSolver<T> getSolver() {
-        return new Solver<T>(field, lu, pivot, singular);
-    }
-
-    /** Specialized solver. */
-    private static class Solver<T extends FieldElement<T>> implements FieldDecompositionSolver<T> {
-
-        /** Field to which the elements belong. */
-        private final Field<T> field;
-
-        /** Entries of LU decomposition. */
-        private final T[][] lu;
-
-        /** Pivot permutation associated with LU decomposition. */
-        private final int[] pivot;
-
-        /** Singularity indicator. */
-        private final boolean singular;
-
-        /**
-         * Build a solver from decomposed matrix.
-         * @param field field to which the matrix elements belong
-         * @param lu entries of LU decomposition
-         * @param pivot pivot permutation associated with LU decomposition
-         * @param singular singularity indicator
-         */
-        private Solver(final Field<T> field, final T[][] lu,
-                       final int[] pivot, final boolean singular) {
-            this.field    = field;
-            this.lu       = lu;
-            this.pivot    = pivot;
-            this.singular = singular;
-        }
-
-        /** {@inheritDoc} */
-        public boolean isNonSingular() {
-            return !singular;
-        }
-
-        /** {@inheritDoc} */
-        public FieldVector<T> solve(FieldVector<T> b) {
-            try {
-                return solve((ArrayFieldVector<T>) b);
-            } catch (ClassCastException cce) {
-
-                final int m = pivot.length;
-                if (b.getDimension() != m) {
-                    throw new DimensionMismatchException(b.getDimension(), m);
-                }
-                if (singular) {
-                    throw new SingularMatrixException();
-                }
-
-                // Apply permutations to b
-                final T[] bp = MathArrays.buildArray(field, m);
-                for (int row = 0; row < m; row++) {
-                    bp[row] = b.getEntry(pivot[row]);
-                }
-
-                // Solve LY = b
-                for (int col = 0; col < m; col++) {
-                    final T bpCol = bp[col];
-                    for (int i = col + 1; i < m; i++) {
-                        bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));
-                    }
-                }
-
-                // Solve UX = Y
-                for (int col = m - 1; col >= 0; col--) {
-                    bp[col] = bp[col].divide(lu[col][col]);
-                    final T bpCol = bp[col];
-                    for (int i = 0; i < col; i++) {
-                        bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));
-                    }
-                }
-
-                return new ArrayFieldVector<T>(field, bp, false);
-
-            }
-        }
-
-        /** Solve the linear equation A &times; X = B.
-         * <p>The A matrix is implicit here. It is </p>
-         * @param b right-hand side of the equation A &times; X = B
-         * @return a vector X such that A &times; X = B
-         * @throws DimensionMismatchException if the matrices dimensions do not match.
-         * @throws SingularMatrixException if the decomposed matrix is singular.
-         */
-        public ArrayFieldVector<T> solve(ArrayFieldVector<T> b) {
-            final int m = pivot.length;
-            final int length = b.getDimension();
-            if (length != m) {
-                throw new DimensionMismatchException(length, m);
-            }
-            if (singular) {
-                throw new SingularMatrixException();
-            }
-
-            // Apply permutations to b
-            final T[] bp = MathArrays.buildArray(field, m);
-            for (int row = 0; row < m; row++) {
-                bp[row] = b.getEntry(pivot[row]);
-            }
-
-            // Solve LY = b
-            for (int col = 0; col < m; col++) {
-                final T bpCol = bp[col];
-                for (int i = col + 1; i < m; i++) {
-                    bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));
-                }
-            }
-
-            // Solve UX = Y
-            for (int col = m - 1; col >= 0; col--) {
-                bp[col] = bp[col].divide(lu[col][col]);
-                final T bpCol = bp[col];
-                for (int i = 0; i < col; i++) {
-                    bp[i] = bp[i].subtract(bpCol.multiply(lu[i][col]));
-                }
-            }
-
-            return new ArrayFieldVector<T>(bp, false);
-        }
-
-        /** {@inheritDoc} */
-        public FieldMatrix<T> solve(FieldMatrix<T> b) {
-            final int m = pivot.length;
-            if (b.getRowDimension() != m) {
-                throw new DimensionMismatchException(b.getRowDimension(), m);
-            }
-            if (singular) {
-                throw new SingularMatrixException();
-            }
-
-            final int nColB = b.getColumnDimension();
-
-            // Apply permutations to b
-            final T[][] bp = MathArrays.buildArray(field, m, nColB);
-            for (int row = 0; row < m; row++) {
-                final T[] bpRow = bp[row];
-                final int pRow = pivot[row];
-                for (int col = 0; col < nColB; col++) {
-                    bpRow[col] = b.getEntry(pRow, col);
-                }
-            }
-
-            // Solve LY = b
-            for (int col = 0; col < m; col++) {
-                final T[] bpCol = bp[col];
-                for (int i = col + 1; i < m; i++) {
-                    final T[] bpI = bp[i];
-                    final T luICol = lu[i][col];
-                    for (int j = 0; j < nColB; j++) {
-                        bpI[j] = bpI[j].subtract(bpCol[j].multiply(luICol));
-                    }
-                }
-            }
-
-            // Solve UX = Y
-            for (int col = m - 1; col >= 0; col--) {
-                final T[] bpCol = bp[col];
-                final T luDiag = lu[col][col];
-                for (int j = 0; j < nColB; j++) {
-                    bpCol[j] = bpCol[j].divide(luDiag);
-                }
-                for (int i = 0; i < col; i++) {
-                    final T[] bpI = bp[i];
-                    final T luICol = lu[i][col];
-                    for (int j = 0; j < nColB; j++) {
-                        bpI[j] = bpI[j].subtract(bpCol[j].multiply(luICol));
-                    }
-                }
-            }
-
-            return new Array2DRowFieldMatrix<T>(field, bp, false);
-
-        }
-
-        /** {@inheritDoc} */
-        public FieldMatrix<T> getInverse() {
-            final int m = pivot.length;
-            final T one = field.getOne();
-            FieldMatrix<T> identity = new Array2DRowFieldMatrix<T>(field, m, m);
-            for (int i = 0; i < m; ++i) {
-                identity.setEntry(i, i, one);
-            }
-            return solve(identity);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldMatrix.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldMatrix.java b/src/main/java/org/apache/commons/math3/linear/FieldMatrix.java
deleted file mode 100644
index 1048887..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldMatrix.java
+++ /dev/null
@@ -1,816 +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.linear;
-
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-
-/**
- * Interface defining field-valued matrix with basic algebraic operations.
- * <p>
- * Matrix element indexing is 0-based -- e.g., <code>getEntry(0, 0)</code>
- * returns the element in the first row, first column of the matrix.</p>
- *
- * @param <T> the type of the field elements
- */
-public interface FieldMatrix<T extends FieldElement<T>> extends AnyMatrix {
-    /**
-     * Get the type of field elements of the matrix.
-     *
-     * @return the type of field elements of the matrix.
-     */
-    Field<T> getField();
-
-    /**
-     * Create a new FieldMatrix<T> of the same type as the instance with
-     * the supplied row and column dimensions.
-     *
-     * @param rowDimension  the number of rows in the new matrix
-     * @param columnDimension  the number of columns in the new matrix
-     * @return a new matrix of the same type as the instance
-     * @throws NotStrictlyPositiveException if row or column dimension is not
-     * positive.
-     * @since 2.0
-     */
-    FieldMatrix<T> createMatrix(final int rowDimension, final int columnDimension)
-    throws NotStrictlyPositiveException;
-
-    /**
-     * Make a (deep) copy of this.
-     *
-     * @return a copy of this matrix.
-     */
-    FieldMatrix<T> copy();
-
-    /**
-     * Compute the sum of this and m.
-     *
-     * @param m Matrix to be added.
-     * @return {@code this} + {@code m}.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this} matrix.
-     */
-    FieldMatrix<T> add(FieldMatrix<T> m) throws MatrixDimensionMismatchException;
-
-    /**
-     * Subtract {@code m} from this matrix.
-     *
-     * @param m Matrix to be subtracted.
-     * @return {@code this} - {@code m}.
-     * @throws MatrixDimensionMismatchException if {@code m} is not the same
-     * size as {@code this} matrix.
-     */
-    FieldMatrix<T> subtract(FieldMatrix<T> m) throws MatrixDimensionMismatchException;
-
-     /**
-     * Increment each entry of this matrix.
-     *
-     * @param d Value to be added to each entry.
-     * @return {@code d} + {@code this}.
-     */
-    FieldMatrix<T> scalarAdd(T d);
-
-    /**
-     * Multiply each entry by {@code d}.
-     *
-     * @param d Value to multiply all entries by.
-     * @return {@code d} * {@code this}.
-     */
-    FieldMatrix<T> scalarMultiply(T d);
-
-    /**
-     * Postmultiply this matrix by {@code m}.
-     *
-     * @param m  Matrix to postmultiply by.
-     * @return {@code this} * {@code m}.
-     * @throws DimensionMismatchException if the number of columns of
-     * {@code this} matrix is not equal to the number of rows of matrix
-     * {@code m}.
-     */
-    FieldMatrix<T> multiply(FieldMatrix<T> m) throws DimensionMismatchException;
-
-    /**
-     * Premultiply this matrix by {@code m}.
-     *
-     * @param m Matrix to premultiply by.
-     * @return {@code m} * {@code this}.
-     * @throws DimensionMismatchException if the number of columns of {@code m}
-     * differs from the number of rows of {@code this} matrix.
-     */
-    FieldMatrix<T> preMultiply(FieldMatrix<T> m) throws DimensionMismatchException;
-
-    /**
-     * Returns the result multiplying this with itself <code>p</code> times.
-     * Depending on the type of the field elements, T, instability for high
-     * powers might occur.
-     *
-     * @param p raise this to power p
-     * @return this^p
-     * @throws NotPositiveException if {@code p < 0}
-     * @throws NonSquareMatrixException if {@code this matrix} is not square
-     */
-    FieldMatrix<T> power(final int p) throws NonSquareMatrixException,
-    NotPositiveException;
-
-    /**
-     * Returns matrix entries as a two-dimensional array.
-     *
-     * @return a 2-dimensional array of entries.
-     */
-    T[][] getData();
-
-    /**
-     * Get a submatrix. Rows and columns are indicated
-     * counting from 0 to n - 1.
-     *
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index (inclusive)
-     * @return the matrix containing the data of the specified rows and columns.
-     * @throws NumberIsTooSmallException is {@code endRow < startRow} of
-     * {@code endColumn < startColumn}.
-     * @throws OutOfRangeException if the indices are not valid.
-     */
-   FieldMatrix<T> getSubMatrix(int startRow, int endRow, int startColumn, int endColumn)
-   throws NumberIsTooSmallException, OutOfRangeException;
-
-   /**
-    * Get a submatrix. Rows and columns are indicated
-    * counting from 0 to n - 1.
-    *
-    * @param selectedRows Array of row indices.
-    * @param selectedColumns Array of column indices.
-    * @return the matrix containing the data in the
-    * specified rows and columns.
-    * @throws NoDataException if {@code selectedRows} or
-    * {@code selectedColumns} is empty
-    * @throws NullArgumentException if {@code selectedRows} or
-    * {@code selectedColumns} is {@code null}.
-    * @throws OutOfRangeException if row or column selections are not valid.
-    */
-   FieldMatrix<T> getSubMatrix(int[] selectedRows, int[] selectedColumns)
-   throws NoDataException, NullArgumentException, OutOfRangeException;
-
-   /**
-    * Copy a submatrix. Rows and columns are indicated
-    * counting from 0 to n-1.
-    *
-    * @param startRow Initial row index.
-    * @param endRow Final row index (inclusive).
-    * @param startColumn Initial column index.
-    * @param endColumn Final column index (inclusive).
-    * @param destination The arrays where the submatrix data should be copied
-    * (if larger than rows/columns counts, only the upper-left part will be used).
-    * @throws MatrixDimensionMismatchException if the dimensions of
-    * {@code destination} do not match those of {@code this}.
-    * @throws NumberIsTooSmallException is {@code endRow < startRow} of
-    * {@code endColumn < startColumn}.
-    * @throws OutOfRangeException if the indices are not valid.
-    * @exception IllegalArgumentException if the destination array is too small.
-    */
-    void copySubMatrix(int startRow, int endRow, int startColumn, int endColumn,
-                       T[][] destination)
-    throws MatrixDimensionMismatchException, NumberIsTooSmallException,
-    OutOfRangeException;
-
-  /**
-   * Copy a submatrix. Rows and columns are indicated
-   * counting from 0 to n - 1.
-   *
-   * @param selectedRows Array of row indices.
-   * @param selectedColumns Array of column indices.
-   * @param destination Arrays where the submatrix data should be copied
-   * (if larger than rows/columns counts, only the upper-left part will be used)
-   * @throws MatrixDimensionMismatchException if the dimensions of
-   * {@code destination} do not match those of {@code this}.
-   * @throws NoDataException if {@code selectedRows} or
-   * {@code selectedColumns} is empty
-   * @throws NullArgumentException if {@code selectedRows} or
-   * {@code selectedColumns} is {@code null}.
-   * @throws OutOfRangeException if the indices are not valid.
-   */
-  void copySubMatrix(int[] selectedRows, int[] selectedColumns, T[][] destination)
-  throws MatrixDimensionMismatchException, NoDataException, NullArgumentException,
-  OutOfRangeException;
-
-    /**
-     * Replace the submatrix starting at {@code (row, column)} using data in the
-     * input {@code subMatrix} array. Indexes are 0-based.
-     * <p>
-     * Example:<br>
-     * Starting with
-     *
-     * <pre>
-     * 1  2  3  4
-     * 5  6  7  8
-     * 9  0  1  2
-     * </pre>
-     *
-     * and <code>subMatrix = {{3, 4} {5,6}}</code>, invoking
-     * <code>setSubMatrix(subMatrix,1,1))</code> will result in
-     *
-     * <pre>
-     * 1  2  3  4
-     * 5  3  4  8
-     * 9  5  6  2
-     * </pre>
-     *
-     * </p>
-     *
-     * @param subMatrix Array containing the submatrix replacement data.
-     * @param row Row coordinate of the top-left element to be replaced.
-     * @param column Column coordinate of the top-left element to be replaced.
-     * @throws OutOfRangeException if {@code subMatrix} does not fit into this
-     * matrix from element in {@code (row, column)}.
-     * @throws NoDataException if a row or column of {@code subMatrix} is empty.
-     * @throws DimensionMismatchException if {@code subMatrix} is not
-     * rectangular (not all rows have the same length).
-     * @throws NullArgumentException if {@code subMatrix} is {@code null}.
-     * @since 2.0
-     */
-    void setSubMatrix(T[][] subMatrix, int row, int column)
-        throws DimensionMismatchException, OutOfRangeException,
-        NoDataException, NullArgumentException;
-
-   /**
-    * Get the entries in row number {@code row}
-    * as a row matrix.
-    *
-    * @param row Row to be fetched.
-    * @return a row matrix.
-    * @throws OutOfRangeException if the specified row index is invalid.
-    */
-   FieldMatrix<T> getRowMatrix(int row) throws OutOfRangeException;
-
-   /**
-    * Set the entries in row number {@code row}
-    * as a row matrix.
-    *
-    * @param row Row to be set.
-    * @param matrix Row matrix (must have one row and the same number
-    * of columns as the instance).
-    * @throws OutOfRangeException if the specified row index is invalid.
-    * @throws MatrixDimensionMismatchException
-    * if the matrix dimensions do not match one instance row.
-    */
-   void setRowMatrix(int row, FieldMatrix<T> matrix)
-   throws MatrixDimensionMismatchException, OutOfRangeException;
-
-   /**
-    * Get the entries in column number {@code column}
-    * as a column matrix.
-    *
-    * @param column Column to be fetched.
-    * @return a column matrix.
-    * @throws OutOfRangeException if the specified column index is invalid.
-    */
-   FieldMatrix<T> getColumnMatrix(int column) throws OutOfRangeException;
-
-   /**
-    * Set the entries in column number {@code column}
-    * as a column matrix.
-    *
-    * @param column Column to be set.
-    * @param matrix column matrix (must have one column and the same
-    * number of rows as the instance).
-    * @throws OutOfRangeException if the specified column index is invalid.
-    * @throws MatrixDimensionMismatchException if the matrix dimensions do
-    * not match one instance column.
-    */
-   void setColumnMatrix(int column, FieldMatrix<T> matrix)
-   throws MatrixDimensionMismatchException, OutOfRangeException;
-
-   /**
-    * Get the entries in row number {@code row}
-    * as a vector.
-    *
-    * @param row Row to be fetched
-    * @return a row vector.
-    * @throws OutOfRangeException if the specified row index is invalid.
-    */
-   FieldVector<T> getRowVector(int row) throws OutOfRangeException;
-
-   /**
-    * Set the entries in row number {@code row}
-    * as a vector.
-    *
-    * @param row Row to be set.
-    * @param vector row vector (must have the same number of columns
-    * as the instance).
-    * @throws OutOfRangeException if the specified row index is invalid.
-    * @throws MatrixDimensionMismatchException if the vector dimension does not
-    * match one instance row.
-    */
-   void setRowVector(int row, FieldVector<T> vector)
-   throws MatrixDimensionMismatchException, OutOfRangeException;
-
-   /**
-    * Returns the entries in column number {@code column}
-    * as a vector.
-    *
-    * @param column Column to be fetched.
-    * @return a column vector.
-    * @throws OutOfRangeException if the specified column index is invalid.
-    */
-   FieldVector<T> getColumnVector(int column) throws OutOfRangeException;
-
-   /**
-    * Set the entries in column number {@code column}
-    * as a vector.
-    *
-    * @param column Column to be set.
-    * @param vector Column vector (must have the same number of rows
-    * as the instance).
-    * @throws OutOfRangeException if the specified column index is invalid.
-    * @throws MatrixDimensionMismatchException if the vector dimension does not
-    * match one instance column.
-    */
-   void setColumnVector(int column, FieldVector<T> vector)
-   throws MatrixDimensionMismatchException, OutOfRangeException;
-
-    /**
-     * Get the entries in row number {@code row} as an array.
-     *
-     * @param row Row to be fetched.
-     * @return array of entries in the row.
-     * @throws OutOfRangeException if the specified row index is not valid.
-     */
-    T[] getRow(int row) throws OutOfRangeException;
-
-    /**
-     * Set the entries in row number {@code row}
-     * as a row matrix.
-     *
-     * @param row Row to be set.
-     * @param array Row matrix (must have the same number of columns as
-     * the instance).
-     * @throws OutOfRangeException if the specified row index is invalid.
-     * @throws MatrixDimensionMismatchException if the array size does not match
-     * one instance row.
-     */
-    void setRow(int row, T[] array) throws MatrixDimensionMismatchException,
-    OutOfRangeException;
-
-    /**
-     * Get the entries in column number {@code col} as an array.
-     *
-     * @param column the column to be fetched
-     * @return array of entries in the column
-     * @throws OutOfRangeException if the specified column index is not valid.
-     */
-    T[] getColumn(int column) throws OutOfRangeException;
-
-    /**
-     * Set the entries in column number {@code column}
-     * as a column matrix.
-     *
-     * @param column the column to be set
-     * @param array column array (must have the same number of rows as the instance)
-     * @throws OutOfRangeException if the specified column index is invalid.
-     * @throws MatrixDimensionMismatchException if the array size does not match
-     * one instance column.
-     */
-    void setColumn(int column, T[] array) throws MatrixDimensionMismatchException,
-    OutOfRangeException;
-
-    /**
-     * Returns the entry in the specified row and column.
-     *
-     * @param row  row location of entry to be fetched
-     * @param column  column location of entry to be fetched
-     * @return matrix entry in row,column
-     * @throws OutOfRangeException if the row or column index is not valid.
-     */
-    T getEntry(int row, int column) throws OutOfRangeException;
-
-    /**
-     * Set the entry in the specified row and column.
-     *
-     * @param row  row location of entry to be set
-     * @param column  column location of entry to be set
-     * @param value matrix entry to be set in row,column
-     * @throws OutOfRangeException if the row or column index is not valid.
-     * @since 2.0
-     */
-    void setEntry(int row, int column, T value) throws OutOfRangeException;
-
-    /**
-     * Change an entry in the specified row and column.
-     *
-     * @param row Row location of entry to be set.
-     * @param column Column location of entry to be set.
-     * @param increment Value to add to the current matrix entry in
-     * {@code (row, column)}.
-     * @throws OutOfRangeException if the row or column index is not valid.
-     * @since 2.0
-     */
-    void addToEntry(int row, int column, T increment) throws OutOfRangeException;
-
-    /**
-     * Change an entry in the specified row and column.
-     *
-     * @param row Row location of entry to be set.
-     * @param column Column location of entry to be set.
-     * @param factor Multiplication factor for the current matrix entry
-     * in {@code (row,column)}
-     * @throws OutOfRangeException if the row or column index is not valid.
-     * @since 2.0
-     */
-    void multiplyEntry(int row, int column, T factor) throws OutOfRangeException;
-
-    /**
-     * Returns the transpose of this matrix.
-     *
-     * @return transpose matrix
-     */
-    FieldMatrix<T> transpose();
-
-    /**
-     * Returns the <a href="http://mathworld.wolfram.com/MatrixTrace.html">
-     * trace</a> of the matrix (the sum of the elements on the main diagonal).
-     *
-     * @return trace
-     * @throws NonSquareMatrixException if the matrix is not square.
-     */
-    T getTrace() throws NonSquareMatrixException;
-
-    /**
-     * Returns the result of multiplying this by the vector {@code v}.
-     *
-     * @param v the vector to operate on
-     * @return {@code this * v}
-     * @throws DimensionMismatchException if the number of columns of
-     * {@code this} matrix is not equal to the size of the vector {@code v}.
-     */
-    T[] operate(T[] v) throws DimensionMismatchException;
-
-    /**
-     * Returns the result of multiplying this by the vector {@code v}.
-     *
-     * @param v the vector to operate on
-     * @return {@code this * v}
-     * @throws DimensionMismatchException if the number of columns of
-     * {@code this} matrix is not equal to the size of the vector {@code v}.
-     */
-    FieldVector<T> operate(FieldVector<T> v) throws DimensionMismatchException;
-
-    /**
-     * Returns the (row) vector result of premultiplying this by the vector
-     * {@code v}.
-     *
-     * @param v the row vector to premultiply by
-     * @return {@code v * this}
-     * @throws DimensionMismatchException if the number of rows of {@code this}
-     * matrix is not equal to the size of the vector {@code v}
-     */
-    T[] preMultiply(T[] v) throws DimensionMismatchException;
-
-    /**
-     * Returns the (row) vector result of premultiplying this by the vector
-     * {@code v}.
-     *
-     * @param v the row vector to premultiply by
-     * @return {@code v * this}
-     * @throws DimensionMismatchException if the number of rows of {@code this}
-     * matrix is not equal to the size of the vector {@code v}
-     */
-    FieldVector<T> preMultiply(FieldVector<T> v) throws DimensionMismatchException;
-
-    /**
-     * Visit (and possibly change) all matrix entries in row order.
-     * <p>Row order starts at upper left and iterating through all elements
-     * of a row from left to right before going to the leftmost element
-     * of the next row.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor);
-
-    /**
-     * Visit (but don't change) all matrix entries in row order.
-     * <p>Row order starts at upper left and iterating through all elements
-     * of a row from left to right before going to the leftmost element
-     * of the next row.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor);
-
-    /**
-     * Visit (and possibly change) some matrix entries in row order.
-     * <p>Row order starts at upper left and iterating through all elements
-     * of a row from left to right before going to the leftmost element
-     * of the next row.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index
-     * @throws OutOfRangeException if the indices are not valid.
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInRowOrder(FieldMatrixChangingVisitor<T> visitor,
-                     int startRow, int endRow, int startColumn, int endColumn)
-    throws OutOfRangeException, NumberIsTooSmallException;
-
-    /**
-     * Visit (but don't change) some matrix entries in row order.
-     * <p>Row order starts at upper left and iterating through all elements
-     * of a row from left to right before going to the leftmost element
-     * of the next row.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index
-     * @throws OutOfRangeException if the indices are not valid.
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInRowOrder(FieldMatrixPreservingVisitor<T> visitor,
-                     int startRow, int endRow, int startColumn, int endColumn)
-    throws OutOfRangeException, NumberIsTooSmallException;
-
-    /**
-     * Visit (and possibly change) all matrix entries in column order.
-     * <p>Column order starts at upper left and iterating through all elements
-     * of a column from top to bottom before going to the topmost element
-     * of the next column.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor);
-
-    /**
-     * Visit (but don't change) all matrix entries in column order.
-     * <p>Column order starts at upper left and iterating through all elements
-     * of a column from top to bottom before going to the topmost element
-     * of the next column.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor);
-
-    /**
-     * Visit (and possibly change) some matrix entries in column order.
-     * <p>Column order starts at upper left and iterating through all elements
-     * of a column from top to bottom before going to the topmost element
-     * of the next column.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInColumnOrder(FieldMatrixChangingVisitor<T> visitor,
-                        int startRow, int endRow, int startColumn, int endColumn)
-    throws NumberIsTooSmallException, OutOfRangeException;
-
-    /**
-     * Visit (but don't change) some matrix entries in column order.
-     * <p>Column order starts at upper left and iterating through all elements
-     * of a column from top to bottom before going to the topmost element
-     * of the next column.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInColumnOrder(FieldMatrixPreservingVisitor<T> visitor,
-                        int startRow, int endRow, int startColumn, int endColumn)
-    throws NumberIsTooSmallException, OutOfRangeException;
-
-    /**
-     * Visit (and possibly change) all matrix entries using the fastest possible order.
-     * <p>The fastest walking order depends on the exact matrix class. It may be
-     * different from traditional row or column orders.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInOptimizedOrder(FieldMatrixChangingVisitor<T> visitor);
-
-    /**
-     * Visit (but don't change) all matrix entries using the fastest possible order.
-     * <p>The fastest walking order depends on the exact matrix class. It may be
-     * different from traditional row or column orders.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInOptimizedOrder(FieldMatrixPreservingVisitor<T> visitor);
-
-    /**
-     * Visit (and possibly change) some matrix entries using the fastest possible order.
-     * <p>The fastest walking order depends on the exact matrix class. It may be
-     * different from traditional row or column orders.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index (inclusive)
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixChangingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInOptimizedOrder(FieldMatrixChangingVisitor<T> visitor,
-                           int startRow, int endRow, int startColumn, int endColumn)
-    throws NumberIsTooSmallException, OutOfRangeException;
-
-    /**
-     * Visit (but don't change) some matrix entries using the fastest possible order.
-     * <p>The fastest walking order depends on the exact matrix class. It may be
-     * different from traditional row or column orders.</p>
-     * @param visitor visitor used to process all matrix entries
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index (inclusive)
-     * @throws NumberIsTooSmallException if {@code endRow < startRow} or
-     * {@code endColumn < startColumn}.
-     * @throws OutOfRangeException if the indices are not valid.
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInRowOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInRowOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInColumnOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @see #walkInColumnOrder(FieldMatrixPreservingVisitor, int, int, int, int)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixPreservingVisitor)
-     * @see #walkInOptimizedOrder(FieldMatrixChangingVisitor, int, int, int, int)
-     * @return the value returned by {@link FieldMatrixPreservingVisitor#end()} at the end
-     * of the walk
-     */
-    T walkInOptimizedOrder(FieldMatrixPreservingVisitor<T> visitor,
-                           int startRow, int endRow, int startColumn, int endColumn)
-    throws NumberIsTooSmallException, OutOfRangeException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldMatrixChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldMatrixChangingVisitor.java b/src/main/java/org/apache/commons/math3/linear/FieldMatrixChangingVisitor.java
deleted file mode 100644
index d510cd0..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldMatrixChangingVisitor.java
+++ /dev/null
@@ -1,57 +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.linear;
-
-import org.apache.commons.math3.FieldElement;
-
-/**
- * Interface defining a visitor for matrix entries.
- *
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public interface FieldMatrixChangingVisitor<T extends FieldElement<?>> {
-    /**
-     * Start visiting a matrix.
-     * <p>This method is called once before any entry of the matrix is visited.</p>
-     * @param rows number of rows of the matrix
-     * @param columns number of columns of the matrix
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index (inclusive)
-     */
-    void start(int rows, int columns,
-               int startRow, int endRow, int startColumn, int endColumn);
-
-    /**
-     * Visit one matrix entry.
-     * @param row row index of the entry
-     * @param column column index of the entry
-     * @param value current value of the entry
-     * @return the new value to be set for the entry
-     */
-    T visit(int row, int column, T value);
-
-    /**
-     * End visiting a matrix.
-     * <p>This method is called once after all entries of the matrix have been visited.</p>
-     * @return the value that the <code>walkInXxxOrder</code> must return
-     */
-    T end();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldMatrixPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldMatrixPreservingVisitor.java b/src/main/java/org/apache/commons/math3/linear/FieldMatrixPreservingVisitor.java
deleted file mode 100644
index 8db2e3a..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldMatrixPreservingVisitor.java
+++ /dev/null
@@ -1,56 +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.linear;
-
-import org.apache.commons.math3.FieldElement;
-
-/**
- * Interface defining a visitor for matrix entries.
- *
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public interface FieldMatrixPreservingVisitor<T extends FieldElement<?>> {
-    /**
-     * Start visiting a matrix.
-     * <p>This method is called once before any entry of the matrix is visited.</p>
-     * @param rows number of rows of the matrix
-     * @param columns number of columns of the matrix
-     * @param startRow Initial row index
-     * @param endRow Final row index (inclusive)
-     * @param startColumn Initial column index
-     * @param endColumn Final column index (inclusive)
-     */
-    void start(int rows, int columns,
-               int startRow, int endRow, int startColumn, int endColumn);
-
-    /**
-     * Visit one matrix entry.
-     * @param row row index of the entry
-     * @param column column index of the entry
-     * @param value current value of the entry
-     */
-    void visit(int row, int column, T value);
-
-    /**
-     * End visiting a matrix.
-     * <p>This method is called once after all entries of the matrix have been visited.</p>
-     * @return the value that the <code>walkInXxxOrder</code> must return
-     */
-    T end();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldVector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldVector.java b/src/main/java/org/apache/commons/math3/linear/FieldVector.java
deleted file mode 100644
index 2161e81..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldVector.java
+++ /dev/null
@@ -1,298 +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.linear;
-
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-
-/**
- * Interface defining a field-valued vector with basic algebraic operations.
- * <p>
- * vector element indexing is 0-based -- e.g., <code>getEntry(0)</code>
- * returns the first element of the vector.
- * </p>
- * <p>
- * The various <code>mapXxx</code> and <code>mapXxxToSelf</code> methods operate
- * on vectors element-wise, i.e. they perform the same operation (adding a scalar,
- * applying a function ...) on each element in turn. The <code>mapXxx</code>
- * versions create a new vector to hold the result and do not change the instance.
- * The <code>mapXxxToSelf</code> versions use the instance itself to store the
- * results, so the instance is changed by these methods. In both cases, the result
- * vector is returned by the methods, this allows to use the <i>fluent API</i>
- * style, like this:
- * </p>
- * <pre>
- *   RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();
- * </pre>
- * <p>
- * Note that as almost all operations on {@link FieldElement} throw {@link
- * NullArgumentException} when operating on a null element, it is the responsibility
- * of <code>FieldVector</code> implementations to make sure no null elements
- * are inserted into the vector. This must be done in all constructors and
- * all setters.
- * <p>
- *
- * @param <T> the type of the field elements
- * @since 2.0
- */
-public interface FieldVector<T extends FieldElement<T>>  {
-
-    /**
-     * Get the type of field elements of the vector.
-     * @return type of field elements of the vector
-     */
-    Field<T> getField();
-
-    /**
-     * Returns a (deep) copy of this.
-     * @return vector copy
-     */
-    FieldVector<T> copy();
-
-    /**
-     * Compute the sum of {@code this} and {@code v}.
-     * @param v vector to be added
-     * @return {@code this + v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as {@code this}
-     */
-    FieldVector<T> add(FieldVector<T> v) throws DimensionMismatchException;
-
-    /**
-     * Compute {@code this} minus {@code v}.
-     * @param v vector to be subtracted
-     * @return {@code this - v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as {@code this}
-     */
-    FieldVector<T> subtract(FieldVector<T> v) throws DimensionMismatchException;
-
-    /**
-     * Map an addition operation to each entry.
-     * @param d value to be added to each entry
-     * @return {@code this + d}
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     */
-    FieldVector<T> mapAdd(T d) throws NullArgumentException;
-
-    /**
-     * Map an addition operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to be added to each entry
-     * @return for convenience, return {@code this}
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     */
-    FieldVector<T> mapAddToSelf(T d) throws NullArgumentException;
-
-    /**
-     * Map a subtraction operation to each entry.
-     * @param d value to be subtracted to each entry
-     * @return {@code this - d}
-     * @throws NullArgumentException if {@code d} is {@code null}
-     */
-    FieldVector<T> mapSubtract(T d) throws NullArgumentException;
-
-    /**
-     * Map a subtraction operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to be subtracted to each entry
-     * @return for convenience, return {@code this}
-     * @throws NullArgumentException if {@code d} is {@code null}
-     */
-    FieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException;
-
-    /**
-     * Map a multiplication operation to each entry.
-     * @param d value to multiply all entries by
-     * @return {@code this * d}
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     */
-    FieldVector<T> mapMultiply(T d) throws NullArgumentException;
-
-    /**
-     * Map a multiplication operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to multiply all entries by
-     * @return for convenience, return {@code this}
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     */
-    FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException;
-
-    /**
-     * Map a division operation to each entry.
-     * @param d value to divide all entries by
-     * @return {@code this / d}
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws MathArithmeticException if {@code d} is zero.
-     */
-    FieldVector<T> mapDivide(T d)
-        throws NullArgumentException, MathArithmeticException;
-
-    /**
-     * Map a division operation to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @param d value to divide all entries by
-     * @return for convenience, return {@code this}
-     * @throws NullArgumentException if {@code d} is {@code null}.
-     * @throws MathArithmeticException if {@code d} is zero.
-     */
-    FieldVector<T> mapDivideToSelf(T d)
-        throws NullArgumentException, MathArithmeticException;
-
-    /**
-     * Map the 1/x function to each entry.
-     * @return a vector containing the result of applying the function to each entry.
-     * @throws MathArithmeticException if one of the entries is zero.
-     */
-    FieldVector<T> mapInv() throws MathArithmeticException;
-
-    /**
-     * Map the 1/x function to each entry.
-     * <p>The instance <strong>is</strong> changed by this method.</p>
-     * @return for convenience, return {@code this}
-     * @throws MathArithmeticException if one of the entries is zero.
-     */
-    FieldVector<T> mapInvToSelf() throws MathArithmeticException;
-
-    /**
-     * Element-by-element multiplication.
-     * @param v vector by which instance elements must be multiplied
-     * @return a vector containing {@code this[i] * v[i]} for all {@code i}
-     * @throws DimensionMismatchException if {@code v} is not the same size as {@code this}
-     */
-    FieldVector<T> ebeMultiply(FieldVector<T> v)
-        throws DimensionMismatchException;
-
-    /**
-     * Element-by-element division.
-     * @param v vector by which instance elements must be divided
-     * @return a vector containing {@code this[i] / v[i]} for all {@code i}
-     * @throws DimensionMismatchException if {@code v} is not the same size as {@code this}
-     * @throws MathArithmeticException if one entry of {@code v} is zero.
-     */
-    FieldVector<T> ebeDivide(FieldVector<T> v)
-        throws DimensionMismatchException, MathArithmeticException;
-
-    /**
-     * Returns vector entries as a T array.
-     * @return T array of entries
-     * @deprecated as of 3.1, to be removed in 4.0. Please use the {@link #toArray()} method instead.
-     */
-    @Deprecated
-    T[] getData();
-
-    /**
-     * Compute the dot product.
-     * @param v vector with which dot product should be computed
-     * @return the scalar dot product of {@code this} and {@code v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as {@code this}
-     */
-    T dotProduct(FieldVector<T> v) throws DimensionMismatchException;
-
-    /**
-     * Find the orthogonal projection of this vector onto another vector.
-     * @param v vector onto which {@code this} must be projected
-     * @return projection of {@code this} onto {@code v}
-     * @throws DimensionMismatchException if {@code v} is not the same size as {@code this}
-     * @throws MathArithmeticException if {@code v} is the null vector.
-     */
-    FieldVector<T> projection(FieldVector<T> v)
-        throws DimensionMismatchException, MathArithmeticException;
-
-    /**
-     * Compute the outer product.
-     * @param v vector with which outer product should be computed
-     * @return the matrix outer product between instance and v
-     */
-    FieldMatrix<T> outerProduct(FieldVector<T> v);
-
-    /**
-     * Returns the entry in the specified index.
-     *
-     * @param index Index location of entry to be fetched.
-     * @return the vector entry at {@code index}.
-     * @throws OutOfRangeException if the index is not valid.
-     * @see #setEntry(int, FieldElement)
-     */
-    T getEntry(int index) throws OutOfRangeException;
-
-    /**
-     * Set a single element.
-     * @param index element index.
-     * @param value new value for the element.
-     * @throws OutOfRangeException if the index is not valid.
-     * @see #getEntry(int)
-     */
-    void setEntry(int index, T value) throws OutOfRangeException;
-
-    /**
-     * Returns the size of the vector.
-     * @return size
-     */
-    int getDimension();
-
-    /**
-     * Construct a vector by appending a vector to this vector.
-     * @param v vector to append to this one.
-     * @return a new vector
-     */
-    FieldVector<T> append(FieldVector<T> v);
-
-    /**
-     * Construct a vector by appending a T to this vector.
-     * @param d T to append.
-     * @return a new vector
-     */
-    FieldVector<T> append(T d);
-
-    /**
-     * Get a subvector from consecutive elements.
-     * @param index index of first element.
-     * @param n number of elements to be retrieved.
-     * @return a vector containing n elements.
-     * @throws OutOfRangeException if the index is not valid.
-     * @throws NotPositiveException if the number of elements if not positive.
-     */
-    FieldVector<T> getSubVector(int index, int n)
-        throws OutOfRangeException, NotPositiveException;
-
-    /**
-     * Set a set of consecutive elements.
-     * @param index index of first element to be set.
-     * @param v vector containing the values to set.
-     * @throws OutOfRangeException if the index is not valid.
-     */
-    void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException;
-
-    /**
-     * Set all elements to a single value.
-     * @param value single value to set for all elements
-     */
-    void set(T value);
-
-    /**
-     * Convert the vector to a T array.
-     * <p>The array is independent from vector data, it's elements
-     * are copied.</p>
-     * @return array containing a copy of vector elements
-     */
-    T[] toArray();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldVectorChangingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldVectorChangingVisitor.java b/src/main/java/org/apache/commons/math3/linear/FieldVectorChangingVisitor.java
deleted file mode 100644
index b1589b1..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldVectorChangingVisitor.java
+++ /dev/null
@@ -1,56 +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.linear;
-
-import org.apache.commons.math3.FieldElement;
-
-/**
- * This interface defines a visitor for the entries of a vector. Visitors
- * implementing this interface may alter the entries of the vector being
- * visited.
- *
- * @param <T> the type of the field elements
- * @since 3.3
- */
-public interface FieldVectorChangingVisitor<T extends FieldElement<?>> {
-    /**
-     * Start visiting a vector. This method is called once, before any entry
-     * of the vector is visited.
-     *
-     * @param dimension the size of the vector
-     * @param start the index of the first entry to be visited
-     * @param end the index of the last entry to be visited (inclusive)
-     */
-    void start(int dimension, int start, int end);
-
-    /**
-     * Visit one entry of the vector.
-     *
-     * @param index the index of the entry being visited
-     * @param value the value of the entry being visited
-     * @return the new value of the entry being visited
-     */
-    T visit(int index, T value);
-
-    /**
-     * End visiting a vector. This method is called once, after all entries of
-     * the vector have been visited.
-     *
-     * @return the value returned after visiting all entries
-     */
-    T end();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/FieldVectorPreservingVisitor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/FieldVectorPreservingVisitor.java b/src/main/java/org/apache/commons/math3/linear/FieldVectorPreservingVisitor.java
deleted file mode 100644
index bc09bda..0000000
--- a/src/main/java/org/apache/commons/math3/linear/FieldVectorPreservingVisitor.java
+++ /dev/null
@@ -1,55 +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.linear;
-
-import org.apache.commons.math3.FieldElement;
-
-/**
- * This interface defines a visitor for the entries of a vector. Visitors
- * implementing this interface do not alter the entries of the vector being
- * visited.
- *
- * @param <T> the type of the field elements
- * @since 3.3
- */
-public interface FieldVectorPreservingVisitor<T extends FieldElement<?>> {
-    /**
-     * Start visiting a vector. This method is called once, before any entry
-     * of the vector is visited.
-     *
-     * @param dimension the size of the vector
-     * @param start the index of the first entry to be visited
-     * @param end the index of the last entry to be visited (inclusive)
-     */
-    void start(int dimension, int start, int end);
-
-    /**
-     * Visit one entry of the vector.
-     *
-     * @param index the index of the entry being visited
-     * @param value the value of the entry being visited
-     */
-    void visit(int index, T value);
-
-    /**
-     * End visiting a vector. This method is called once, after all entries of
-     * the vector have been visited.
-     *
-     * @return the value returned after visiting all entries
-     */
-    T end();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/HessenbergTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/HessenbergTransformer.java b/src/main/java/org/apache/commons/math3/linear/HessenbergTransformer.java
deleted file mode 100644
index 8fefc09..0000000
--- a/src/main/java/org/apache/commons/math3/linear/HessenbergTransformer.java
+++ /dev/null
@@ -1,232 +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.linear;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * Class transforming a general real matrix to Hessenberg form.
- * <p>A m &times; m matrix A can be written as the product of three matrices: A = P
- * &times; H &times; P<sup>T</sup> with P an orthogonal matrix and H a Hessenberg
- * matrix. Both P and H are m &times; m matrices.</p>
- * <p>Transformation to Hessenberg form is often not a goal by itself, but it is an
- * intermediate step in more general decomposition algorithms like
- * {@link EigenDecomposition eigen decomposition}. This class is therefore
- * intended for internal use by the library and is not public. As a consequence
- * of this explicitly limited scope, many methods directly returns references to
- * internal arrays, not copies.</p>
- * <p>This class is based on the method orthes in class EigenvalueDecomposition
- * from the <a href="http://math.nist.gov/javanumerics/jama/">JAMA</a> library.</p>
- *
- * @see <a href="http://mathworld.wolfram.com/HessenbergDecomposition.html">MathWorld</a>
- * @see <a href="http://en.wikipedia.org/wiki/Householder_transformation">Householder Transformations</a>
- * @since 3.1
- */
-class HessenbergTransformer {
-    /** Householder vectors. */
-    private final double householderVectors[][];
-    /** Temporary storage vector. */
-    private final double ort[];
-    /** Cached value of P. */
-    private RealMatrix cachedP;
-    /** Cached value of Pt. */
-    private RealMatrix cachedPt;
-    /** Cached value of H. */
-    private RealMatrix cachedH;
-
-    /**
-     * Build the transformation to Hessenberg form of a general matrix.
-     *
-     * @param matrix matrix to transform
-     * @throws NonSquareMatrixException if the matrix is not square
-     */
-    public HessenbergTransformer(final RealMatrix matrix) {
-        if (!matrix.isSquare()) {
-            throw new NonSquareMatrixException(matrix.getRowDimension(),
-                    matrix.getColumnDimension());
-        }
-
-        final int m = matrix.getRowDimension();
-        householderVectors = matrix.getData();
-        ort = new double[m];
-        cachedP = null;
-        cachedPt = null;
-        cachedH = null;
-
-        // transform matrix
-        transform();
-    }
-
-    /**
-     * Returns the matrix P of the transform.
-     * <p>P is an orthogonal matrix, i.e. its inverse is also its transpose.</p>
-     *
-     * @return the P matrix
-     */
-    public RealMatrix getP() {
-        if (cachedP == null) {
-            final int n = householderVectors.length;
-            final int high = n - 1;
-            final double[][] pa = new double[n][n];
-
-            for (int i = 0; i < n; i++) {
-                for (int j = 0; j < n; j++) {
-                    pa[i][j] = (i == j) ? 1 : 0;
-                }
-            }
-
-            for (int m = high - 1; m >= 1; m--) {
-                if (householderVectors[m][m - 1] != 0.0) {
-                    for (int i = m + 1; i <= high; i++) {
-                        ort[i] = householderVectors[i][m - 1];
-                    }
-
-                    for (int j = m; j <= high; j++) {
-                        double g = 0.0;
-
-                        for (int i = m; i <= high; i++) {
-                            g += ort[i] * pa[i][j];
-                        }
-
-                        // Double division avoids possible underflow
-                        g = (g / ort[m]) / householderVectors[m][m - 1];
-
-                        for (int i = m; i <= high; i++) {
-                            pa[i][j] += g * ort[i];
-                        }
-                    }
-                }
-            }
-
-            cachedP = MatrixUtils.createRealMatrix(pa);
-        }
-        return cachedP;
-    }
-
-    /**
-     * Returns the transpose of the matrix P of the transform.
-     * <p>P is an orthogonal matrix, i.e. its inverse is also its transpose.</p>
-     *
-     * @return the transpose of the P matrix
-     */
-    public RealMatrix getPT() {
-        if (cachedPt == null) {
-            cachedPt = getP().transpose();
-        }
-
-        // return the cached matrix
-        return cachedPt;
-    }
-
-    /**
-     * Returns the Hessenberg matrix H of the transform.
-     *
-     * @return the H matrix
-     */
-    public RealMatrix getH() {
-        if (cachedH == null) {
-            final int m = householderVectors.length;
-            final double[][] h = new double[m][m];
-            for (int i = 0; i < m; ++i) {
-                if (i > 0) {
-                    // copy the entry of the lower sub-diagonal
-                    h[i][i - 1] = householderVectors[i][i - 1];
-                }
-
-                // copy upper triangular part of the matrix
-                for (int j = i; j < m; ++j) {
-                    h[i][j] = householderVectors[i][j];
-                }
-            }
-            cachedH = MatrixUtils.createRealMatrix(h);
-        }
-
-        // return the cached matrix
-        return cachedH;
-    }
-
-    /**
-     * Get the Householder vectors of the transform.
-     * <p>Note that since this class is only intended for internal use, it returns
-     * directly a reference to its internal arrays, not a copy.</p>
-     *
-     * @return the main diagonal elements of the B matrix
-     */
-    double[][] getHouseholderVectorsRef() {
-        return householderVectors;
-    }
-
-    /**
-     * Transform original matrix to Hessenberg form.
-     * <p>Transformation is done using Householder transforms.</p>
-     */
-    private void transform() {
-        final int n = householderVectors.length;
-        final int high = n - 1;
-
-        for (int m = 1; m <= high - 1; m++) {
-            // Scale column.
-            double scale = 0;
-            for (int i = m; i <= high; i++) {
-                scale += FastMath.abs(householderVectors[i][m - 1]);
-            }
-
-            if (!Precision.equals(scale, 0)) {
-                // Compute Householder transformation.
-                double h = 0;
-                for (int i = high; i >= m; i--) {
-                    ort[i] = householderVectors[i][m - 1] / scale;
-                    h += ort[i] * ort[i];
-                }
-                final double g = (ort[m] > 0) ? -FastMath.sqrt(h) : FastMath.sqrt(h);
-
-                h -= ort[m] * g;
-                ort[m] -= g;
-
-                // Apply Householder similarity transformation
-                // H = (I - u*u' / h) * H * (I - u*u' / h)
-
-                for (int j = m; j < n; j++) {
-                    double f = 0;
-                    for (int i = high; i >= m; i--) {
-                        f += ort[i] * householderVectors[i][j];
-                    }
-                    f /= h;
-                    for (int i = m; i <= high; i++) {
-                        householderVectors[i][j] -= f * ort[i];
-                    }
-                }
-
-                for (int i = 0; i <= high; i++) {
-                    double f = 0;
-                    for (int j = high; j >= m; j--) {
-                        f += ort[j] * householderVectors[i][j];
-                    }
-                    f /= h;
-                    for (int j = m; j <= high; j++) {
-                        householderVectors[i][j] -= f * ort[j];
-                    }
-                }
-
-                ort[m] = scale * ort[m];
-                householderVectors[m][m - 1] = scale * g;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/linear/IllConditionedOperatorException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/linear/IllConditionedOperatorException.java b/src/main/java/org/apache/commons/math3/linear/IllConditionedOperatorException.java
deleted file mode 100644
index 3285f68..0000000
--- a/src/main/java/org/apache/commons/math3/linear/IllConditionedOperatorException.java
+++ /dev/null
@@ -1,42 +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.linear;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * An exception to be thrown when the condition number of a
- * {@link RealLinearOperator} is too high.
- *
- * @since 3.0
- */
-public class IllConditionedOperatorException
-    extends MathIllegalArgumentException {
-    /** Serializable version Id. */
-    private static final long serialVersionUID = -7883263944530490135L;
-
-    /**
-     * Creates a new instance of this class.
-     *
-     * @param cond An estimate of the condition number of the offending linear
-     * operator.
-     */
-    public IllConditionedOperatorException(final double cond) {
-        super(LocalizedFormats.ILL_CONDITIONED_OPERATOR, cond);
-    }
-}


[12/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/NodesSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/NodesSet.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/NodesSet.java
deleted file mode 100644
index 688279a..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/NodesSet.java
+++ /dev/null
@@ -1,72 +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.geometry.partitioning;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** Set of {@link BSPTree BSP tree} nodes.
- * @see BoundaryAttribute
- * @param <S> Type of the space.
- * @since 3.4
- */
-public class NodesSet<S extends Space> implements Iterable<BSPTree<S>> {
-
-    /** List of sub-hyperplanes. */
-    private List<BSPTree<S>> list;
-
-    /** Simple constructor.
-     */
-    public NodesSet() {
-        list = new ArrayList<BSPTree<S>>();
-    }
-
-    /** Add a node if not already known.
-     * @param node node to add
-     */
-    public void add(final BSPTree<S> node) {
-
-        for (final BSPTree<S> existing : list) {
-            if (node == existing) {
-                // the node is already known, don't add it
-                return;
-            }
-        }
-
-        // the node was not known, add it
-        list.add(node);
-
-    }
-
-    /** Add nodes if they are not already known.
-     * @param iterator nodes iterator
-     */
-    public void addAll(final Iterable<BSPTree<S>> iterator) {
-        for (final BSPTree<S> node : iterator) {
-            add(node);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public Iterator<BSPTree<S>> iterator() {
-        return list.iterator();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/Region.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/Region.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/Region.java
deleted file mode 100644
index 3f4d5f5..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/Region.java
+++ /dev/null
@@ -1,218 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Point;
-
-/** This interface represents a region of a space as a partition.
-
- * <p>Region are subsets of a space, they can be infinite (whole
- * space, half space, infinite stripe ...) or finite (polygons in 2D,
- * polyhedrons in 3D ...). Their main characteristic is to separate
- * points that are considered to be <em>inside</em> the region from
- * points considered to be <em>outside</em> of it. In between, there
- * may be points on the <em>boundary</em> of the region.</p>
-
- * <p>This implementation is limited to regions for which the boundary
- * is composed of several {@link SubHyperplane sub-hyperplanes},
- * including regions with no boundary at all: the whole space and the
- * empty region. They are not necessarily finite and not necessarily
- * path-connected. They can contain holes.</p>
-
- * <p>Regions can be combined using the traditional sets operations :
- * union, intersection, difference and symetric difference (exclusive
- * or) for the binary operations, complement for the unary
- * operation.</p>
-
- * <p>
- * Note that this interface is <em>not</em> intended to be implemented
- * by Apache Commons Math users, it is only intended to be implemented
- * within the library itself. New methods may be added even for minor
- * versions, which breaks compatibility for external implementations.
- * </p>
-
- * @param <S> Type of the space.
-
- * @since 3.0
- */
-public interface Region<S extends Space> {
-
-    /** Enumerate for the location of a point with respect to the region. */
-    public static enum Location {
-        /** Code for points inside the partition. */
-        INSIDE,
-
-        /** Code for points outside of the partition. */
-        OUTSIDE,
-
-        /** Code for points on the partition boundary. */
-        BOUNDARY;
-    }
-
-    /** Build a region using the instance as a prototype.
-     * <p>This method allow to create new instances without knowing
-     * exactly the type of the region. It is an application of the
-     * prototype design pattern.</p>
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}. The
-     * tree also <em>must</em> have either null internal nodes or
-     * internal nodes representing the boundary as specified in the
-     * {@link #getTree getTree} method).</p>
-     * @param newTree inside/outside BSP tree representing the new region
-     * @return the built region
-     */
-    Region<S> buildNew(BSPTree<S> newTree);
-
-    /** Copy the instance.
-     * <p>The instance created is completely independant of the original
-     * one. A deep copy is used, none of the underlying objects are
-     * shared (except for the underlying tree {@code Boolean}
-     * attributes and immutable objects).</p>
-     * @return a new region, copy of the instance
-     */
-    Region<S> copySelf();
-
-    /** Check if the instance is empty.
-     * @return true if the instance is empty
-     */
-    boolean isEmpty();
-
-    /** Check if the sub-tree starting at a given node is empty.
-     * @param node root node of the sub-tree (<em>must</em> have {@link
-     * Region Region} tree semantics, i.e. the leaf nodes must have
-     * {@code Boolean} attributes representing an inside/outside
-     * property)
-     * @return true if the sub-tree starting at the given node is empty
-     */
-    boolean isEmpty(final BSPTree<S> node);
-
-    /** Check if the instance covers the full space.
-     * @return true if the instance covers the full space
-     */
-    boolean isFull();
-
-    /** Check if the sub-tree starting at a given node covers the full space.
-     * @param node root node of the sub-tree (<em>must</em> have {@link
-     * Region Region} tree semantics, i.e. the leaf nodes must have
-     * {@code Boolean} attributes representing an inside/outside
-     * property)
-     * @return true if the sub-tree starting at the given node covers the full space
-     */
-    boolean isFull(final BSPTree<S> node);
-
-    /** Check if the instance entirely contains another region.
-     * @param region region to check against the instance
-     * @return true if the instance contains the specified tree
-     */
-    boolean contains(final Region<S> region);
-
-    /** Check a point with respect to the region.
-     * @param point point to check
-     * @return a code representing the point status: either {@link
-     * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY}
-     */
-    Location checkPoint(final Point<S> point);
-
-    /** Project a point on the boundary of the region.
-     * @param point point to check
-     * @return projection of the point on the boundary
-     * @since 3.3
-     */
-    BoundaryProjection<S> projectToBoundary(final Point<S> point);
-
-    /** Get the underlying BSP tree.
-
-     * <p>Regions are represented by an underlying inside/outside BSP
-     * tree whose leaf attributes are {@code Boolean} instances
-     * representing inside leaf cells if the attribute value is
-     * {@code true} and outside leaf cells if the attribute is
-     * {@code false}. These leaf attributes are always present and
-     * guaranteed to be non null.</p>
-
-     * <p>In addition to the leaf attributes, the internal nodes which
-     * correspond to cells split by cut sub-hyperplanes may contain
-     * {@link BoundaryAttribute BoundaryAttribute} objects representing
-     * the parts of the corresponding cut sub-hyperplane that belong to
-     * the boundary. When the boundary attributes have been computed,
-     * all internal nodes are guaranteed to have non-null
-     * attributes, however some {@link BoundaryAttribute
-     * BoundaryAttribute} instances may have their {@link
-     * BoundaryAttribute#getPlusInside() getPlusInside} and {@link
-     * BoundaryAttribute#getPlusOutside() getPlusOutside} methods both
-     * returning null if the corresponding cut sub-hyperplane does not
-     * have any parts belonging to the boundary.</p>
-
-     * <p>Since computing the boundary is not always required and can be
-     * time-consuming for large trees, these internal nodes attributes
-     * are computed using lazy evaluation only when required by setting
-     * the {@code includeBoundaryAttributes} argument to
-     * {@code true}. Once computed, these attributes remain in the
-     * tree, which implies that in this case, further calls to the
-     * method for the same region will always include these attributes
-     * regardless of the value of the
-     * {@code includeBoundaryAttributes} argument.</p>
-
-     * @param includeBoundaryAttributes if true, the boundary attributes
-     * at internal nodes are guaranteed to be included (they may be
-     * included even if the argument is false, if they have already been
-     * computed due to a previous call)
-     * @return underlying BSP tree
-     * @see BoundaryAttribute
-     */
-    BSPTree<S> getTree(final boolean includeBoundaryAttributes);
-
-    /** Get the size of the boundary.
-     * @return the size of the boundary (this is 0 in 1D, a length in
-     * 2D, an area in 3D ...)
-     */
-    double getBoundarySize();
-
-    /** Get the size of the instance.
-     * @return the size of the instance (this is a length in 1D, an area
-     * in 2D, a volume in 3D ...)
-     */
-    double getSize();
-
-    /** Get the barycenter of the instance.
-     * @return an object representing the barycenter
-     */
-    Point<S> getBarycenter();
-
-    /** Compute the relative position of the instance with respect to an
-     * hyperplane.
-     * @param hyperplane reference hyperplane
-     * @return one of {@link Side#PLUS Side.PLUS}, {@link Side#MINUS
-     * Side.MINUS}, {@link Side#BOTH Side.BOTH} or {@link Side#HYPER
-     * Side.HYPER} (the latter result can occur only if the tree
-     * contains only one cut hyperplane)
-     */
-    Side side(final Hyperplane<S> hyperplane);
-
-    /** Get the parts of a sub-hyperplane that are contained in the region.
-     * <p>The parts of the sub-hyperplane that belong to the boundary are
-     * <em>not</em> included in the resulting parts.</p>
-     * @param sub sub-hyperplane traversing the region
-     * @return filtered sub-hyperplane
-     */
-    SubHyperplane<S> intersection(final SubHyperplane<S> sub);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java
deleted file mode 100644
index 16d4472..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/RegionFactory.java
+++ /dev/null
@@ -1,349 +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.geometry.partitioning;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.partitioning.BSPTree.VanishingCutHandler;
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-
-/** This class is a factory for {@link Region}.
-
- * @param <S> Type of the space.
-
- * @since 3.0
- */
-public class RegionFactory<S extends Space> {
-
-    /** Visitor removing internal nodes attributes. */
-    private final NodesCleaner nodeCleaner;
-
-    /** Simple constructor.
-     */
-    public RegionFactory() {
-        nodeCleaner = new NodesCleaner();
-    }
-
-    /** Build a convex region from a collection of bounding hyperplanes.
-     * @param hyperplanes collection of bounding hyperplanes
-     * @return a new convex region, or null if the collection is empty
-     */
-    public Region<S> buildConvex(final Hyperplane<S> ... hyperplanes) {
-        if ((hyperplanes == null) || (hyperplanes.length == 0)) {
-            return null;
-        }
-
-        // use the first hyperplane to build the right class
-        final Region<S> region = hyperplanes[0].wholeSpace();
-
-        // chop off parts of the space
-        BSPTree<S> node = region.getTree(false);
-        node.setAttribute(Boolean.TRUE);
-        for (final Hyperplane<S> hyperplane : hyperplanes) {
-            if (node.insertCut(hyperplane)) {
-                node.setAttribute(null);
-                node.getPlus().setAttribute(Boolean.FALSE);
-                node = node.getMinus();
-                node.setAttribute(Boolean.TRUE);
-            }
-        }
-
-        return region;
-
-    }
-
-    /** Compute the union of two regions.
-     * @param region1 first region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @param region2 second region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @return a new region, result of {@code region1 union region2}
-     */
-    public Region<S> union(final Region<S> region1, final Region<S> region2) {
-        final BSPTree<S> tree =
-            region1.getTree(false).merge(region2.getTree(false), new UnionMerger());
-        tree.visit(nodeCleaner);
-        return region1.buildNew(tree);
-    }
-
-    /** Compute the intersection of two regions.
-     * @param region1 first region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @param region2 second region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @return a new region, result of {@code region1 intersection region2}
-     */
-    public Region<S> intersection(final Region<S> region1, final Region<S> region2) {
-        final BSPTree<S> tree =
-            region1.getTree(false).merge(region2.getTree(false), new IntersectionMerger());
-        tree.visit(nodeCleaner);
-        return region1.buildNew(tree);
-    }
-
-    /** Compute the symmetric difference (exclusive or) of two regions.
-     * @param region1 first region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @param region2 second region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @return a new region, result of {@code region1 xor region2}
-     */
-    public Region<S> xor(final Region<S> region1, final Region<S> region2) {
-        final BSPTree<S> tree =
-            region1.getTree(false).merge(region2.getTree(false), new XorMerger());
-        tree.visit(nodeCleaner);
-        return region1.buildNew(tree);
-    }
-
-    /** Compute the difference of two regions.
-     * @param region1 first region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @param region2 second region (will be unusable after the operation as
-     * parts of it will be reused in the new region)
-     * @return a new region, result of {@code region1 minus region2}
-     */
-    public Region<S> difference(final Region<S> region1, final Region<S> region2) {
-        final BSPTree<S> tree =
-            region1.getTree(false).merge(region2.getTree(false), new DifferenceMerger(region1, region2));
-        tree.visit(nodeCleaner);
-        return region1.buildNew(tree);
-    }
-
-    /** Get the complement of the region (exchanged interior/exterior).
-     * @param region region to complement, it will not modified, a new
-     * region independent region will be built
-     * @return a new region, complement of the specified one
-     */
-    /** Get the complement of the region (exchanged interior/exterior).
-     * @param region region to complement, it will not modified, a new
-     * region independent region will be built
-     * @return a new region, complement of the specified one
-     */
-    public Region<S> getComplement(final Region<S> region) {
-        return region.buildNew(recurseComplement(region.getTree(false)));
-    }
-
-    /** Recursively build the complement of a BSP tree.
-     * @param node current node of the original tree
-     * @return new tree, complement of the node
-     */
-    private BSPTree<S> recurseComplement(final BSPTree<S> node) {
-
-        // transform the tree, except for boundary attribute splitters
-        final Map<BSPTree<S>, BSPTree<S>> map = new HashMap<BSPTree<S>, BSPTree<S>>();
-        final BSPTree<S> transformedTree = recurseComplement(node, map);
-
-        // set up the boundary attributes splitters
-        for (final Map.Entry<BSPTree<S>, BSPTree<S>> entry : map.entrySet()) {
-            if (entry.getKey().getCut() != null) {
-                @SuppressWarnings("unchecked")
-                BoundaryAttribute<S> original = (BoundaryAttribute<S>) entry.getKey().getAttribute();
-                if (original != null) {
-                    @SuppressWarnings("unchecked")
-                    BoundaryAttribute<S> transformed = (BoundaryAttribute<S>) entry.getValue().getAttribute();
-                    for (final BSPTree<S> splitter : original.getSplitters()) {
-                        transformed.getSplitters().add(map.get(splitter));
-                    }
-                }
-            }
-        }
-
-        return transformedTree;
-
-    }
-
-    /** Recursively build the complement of a BSP tree.
-     * @param node current node of the original tree
-     * @param map transformed nodes map
-     * @return new tree, complement of the node
-     */
-    private BSPTree<S> recurseComplement(final BSPTree<S> node,
-                                         final Map<BSPTree<S>, BSPTree<S>> map) {
-
-        final BSPTree<S> transformedNode;
-        if (node.getCut() == null) {
-            transformedNode = new BSPTree<S>(((Boolean) node.getAttribute()) ? Boolean.FALSE : Boolean.TRUE);
-        } else {
-
-            @SuppressWarnings("unchecked")
-            BoundaryAttribute<S> attribute = (BoundaryAttribute<S>) node.getAttribute();
-            if (attribute != null) {
-                final SubHyperplane<S> plusOutside =
-                        (attribute.getPlusInside() == null) ? null : attribute.getPlusInside().copySelf();
-                final SubHyperplane<S> plusInside  =
-                        (attribute.getPlusOutside() == null) ? null : attribute.getPlusOutside().copySelf();
-                // we start with an empty list of splitters, it will be filled in out of recursion
-                attribute = new BoundaryAttribute<S>(plusOutside, plusInside, new NodesSet<S>());
-            }
-
-            transformedNode = new BSPTree<S>(node.getCut().copySelf(),
-                                             recurseComplement(node.getPlus(),  map),
-                                             recurseComplement(node.getMinus(), map),
-                                             attribute);
-        }
-
-        map.put(node, transformedNode);
-        return transformedNode;
-
-    }
-
-    /** BSP tree leaf merger computing union of two regions. */
-    private class UnionMerger implements BSPTree.LeafMerger<S> {
-        /** {@inheritDoc} */
-        public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
-                                final BSPTree<S> parentTree,
-                                final boolean isPlusChild, final boolean leafFromInstance) {
-            if ((Boolean) leaf.getAttribute()) {
-                // the leaf node represents an inside cell
-                leaf.insertInTree(parentTree, isPlusChild, new VanishingToLeaf(true));
-                return leaf;
-            }
-            // the leaf node represents an outside cell
-            tree.insertInTree(parentTree, isPlusChild, new VanishingToLeaf(false));
-            return tree;
-        }
-    }
-
-    /** BSP tree leaf merger computing intersection of two regions. */
-    private class IntersectionMerger implements BSPTree.LeafMerger<S> {
-        /** {@inheritDoc} */
-        public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
-                                final BSPTree<S> parentTree,
-                                final boolean isPlusChild, final boolean leafFromInstance) {
-            if ((Boolean) leaf.getAttribute()) {
-                // the leaf node represents an inside cell
-                tree.insertInTree(parentTree, isPlusChild, new VanishingToLeaf(true));
-                return tree;
-            }
-            // the leaf node represents an outside cell
-            leaf.insertInTree(parentTree, isPlusChild, new VanishingToLeaf(false));
-            return leaf;
-        }
-    }
-
-    /** BSP tree leaf merger computing symmetric difference (exclusive or) of two regions. */
-    private class XorMerger implements BSPTree.LeafMerger<S> {
-        /** {@inheritDoc} */
-        public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
-                                final BSPTree<S> parentTree, final boolean isPlusChild,
-                                final boolean leafFromInstance) {
-            BSPTree<S> t = tree;
-            if ((Boolean) leaf.getAttribute()) {
-                // the leaf node represents an inside cell
-                t = recurseComplement(t);
-            }
-            t.insertInTree(parentTree, isPlusChild, new VanishingToLeaf(true));
-            return t;
-        }
-    }
-
-    /** BSP tree leaf merger computing difference of two regions. */
-    private class DifferenceMerger implements BSPTree.LeafMerger<S>, VanishingCutHandler<S> {
-
-        /** Region to subtract from. */
-        private final Region<S> region1;
-
-        /** Region to subtract. */
-        private final Region<S> region2;
-
-        /** Simple constructor.
-         * @param region1 region to subtract from
-         * @param region2 region to subtract
-         */
-        public DifferenceMerger(final Region<S> region1, final Region<S> region2) {
-            this.region1 = region1.copySelf();
-            this.region2 = region2.copySelf();
-        }
-
-        /** {@inheritDoc} */
-        public BSPTree<S> merge(final BSPTree<S> leaf, final BSPTree<S> tree,
-                                final BSPTree<S> parentTree, final boolean isPlusChild,
-                                final boolean leafFromInstance) {
-            if ((Boolean) leaf.getAttribute()) {
-                // the leaf node represents an inside cell
-                final BSPTree<S> argTree =
-                    recurseComplement(leafFromInstance ? tree : leaf);
-                argTree.insertInTree(parentTree, isPlusChild, this);
-                return argTree;
-            }
-            // the leaf node represents an outside cell
-            final BSPTree<S> instanceTree =
-                leafFromInstance ? leaf : tree;
-            instanceTree.insertInTree(parentTree, isPlusChild, this);
-            return instanceTree;
-        }
-
-        /** {@inheritDoc} */
-        public BSPTree<S> fixNode(final BSPTree<S> node) {
-            // get a representative point in the degenerate cell
-            final BSPTree<S> cell = node.pruneAroundConvexCell(Boolean.TRUE, Boolean.FALSE, null);
-            final Region<S> r = region1.buildNew(cell);
-            final Point<S> p = r.getBarycenter();
-            return new BSPTree<S>(region1.checkPoint(p) == Location.INSIDE &&
-                                  region2.checkPoint(p) == Location.OUTSIDE);
-        }
-
-    }
-
-    /** Visitor removing internal nodes attributes. */
-    private class NodesCleaner implements  BSPTreeVisitor<S> {
-
-        /** {@inheritDoc} */
-        public Order visitOrder(final BSPTree<S> node) {
-            return Order.PLUS_SUB_MINUS;
-        }
-
-        /** {@inheritDoc} */
-        public void visitInternalNode(final BSPTree<S> node) {
-            node.setAttribute(null);
-        }
-
-        /** {@inheritDoc} */
-        public void visitLeafNode(final BSPTree<S> node) {
-        }
-
-    }
-
-    /** Handler replacing nodes with vanishing cuts with leaf nodes. */
-    private class VanishingToLeaf implements VanishingCutHandler<S> {
-
-        /** Inside/outside indocator to use for ambiguous nodes. */
-        private final boolean inside;
-
-        /** Simple constructor.
-         * @param inside inside/outside indicator to use for ambiguous nodes
-         */
-        public VanishingToLeaf(final boolean inside) {
-            this.inside = inside;
-        }
-
-        /** {@inheritDoc} */
-        public BSPTree<S> fixNode(final BSPTree<S> node) {
-            if (node.getPlus().getAttribute().equals(node.getMinus().getAttribute())) {
-                // no ambiguity
-                return new BSPTree<S>(node.getPlus().getAttribute());
-            } else {
-                // ambiguous node
-                return new BSPTree<S>(inside);
-            }
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/Side.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/Side.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/Side.java
deleted file mode 100644
index c9a1357..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/Side.java
+++ /dev/null
@@ -1,37 +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.geometry.partitioning;
-
-/** Enumerate representing the location of an element with respect to an
- * {@link Hyperplane hyperplane} of a space.
- * @since 3.0
- */
-public enum Side {
-
-    /** Code for the plus side of the hyperplane. */
-    PLUS,
-
-    /** Code for the minus side of the hyperplane. */
-    MINUS,
-
-    /** Code for elements crossing the hyperplane from plus to minus side. */
-    BOTH,
-
-    /** Code for the hyperplane itself. */
-    HYPER;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/SubHyperplane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/SubHyperplane.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/SubHyperplane.java
deleted file mode 100644
index 70c6043..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/SubHyperplane.java
+++ /dev/null
@@ -1,131 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** This interface represents the remaining parts of an hyperplane after
- * other parts have been chopped off.
-
- * <p>sub-hyperplanes are obtained when parts of an {@link
- * Hyperplane hyperplane} are chopped off by other hyperplanes that
- * intersect it. The remaining part is a convex region. Such objects
- * appear in {@link BSPTree BSP trees} as the intersection of a cut
- * hyperplane with the convex region which it splits, the chopping
- * hyperplanes are the cut hyperplanes closer to the tree root.</p>
-
- * <p>
- * Note that this interface is <em>not</em> intended to be implemented
- * by Apache Commons Math users, it is only intended to be implemented
- * within the library itself. New methods may be added even for minor
- * versions, which breaks compatibility for external implementations.
- * </p>
-
- * @param <S> Type of the embedding space.
-
- * @since 3.0
- */
-public interface SubHyperplane<S extends Space> {
-
-    /** Copy the instance.
-     * <p>The instance created is completely independent of the original
-     * one. A deep copy is used, none of the underlying objects are
-     * shared (except for the nodes attributes and immutable
-     * objects).</p>
-     * @return a new sub-hyperplane, copy of the instance
-     */
-    SubHyperplane<S> copySelf();
-
-    /** Get the underlying hyperplane.
-     * @return underlying hyperplane
-     */
-    Hyperplane<S> getHyperplane();
-
-    /** Check if the instance is empty.
-     * @return true if the instance is empty
-     */
-    boolean isEmpty();
-
-    /** Get the size of the instance.
-     * @return the size of the instance (this is a length in 1D, an area
-     * in 2D, a volume in 3D ...)
-     */
-    double getSize();
-
-    /** Compute the relative position of the instance with respect
-     * to an hyperplane.
-     * @param hyperplane hyperplane to check instance against
-     * @return one of {@link Side#PLUS}, {@link Side#MINUS}, {@link Side#BOTH},
-     * {@link Side#HYPER}
-     */
-    Side side(Hyperplane<S> hyperplane);
-
-    /** Split the instance in two parts by an hyperplane.
-     * @param hyperplane splitting hyperplane
-     * @return an object containing both the part of the instance
-     * on the plus side of the hyperplane and the part of the
-     * instance on the minus side of the hyperplane
-     */
-    SplitSubHyperplane<S> split(Hyperplane<S> hyperplane);
-
-    /** Compute the union of the instance and another sub-hyperplane.
-     * @param other other sub-hyperplane to union (<em>must</em> be in the
-     * same hyperplane as the instance)
-     * @return a new sub-hyperplane, union of the instance and other
-     */
-    SubHyperplane<S> reunite(SubHyperplane<S> other);
-
-    /** Class holding the results of the {@link #split split} method.
-     * @param <U> Type of the embedding space.
-     */
-    public static class SplitSubHyperplane<U extends Space> {
-
-        /** Part of the sub-hyperplane on the plus side of the splitting hyperplane. */
-        private final SubHyperplane<U> plus;
-
-        /** Part of the sub-hyperplane on the minus side of the splitting hyperplane. */
-        private final SubHyperplane<U> minus;
-
-        /** Build a SplitSubHyperplane from its parts.
-         * @param plus part of the sub-hyperplane on the plus side of the
-         * splitting hyperplane
-         * @param minus part of the sub-hyperplane on the minus side of the
-         * splitting hyperplane
-         */
-        public SplitSubHyperplane(final SubHyperplane<U> plus,
-                                  final SubHyperplane<U> minus) {
-            this.plus  = plus;
-            this.minus = minus;
-        }
-
-        /** Get the part of the sub-hyperplane on the plus side of the splitting hyperplane.
-         * @return part of the sub-hyperplane on the plus side of the splitting hyperplane
-         */
-        public SubHyperplane<U> getPlus() {
-            return plus;
-        }
-
-        /** Get the part of the sub-hyperplane on the minus side of the splitting hyperplane.
-         * @return part of the sub-hyperplane on the minus side of the splitting hyperplane
-         */
-        public SubHyperplane<U> getMinus() {
-            return minus;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/Transform.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/Transform.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/Transform.java
deleted file mode 100644
index ba0c1dd..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/Transform.java
+++ /dev/null
@@ -1,80 +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.geometry.partitioning;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-
-/** This interface represents an inversible affine transform in a space.
- * <p>Inversible affine transform include for example scalings,
- * translations, rotations.</p>
-
- * <p>Transforms are dimension-specific. The consistency rules between
- * the three {@code apply} methods are the following ones for a
- * transformed defined for dimension D:</p>
- * <ul>
- *   <li>
- *     the transform can be applied to a point in the
- *     D-dimension space using its {@link #apply(Point)}
- *     method
- *   </li>
- *   <li>
- *     the transform can be applied to a (D-1)-dimension
- *     hyperplane in the D-dimension space using its
- *     {@link #apply(Hyperplane)} method
- *   </li>
- *   <li>
- *     the transform can be applied to a (D-2)-dimension
- *     sub-hyperplane in a (D-1)-dimension hyperplane using
- *     its {@link #apply(SubHyperplane, Hyperplane, Hyperplane)}
- *     method
- *   </li>
- * </ul>
-
- * @param <S> Type of the embedding space.
- * @param <T> Type of the embedded sub-space.
-
- * @since 3.0
- */
-public interface Transform<S extends Space, T extends Space> {
-
-    /** Transform a point of a space.
-     * @param point point to transform
-     * @return a new object representing the transformed point
-     */
-    Point<S> apply(Point<S> point);
-
-    /** Transform an hyperplane of a space.
-     * @param hyperplane hyperplane to transform
-     * @return a new object representing the transformed hyperplane
-     */
-    Hyperplane<S> apply(Hyperplane<S> hyperplane);
-
-    /** Transform a sub-hyperplane embedded in an hyperplane.
-     * @param sub sub-hyperplane to transform
-     * @param original hyperplane in which the sub-hyperplane is
-     * defined (this is the original hyperplane, the transform has
-     * <em>not</em> been applied to it)
-     * @param transformed hyperplane in which the sub-hyperplane is
-     * defined (this is the transformed hyperplane, the transform
-     * <em>has</em> been applied to it)
-     * @return a new object representing the transformed sub-hyperplane
-     */
-    SubHyperplane<T> apply(SubHyperplane<T> sub, Hyperplane<S> original, Hyperplane<S> transformed);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/package-info.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/package-info.java
deleted file mode 100644
index 6e63c73..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/package-info.java
+++ /dev/null
@@ -1,114 +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.
- */
-/**
- *
- * This package provides classes to implement Binary Space Partition trees.
- *
- * <p>
- * {@link org.apache.commons.math3.geometry.partitioning.BSPTree BSP trees}
- * are an efficient way to represent parts of space and in particular
- * polytopes (line segments in 1D, polygons in 2D and polyhedrons in 3D)
- * and to operate on them. The main principle is to recursively subdivide
- * the space using simple hyperplanes (points in 1D, lines in 2D, planes
- * in 3D).
- * </p>
- *
- * <p>
- * We start with a tree composed of a single node without any cut
- * hyperplane: it represents the complete space, which is a convex
- * part. If we add a cut hyperplane to this node, this represents a
- * partition with the hyperplane at the node level and two half spaces at
- * each side of the cut hyperplane. These half-spaces are represented by
- * two child nodes without any cut hyperplanes associated, the plus child
- * which represents the half space on the plus side of the cut hyperplane
- * and the minus child on the other side. Continuing the subdivisions, we
- * end up with a tree having internal nodes that are associated with a
- * cut hyperplane and leaf nodes without any hyperplane which correspond
- * to convex parts.
- * </p>
- *
- * <p>
- * When BSP trees are used to represent polytopes, the convex parts are
- * known to be completely inside or outside the polytope as long as there
- * is no facet in the part (which is obviously the case if the cut
- * hyperplanes have been chosen as the underlying hyperplanes of the
- * facets (this is called an autopartition) and if the subdivision
- * process has been continued until all facets have been processed. It is
- * important to note that the polytope is <em>not</em> defined by a
- * single part, but by several convex ones. This is the property that
- * allows BSP-trees to represent non-convex polytopes despites all parts
- * are convex. The {@link
- * org.apache.commons.math3.geometry.partitioning.Region Region} class is
- * devoted to this representation, it is build on top of the {@link
- * org.apache.commons.math3.geometry.partitioning.BSPTree BSPTree} class using
- * boolean objects as the leaf nodes attributes to represent the
- * inside/outside property of each leaf part, and also adds various
- * methods dealing with boundaries (i.e. the separation between the
- * inside and the outside parts).
- * </p>
- *
- * <p>
- * Rather than simply associating the internal nodes with an hyperplane,
- * we consider <em>sub-hyperplanes</em> which correspond to the part of
- * the hyperplane that is inside the convex part defined by all the
- * parent nodes (this implies that the sub-hyperplane at root node is in
- * fact a complete hyperplane, because there is no parent to bound
- * it). Since the parts are convex, the sub-hyperplanes are convex, in
- * 3D the convex parts are convex polyhedrons, and the sub-hyperplanes
- * are convex polygons that cut these polyhedrons in two
- * sub-polyhedrons. Using this definition, a BSP tree completely
- * partitions the space. Each point either belongs to one of the
- * sub-hyperplanes in an internal node or belongs to one of the leaf
- * convex parts.
- * </p>
- *
- * <p>
- * In order to determine where a point is, it is sufficient to check its
- * position with respect to the root cut hyperplane, to select the
- * corresponding child tree and to repeat the procedure recursively,
- * until either the point appears to be exactly on one of the hyperplanes
- * in the middle of the tree or to be in one of the leaf parts. For
- * this operation, it is sufficient to consider the complete hyperplanes,
- * there is no need to check the points with the boundary of the
- * sub-hyperplanes, because this check has in fact already been realized
- * by the recursive descent in the tree. This is very easy to do and very
- * efficient, especially if the tree is well balanced (the cost is
- * <code>O(log(n))</code> where <code>n</code> is the number of facets)
- * or if the first tree levels close to the root discriminate large parts
- * of the total space.
- * </p>
- *
- * <p>
- * One of the main sources for the development of this package was Bruce
- * Naylor, John Amanatides and William Thibault paper <a
- * href="http://www.cs.yorku.ca/~amana/research/bsptSetOp.pdf">Merging
- * BSP Trees Yields Polyhedral Set Operations</a> Proc. Siggraph '90,
- * Computer Graphics 24(4), August 1990, pp 115-124, published by the
- * Association for Computing Machinery (ACM). The same paper can also be
- * found <a
- * href="http://www.cs.utexas.edu/users/fussell/courses/cs384g/bsp_treemerge.pdf">here</a>.
- * </p>
- *
- * <p>
- * Note that the interfaces defined in this package are <em>not</em> intended to
- * be implemented by Apache Commons Math users, they are only intended to be
- * implemented within the library itself. New methods may be added even for
- * minor versions, which breaks compatibility for external implementations.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.partitioning;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/AVLTree.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/AVLTree.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/AVLTree.java
deleted file mode 100644
index 9412421..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/AVLTree.java
+++ /dev/null
@@ -1,634 +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.geometry.partitioning.utilities;
-
-/** This class implements AVL trees.
- *
- * <p>The purpose of this class is to sort elements while allowing
- * duplicate elements (i.e. such that {@code a.equals(b)} is
- * true). The {@code SortedSet} interface does not allow this, so
- * a specific class is needed. Null elements are not allowed.</p>
- *
- * <p>Since the {@code equals} method is not sufficient to
- * differentiate elements, the {@link #delete delete} method is
- * implemented using the equality operator.</p>
- *
- * <p>In order to clearly mark the methods provided here do not have
- * the same semantics as the ones specified in the
- * {@code SortedSet} interface, different names are used
- * ({@code add} has been replaced by {@link #insert insert} and
- * {@code remove} has been replaced by {@link #delete
- * delete}).</p>
- *
- * <p>This class is based on the C implementation Georg Kraml has put
- * in the public domain. Unfortunately, his <a
- * href="www.purists.org/georg/avltree/index.html">page</a> seems not
- * to exist any more.</p>
- *
- * @param <T> the type of the elements
- *
- * @since 3.0
- * @deprecated as of 3.4, this class is not used anymore and considered
- * to be out of scope of Apache Commons Math
- */
-@Deprecated
-public class AVLTree<T extends Comparable<T>> {
-
-    /** Top level node. */
-    private Node top;
-
-    /** Build an empty tree.
-     */
-    public AVLTree() {
-        top = null;
-    }
-
-    /** Insert an element in the tree.
-     * @param element element to insert (silently ignored if null)
-     */
-    public void insert(final T element) {
-        if (element != null) {
-            if (top == null) {
-                top = new Node(element, null);
-            } else {
-                top.insert(element);
-            }
-        }
-    }
-
-    /** Delete an element from the tree.
-     * <p>The element is deleted only if there is a node {@code n}
-     * containing exactly the element instance specified, i.e. for which
-     * {@code n.getElement() == element}. This is purposely
-     * <em>different</em> from the specification of the
-     * {@code java.util.Set} {@code remove} method (in fact,
-     * this is the reason why a specific class has been developed).</p>
-     * @param element element to delete (silently ignored if null)
-     * @return true if the element was deleted from the tree
-     */
-    public boolean delete(final T element) {
-        if (element != null) {
-            for (Node node = getNotSmaller(element); node != null; node = node.getNext()) {
-                // loop over all elements neither smaller nor larger
-                // than the specified one
-                if (node.element == element) {
-                    node.delete();
-                    return true;
-                } else if (node.element.compareTo(element) > 0) {
-                    // all the remaining elements are known to be larger,
-                    // the element is not in the tree
-                    return false;
-                }
-            }
-        }
-        return false;
-    }
-
-    /** Check if the tree is empty.
-     * @return true if the tree is empty
-     */
-    public boolean isEmpty() {
-        return top == null;
-    }
-
-
-    /** Get the number of elements of the tree.
-     * @return number of elements contained in the tree
-     */
-    public int size() {
-        return (top == null) ? 0 : top.size();
-    }
-
-    /** Get the node whose element is the smallest one in the tree.
-     * @return the tree node containing the smallest element in the tree
-     * or null if the tree is empty
-     * @see #getLargest
-     * @see #getNotSmaller
-     * @see #getNotLarger
-     * @see Node#getPrevious
-     * @see Node#getNext
-     */
-    public Node getSmallest() {
-        return (top == null) ? null : top.getSmallest();
-    }
-
-    /** Get the node whose element is the largest one in the tree.
-     * @return the tree node containing the largest element in the tree
-     * or null if the tree is empty
-     * @see #getSmallest
-     * @see #getNotSmaller
-     * @see #getNotLarger
-     * @see Node#getPrevious
-     * @see Node#getNext
-     */
-    public Node getLargest() {
-        return (top == null) ? null : top.getLargest();
-    }
-
-    /** Get the node whose element is not smaller than the reference object.
-     * @param reference reference object (may not be in the tree)
-     * @return the tree node containing the smallest element not smaller
-     * than the reference object or null if either the tree is empty or
-     * all its elements are smaller than the reference object
-     * @see #getSmallest
-     * @see #getLargest
-     * @see #getNotLarger
-     * @see Node#getPrevious
-     * @see Node#getNext
-     */
-    public Node getNotSmaller(final T reference) {
-        Node candidate = null;
-        for (Node node = top; node != null;) {
-            if (node.element.compareTo(reference) < 0) {
-                if (node.right == null) {
-                    return candidate;
-                }
-                node = node.right;
-            } else {
-                candidate = node;
-                if (node.left == null) {
-                    return candidate;
-                }
-                node = node.left;
-            }
-        }
-        return null;
-    }
-
-    /** Get the node whose element is not larger than the reference object.
-     * @param reference reference object (may not be in the tree)
-     * @return the tree node containing the largest element not larger
-     * than the reference object (in which case the node is guaranteed
-     * not to be empty) or null if either the tree is empty or all its
-     * elements are larger than the reference object
-     * @see #getSmallest
-     * @see #getLargest
-     * @see #getNotSmaller
-     * @see Node#getPrevious
-     * @see Node#getNext
-     */
-    public Node getNotLarger(final T reference) {
-        Node candidate = null;
-        for (Node node = top; node != null;) {
-            if (node.element.compareTo(reference) > 0) {
-                if (node.left == null) {
-                    return candidate;
-                }
-                node = node.left;
-            } else {
-                candidate = node;
-                if (node.right == null) {
-                    return candidate;
-                }
-                node = node.right;
-            }
-        }
-        return null;
-    }
-
-    /** Enum for tree skew factor. */
-    private static enum Skew {
-        /** Code for left high trees. */
-        LEFT_HIGH,
-
-        /** Code for right high trees. */
-        RIGHT_HIGH,
-
-        /** Code for Skew.BALANCED trees. */
-        BALANCED;
-    }
-
-    /** This class implements AVL trees nodes.
-     * <p>AVL tree nodes implement all the logical structure of the
-     * tree. Nodes are created by the {@link AVLTree AVLTree} class.</p>
-     * <p>The nodes are not independant from each other but must obey
-     * specific balancing constraints and the tree structure is
-     * rearranged as elements are inserted or deleted from the tree. The
-     * creation, modification and tree-related navigation methods have
-     * therefore restricted access. Only the order-related navigation,
-     * reading and delete methods are public.</p>
-     * @see AVLTree
-     */
-    public class Node {
-
-        /** Element contained in the current node. */
-        private T element;
-
-        /** Left sub-tree. */
-        private Node left;
-
-        /** Right sub-tree. */
-        private Node right;
-
-        /** Parent tree. */
-        private Node parent;
-
-        /** Skew factor. */
-        private Skew skew;
-
-        /** Build a node for a specified element.
-         * @param element element
-         * @param parent parent node
-         */
-        Node(final T element, final Node parent) {
-            this.element = element;
-            left         = null;
-            right        = null;
-            this.parent  = parent;
-            skew         = Skew.BALANCED;
-        }
-
-        /** Get the contained element.
-         * @return element contained in the node
-         */
-        public T getElement() {
-            return element;
-        }
-
-        /** Get the number of elements of the tree rooted at this node.
-         * @return number of elements contained in the tree rooted at this node
-         */
-        int size() {
-            return 1 + ((left  == null) ? 0 : left.size()) + ((right == null) ? 0 : right.size());
-        }
-
-        /** Get the node whose element is the smallest one in the tree
-         * rooted at this node.
-         * @return the tree node containing the smallest element in the
-         * tree rooted at this node or null if the tree is empty
-         * @see #getLargest
-         */
-        Node getSmallest() {
-            Node node = this;
-            while (node.left != null) {
-                node = node.left;
-            }
-            return node;
-        }
-
-        /** Get the node whose element is the largest one in the tree
-         * rooted at this node.
-         * @return the tree node containing the largest element in the
-         * tree rooted at this node or null if the tree is empty
-         * @see #getSmallest
-         */
-        Node getLargest() {
-            Node node = this;
-            while (node.right != null) {
-                node = node.right;
-            }
-            return node;
-        }
-
-        /** Get the node containing the next smaller or equal element.
-         * @return node containing the next smaller or equal element or
-         * null if there is no smaller or equal element in the tree
-         * @see #getNext
-         */
-        public Node getPrevious() {
-
-            if (left != null) {
-                final Node node = left.getLargest();
-                if (node != null) {
-                    return node;
-                }
-            }
-
-            for (Node node = this; node.parent != null; node = node.parent) {
-                if (node != node.parent.left) {
-                    return node.parent;
-                }
-            }
-
-            return null;
-
-        }
-
-        /** Get the node containing the next larger or equal element.
-         * @return node containing the next larger or equal element (in
-         * which case the node is guaranteed not to be empty) or null if
-         * there is no larger or equal element in the tree
-         * @see #getPrevious
-         */
-        public Node getNext() {
-
-            if (right != null) {
-                final Node node = right.getSmallest();
-                if (node != null) {
-                    return node;
-                }
-            }
-
-            for (Node node = this; node.parent != null; node = node.parent) {
-                if (node != node.parent.right) {
-                    return node.parent;
-                }
-            }
-
-            return null;
-
-        }
-
-        /** Insert an element in a sub-tree.
-         * @param newElement element to insert
-         * @return true if the parent tree should be re-Skew.BALANCED
-         */
-        boolean insert(final T newElement) {
-            if (newElement.compareTo(this.element) < 0) {
-                // the inserted element is smaller than the node
-                if (left == null) {
-                    left = new Node(newElement, this);
-                    return rebalanceLeftGrown();
-                }
-                return left.insert(newElement) ? rebalanceLeftGrown() : false;
-            }
-
-            // the inserted element is equal to or greater than the node
-            if (right == null) {
-                right = new Node(newElement, this);
-                return rebalanceRightGrown();
-            }
-            return right.insert(newElement) ? rebalanceRightGrown() : false;
-
-        }
-
-        /** Delete the node from the tree.
-         */
-        public void delete() {
-            if ((parent == null) && (left == null) && (right == null)) {
-                // this was the last node, the tree is now empty
-                element = null;
-                top     = null;
-            } else {
-
-                Node node;
-                Node child;
-                boolean leftShrunk;
-                if ((left == null) && (right == null)) {
-                    node       = this;
-                    element    = null;
-                    leftShrunk = node == node.parent.left;
-                    child      = null;
-                } else {
-                    node       = (left != null) ? left.getLargest() : right.getSmallest();
-                    element    = node.element;
-                    leftShrunk = node == node.parent.left;
-                    child      = (node.left != null) ? node.left : node.right;
-                }
-
-                node = node.parent;
-                if (leftShrunk) {
-                    node.left = child;
-                } else {
-                    node.right = child;
-                }
-                if (child != null) {
-                    child.parent = node;
-                }
-
-                while (leftShrunk ? node.rebalanceLeftShrunk() : node.rebalanceRightShrunk()) {
-                    if (node.parent == null) {
-                        return;
-                    }
-                    leftShrunk = node == node.parent.left;
-                    node = node.parent;
-                }
-
-            }
-        }
-
-        /** Re-balance the instance as left sub-tree has grown.
-         * @return true if the parent tree should be reSkew.BALANCED too
-         */
-        private boolean rebalanceLeftGrown() {
-            switch (skew) {
-            case LEFT_HIGH:
-                if (left.skew == Skew.LEFT_HIGH) {
-                    rotateCW();
-                    skew       = Skew.BALANCED;
-                    right.skew = Skew.BALANCED;
-                } else {
-                    final Skew s = left.right.skew;
-                    left.rotateCCW();
-                    rotateCW();
-                    switch(s) {
-                    case LEFT_HIGH:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.RIGHT_HIGH;
-                        break;
-                    case RIGHT_HIGH:
-                        left.skew  = Skew.LEFT_HIGH;
-                        right.skew = Skew.BALANCED;
-                        break;
-                    default:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.BALANCED;
-                    }
-                    skew = Skew.BALANCED;
-                }
-                return false;
-            case RIGHT_HIGH:
-                skew = Skew.BALANCED;
-                return false;
-            default:
-                skew = Skew.LEFT_HIGH;
-                return true;
-            }
-        }
-
-        /** Re-balance the instance as right sub-tree has grown.
-         * @return true if the parent tree should be reSkew.BALANCED too
-         */
-        private boolean rebalanceRightGrown() {
-            switch (skew) {
-            case LEFT_HIGH:
-                skew = Skew.BALANCED;
-                return false;
-            case RIGHT_HIGH:
-                if (right.skew == Skew.RIGHT_HIGH) {
-                    rotateCCW();
-                    skew      = Skew.BALANCED;
-                    left.skew = Skew.BALANCED;
-                } else {
-                    final Skew s = right.left.skew;
-                    right.rotateCW();
-                    rotateCCW();
-                    switch (s) {
-                    case LEFT_HIGH:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.RIGHT_HIGH;
-                        break;
-                    case RIGHT_HIGH:
-                        left.skew  = Skew.LEFT_HIGH;
-                        right.skew = Skew.BALANCED;
-                        break;
-                    default:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.BALANCED;
-                    }
-                    skew = Skew.BALANCED;
-                }
-                return false;
-            default:
-                skew = Skew.RIGHT_HIGH;
-                return true;
-            }
-        }
-
-        /** Re-balance the instance as left sub-tree has shrunk.
-         * @return true if the parent tree should be reSkew.BALANCED too
-         */
-        private boolean rebalanceLeftShrunk() {
-            switch (skew) {
-            case LEFT_HIGH:
-                skew = Skew.BALANCED;
-                return true;
-            case RIGHT_HIGH:
-                if (right.skew == Skew.RIGHT_HIGH) {
-                    rotateCCW();
-                    skew      = Skew.BALANCED;
-                    left.skew = Skew.BALANCED;
-                    return true;
-                } else if (right.skew == Skew.BALANCED) {
-                    rotateCCW();
-                    skew      = Skew.LEFT_HIGH;
-                    left.skew = Skew.RIGHT_HIGH;
-                    return false;
-                } else {
-                    final Skew s = right.left.skew;
-                    right.rotateCW();
-                    rotateCCW();
-                    switch (s) {
-                    case LEFT_HIGH:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.RIGHT_HIGH;
-                        break;
-                    case RIGHT_HIGH:
-                        left.skew  = Skew.LEFT_HIGH;
-                        right.skew = Skew.BALANCED;
-                        break;
-                    default:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.BALANCED;
-                    }
-                    skew = Skew.BALANCED;
-                    return true;
-                }
-            default:
-                skew = Skew.RIGHT_HIGH;
-                return false;
-            }
-        }
-
-        /** Re-balance the instance as right sub-tree has shrunk.
-         * @return true if the parent tree should be reSkew.BALANCED too
-         */
-        private boolean rebalanceRightShrunk() {
-            switch (skew) {
-            case RIGHT_HIGH:
-                skew = Skew.BALANCED;
-                return true;
-            case LEFT_HIGH:
-                if (left.skew == Skew.LEFT_HIGH) {
-                    rotateCW();
-                    skew       = Skew.BALANCED;
-                    right.skew = Skew.BALANCED;
-                    return true;
-                } else if (left.skew == Skew.BALANCED) {
-                    rotateCW();
-                    skew       = Skew.RIGHT_HIGH;
-                    right.skew = Skew.LEFT_HIGH;
-                    return false;
-                } else {
-                    final Skew s = left.right.skew;
-                    left.rotateCCW();
-                    rotateCW();
-                    switch (s) {
-                    case LEFT_HIGH:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.RIGHT_HIGH;
-                        break;
-                    case RIGHT_HIGH:
-                        left.skew  = Skew.LEFT_HIGH;
-                        right.skew = Skew.BALANCED;
-                        break;
-                    default:
-                        left.skew  = Skew.BALANCED;
-                        right.skew = Skew.BALANCED;
-                    }
-                    skew = Skew.BALANCED;
-                    return true;
-                }
-            default:
-                skew = Skew.LEFT_HIGH;
-                return false;
-            }
-        }
-
-        /** Perform a clockwise rotation rooted at the instance.
-         * <p>The skew factor are not updated by this method, they
-         * <em>must</em> be updated by the caller</p>
-         */
-        private void rotateCW() {
-
-            final T tmpElt       = element;
-            element              = left.element;
-            left.element         = tmpElt;
-
-            final Node tmpNode   = left;
-            left                 = tmpNode.left;
-            tmpNode.left         = tmpNode.right;
-            tmpNode.right        = right;
-            right                = tmpNode;
-
-            if (left != null) {
-                left.parent = this;
-            }
-            if (right.right != null) {
-                right.right.parent = right;
-            }
-
-        }
-
-        /** Perform a counter-clockwise rotation rooted at the instance.
-         * <p>The skew factor are not updated by this method, they
-         * <em>must</em> be updated by the caller</p>
-         */
-        private void rotateCCW() {
-
-            final T tmpElt        = element;
-            element               = right.element;
-            right.element         = tmpElt;
-
-            final Node tmpNode    = right;
-            right                 = tmpNode.right;
-            tmpNode.right         = tmpNode.left;
-            tmpNode.left          = left;
-            left                  = tmpNode;
-
-            if (right != null) {
-                right.parent = this;
-            }
-            if (left.left != null) {
-                left.left.parent = left;
-            }
-
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
deleted file mode 100644
index 2dad2d7..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/OrderedTuple.java
+++ /dev/null
@@ -1,431 +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.geometry.partitioning.utilities;
-
-import java.util.Arrays;
-
-import org.apache.commons.math3.util.FastMath;
-
-/** This class implements an ordering operation for T-uples.
- *
- * <p>Ordering is done by encoding all components of the T-uple into a
- * single scalar value and using this value as the sorting
- * key. Encoding is performed using the method invented by Georg
- * Cantor in 1877 when he proved it was possible to establish a
- * bijection between a line and a plane. The binary representations of
- * the components of the T-uple are mixed together to form a single
- * scalar. This means that the 2<sup>k</sup> bit of component 0 is
- * followed by the 2<sup>k</sup> bit of component 1, then by the
- * 2<sup>k</sup> bit of component 2 up to the 2<sup>k</sup> bit of
- * component {@code t}, which is followed by the 2<sup>k-1</sup>
- * bit of component 0, followed by the 2<sup>k-1</sup> bit of
- * component 1 ... The binary representations are extended as needed
- * to handle numbers with different scales and a suitable
- * 2<sup>p</sup> offset is added to the components in order to avoid
- * negative numbers (this offset is adjusted as needed during the
- * comparison operations).</p>
- *
- * <p>The more interesting property of the encoding method for our
- * purpose is that it allows to select all the points that are in a
- * given range. This is depicted in dimension 2 by the following
- * picture:</p>
- *
- * <img src="doc-files/OrderedTuple.png" />
- *
- * <p>This picture shows a set of 100000 random 2-D pairs having their
- * first component between -50 and +150 and their second component
- * between -350 and +50. We wanted to extract all pairs having their
- * first component between +30 and +70 and their second component
- * between -120 and -30. We built the lower left point at coordinates
- * (30, -120) and the upper right point at coordinates (70, -30). All
- * points smaller than the lower left point are drawn in red and all
- * points larger than the upper right point are drawn in blue. The
- * green points are between the two limits. This picture shows that
- * all the desired points are selected, along with spurious points. In
- * this case, we get 15790 points, 4420 of which really belonging to
- * the desired rectangle. It is possible to extract very small
- * subsets. As an example extracting from the same 100000 points set
- * the points having their first component between +30 and +31 and
- * their second component between -91 and -90, we get a subset of 11
- * points, 2 of which really belonging to the desired rectangle.</p>
- *
- * <p>the previous selection technique can be applied in all
- * dimensions, still using two points to define the interval. The
- * first point will have all its components set to their lower bounds
- * while the second point will have all its components set to their
- * upper bounds.</p>
- *
- * <p>T-uples with negative infinite or positive infinite components
- * are sorted logically.</p>
- *
- * <p>Since the specification of the {@code Comparator} interface
- * allows only {@code ClassCastException} errors, some arbitrary
- * choices have been made to handle specific cases. The rationale for
- * these choices is to keep <em>regular</em> and consistent T-uples
- * together.</p>
- * <ul>
- * <li>instances with different dimensions are sorted according to
- * their dimension regardless of their components values</li>
- * <li>instances with {@code Double.NaN} components are sorted
- * after all other ones (even after instances with positive infinite
- * components</li>
- * <li>instances with both positive and negative infinite components
- * are considered as if they had {@code Double.NaN}
- * components</li>
- * </ul>
- *
- * @since 3.0
- * @deprecated as of 3.4, this class is not used anymore and considered
- * to be out of scope of Apache Commons Math
- */
-@Deprecated
-public class OrderedTuple implements Comparable<OrderedTuple> {
-
-    /** Sign bit mask. */
-    private static final long SIGN_MASK     = 0x8000000000000000L;
-
-    /** Exponent bits mask. */
-    private static final long EXPONENT_MASK = 0x7ff0000000000000L;
-
-    /** Mantissa bits mask. */
-    private static final long MANTISSA_MASK = 0x000fffffffffffffL;
-
-    /** Implicit MSB for normalized numbers. */
-    private static final long IMPLICIT_ONE  = 0x0010000000000000L;
-
-    /** Double components of the T-uple. */
-    private double[] components;
-
-    /** Offset scale. */
-    private int offset;
-
-    /** Least Significant Bit scale. */
-    private int lsb;
-
-    /** Ordering encoding of the double components. */
-    private long[] encoding;
-
-    /** Positive infinity marker. */
-    private boolean posInf;
-
-    /** Negative infinity marker. */
-    private boolean negInf;
-
-    /** Not A Number marker. */
-    private boolean nan;
-
-    /** Build an ordered T-uple from its components.
-     * @param components double components of the T-uple
-     */
-    public OrderedTuple(final double ... components) {
-        this.components = components.clone();
-        int msb = Integer.MIN_VALUE;
-        lsb     = Integer.MAX_VALUE;
-        posInf  = false;
-        negInf  = false;
-        nan     = false;
-        for (int i = 0; i < components.length; ++i) {
-            if (Double.isInfinite(components[i])) {
-                if (components[i] < 0) {
-                    negInf = true;
-                } else {
-                    posInf = true;
-                }
-            } else if (Double.isNaN(components[i])) {
-                nan = true;
-            } else {
-                final long b = Double.doubleToLongBits(components[i]);
-                final long m = mantissa(b);
-                if (m != 0) {
-                    final int e = exponent(b);
-                    msb = FastMath.max(msb, e + computeMSB(m));
-                    lsb = FastMath.min(lsb, e + computeLSB(m));
-                }
-            }
-        }
-
-        if (posInf && negInf) {
-            // instance cannot be sorted logically
-            posInf = false;
-            negInf = false;
-            nan    = true;
-        }
-
-        if (lsb <= msb) {
-            // encode the T-upple with the specified offset
-            encode(msb + 16);
-        } else {
-            encoding = new long[] {
-                0x0L
-            };
-        }
-
-    }
-
-    /** Encode the T-uple with a given offset.
-     * @param minOffset minimal scale of the offset to add to all
-     * components (must be greater than the MSBs of all components)
-     */
-    private void encode(final int minOffset) {
-
-        // choose an offset with some margins
-        offset  = minOffset + 31;
-        offset -= offset % 32;
-
-        if ((encoding != null) && (encoding.length == 1) && (encoding[0] == 0x0L)) {
-            // the components are all zeroes
-            return;
-        }
-
-        // allocate an integer array to encode the components (we use only
-        // 63 bits per element because there is no unsigned long in Java)
-        final int neededBits  = offset + 1 - lsb;
-        final int neededLongs = (neededBits + 62) / 63;
-        encoding = new long[components.length * neededLongs];
-
-        // mix the bits from all components
-        int  eIndex = 0;
-        int  shift  = 62;
-        long word   = 0x0L;
-        for (int k = offset; eIndex < encoding.length; --k) {
-            for (int vIndex = 0; vIndex < components.length; ++vIndex) {
-                if (getBit(vIndex, k) != 0) {
-                    word |= 0x1L << shift;
-                }
-                if (shift-- == 0) {
-                    encoding[eIndex++] = word;
-                    word  = 0x0L;
-                    shift = 62;
-                }
-            }
-        }
-
-    }
-
-    /** Compares this ordered T-uple with the specified object.
-
-     * <p>The ordering method is detailed in the general description of
-     * the class. Its main property is to be consistent with distance:
-     * geometrically close T-uples stay close to each other when stored
-     * in a sorted collection using this comparison method.</p>
-
-     * <p>T-uples with negative infinite, positive infinite are sorted
-     * logically.</p>
-
-     * <p>Some arbitrary choices have been made to handle specific
-     * cases. The rationale for these choices is to keep
-     * <em>normal</em> and consistent T-uples together.</p>
-     * <ul>
-     * <li>instances with different dimensions are sorted according to
-     * their dimension regardless of their components values</li>
-     * <li>instances with {@code Double.NaN} components are sorted
-     * after all other ones (evan after instances with positive infinite
-     * components</li>
-     * <li>instances with both positive and negative infinite components
-     * are considered as if they had {@code Double.NaN}
-     * components</li>
-     * </ul>
-
-     * @param ot T-uple to compare instance with
-     * @return a negative integer if the instance is less than the
-     * object, zero if they are equal, or a positive integer if the
-     * instance is greater than the object
-
-     */
-    public int compareTo(final OrderedTuple ot) {
-        if (components.length == ot.components.length) {
-            if (nan) {
-                return +1;
-            } else if (ot.nan) {
-                return -1;
-            } else if (negInf || ot.posInf) {
-                return -1;
-            } else if (posInf || ot.negInf) {
-                return +1;
-            } else {
-
-                if (offset < ot.offset) {
-                    encode(ot.offset);
-                } else if (offset > ot.offset) {
-                    ot.encode(offset);
-                }
-
-                final int limit = FastMath.min(encoding.length, ot.encoding.length);
-                for (int i = 0; i < limit; ++i) {
-                    if (encoding[i] < ot.encoding[i]) {
-                        return -1;
-                    } else if (encoding[i] > ot.encoding[i]) {
-                        return +1;
-                    }
-                }
-
-                if (encoding.length < ot.encoding.length) {
-                    return -1;
-                } else if (encoding.length > ot.encoding.length) {
-                    return +1;
-                } else {
-                    return 0;
-                }
-
-            }
-        }
-
-        return components.length - ot.components.length;
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public boolean equals(final Object other) {
-        if (this == other) {
-            return true;
-        } else if (other instanceof OrderedTuple) {
-            return compareTo((OrderedTuple) other) == 0;
-        } else {
-            return false;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public int hashCode() {
-        // the following constants are arbitrary small primes
-        final int multiplier = 37;
-        final int trueHash   = 97;
-        final int falseHash  = 71;
-
-        // hash fields and combine them
-        // (we rely on the multiplier to have different combined weights
-        //  for all int fields and all boolean fields)
-        int hash = Arrays.hashCode(components);
-        hash = hash * multiplier + offset;
-        hash = hash * multiplier + lsb;
-        hash = hash * multiplier + (posInf ? trueHash : falseHash);
-        hash = hash * multiplier + (negInf ? trueHash : falseHash);
-        hash = hash * multiplier + (nan    ? trueHash : falseHash);
-
-        return hash;
-
-    }
-
-    /** Get the components array.
-     * @return array containing the T-uple components
-     */
-    public double[] getComponents() {
-        return components.clone();
-    }
-
-    /** Extract the sign from the bits of a double.
-     * @param bits binary representation of the double
-     * @return sign bit (zero if positive, non zero if negative)
-     */
-    private static long sign(final long bits) {
-        return bits & SIGN_MASK;
-    }
-
-    /** Extract the exponent from the bits of a double.
-     * @param bits binary representation of the double
-     * @return exponent
-     */
-    private static int exponent(final long bits) {
-        return ((int) ((bits & EXPONENT_MASK) >> 52)) - 1075;
-    }
-
-    /** Extract the mantissa from the bits of a double.
-     * @param bits binary representation of the double
-     * @return mantissa
-     */
-    private static long mantissa(final long bits) {
-        return ((bits & EXPONENT_MASK) == 0) ?
-               ((bits & MANTISSA_MASK) << 1) :          // subnormal number
-               (IMPLICIT_ONE | (bits & MANTISSA_MASK)); // normal number
-    }
-
-    /** Compute the most significant bit of a long.
-     * @param l long from which the most significant bit is requested
-     * @return scale of the most significant bit of {@code l},
-     * or 0 if {@code l} is zero
-     * @see #computeLSB
-     */
-    private static int computeMSB(final long l) {
-
-        long ll = l;
-        long mask  = 0xffffffffL;
-        int  scale = 32;
-        int  msb   = 0;
-
-        while (scale != 0) {
-            if ((ll & mask) != ll) {
-                msb |= scale;
-                ll >>= scale;
-            }
-            scale >>= 1;
-            mask >>= scale;
-        }
-
-        return msb;
-
-    }
-
-    /** Compute the least significant bit of a long.
-     * @param l long from which the least significant bit is requested
-     * @return scale of the least significant bit of {@code l},
-     * or 63 if {@code l} is zero
-     * @see #computeMSB
-     */
-    private static int computeLSB(final long l) {
-
-        long ll = l;
-        long mask  = 0xffffffff00000000L;
-        int  scale = 32;
-        int  lsb   = 0;
-
-        while (scale != 0) {
-            if ((ll & mask) == ll) {
-                lsb |= scale;
-                ll >>= scale;
-            }
-            scale >>= 1;
-            mask >>= scale;
-        }
-
-        return lsb;
-
-    }
-
-    /** Get a bit from the mantissa of a double.
-     * @param i index of the component
-     * @param k scale of the requested bit
-     * @return the specified bit (either 0 or 1), after the offset has
-     * been added to the double
-     */
-    private int getBit(final int i, final int k) {
-        final long bits = Double.doubleToLongBits(components[i]);
-        final int e = exponent(bits);
-        if ((k < e) || (k > offset)) {
-            return 0;
-        } else if (k == offset) {
-            return (sign(bits) == 0L) ? 1 : 0;
-        } else if (k > (e + 52)) {
-            return (sign(bits) == 0L) ? 0 : 1;
-        } else {
-            final long m = (sign(bits) == 0L) ? mantissa(bits) : -mantissa(bits);
-            return (int) ((m >> (k - e)) & 0x1L);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/doc-files/OrderedTuple.png
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/doc-files/OrderedTuple.png b/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/doc-files/OrderedTuple.png
deleted file mode 100644
index 4eca233..0000000
Binary files a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/doc-files/OrderedTuple.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/package-info.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/package-info.java
deleted file mode 100644
index 31f57f1..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/utilities/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- *
- * <p>
- * This package provides multidimensional ordering features for partitioning.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.partitioning.utilities;


[68/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizer.java
index 96f7fb2..3bc9a05 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/AbstractLeastSquaresOptimizer.java
@@ -15,31 +15,31 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
-
-import org.apache.commons.math3.analysis.DifferentiableMultivariateVectorFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.DiagonalMatrix;
-import org.apache.commons.math3.linear.DecompositionSolver;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.EigenDecomposition;
-import org.apache.commons.math3.optimization.OptimizationData;
-import org.apache.commons.math3.optimization.InitialGuess;
-import org.apache.commons.math3.optimization.Target;
-import org.apache.commons.math3.optimization.Weight;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.DifferentiableMultivariateVectorOptimizer;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateVectorOptimizer;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.optimization.general;
+
+import org.apache.commons.math4.analysis.DifferentiableMultivariateVectorFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.DiagonalMatrix;
+import org.apache.commons.math4.linear.EigenDecomposition;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.DifferentiableMultivariateVectorOptimizer;
+import org.apache.commons.math4.optimization.InitialGuess;
+import org.apache.commons.math4.optimization.OptimizationData;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.Target;
+import org.apache.commons.math4.optimization.Weight;
+import org.apache.commons.math4.optimization.direct.BaseAbstractMultivariateVectorOptimizer;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Base class for implementing least squares optimizers.
@@ -48,13 +48,13 @@ import org.apache.commons.math3.util.FastMath;
  * <br/>
  * This class constructs the Jacobian matrix of the function argument in method
  * {@link BaseAbstractMultivariateVectorOptimizer#optimize(int,
- * org.apache.commons.math3.analysis.MultivariateVectorFunction,OptimizationData[])
+ * org.apache.commons.math4.analysis.MultivariateVectorFunction,OptimizationData[])
  * optimize} and assumes that the rows of that matrix iterate on the model
  * functions while the columns iterate on the parameters; thus, the numbers
  * of rows is equal to the dimension of the
- * {@link org.apache.commons.math3.optimization.Target Target} while
+ * {@link org.apache.commons.math4.optimization.Target Target} while
  * the number of columns is equal to the dimension of the
- * {@link org.apache.commons.math3.optimization.InitialGuess InitialGuess}.
+ * {@link org.apache.commons.math4.optimization.InitialGuess InitialGuess}.
  *
  * @deprecated As of 3.1 (to be removed in 4.0).
  * @since 1.2
@@ -121,8 +121,8 @@ public abstract class AbstractLeastSquaresOptimizer
     /**
      * Simple constructor with default settings.
      * The convergence check is set to a {@link
-     * org.apache.commons.math3.optimization.SimpleVectorValueChecker}.
-     * @deprecated See {@link org.apache.commons.math3.optimization.SimpleValueChecker#SimpleValueChecker()}
+     * org.apache.commons.math4.optimization.SimpleVectorValueChecker}.
+     * @deprecated See {@link org.apache.commons.math4.optimization.SimpleValueChecker#SimpleValueChecker()}
      */
     @Deprecated
     protected AbstractLeastSquaresOptimizer() {}
@@ -194,7 +194,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * Update the residuals array and cost function value.
      * @throws DimensionMismatchException if the dimension does not match the
      * problem dimension.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
      * @deprecated As of 3.1. Please use {@link #computeResiduals(double[])},
      * {@link #computeObjectiveValue(double[])}, {@link #computeCost(double[])}
@@ -274,7 +274,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * Get the covariance matrix of the optimized parameters.
      *
      * @return the covariance matrix.
-     * @throws org.apache.commons.math3.linear.SingularMatrixException
+     * @throws org.apache.commons.math4.linear.SingularMatrixException
      * if the covariance matrix cannot be computed (singular problem).
      * @see #getCovariances(double)
      * @deprecated As of 3.1. Please use {@link #computeCovariances(double[],double)}
@@ -297,7 +297,7 @@ public abstract class AbstractLeastSquaresOptimizer
      *
      * @param threshold Singularity threshold.
      * @return the covariance matrix.
-     * @throws org.apache.commons.math3.linear.SingularMatrixException
+     * @throws org.apache.commons.math4.linear.SingularMatrixException
      * if the covariance matrix cannot be computed (singular problem).
      * @deprecated As of 3.1. Please use {@link #computeCovariances(double[],double)}
      * instead.
@@ -320,7 +320,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * @param params Model parameters.
      * @param threshold Singularity threshold.
      * @return the covariance matrix.
-     * @throws org.apache.commons.math3.linear.SingularMatrixException
+     * @throws org.apache.commons.math4.linear.SingularMatrixException
      * if the covariance matrix cannot be computed (singular problem).
      * @since 3.1
      */
@@ -358,7 +358,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * </p>
      *
      * @return an estimate of the standard deviation of the optimized parameters
-     * @throws org.apache.commons.math3.linear.SingularMatrixException
+     * @throws org.apache.commons.math4.linear.SingularMatrixException
      * if the covariance matrix cannot be computed.
      * @throws NumberIsTooSmallException if the number of degrees of freedom is not
      * positive, i.e. the number of measurements is less or equal to the number of
@@ -393,7 +393,7 @@ public abstract class AbstractLeastSquaresOptimizer
      * @param covarianceSingularityThreshold Singularity threshold (see
      * {@link #computeCovariances(double[],double) computeCovariances}).
      * @return an estimate of the standard deviation of the optimized parameters
-     * @throws org.apache.commons.math3.linear.SingularMatrixException
+     * @throws org.apache.commons.math4.linear.SingularMatrixException
      * if the covariance matrix cannot be computed.
      * @since 3.1
      */
@@ -411,7 +411,7 @@ public abstract class AbstractLeastSquaresOptimizer
     /** {@inheritDoc}
      * @deprecated As of 3.1. Please use
      * {@link BaseAbstractMultivariateVectorOptimizer#optimize(int,
-     * org.apache.commons.math3.analysis.MultivariateVectorFunction,OptimizationData[])
+     * org.apache.commons.math4.analysis.MultivariateVectorFunction,OptimizationData[])
      * optimize(int,MultivariateDifferentiableVectorFunction,OptimizationData...)}
      * instead.
      */
@@ -441,15 +441,15 @@ public abstract class AbstractLeastSquaresOptimizer
      * @return the point/value pair giving the optimal value for objective
      * function.
      * @param maxEval Maximum number of function evaluations.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if
+     * @throws org.apache.commons.math4.exception.NullArgumentException if
      * any argument is {@code null}.
      * @deprecated As of 3.1. Please use
      * {@link BaseAbstractMultivariateVectorOptimizer#optimize(int,
-     * org.apache.commons.math3.analysis.MultivariateVectorFunction,OptimizationData[])
+     * org.apache.commons.math4.analysis.MultivariateVectorFunction,OptimizationData[])
      * optimize(int,MultivariateDifferentiableVectorFunction,OptimizationData...)}
      * instead.
      */
@@ -480,12 +480,12 @@ public abstract class AbstractLeastSquaresOptimizer
      * </ul>
      * @return the point/value pair giving the optimal value of the objective
      * function.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException if
      * the maximal number of evaluations is exceeded.
      * @throws DimensionMismatchException if the target, and weight arguments
      * have inconsistent dimensions.
      * @see BaseAbstractMultivariateVectorOptimizer#optimizeInternal(int,
-     * org.apache.commons.math3.analysis.MultivariateVectorFunction,OptimizationData[])
+     * org.apache.commons.math4.analysis.MultivariateVectorFunction,OptimizationData[])
      * @since 3.1
      * @deprecated As of 3.1. Override is necessary only until this class's generic
      * argument is changed to {@code MultivariateDifferentiableVectorFunction}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/AbstractScalarDifferentiableOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/AbstractScalarDifferentiableOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/general/AbstractScalarDifferentiableOptimizer.java
index 3947c2c..1bb8cc0 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/AbstractScalarDifferentiableOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/AbstractScalarDifferentiableOptimizer.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
-import org.apache.commons.math3.analysis.DifferentiableMultivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.optimization.DifferentiableMultivariateOptimizer;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.direct.BaseAbstractMultivariateOptimizer;
+import org.apache.commons.math4.analysis.DifferentiableMultivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.DifferentiableMultivariateOptimizer;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.direct.BaseAbstractMultivariateOptimizer;
 
 /**
  * Base class for implementing optimizers for multivariate scalar
@@ -47,9 +47,9 @@ public abstract class AbstractScalarDifferentiableOptimizer
     /**
      * Simple constructor with default settings.
      * The convergence check is set to a
-     * {@link org.apache.commons.math3.optimization.SimpleValueChecker
+     * {@link org.apache.commons.math4.optimization.SimpleValueChecker
      * SimpleValueChecker}.
-     * @deprecated See {@link org.apache.commons.math3.optimization.SimpleValueChecker#SimpleValueChecker()}
+     * @deprecated See {@link org.apache.commons.math4.optimization.SimpleValueChecker#SimpleValueChecker()}
      */
     @Deprecated
     protected AbstractScalarDifferentiableOptimizer() {}
@@ -66,7 +66,7 @@ public abstract class AbstractScalarDifferentiableOptimizer
      *
      * @param evaluationPoint Point at which the gradient must be evaluated.
      * @return the gradient at the specified point.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the allowed number of evaluations is exceeded.
      */
     protected double[] computeObjectiveGradient(final double[] evaluationPoint) {
@@ -95,11 +95,11 @@ public abstract class AbstractScalarDifferentiableOptimizer
      * @param maxEval Maximum number of function evaluations.
      * @return the point/value pair giving the optimal value for objective
      * function.
-     * @throws org.apache.commons.math3.exception.DimensionMismatchException
+     * @throws org.apache.commons.math4.exception.DimensionMismatchException
      * if the start point dimension is wrong.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if
+     * @throws org.apache.commons.math4.exception.NullArgumentException if
      * any argument is {@code null}.
      */
     public PointValuePair optimize(final int maxEval,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/ConjugateGradientFormula.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/ConjugateGradientFormula.java b/src/main/java/org/apache/commons/math4/optimization/general/ConjugateGradientFormula.java
index 5fee40a..fae7419 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/ConjugateGradientFormula.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/ConjugateGradientFormula.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 /**
  * Available choices of update formulas for the &beta; parameter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizer.java
index 464a0f0..9a44084 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/GaussNewtonOptimizer.java
@@ -15,22 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.DecompositionSolver;
-import org.apache.commons.math3.linear.LUDecomposition;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.SingularMatrixException;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.SimpleVectorValueChecker;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
+package org.apache.commons.math4.optimization.general;
+
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.DecompositionSolver;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.SingularMatrixException;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.optimization.SimpleVectorValueChecker;
 
 /**
  * Gauss-Newton least-squares solver.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizer.java
index a29cafc..407f721 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizer.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optimization.PointVectorValuePair;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.PointVectorValuePair;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizer.java
index c076d11..499fd07 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizer.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.solvers.BrentSolver;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolver;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.optimization.SimpleValueChecker;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.solvers.BrentSolver;
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.optimization.SimpleValueChecker;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Non-linear conjugate gradient optimizer.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/Preconditioner.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/Preconditioner.java b/src/main/java/org/apache/commons/math4/optimization/general/Preconditioner.java
index 7142e76..882b789 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/Preconditioner.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/Preconditioner.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;
 
 /**
  * This interface represents a preconditioner for differentiable scalar

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/general/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/general/package-info.java b/src/main/java/org/apache/commons/math4/optimization/general/package-info.java
index ba140ce..ac50fd4 100644
--- a/src/main/java/org/apache/commons/math4/optimization/general/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optimization/general/package-info.java
@@ -19,4 +19,4 @@
  * This package provides optimization algorithms that require derivatives.
  *
  */
-package org.apache.commons.math3.optimization.general;
+package org.apache.commons.math4.optimization.general;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/AbstractLinearOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/AbstractLinearOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/linear/AbstractLinearOptimizer.java
index 921d877..7a58f0d 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/AbstractLinearOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/AbstractLinearOptimizer.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import java.util.Collection;
 import java.util.Collections;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
 
 /**
  * Base class for implementing linear optimizers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/LinearConstraint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/LinearConstraint.java b/src/main/java/org/apache/commons/math4/optimization/linear/LinearConstraint.java
index 4e1966c..85c3b2f 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/LinearConstraint.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/LinearConstraint.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealVector;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/LinearObjectiveFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/LinearObjectiveFunction.java b/src/main/java/org/apache/commons/math4/optimization/linear/LinearObjectiveFunction.java
index 5755f5e..be5ed6bd 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/LinearObjectiveFunction.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/LinearObjectiveFunction.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
 
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * An objective function for a linear optimization problem.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/LinearOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/LinearOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/linear/LinearOptimizer.java
index 610d0cb..07e5930 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/LinearOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/LinearOptimizer.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import java.util.Collection;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
 
 /**
  * This interface represents an optimization algorithm for linear problems.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/NoFeasibleSolutionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/NoFeasibleSolutionException.java b/src/main/java/org/apache/commons/math4/optimization/linear/NoFeasibleSolutionException.java
index c585c3a..ca3b438 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/NoFeasibleSolutionException.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/NoFeasibleSolutionException.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown by optimizers when no solution fulfills the constraints.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/Relationship.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/Relationship.java b/src/main/java/org/apache/commons/math4/optimization/linear/Relationship.java
index 0da755f..7675694 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/Relationship.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/Relationship.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 /**
  * Types of relationships between two cells in a Solver {@link LinearConstraint}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/SimplexSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/SimplexSolver.java b/src/main/java/org/apache/commons/math4/optimization/linear/SimplexSolver.java
index 1e5dbda..23db158 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/SimplexSolver.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/SimplexSolver.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.util.Precision;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/SimplexTableau.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/SimplexTableau.java b/src/main/java/org/apache/commons/math4/optimization/linear/SimplexTableau.java
index ebc703a..16f07ef 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/SimplexTableau.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/SimplexTableau.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -28,14 +28,14 @@ import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.PointValuePair;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.optimization.PointValuePair;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * A tableau for use in the Simplex method.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/UnboundedSolutionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/UnboundedSolutionException.java b/src/main/java/org/apache/commons/math4/optimization/linear/UnboundedSolutionException.java
index a8fe77b..1332440 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/UnboundedSolutionException.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/UnboundedSolutionException.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown by optimizers when a solution escapes to infinity.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/linear/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/linear/package-info.java b/src/main/java/org/apache/commons/math4/optimization/linear/package-info.java
index b61b03b..3e7c424 100644
--- a/src/main/java/org/apache/commons/math4/optimization/linear/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optimization/linear/package-info.java
@@ -19,4 +19,4 @@
  * This package provides optimization algorithms for linear constrained problems.
  *
  */
-package org.apache.commons.math3.optimization.linear;
+package org.apache.commons.math4.optimization.linear;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/package-info.java b/src/main/java/org/apache/commons/math4/optimization/package-info.java
index 84349b2..f92cb0f 100644
--- a/src/main/java/org/apache/commons/math4/optimization/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optimization/package-info.java
@@ -18,8 +18,8 @@
  * <h2>All classes and sub-packages of this package are deprecated.</h2>
  * <h3>Please use their replacements, to be found under
  *  <ul>
- *   <li>{@link org.apache.commons.math3.optim}</li>
- *   <li>{@link org.apache.commons.math3.fitting}</li>
+ *   <li>{@link org.apache.commons.math4.optim}</li>
+ *   <li>{@link org.apache.commons.math4.fitting}</li>
  *  </ul>
  * </h3>
  *
@@ -39,32 +39,32 @@
  * interfaces defining the common behavior of optimizers, one for each supported type of objective
  * function:
  * <ul>
- *  <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer
- *      UnivariateOptimizer} for {@link org.apache.commons.math3.analysis.UnivariateFunction
+ *  <li>{@link org.apache.commons.math4.optimization.univariate.UnivariateOptimizer
+ *      UnivariateOptimizer} for {@link org.apache.commons.math4.analysis.UnivariateFunction
  *      univariate real functions}</li>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateOptimizer
- *      MultivariateOptimizer} for {@link org.apache.commons.math3.analysis.MultivariateFunction
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateOptimizer
+ *      MultivariateOptimizer} for {@link org.apache.commons.math4.analysis.MultivariateFunction
  *      multivariate real functions}</li>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateDifferentiableOptimizer
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableOptimizer
  *      MultivariateDifferentiableOptimizer} for {@link
- *      org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction
+ *      org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction
  *      multivariate differentiable real functions}</li>
- *  <li>{@link org.apache.commons.math3.optimization.MultivariateDifferentiableVectorOptimizer
+ *  <li>{@link org.apache.commons.math4.optimization.MultivariateDifferentiableVectorOptimizer
  *      MultivariateDifferentiableVectorOptimizer} for {@link
- *      org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableVectorFunction
+ *      org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction
  *      multivariate differentiable vectorial functions}</li>
  * </ul>
  * </p>
  *
  * <p>
  * Despite there are only four types of supported optimizers, it is possible to optimize a
- * transform a {@link org.apache.commons.math3.analysis.MultivariateVectorFunction
+ * transform a {@link org.apache.commons.math4.analysis.MultivariateVectorFunction
  * non-differentiable multivariate vectorial function} by converting it to a {@link
- * org.apache.commons.math3.analysis.MultivariateFunction non-differentiable multivariate
+ * org.apache.commons.math4.analysis.MultivariateFunction non-differentiable multivariate
  * real function} thanks to the {@link
- * org.apache.commons.math3.optimization.LeastSquaresConverter LeastSquaresConverter} helper class.
+ * org.apache.commons.math4.optimization.LeastSquaresConverter LeastSquaresConverter} helper class.
  * The transformed function can be optimized using any implementation of the {@link
- * org.apache.commons.math3.optimization.MultivariateOptimizer MultivariateOptimizer} interface.
+ * org.apache.commons.math4.optimization.MultivariateOptimizer MultivariateOptimizer} interface.
  * </p>
  *
  * <p>
@@ -76,4 +76,4 @@
  * </p>
  *
  */
-package org.apache.commons.math3.optimization;
+package org.apache.commons.math4.optimization;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/BaseAbstractUnivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/BaseAbstractUnivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/univariate/BaseAbstractUnivariateOptimizer.java
index fcacd01..6b6a9b1 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/BaseAbstractUnivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/BaseAbstractUnivariateOptimizer.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Provide a default implementation for several functions useful to generic

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/BaseUnivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/BaseUnivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/univariate/BaseUnivariateOptimizer.java
index fcae6f1..67e16ca 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/BaseUnivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/BaseUnivariateOptimizer.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optimization.BaseOptimizer;
-import org.apache.commons.math3.optimization.GoalType;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.optimization.BaseOptimizer;
+import org.apache.commons.math4.optimization.GoalType;
 
 /**
  * This interface is mainly intended to enforce the internal coherence of
  * Commons-Math. Users of the API are advised to base their code on
  * the following interfaces:
  * <ul>
- *  <li>{@link org.apache.commons.math3.optimization.univariate.UnivariateOptimizer}</li>
+ *  <li>{@link org.apache.commons.math4.optimization.univariate.UnivariateOptimizer}</li>
  * </ul>
  *
  * @param <FUNC> Type of the objective function to be optimized.
@@ -49,9 +49,9 @@ public interface BaseUnivariateOptimizer<FUNC extends UnivariateFunction>
      * @param max Upper bound for the interval.
      * @param maxEval Maximum number of function evaluations.
      * @return a (point, value) pair where the function is optimum.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximum evaluation count is exceeded.
-     * @throws org.apache.commons.math3.exception.ConvergenceException
+     * @throws org.apache.commons.math4.exception.ConvergenceException
      * if the optimizer detects a convergence problem.
      * @throws IllegalArgumentException if {@code min > max} or the endpoints
      * do not satisfy the requirements specified by the optimizer.
@@ -71,13 +71,13 @@ public interface BaseUnivariateOptimizer<FUNC extends UnivariateFunction>
      * @param startValue Start value to use.
      * @param maxEval Maximum number of function evaluations.
      * @return a (point, value) pair where the function is optimum.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException
+     * @throws org.apache.commons.math4.exception.TooManyEvaluationsException
      * if the maximum evaluation count is exceeded.
-     * @throws org.apache.commons.math3.exception.ConvergenceException if the
+     * @throws org.apache.commons.math4.exception.ConvergenceException if the
      * optimizer detects a convergence problem.
      * @throws IllegalArgumentException if {@code min > max} or the endpoints
      * do not satisfy the requirements specified by the optimizer.
-     * @throws org.apache.commons.math3.exception.NullArgumentException if any
+     * @throws org.apache.commons.math4.exception.NullArgumentException if any
      * argument is {@code null}.
      */
     UnivariatePointValuePair optimize(int maxEval, FUNC f, GoalType goalType,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/BracketFinder.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/BracketFinder.java b/src/main/java/org/apache/commons/math4/optimization/univariate/BracketFinder.java
index cd3057f..2727a2f 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/BracketFinder.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/BracketFinder.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.optimization.GoalType;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Provide an interval that brackets a local optimum of a function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/BrentOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/BrentOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/univariate/BrentOptimizer.java
index 763ec99..a7d39df 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/BrentOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/BrentOptimizer.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
-import org.apache.commons.math3.optimization.GoalType;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * For a function defined on some interval {@code (lo, hi)}, this class

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueChecker.java b/src/main/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueChecker.java
index 82c50b6..29928e1 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueChecker.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/SimpleUnivariateValueChecker.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.optimization.AbstractConvergenceChecker;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.optimization.AbstractConvergenceChecker;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Simple implementation of the
- * {@link org.apache.commons.math3.optimization.ConvergenceChecker} interface
+ * {@link org.apache.commons.math4.optimization.ConvergenceChecker} interface
  * that uses only objective function values.
  *
  * Convergence is considered to have been reached if either the relative

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizer.java
index 6606d33..cbf73c5 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateMultiStartOptimizer.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.optimization.GoalType;
-import org.apache.commons.math3.optimization.ConvergenceChecker;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.optimization.ConvergenceChecker;
+import org.apache.commons.math4.optimization.GoalType;
+import org.apache.commons.math4.random.RandomGenerator;
 
 /**
  * Special implementation of the {@link UnivariateOptimizer} interface

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateOptimizer.java
index e3ebbb3..b621c8b 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariateOptimizer.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
 
 /**
  * Interface for univariate optimization algorithms.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariatePointValuePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariatePointValuePair.java b/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariatePointValuePair.java
index eee931c..6f5c450 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariatePointValuePair.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/UnivariatePointValuePair.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;
 
 import java.io.Serializable;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optimization/univariate/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optimization/univariate/package-info.java b/src/main/java/org/apache/commons/math4/optimization/univariate/package-info.java
index 04feb33..97258e3 100644
--- a/src/main/java/org/apache/commons/math4/optimization/univariate/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optimization/univariate/package-info.java
@@ -19,4 +19,4 @@
  *     Univariate real functions minimum finding algorithms.
  *
  */
-package org.apache.commons.math3.optimization.univariate;
+package org.apache.commons.math4.optimization.univariate;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/package-info.java b/src/main/java/org/apache/commons/math4/package-info.java
index 200346d..86871c6 100644
--- a/src/main/java/org/apache/commons/math4/package-info.java
+++ b/src/main/java/org/apache/commons/math4/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Common classes used throughout the commons-math library.
  */
-package org.apache.commons.math3;
+package org.apache.commons.math4;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/primes/PollardRho.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/primes/PollardRho.java b/src/main/java/org/apache/commons/math4/primes/PollardRho.java
index bf7fbf8..fc2ec88 100644
--- a/src/main/java/org/apache/commons/math4/primes/PollardRho.java
+++ b/src/main/java/org/apache/commons/math4/primes/PollardRho.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.primes;
+package org.apache.commons.math4.primes;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of the Pollard's rho factorization algorithm.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/primes/Primes.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/primes/Primes.java b/src/main/java/org/apache/commons/math4/primes/Primes.java
index 12cd317..7dbb883 100644
--- a/src/main/java/org/apache/commons/math4/primes/Primes.java
+++ b/src/main/java/org/apache/commons/math4/primes/Primes.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.primes;
+package org.apache.commons.math4.primes;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 import java.util.List;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java b/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java
index c889f10..0738cd2 100644
--- a/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java
+++ b/src/main/java/org/apache/commons/math4/primes/SmallPrimes.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.primes;
+package org.apache.commons.math4.primes;
 
 
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Utility methods to work on primes within the <code>int</code> range.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/primes/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/primes/package-info.java b/src/main/java/org/apache/commons/math4/primes/package-info.java
index 0873f66..076ec31 100644
--- a/src/main/java/org/apache/commons/math4/primes/package-info.java
+++ b/src/main/java/org/apache/commons/math4/primes/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Methods related to prime numbers like primality test, factor decomposition.
  */
-package org.apache.commons.math3.primes;
+package org.apache.commons.math4.primes;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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
index ea7a5cc..0e1251c 100644
--- a/src/main/java/org/apache/commons/math4/random/AbstractRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/AbstractRandomGenerator.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Abstract class implementing the {@link  RandomGenerator} interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 615854e..19820a1 100644
--- a/src/main/java/org/apache/commons/math4/random/AbstractWell.java
+++ b/src/main/java/org/apache/commons/math4/random/AbstractWell.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /** This abstract class implements the WELL class of pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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
index dcb000f..d8ddd2e 100644
--- a/src/main/java/org/apache/commons/math4/random/BitsStreamGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/BitsStreamGenerator.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 
 /** Base class for random number generators that generates bits streams.
  *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/CorrelatedRandomVectorGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/CorrelatedRandomVectorGenerator.java b/src/main/java/org/apache/commons/math4/random/CorrelatedRandomVectorGenerator.java
index f0325b7..f95b018 100644
--- a/src/main/java/org/apache/commons/math4/random/CorrelatedRandomVectorGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/CorrelatedRandomVectorGenerator.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RectangularCholeskyDecomposition;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RectangularCholeskyDecomposition;
 
 /**
  * A {@link RandomVectorGenerator} that generates vectors with with
@@ -78,7 +78,7 @@ public class CorrelatedRandomVectorGenerator
      * considered to be dependent on previous ones and are discarded
      * @param generator underlying generator for uncorrelated normalized
      * components.
-     * @throws org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException
+     * @throws org.apache.commons.math4.linear.NonPositiveDefiniteMatrixException
      * if the covariance matrix is not strictly positive definite.
      * @throws DimensionMismatchException if the mean and covariance
      * arrays dimensions do not match.
@@ -110,7 +110,7 @@ public class CorrelatedRandomVectorGenerator
      * considered to be dependent on previous ones and are discarded.
      * @param generator Underlying generator for uncorrelated normalized
      * components.
-     * @throws org.apache.commons.math3.linear.NonPositiveDefiniteMatrixException
+     * @throws org.apache.commons.math4.linear.NonPositiveDefiniteMatrixException
      * if the covariance matrix is not strictly positive definite.
      */
     public CorrelatedRandomVectorGenerator(RealMatrix covariance, double small,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java b/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
index 3dd2d7f..7997181 100644
--- a/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
+++ b/src/main/java/org/apache/commons/math4/random/EmpiricalDistribution.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -28,20 +28,20 @@ import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.distribution.AbstractRealDistribution;
-import org.apache.commons.math3.distribution.ConstantRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.distribution.AbstractRealDistribution;
+import org.apache.commons.math4.distribution.ConstantRealDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * <p>Represents an <a href="http://http://en.wikipedia.org/wiki/Empirical_distribution_function">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java
index 1067ffc..55369b2 100644
--- a/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/GaussianRandomGenerator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 /**
  * This class is a gaussian normalized random generator for scalars.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/HaltonSequenceGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/HaltonSequenceGenerator.java b/src/main/java/org/apache/commons/math4/random/HaltonSequenceGenerator.java
index af58e1d..25059ab 100644
--- a/src/main/java/org/apache/commons/math4/random/HaltonSequenceGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/HaltonSequenceGenerator.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implementation of a Halton sequence.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 87035cf..24ef390 100644
--- a/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
+++ b/src/main/java/org/apache/commons/math4/random/ISAACRandom.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <a href="http://burtleburtle.net/bob/rand/isaacafa.html">

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java
index 73c2f75..3594332 100644
--- a/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/JDKRandomGenerator.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Random;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 288df3e..ab684c0 100644
--- a/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
+++ b/src/main/java/org/apache/commons/math4/random/MersenneTwister.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /** This class implements a powerful pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/NormalizedRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/NormalizedRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/NormalizedRandomGenerator.java
index bd3552b..0574cc7 100644
--- a/src/main/java/org/apache/commons/math4/random/NormalizedRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/NormalizedRandomGenerator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 /**
  * This interface represent a normalized random generator for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/RandomAdaptor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RandomAdaptor.java b/src/main/java/org/apache/commons/math4/random/RandomAdaptor.java
index 80ca940..066aa99 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomAdaptor.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomAdaptor.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Random;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/RandomData.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RandomData.java b/src/main/java/org/apache/commons/math4/random/RandomData.java
index fad4cb8..9f862f1 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomData.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomData.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 import java.util.Collection;
 
-import org.apache.commons.math3.exception.NotANumberException;
-import org.apache.commons.math3.exception.NotFiniteNumberException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
 
 /**
  * Random data generation utilities.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/RandomDataGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RandomDataGenerator.java b/src/main/java/org/apache/commons/math4/random/RandomDataGenerator.java
index b0948d8..34765aa 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomDataGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomDataGenerator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.Serializable;
 import java.security.MessageDigest;
@@ -24,29 +24,29 @@ import java.security.NoSuchProviderException;
 import java.security.SecureRandom;
 import java.util.Collection;
 
-import org.apache.commons.math3.distribution.BetaDistribution;
-import org.apache.commons.math3.distribution.BinomialDistribution;
-import org.apache.commons.math3.distribution.CauchyDistribution;
-import org.apache.commons.math3.distribution.ChiSquaredDistribution;
-import org.apache.commons.math3.distribution.ExponentialDistribution;
-import org.apache.commons.math3.distribution.FDistribution;
-import org.apache.commons.math3.distribution.GammaDistribution;
-import org.apache.commons.math3.distribution.HypergeometricDistribution;
-import org.apache.commons.math3.distribution.PascalDistribution;
-import org.apache.commons.math3.distribution.PoissonDistribution;
-import org.apache.commons.math3.distribution.TDistribution;
-import org.apache.commons.math3.distribution.WeibullDistribution;
-import org.apache.commons.math3.distribution.ZipfDistribution;
-import org.apache.commons.math3.distribution.UniformIntegerDistribution;
-import org.apache.commons.math3.exception.MathInternalError;
-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.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.distribution.BetaDistribution;
+import org.apache.commons.math4.distribution.BinomialDistribution;
+import org.apache.commons.math4.distribution.CauchyDistribution;
+import org.apache.commons.math4.distribution.ChiSquaredDistribution;
+import org.apache.commons.math4.distribution.ExponentialDistribution;
+import org.apache.commons.math4.distribution.FDistribution;
+import org.apache.commons.math4.distribution.GammaDistribution;
+import org.apache.commons.math4.distribution.HypergeometricDistribution;
+import org.apache.commons.math4.distribution.PascalDistribution;
+import org.apache.commons.math4.distribution.PoissonDistribution;
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.distribution.UniformIntegerDistribution;
+import org.apache.commons.math4.distribution.WeibullDistribution;
+import org.apache.commons.math4.distribution.ZipfDistribution;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Implements the {@link RandomData} interface using a {@link RandomGenerator}
@@ -398,7 +398,7 @@ public class RandomDataGenerator implements RandomData, Serializable {
 
     /**
      * <p>Generates a random value from the
-     * {@link org.apache.commons.math3.distribution.GammaDistribution Gamma Distribution}.</p>
+     * {@link org.apache.commons.math4.distribution.GammaDistribution Gamma Distribution}.</p>
      *
      * <p>This implementation uses the following algorithms: </p>
      *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/RandomDataImpl.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RandomDataImpl.java b/src/main/java/org/apache/commons/math4/random/RandomDataImpl.java
index 5b79393..df2c699 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomDataImpl.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomDataImpl.java
@@ -15,22 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.Serializable;
 import java.security.NoSuchAlgorithmException;
 import java.security.NoSuchProviderException;
 import java.util.Collection;
 
-import org.apache.commons.math3.distribution.IntegerDistribution;
-import org.apache.commons.math3.distribution.RealDistribution;
-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.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Generates random deviates and other random data using a {@link RandomGenerator}
@@ -265,7 +265,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.BetaDistribution Beta Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.BetaDistribution Beta Distribution}.
      * This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
      * to generate random values.
      *
@@ -279,7 +279,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.BinomialDistribution Binomial Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.BinomialDistribution Binomial Distribution}.
      * This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
      * to generate random values.
      *
@@ -293,7 +293,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.CauchyDistribution Cauchy Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.CauchyDistribution Cauchy Distribution}.
      * This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
      * to generate random values.
      *
@@ -307,7 +307,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.ChiSquaredDistribution ChiSquare Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.ChiSquaredDistribution ChiSquare Distribution}.
      * This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
      * to generate random values.
      *
@@ -320,7 +320,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.FDistribution F Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.FDistribution F Distribution}.
      * This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
      * to generate random values.
      *
@@ -337,7 +337,7 @@ public class RandomDataImpl implements RandomData, Serializable {
 
     /**
      * <p>Generates a random value from the
-     * {@link org.apache.commons.math3.distribution.GammaDistribution Gamma Distribution}.</p>
+     * {@link org.apache.commons.math4.distribution.GammaDistribution Gamma Distribution}.</p>
      *
      * <p>This implementation uses the following algorithms: </p>
      *
@@ -363,7 +363,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.HypergeometricDistribution Hypergeometric Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.HypergeometricDistribution Hypergeometric Distribution}.
      * This implementation uses {@link #nextInversionDeviate(IntegerDistribution) inversion}
      * to generate random values.
      *
@@ -383,7 +383,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.PascalDistribution Pascal Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.PascalDistribution Pascal Distribution}.
      * This implementation uses {@link #nextInversionDeviate(IntegerDistribution) inversion}
      * to generate random values.
      *
@@ -401,7 +401,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.TDistribution T Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.TDistribution T Distribution}.
      * This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
      * to generate random values.
      *
@@ -415,7 +415,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.WeibullDistribution Weibull Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.WeibullDistribution Weibull Distribution}.
      * This implementation uses {@link #nextInversionDeviate(RealDistribution) inversion}
      * to generate random values.
      *
@@ -431,7 +431,7 @@ public class RandomDataImpl implements RandomData, Serializable {
     }
 
     /**
-     * Generates a random value from the {@link org.apache.commons.math3.distribution.ZipfDistribution Zipf Distribution}.
+     * Generates a random value from the {@link org.apache.commons.math4.distribution.ZipfDistribution Zipf Distribution}.
      * This implementation uses {@link #nextInversionDeviate(IntegerDistribution) inversion}
      * to generate random values.
      *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 56cf4bf..8e0b5b1 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomGenerator.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /**


[63/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/ode.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/ode.xml b/src/site/xdoc/userguide/ode.xml
index a255947..37b266c 100644
--- a/src/site/xdoc/userguide/ode.xml
+++ b/src/site/xdoc/userguide/ode.xml
@@ -39,7 +39,7 @@
           All integrators provide dense output. This means that besides computing the state vector
           at discrete times, they also provide a cheap mean to get both the state and its derivative
           between the time steps. They do so through classes extending the
-          <a href="../apidocs/org/apache/commons/math3/ode/sampling/StepInterpolator.html">StepInterpolator</a>
+          <a href="../apidocs/org/apache/commons/math4/ode/sampling/StepInterpolator.html">StepInterpolator</a>
           abstract class, which are made available to the user at the end of each step.
         </p>
         <p>
@@ -63,9 +63,9 @@
         </p>
         <p>
           The user should describe his problem in his own classes which should implement the
-          <a href="../apidocs/org/apache/commons/math3/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
+          <a href="../apidocs/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
           interface. Then he should pass it to the integrator he prefers among all the classes that implement
-          the <a href="../apidocs/org/apache/commons/math3/ode/FirstOrderIntegrator.html">FirstOrderIntegrator</a>
+          the <a href="../apidocs/org/apache/commons/math4/ode/FirstOrderIntegrator.html">FirstOrderIntegrator</a>
           interface. The following example shows how to implement the simple two-dimensional problem:
           <ul>
             <li>y'<sub>0</sub>(t) = &#x3c9; &#xD7; (c<sub>1</sub> - y<sub>1</sub>(t))</li>
@@ -115,10 +115,10 @@ dp853.integrate(ode, 0.0, y, 16.0, y); // now y contains final state at time t=1
           <code>FirstOrderIntegrator.integrate</code> method, as shown by previous example. The second one
           should be used when more in-depth information is needed throughout the integration process. The user
           can register an object implementing the
-          <a href="../apidocs/org/apache/commons/math3/ode/sampling/StepHandler.html">StepHandler</a> interface or a
-          <a href="../apidocs/org/apache/commons/math3/ode/sampling/StepNormalizer.html">StepNormalizer</a> object wrapping
+          <a href="../apidocs/org/apache/commons/math4/ode/sampling/StepHandler.html">StepHandler</a> interface or a
+          <a href="../apidocs/org/apache/commons/math4/ode/sampling/StepNormalizer.html">StepNormalizer</a> object wrapping
           a user-specified object implementing the
-          <a href="../apidocs/org/apache/commons/math3/ode/sampling/FixedStepHandler.html">FixedStepHandler</a> interface
+          <a href="../apidocs/org/apache/commons/math4/ode/sampling/FixedStepHandler.html">FixedStepHandler</a> interface
           into the integrator before calling the <code>FirstOrderIntegrator.integrate</code> method. The user object
           will be called appropriately during the integration process, allowing the user to process intermediate
           results. The default step handler does nothing. Considering again the previous example, we want to print the
@@ -139,7 +139,7 @@ StepHandler stepHandler = new StepHandler() {
 integrator.addStepHandler(stepHandler);
         </source>
         <p>
-          <a href="../apidocs/org/apache/commons/math3/ode/ContinuousOutputModel.html">ContinuousOutputModel</a>
+          <a href="../apidocs/org/apache/commons/math4/ode/ContinuousOutputModel.html">ContinuousOutputModel</a>
           is a special-purpose step handler that is able to store all steps and to provide transparent access to
           any intermediate result once the integration is over. An important feature of this class is that it
           implements the <code>Serializable</code> interface. This means that a complete continuous model of the
@@ -148,10 +148,10 @@ integrator.addStepHandler(stepHandler);
           Only the result of the integration is stored, there is no reference to the integrated problem by itself.
         </p>
         <p>
-          Other default implementations of the <a href="../apidocs/org/apache/commons/math3/ode/sampling/StepHandler.html">StepHandler</a>
+          Other default implementations of the <a href="../apidocs/org/apache/commons/math4/ode/sampling/StepHandler.html">StepHandler</a>
           interface are available for general needs
-          (<a href="../apidocs/org/apache/commons/math3/ode/sampling/DummyStepHandler.html">DummyStepHandler</a>,
-          <a href="../apidocs/org/apache/commons/math3/ode/sampling/StepNormalizer.html">StepNormalizer</a>) and custom
+          (<a href="../apidocs/org/apache/commons/math4/ode/sampling/DummyStepHandler.html">DummyStepHandler</a>,
+          <a href="../apidocs/org/apache/commons/math4/ode/sampling/StepNormalizer.html">StepNormalizer</a>) and custom
           implementations can be developed for specific needs. As an example, if an application is to be
           completely driven by the integration process, then most of the application code will be run inside a
           step handler specific to this application.
@@ -160,11 +160,11 @@ integrator.addStepHandler(stepHandler);
           Some integrators (the simple ones) use fixed steps that are set at creation time. The more efficient
           integrators use variable steps that are handled internally in order to control the integration error
           with respect to a specified accuracy (these integrators extend the
-          <a href="../apidocs/org/apache/commons/math3/ode/AdaptiveStepsizeIntegrator.html">AdaptiveStepsizeIntegrator</a>
+          <a href="../apidocs/org/apache/commons/math4/ode/AdaptiveStepsizeIntegrator.html">AdaptiveStepsizeIntegrator</a>
           abstract class). In this case, the step handler which is called after each successful step shows up
-          the variable stepsize. The <a href="../apidocs/org/apache/commons/math3/ode/sampling/StepNormalizer.html">StepNormalizer</a>
+          the variable stepsize. The <a href="../apidocs/org/apache/commons/math4/ode/sampling/StepNormalizer.html">StepNormalizer</a>
           class can be used to convert the variable stepsize into a fixed stepsize that can be handled by classes
-          implementing the <a href="../apidocs/org/apache/commons/math3/ode/sampling/FixedStepHandler.html">FixedStepHandler</a>
+          implementing the <a href="../apidocs/org/apache/commons/math4/ode/sampling/FixedStepHandler.html">FixedStepHandler</a>
           interface. Adaptive stepsize integrators can automatically compute the initial stepsize by themselves,
           however the user can specify it if he prefers to retain full control over the integration or if the
           automatic guess is wrong.
@@ -179,7 +179,7 @@ integrator.addStepHandler(stepHandler);
         </p>
         <p>
           Discrete events detection is based on switching functions. The user provides
-          a simple <a href="../apidocs/org/apache/commons/math3/ode/events/EventHandler.html">g(t, y)</a>
+          a simple <a href="../apidocs/org/apache/commons/math4/ode/events/EventHandler.html">g(t, y)</a>
           function depending on the current time and state. The integrator will monitor
           the value of the function throughout integration range and will trigger the
           event when its sign changes. The magnitude of the value is almost irrelevant.
@@ -259,24 +259,24 @@ public int eventOccurred(double t, double[] y, boolean increasing) {
           <table border="1" align="center">
           <tr BGCOLOR="#CCCCFF"><td colspan="2"><font size="+1">Fixed Step Integrators</font></td></tr>
           <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>Order</td></font></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/EulerIntegrator.html">Euler</a></td><td>1</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/MidpointIntegrator.html">Midpoint</a></td><td>2</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/ClassicalRungeKuttaIntegrator.html">Classical Runge-Kutta</a></td><td>4</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/GillIntegrator.html">Gill</a></td><td>4</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/ThreeEighthesIntegrator.html">3/8</a></td><td>4</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/LutherIntegrator.html">Luther</a></td><td>6</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/EulerIntegrator.html">Euler</a></td><td>1</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/MidpointIntegrator.html">Midpoint</a></td><td>2</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/ClassicalRungeKuttaIntegrator.html">Classical Runge-Kutta</a></td><td>4</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/GillIntegrator.html">Gill</a></td><td>4</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegrator.html">3/8</a></td><td>4</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/LutherIntegrator.html">Luther</a></td><td>6</td></tr>
           </table>
         </p>
         <p>
           <table border="1" align="center">
           <tr BGCOLOR="#CCCCFF"><td colspan="3"><font size="+1">Adaptive Stepsize Integrators</font></td></tr>
           <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>Integration Order</td><td>Error Estimation Order</td></font></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/HighamHall54Integrator.html">Higham and Hall</a></td><td>5</td><td>4</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/DormandPrince54Integrator.html">Dormand-Prince 5(4)</a></td><td>5</td><td>4</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/DormandPrince853Integrator.html">Dormand-Prince 8(5,3)</a></td><td>8</td><td>5 and 3</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/GraggBulirschStoerIntegrator.html">Gragg-Bulirsch-Stoer</a></td><td>variable (up to 18 by default)</td><td>variable</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/AdamsBashforthIntegrator.html">Adams-Bashforth</a></td><td>variable</td><td>variable</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/ode/nonstiff/AdamsMoultonIntegrator.html">Adams-Moulton</a></td><td>variable</td><td>variable</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/HighamHall54Integrator.html">Higham and Hall</a></td><td>5</td><td>4</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/DormandPrince54Integrator.html">Dormand-Prince 5(4)</a></td><td>5</td><td>4</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/DormandPrince853Integrator.html">Dormand-Prince 8(5,3)</a></td><td>8</td><td>5 and 3</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegrator.html">Gragg-Bulirsch-Stoer</a></td><td>variable (up to 18 by default)</td><td>variable</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/AdamsBashforthIntegrator.html">Adams-Bashforth</a></td><td>variable</td><td>variable</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/ode/nonstiff/AdamsMoultonIntegrator.html">Adams-Moulton</a></td><td>variable</td><td>variable</td></tr>
           </table>
         </p>
       </subsection>
@@ -285,7 +285,7 @@ public int eventOccurred(double t, double[] y, boolean increasing) {
           If in addition to state y(t) the user needs to compute the sensitivity of the state to
           the initial state or some parameter of the ODE, he will use the classes and interfaces
           from the <a
-          href="../apidocs/org/apache/commons/math3/ode/jacobians/package-summary.html">org.apache.commons.ode.jacobians</a>
+          href="../apidocs/org/apache/commons/math4/ode/jacobians/package-summary.html">org.apache.commons.ode.jacobians</a>
           package instead of the top level ode package. These classes compute the jacobians
           dy(t)/dy<sub>0</sub> and dy(t)/dp where y<sub>0</sub> is the initial state
           and p is some ODE parameter.
@@ -323,9 +323,9 @@ public int eventOccurred(double t, double[] y, boolean increasing) {
         <p>
           If the function f is too complex, the user can simply rely on internal differentiation
           using finite differences to compute these local jacobians. So rather than the <a
-          href="../apidocs/org/apache/commons/math3/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
+          href="../apidocs/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
           interface he will implement the <a
-          href="../apidocs/org/apache/commons/math3/ode/jacobians/ParameterizedODE.html">ParameterizedODE</a>
+          href="../apidocs/org/apache/commons/math4/ode/jacobians/ParameterizedODE.html">ParameterizedODE</a>
           interface. Considering again our example where only &#x3c9; is considered a parameter, we get:
         </p>
         <source>
@@ -373,9 +373,9 @@ integrator.integrate(t0, y0, dy0dp, t, y, dydy0, dydp);
         <p>
           If the function f is simple, the user can simply provide the local jacobians
           by himself. So rather than the <a
-          href="../apidocs/org/apache/commons/math3/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
+          href="../apidocs/org/apache/commons/math4/ode/FirstOrderDifferentialEquations.html">FirstOrderDifferentialEquations</a>
           interface he will implement the <a
-          href="../apidocs/org/apache/commons/math3/ode/jacobians/ODEWithJacobians.html">ODEWithJacobians</a>
+          href="../apidocs/org/apache/commons/math4/ode/jacobians/ODEWithJacobians.html">ODEWithJacobians</a>
           interface. Considering again our example where only &#x3c9; is considered a parameter, we get:
         </p>
         <source>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/optimization.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/optimization.xml b/src/site/xdoc/userguide/optimization.xml
index 16202d9..f691ffa 100644
--- a/src/site/xdoc/userguide/optimization.xml
+++ b/src/site/xdoc/userguide/optimization.xml
@@ -27,7 +27,7 @@
   <body>
     <section name="12 Optimization">
       <p><em>The contents of this section currently describes deprecated classes.</em>
-        Please refer to the new <a href="../apidocs/org/apache/commons/math3/optim/package-summary.html">API description</a>.
+        Please refer to the new <a href="../apidocs/org/apache/commons/math4/optim/package-summary.html">API description</a>.
       </p>
 
       <subsection name="12.1 Overview" href="overview">
@@ -57,7 +57,7 @@
         </p>
         <p>
         The type of goal, i.e. minimization or maximization, is defined by the enumerated
-        <a href="../apidocs/org/apache/commons/math3/optimization/GoalType.html">
+        <a href="../apidocs/org/apache/commons/math4/optimization/GoalType.html">
         GoalType</a> which has only two values: <code>MAXIMIZE</code> and <code>MINIMIZE</code>.
         </p>
         <p>
@@ -66,21 +66,21 @@
         are only four interfaces defining the common behavior of optimizers, one for each
         supported type of objective function:
         <ul>
-          <li><a href="../apidocs/org/apache/commons/math3/optimization/univariate/UnivariateOptimizer.html">
+          <li><a href="../apidocs/org/apache/commons/math4/optimization/univariate/UnivariateOptimizer.html">
               UnivariateOptimizer</a> for <a
-              href="../apidocs/org/apache/commons/math3/analysis/UnivariateFunction.html">
+              href="../apidocs/org/apache/commons/math4/analysis/UnivariateFunction.html">
               univariate real functions</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/optimization/MultivariateOptimizer.html">
+          <li><a href="../apidocs/org/apache/commons/math4/optimization/MultivariateOptimizer.html">
               MultivariateOptimizer</a> for <a
-              href="../apidocs/org/apache/commons/math3/analysis/MultivariateFunction.html">
+              href="../apidocs/org/apache/commons/math4/analysis/MultivariateFunction.html">
               multivariate real functions</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/optimization/DifferentiableMultivariateOptimizer.html">
+          <li><a href="../apidocs/org/apache/commons/math4/optimization/DifferentiableMultivariateOptimizer.html">
               DifferentiableMultivariateOptimizer</a> for <a
-              href="../apidocs/org/apache/commons/math3/analysis/DifferentiableMultivariateFunction.html">
+              href="../apidocs/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.html">
               differentiable multivariate real functions</a></li>
-          <li><a href="../apidocs/org/apache/commons/math3/optimization/DifferentiableMultivariateVectorOptimizer.html">
+          <li><a href="../apidocs/org/apache/commons/math4/optimization/DifferentiableMultivariateVectorOptimizer.html">
               DifferentiableMultivariateVectorOptimizer</a> for <a
-              href="../apidocs/org/apache/commons/math3/analysis/DifferentiableMultivariateVectorFunction.html">
+              href="../apidocs/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.html">
               differentiable multivariate vectorial functions</a></li>
         </ul>
         </p>
@@ -88,14 +88,14 @@
         <p>
         Despite there are only four types of supported optimizers, it is possible to optimize
         a transform a <a
-        href="../apidocs/org/apache/commons/math3/analysis/MultivariateVectorFunction.html">
+        href="../apidocs/org/apache/commons/math4/analysis/MultivariateVectorFunction.html">
         non-differentiable multivariate vectorial function</a> by converting it to a <a
-        href="../apidocs/org/apache/commons/math3/analysis/MultivariateFunction.html">
+        href="../apidocs/org/apache/commons/math4/analysis/MultivariateFunction.html">
         non-differentiable multivariate real function</a> thanks to the <a
-        href="../apidocs/org/apache/commons/math3/optimization/LeastSquaresConverter.html">
+        href="../apidocs/org/apache/commons/math4/optimization/LeastSquaresConverter.html">
         LeastSquaresConverter</a> helper class. The transformed function can be optimized using
         any implementation of the <a
-        href="../apidocs/org/apache/commons/math3/optimization/MultivariateOptimizer.html">
+        href="../apidocs/org/apache/commons/math4/optimization/MultivariateOptimizer.html">
         MultivariateOptimizer</a> interface.
         </p>
 
@@ -109,7 +109,7 @@
       </subsection>
       <subsection name="12.2 Univariate Functions" href="univariate">
         <p>
-          A <a href="../apidocs/org/apache/commons/math3/optimization/univariate/UnivariateOptimizer.html">
+          A <a href="../apidocs/org/apache/commons/math4/optimization/univariate/UnivariateOptimizer.html">
           UnivariateOptimizer</a> is used to find the minimal values of a univariate real-valued
           function <code>f</code>.
         </p>
@@ -160,16 +160,16 @@
           The <code>direct</code> package provides four solvers:
           <ul>
             <li>the classical <a
-                href="../apidocs/org/apache/commons/math3/optimization/direct/NelderMeadSimplex.html">
+                href="../apidocs/org/apache/commons/math4/optimization/direct/NelderMeadSimplex.html">
                 Nelder-Mead</a> method,</li>
             <li>Virginia Torczon's <a
-                href="../apidocs/org/apache/commons/math3/optimization/direct/MultiDirectionalSimplex.html">
+                href="../apidocs/org/apache/commons/math4/optimization/direct/MultiDirectionalSimplex.html">
                 multi-directional</a> method,</li>
             <li>Nikolaus Hansen's <a
-               href="../apidocs/org/apache/commons/math3/optimization/direct/CMAESOptimizer.html">
+               href="../apidocs/org/apache/commons/math4/optimization/direct/CMAESOptimizer.html">
                </a>Covariance Matrix Adaptation Evolution Strategy (CMA-ES),</li>
             <li>Mike Powell's <a
-               href="../apidocs/org/apache/commons/math3/optimization/direct/BOBYQAOptimizer.html">
+               href="../apidocs/org/apache/commons/math4/optimization/direct/BOBYQAOptimizer.html">
                BOBYQA</a> method.
             </li>
           </ul>
@@ -177,9 +177,9 @@
         <p>
           The first two simplex-based methods do not handle simple bounds constraints by themselves.
           However there are two adapters(<a
-          href="../apidocs/org/apache/commons/math3/optimization/direct/MultivariateFunctionMappingAdapter.html">
+          href="../apidocs/org/apache/commons/math4/optimization/direct/MultivariateFunctionMappingAdapter.html">
           MultivariateFunctionMappingAdapter</a> and <a
-          href="../apidocs/org/apache/commons/math3/optimization/direct/MultivariateFunctionPenaltyAdapter.html">
+          href="../apidocs/org/apache/commons/math4/optimization/direct/MultivariateFunctionPenaltyAdapter.html">
           MultivariateFunctionPenaltyAdapter</a>) that can be used to wrap the user function in
           such a way the wrapped function is unbounded and can be used with these optimizers, despite
           the fact the underlying function is still bounded and will be called only with feasible
@@ -233,15 +233,15 @@
         <p>
           Two optimizers are available in the general package, both devoted to least-squares
           problems. The first one is based on the <a
-          href="../apidocs/org/apache/commons/math3/optimization/general/GaussNewtonOptimizer.html">
+          href="../apidocs/org/apache/commons/math4/optimization/general/GaussNewtonOptimizer.html">
           Gauss-Newton</a> method. The second one is the <a
-          href="../apidocs/org/apache/commons/math3/optimization/general/LevenbergMarquardtOptimizer.html">
+          href="../apidocs/org/apache/commons/math4/optimization/general/LevenbergMarquardtOptimizer.html">
           Levenberg-Marquardt</a> method.
         </p>
         <p>
           In order to solve a vectorial optimization problem, the user must provide it as
           an object implementing the <a
-          href="../apidocs/org/apache/commons/math3/analysis/DifferentiableMultivariateVectorFunction.html">
+          href="../apidocs/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.html">
           DifferentiableMultivariateVectorFunction</a> interface. The object will be provided to
           the <code>estimate</code> method of the optimizer, along with the target and weight arrays,
           thus allowing the optimizer to compute the residuals at will. The last parameter to the
@@ -307,7 +307,7 @@
 </table>
 
 <p>
-First we need to implement the interface <a href="../apidocs/org/apache/commons/math3/analysis/DifferentiableMultivariateVectorFunction.html">DifferentiableMultivariateVectorFunction</a>.
+First we need to implement the interface <a href="../apidocs/org/apache/commons/math4/analysis/DifferentiableMultivariateVectorFunction.html">DifferentiableMultivariateVectorFunction</a>.
 This requires the implementation of the method signatures:
 </p>
 
@@ -455,7 +455,7 @@ can be seen below:
 
 <p>
 Below is the the class containing all the implementation details
-(Taken from the Apache Commons Math <b>org.apache.commons.math3.optimization.general.LevenbergMarquardtOptimizerTest</b>):
+(Taken from the Apache Commons Math <b>org.apache.commons.math4.optimization.general.LevenbergMarquardtOptimizerTest</b>):
 </p>
 
 <source>
@@ -567,17 +567,17 @@ C: 16.324008168386605
     </dd></dl>
         <p>
           In addition to least squares solving, the <a
-          href="../apidocs/org/apache/commons/math3/optimization/general/NonLinearConjugateGradientOptimizer.html">
+          href="../apidocs/org/apache/commons/math4/optimization/general/NonLinearConjugateGradientOptimizer.html">
           NonLinearConjugateGradientOptimizer</a> class provides a non-linear conjugate gradient algorithm
           to optimize <a
-          href="../apidocs/org/apache/commons/math3/analysis/DifferentiableMultivariateFunction.html">
+          href="../apidocs/org/apache/commons/math4/analysis/DifferentiableMultivariateFunction.html">
           DifferentiableMultivariateFunction</a>. Both the Fletcher-Reeves and the Polak-Ribi&#232;re
           search direction update methods are supported. It is also possible to set up a preconditioner
           or to change the line-search algorithm of the inner loop if desired (the default one is a Brent
           solver).
         </p>
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/optimization/direct/PowellOptimizer.html">
+          The <a href="../apidocs/org/apache/commons/math4/optimization/direct/PowellOptimizer.html">
           PowellOptimizer</a> provides an optimization method for non-differentiable functions.
         </p>
       </subsection>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/overview.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/overview.xml b/src/site/xdoc/userguide/overview.xml
index 4850965..eb8d8c1 100644
--- a/src/site/xdoc/userguide/overview.xml
+++ b/src/site/xdoc/userguide/overview.xml
@@ -73,22 +73,22 @@
     <p>
     Commons Math is divided into sixteen subpackages, based on functionality provided.
     <ul>
-      <li><a href="stat.html">org.apache.commons.math3.stat</a> - statistics, statistical tests</li>
-      <li><a href="analysis.html">org.apache.commons.math3.analysis</a> - rootfinding, integration, interpolation, polynomials</li>
-      <li><a href="random.html">org.apache.commons.math3.random</a> - random numbers, strings and data generation</li>
-      <li><a href="special.html">org.apache.commons.math3.special</a> - special functions (Gamma, Beta) </li>
-      <li><a href="linear.html">org.apache.commons.math3.linear</a> - matrices, solving linear systems </li>
-      <li><a href="utilities.html">org.apache.commons.math3.util</a> - common math/stat functions extending java.lang.Math </li>
-      <li><a href="complex.html">org.apache.commons.math3.complex</a> - complex numbers</li>
-      <li><a href="distribution.html">org.apache.commons.math3.distribution</a> - probability distributions</li>
-      <li><a href="fraction.html">org.apache.commons.math3.fraction</a> - rational numbers</li>
-      <li><a href="transform.html">org.apache.commons.math3.transform</a> - transform methods (Fast Fourier)</li>
-      <li><a href="geometry.html">org.apache.commons.math3.geometry</a> - geometry (Euclidean spaces and Binary Space Partitioning)</li>
-      <li><a href="optimization.html">org.apache.commons.math3.optim</a> - function maximization or minimization</li>
-      <li><a href="ode.html">org.apache.commons.math3.ode</a> - Ordinary Differential Equations integration</li>
-      <li><a href="genetics.html">org.apache.commons.math3.genetics</a> - Genetic Algorithms</li>
-      <li><a href="fitting.html">org.apache.commons.math3.fitting</a> - Curve Fitting</li>
-      <li><a href="ml.html">org.apache.commons.math3.ml</a> - Machine Learning</li>
+      <li><a href="stat.html">org.apache.commons.math4.stat</a> - statistics, statistical tests</li>
+      <li><a href="analysis.html">org.apache.commons.math4.analysis</a> - rootfinding, integration, interpolation, polynomials</li>
+      <li><a href="random.html">org.apache.commons.math4.random</a> - random numbers, strings and data generation</li>
+      <li><a href="special.html">org.apache.commons.math4.special</a> - special functions (Gamma, Beta) </li>
+      <li><a href="linear.html">org.apache.commons.math4.linear</a> - matrices, solving linear systems </li>
+      <li><a href="utilities.html">org.apache.commons.math4.util</a> - common math/stat functions extending java.lang.Math </li>
+      <li><a href="complex.html">org.apache.commons.math4.complex</a> - complex numbers</li>
+      <li><a href="distribution.html">org.apache.commons.math4.distribution</a> - probability distributions</li>
+      <li><a href="fraction.html">org.apache.commons.math4.fraction</a> - rational numbers</li>
+      <li><a href="transform.html">org.apache.commons.math4.transform</a> - transform methods (Fast Fourier)</li>
+      <li><a href="geometry.html">org.apache.commons.math4.geometry</a> - geometry (Euclidean spaces and Binary Space Partitioning)</li>
+      <li><a href="optimization.html">org.apache.commons.math4.optim</a> - function maximization or minimization</li>
+      <li><a href="ode.html">org.apache.commons.math4.ode</a> - Ordinary Differential Equations integration</li>
+      <li><a href="genetics.html">org.apache.commons.math4.genetics</a> - Genetic Algorithms</li>
+      <li><a href="fitting.html">org.apache.commons.math4.fitting</a> - Curve Fitting</li>
+      <li><a href="ml.html">org.apache.commons.math4.ml</a> - Machine Learning</li>
     </ul>
     Package javadocs are <a href="../apidocs/index.html">here</a>
     </p>
@@ -106,9 +106,9 @@
   <p>
     When the actual parameters provided to a method or the internal state of an object 
     make a computation meaningless, a
-    <a href="../apidocs/org/apache/commons/math3/exception/MathIllegalArgumentException.html">
+    <a href="../apidocs/org/apache/commons/math4/exception/MathIllegalArgumentException.html">
       MathIllegalArgumentException</a> or
-    <a href="../apidocs/org/apache/commons/math3/exception/MathIllegalStateException.html">
+    <a href="../apidocs/org/apache/commons/math4/exception/MathIllegalStateException.html">
     MathIllegalStateException</a> may be thrown. Exact conditions under which runtime
     exceptions (and any other exceptions) are thrown are specified in the javadoc method
     comments.
@@ -120,7 +120,7 @@
   <p>
     As of version 2.2, the policy for dealing with null references is as
     follows: When an argument is unexpectedly null, a
-    <a href="../apidocs/org/apache/commons/math3/exception/NullArgumentException.html">
+    <a href="../apidocs/org/apache/commons/math4/exception/NullArgumentException.html">
     NullArgumentException</a> is raised to signal the illegal argument. Note that this
     class does not inherit from the standard <code>NullPointerException</code> but is a subclass
     of <code>MathIllegalArgumentException</code>.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/random.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/random.xml b/src/site/xdoc/userguide/random.xml
index 914636b..1ea7615 100644
--- a/src/site/xdoc/userguide/random.xml
+++ b/src/site/xdoc/userguide/random.xml
@@ -67,7 +67,7 @@
 
 <subsection name="2.2 Random numbers" href="deviates">
     <p>
-    The <a href="../apidocs/org/apache/commons/math3/random/RandomDataGenerator.html">
+    The <a href="../apidocs/org/apache/commons/math4/random/RandomDataGenerator.html">
     RandomDataGenerator</a> class implements methods for generating random sequences
     of numbers. The API contracts of these methods use the following concepts:
     <dl>
@@ -86,10 +86,10 @@
     ranges in the set  of possible values of a random variable have
     different probabilities of containing the value.  Commons Math supports
     generating random sequences from each of the distributions in the
-    <a href="../apidocs/org/apache/commons/math3/distribution/package-summary.html">
+    <a href="../apidocs/org/apache/commons/math4/distribution/package-summary.html">
     distributions</a> package.
     The javadoc for the <code>nextXxx</code> methods in 
-    <a href="../apidocs/org/apache/commons/math3/random/RandomDataGenerator.html">
+    <a href="../apidocs/org/apache/commons/math4/random/RandomDataGenerator.html">
     RandomDataGenerator</a> describes the algorithms used to generate
     random deviates.   
     </dd>
@@ -166,11 +166,11 @@ for (int i = 0; i &lt; 1000; i++) {
     Some algorithms require random vectors instead of random scalars. When the
     components of these vectors are uncorrelated, they may be generated simply
     one at a time and packed together in the vector. The <a
-    href="../apidocs/org/apache/commons/math3/random/UncorrelatedRandomVectorGenerator.html">
+    href="../apidocs/org/apache/commons/math4/random/UncorrelatedRandomVectorGenerator.html">
     UncorrelatedRandomVectorGenerator</a> class simplifies this
     process by setting the mean and deviation of each component once and
     generating complete vectors. When the components are correlated however,
-    generating them is much more difficult. The <a href="../apidocs/org/apache/commons/math3/random/CorrelatedRandomVectorGenerator.html">
+    generating them is much more difficult. The <a href="../apidocs/org/apache/commons/math4/random/CorrelatedRandomVectorGenerator.html">
     CorrelatedRandomVectorGenerator</a> class provides this service. In this
     case, the user must set up a complete covariance matrix instead of a simple
     standard deviations vector. This matrix gathers both the variance and the
@@ -219,10 +219,10 @@ RealMatrix covariance = MatrixUtils.createRealMatrix(cov); </source>
     <p>
     In addition to multivariate normal distributions, correlated vectors from multivariate uniform
     distributions can be generated by creating a
-    <a href="../apidocs/org/apache/commons/math3/random/UniformRandomGenerator.html">UniformRandomGenerator</a>
+    <a href="../apidocs/org/apache/commons/math4/random/UniformRandomGenerator.html">UniformRandomGenerator</a>
     in place of the 
     <code>GaussianRandomGenerator</code> above.  More generally, any
-    <a href="../apidocs/org/apache/commons/math3/random/NormalizedRandomGenerator.html">NormalizedRandomGenerator</a>
+    <a href="../apidocs/org/apache/commons/math4/random/NormalizedRandomGenerator.html">NormalizedRandomGenerator</a>
     may be used.
     </p>
     <p><dl>
@@ -234,8 +234,8 @@ RealMatrix covariance = MatrixUtils.createRealMatrix(cov); </source>
     is completely deterministic), their unique properties give them an important advantage for quasi-Monte Carlo simulations.<br/>
     Currently, the following low-discrepancy sequences are supported:
     <ul>
-        <li><a href="../apidocs/org/apache/commons/math3/random/SobolSequenceGenerator.html">Sobol sequence</a> (pre-configured up to dimension 1000)</li>
-        <li><a href="../apidocs/org/apache/commons/math3/random/HaltonSequenceGenerator.html">Halton sequence</a> (pre-configured up to dimension 40)</li>
+        <li><a href="../apidocs/org/apache/commons/math4/random/SobolSequenceGenerator.html">Sobol sequence</a> (pre-configured up to dimension 1000)</li>
+        <li><a href="../apidocs/org/apache/commons/math4/random/HaltonSequenceGenerator.html">Halton sequence</a> (pre-configured up to dimension 40)</li>
     </ul>
     <source>
 // Create a Sobol sequence generator for 2-dimensional vectors
@@ -369,41 +369,41 @@ double[] randomVector = generator.nextVector();
       generation utilities and to provide a generic means to replace 
       <code>java.util.Random</code> in applications, a random generator 
       adaptor framework has been added to commons-math.  The
-      <a href="../apidocs/org/apache/commons/math3/random/RandomGenerator.html">
+      <a href="../apidocs/org/apache/commons/math4/random/RandomGenerator.html">
       RandomGenerator</a> interface abstracts the public interface of
       <code>java.util.Random</code> and any implementation of this
       interface can be used as the source of random data for the commons-math 
       data generation classes.  An abstract base class, 
-      <a href="../apidocs/org/apache/commons/math3/random/AbstractRandomGenerator.html">
+      <a href="../apidocs/org/apache/commons/math4/random/AbstractRandomGenerator.html">
       AbstractRandomGenerator</a> is provided to make implementation easier.
       This class provides default implementations of "derived" data generation
       methods based on the primitive,  <code>nextDouble()</code>.
       To support generic replacement of <code>java.util.Random</code>, the 
-      <a href="../apidocs/org/apache/commons/math3/random/RandomAdaptor.html">
+      <a href="../apidocs/org/apache/commons/math4/random/RandomAdaptor.html">
       RandomAdaptor</a> class is provided, which extends
       <code>java.util.Random</code> and wraps and delegates calls to
       a <code>RandomGenerator</code> instance.   
   </p>
 
       <p>Commons-math provides by itself several implementations of the <a
-      href="../apidocs/org/apache/commons/math3/random/RandomGenerator.html">
+      href="../apidocs/org/apache/commons/math4/random/RandomGenerator.html">
       RandomGenerator</a> interface:
       <ul>
-        <li><a href="../apidocs/org/apache/commons/math3/random/JDKRandomGenerator.html">JDKRandomGenerator</a>
+        <li><a href="../apidocs/org/apache/commons/math4/random/JDKRandomGenerator.html">JDKRandomGenerator</a>
             that extends the JDK provided generator</li>
-        <li><a href="../apidocs/org/apache/commons/math3/random/AbstractRandomGenerator.html">
+        <li><a href="../apidocs/org/apache/commons/math4/random/AbstractRandomGenerator.html">
             AbstractRandomGenerator</a> as a helper for users generators</li>
-        <li><a href="../apidocs/org/apache/commons/math3/random/BitStreamGenerator.html">
+        <li><a href="../apidocs/org/apache/commons/math4/random/BitStreamGenerator.html">
             BitStreamGenerator</a> which is an abstract class for several generators and
             which in turn is extended by:
             <ul>
-              <li><a href="../apidocs/org/apache/commons/math3/random/MersenneTwister.html">MersenneTwister</a></li>
-              <li><a href="../apidocs/org/apache/commons/math3/random/Well512a.html">Well512a</a></li>
-              <li><a href="../apidocs/org/apache/commons/math3/random/Well1024a.html">Well1024a</a></li>
-              <li><a href="../apidocs/org/apache/commons/math3/random/Well19937a.html">Well19937a</a></li>
-              <li><a href="../apidocs/org/apache/commons/math3/random/Well19937c.html">Well19937c</a></li>
-              <li><a href="../apidocs/org/apache/commons/math3/random/Well44497a.html">Well44497a</a></li>
-              <li><a href="../apidocs/org/apache/commons/math3/random/Well44497b.html">Well44497b</a></li>
+              <li><a href="../apidocs/org/apache/commons/math4/random/MersenneTwister.html">MersenneTwister</a></li>
+              <li><a href="../apidocs/org/apache/commons/math4/random/Well512a.html">Well512a</a></li>
+              <li><a href="../apidocs/org/apache/commons/math4/random/Well1024a.html">Well1024a</a></li>
+              <li><a href="../apidocs/org/apache/commons/math4/random/Well19937a.html">Well19937a</a></li>
+              <li><a href="../apidocs/org/apache/commons/math4/random/Well19937c.html">Well19937c</a></li>
+              <li><a href="../apidocs/org/apache/commons/math4/random/Well44497a.html">Well44497a</a></li>
+              <li><a href="../apidocs/org/apache/commons/math4/random/Well44497b.html">Well44497b</a></li>
             </ul>
           </li>
         </ul>
@@ -474,21 +474,21 @@ double[] randomVector = generator.nextVector();
         <table border="1" align="center">
           <tr BGCOLOR="#CCCCFF"><td colspan="2"><font size="+1">Example of performances</font></td></tr>
           <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>generation rate (relative to MersenneTwister)</td></font></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/MersenneTwister.html">MersenneTwister</a></td><td>1</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/JDKRandomGenerator.html">JDKRandomGenerator</a></td><td>between 0.96 and 1.16</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/Well512a.html">Well512a</a></td><td>between 0.85 and 0.88</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/Well1024a.html">Well1024a</a></td><td>between 0.63 and 0.73</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/Well19937a.html">Well19937a</a></td><td>between 0.70 and 0.71</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/Well19937c.html">Well19937c</a></td><td>between 0.57 and 0.71</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/Well44497a.html">Well44497a</a></td><td>between 0.69 and 0.71</td></tr>
-          <tr><td><a href="../apidocs/org/apache/commons/math3/random/Well44497b.html">Well44497b</a></td><td>between 0.65 and 0.71</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/MersenneTwister.html">MersenneTwister</a></td><td>1</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/JDKRandomGenerator.html">JDKRandomGenerator</a></td><td>between 0.96 and 1.16</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/Well512a.html">Well512a</a></td><td>between 0.85 and 0.88</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/Well1024a.html">Well1024a</a></td><td>between 0.63 and 0.73</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/Well19937a.html">Well19937a</a></td><td>between 0.70 and 0.71</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/Well19937c.html">Well19937c</a></td><td>between 0.57 and 0.71</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/Well44497a.html">Well44497a</a></td><td>between 0.69 and 0.71</td></tr>
+          <tr><td><a href="../apidocs/org/apache/commons/math4/random/Well44497b.html">Well44497b</a></td><td>between 0.65 and 0.71</td></tr>
         </table>
       </p>
 
       <p>
       So for most simulation problems, the better generators like <a
-      href="../apidocs/org/apache/commons/math3/random/Well19937c.html">Well19937c</a> and <a
-      href="../apidocs/org/apache/commons/math3/random/Well44497b.html">Well44497b</a> are probably very good choices.
+      href="../apidocs/org/apache/commons/math4/random/Well19937c.html">Well19937c</a> and <a
+      href="../apidocs/org/apache/commons/math4/random/Well44497b.html">Well44497b</a> are probably very good choices.
       </p>
 
       <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/stat.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/stat.xml b/src/site/xdoc/userguide/stat.xml
index b93e0e1..6035727 100644
--- a/src/site/xdoc/userguide/stat.xml
+++ b/src/site/xdoc/userguide/stat.xml
@@ -62,12 +62,12 @@
         </p>
         <p>
           The top level interface is
-          <a href="../apidocs/org/apache/commons/math3/stat/descriptive/UnivariateStatistic.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/descriptive/UnivariateStatistic.html">
           UnivariateStatistic</a>.
           This interface, implemented by all statistics, consists of
           <code>evaluate()</code> methods that take double[] arrays as arguments
           and return the value of the statistic.   This interface is extended by
-          <a href="../apidocs/org/apache/commons/math3/stat/descriptive/StorelessUnivariateStatistic.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatistic.html">
           StorelessUnivariateStatistic</a>, which adds <code>increment(),</code>
           <code>getResult()</code> and associated methods to support
           "storageless" implementations that maintain counters, sums or other
@@ -76,9 +76,9 @@
         </p>
         <p>
           Abstract implementations of the top level interfaces are provided in
-          <a href="../apidocs/org/apache/commons/math3/stat/descriptive/AbstractUnivariateStatistic.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.html">
           AbstractUnivariateStatistic</a> and
-          <a href="../apidocs/org/apache/commons/math3/stat/descriptive/AbstractStorelessUnivariateStatistic.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.html">
           AbstractStorelessUnivariateStatistic</a> respectively.
         </p>
         <p>
@@ -88,9 +88,9 @@
           compute the statistic). There are several ways to instantiate and use statistics.
           Statistics can be instantiated and used directly,  but it is generally more convenient
           (and efficient) to access them using the provided aggregates,
-          <a href="../apidocs/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/descriptive/DescriptiveStatistics.html">
            DescriptiveStatistics</a> and
-           <a href="../apidocs/org/apache/commons/math3/stat/descriptive/SummaryStatistics.html">
+           <a href="../apidocs/org/apache/commons/math4/stat/descriptive/SummaryStatistics.html">
            SummaryStatistics.</a>
         </p>
         <p>
@@ -108,18 +108,18 @@
           <table>
             <tr><th>Aggregate</th><th>Statistics Included</th><th>Values stored?</th>
             <th>"Rolling" capability?</th></tr><tr><td>
-            <a href="../apidocs/org/apache/commons/math3/stat/descriptive/DescriptiveStatistics.html">
+            <a href="../apidocs/org/apache/commons/math4/stat/descriptive/DescriptiveStatistics.html">
             DescriptiveStatistics</a></td><td>min, max, mean, geometric mean, n,
             sum, sum of squares, standard deviation, variance, percentiles, skewness,
             kurtosis, median</td><td>Yes</td><td>Yes</td></tr><tr><td>
-            <a href="../apidocs/org/apache/commons/math3/stat/descriptive/SummaryStatistics.html">
+            <a href="../apidocs/org/apache/commons/math4/stat/descriptive/SummaryStatistics.html">
             SummaryStatistics</a></td><td>min, max, mean, geometric mean, n,
             sum, sum of squares, standard deviation, variance</td><td>No</td><td>No</td></tr>
           </table>
         </p>
         <p>
           <code>SummaryStatistics</code> can be aggregated using 
-          <a href="../apidocs/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatistics.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.html">
           AggregateSummaryStatistics.</a>  This class can be used to concurrently
           gather statistics for multiple datasets as well as for a combined sample
           including all of the data.
@@ -133,19 +133,19 @@
         <p>
            Neither <code>DescriptiveStatistics</code> nor <code>SummaryStatistics</code>
            is thread-safe.
-           <a href="../apidocs/org/apache/commons/math3/stat/descriptive/SynchronizedDescriptiveStatistics.html">
+           <a href="../apidocs/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatistics.html">
            SynchronizedDescriptiveStatistics</a> and
-           <a href="../apidocs/org/apache/commons/math3/stat/descriptive/SynchronizedSummaryStatistics.html"> 
+           <a href="../apidocs/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatistics.html"> 
            SynchronizedSummaryStatistics</a>, respectively, provide thread-safe
            versions for applications that require concurrent access to statistical
            aggregates by multiple threads.
-           <a href="../apidocs/org/apache/commons/math3/stat/descriptive/SynchronizedMultiVariateSummaryStatistics.html"> 
+           <a href="../apidocs/org/apache/commons/math4/stat/descriptive/SynchronizedMultiVariateSummaryStatistics.html"> 
            SynchronizedMultivariateSummaryStatistics</a> provides thread-safe
            <code>MultivariateSummaryStatistics.</code>
         </p>
         <p>
           There is also a utility class,
-          <a href="../apidocs/org/apache/commons/math3/stat/StatUtils.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/StatUtils.html">
           StatUtils</a>, that provides static methods for computing statistics
           directly from double[] arrays.
         </p>
@@ -243,7 +243,7 @@ DescriptiveStatistics stats = new SynchronizedDescriptiveStatistics();
         The first is to use an <code>AggregateSummaryStatistics</code> instance
         to accumulate overall statistics contributed by <code>SummaryStatistics</code>
         instances created using
-        <a href="../apidocs/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatistics.html#createContributingStatistics()">
+        <a href="../apidocs/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.html#createContributingStatistics()">
         AggregateSummaryStatistics.createContributingStatistics()</a>:
         <source>
 // Create a AggregateSummaryStatistics instance to accumulate the overall statistics 
@@ -264,7 +264,7 @@ double totalSampleSum = aggregate.getSum();
         <code>SummaryStatistics</code> instance maintained by the aggregate and each value addition updates the
         aggregate as well as the subsample. For applications that can wait to do the aggregation until all values
         have been added, a static
-        <a href="../apidocs/org/apache/commons/math3/stat/descriptive/AggregateSummaryStatistics.html#aggregate(java.util.Collection)">
+        <a href="../apidocs/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.html#aggregate(java.util.Collection)">
           aggregate</a> method is available, as shown in the following example.
         This method should be used when aggregation needs to be done across threads.
         <source>
@@ -292,7 +292,7 @@ double totalSampleSum = aggregatedStats.getSum();
       </subsection>
       <subsection name="1.3 Frequency distributions">
         <p>
-          <a href="../apidocs/org/apache/commons/math3/stat/Frequency.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/Frequency.html">
           Frequency</a>
           provides a simple interface for maintaining counts and percentages of discrete
           values.
@@ -356,7 +356,7 @@ System.out.println(f.getCumPct("z"));  // displays 1
       </subsection>
       <subsection name="1.4 Simple regression">
         <p>
-         <a href="../apidocs/org/apache/commons/math3/stat/regression/SimpleRegression.html">
+         <a href="../apidocs/org/apache/commons/math4/stat/regression/SimpleRegression.html">
           SimpleRegression</a> provides ordinary least squares regression with
          one independent variable estimating the linear model:
          </p>
@@ -392,7 +392,7 @@ System.out.println(f.getCumPct("z"));  // displays 1
            "compute" method that updates all statistics.  Each of the getters performs
            the necessary computations to return the requested statistic.</li>
            <li> The intercept term may be suppressed by passing <code>false</code> to the
-           <a href="../apidocs/org/apache/commons/math3/stat/regression/SimpleRegression.html#SimpleRegression(boolean)">
+           <a href="../apidocs/org/apache/commons/math4/stat/regression/SimpleRegression.html#SimpleRegression(boolean)">
            SimpleRegression(boolean)</a> constructor.  When the <code>hasIntercept</code>
            property is false, the model is estimated without a constant term and
            <code>getIntercept()</code> returns <code>0</code>.</li>
@@ -510,9 +510,9 @@ System.out.println(regression.getInterceptStdErr() );
       </subsection>
       <subsection name="1.5 Multiple linear regression">
         <p>
-         <a href="../apidocs/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegression.html">
+         <a href="../apidocs/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.html">
          OLSMultipleLinearRegression</a> and
-         <a href="../apidocs/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegression.html">
+         <a href="../apidocs/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.html">
          GLSMultipleLinearRegression</a> provide least squares regression to fit the linear model:
          </p>
          <p>
@@ -524,9 +524,9 @@ System.out.println(regression.getInterceptStdErr() );
          of <b>error terms</b> or <b>residuals</b>.
          </p>
          <p>
-          <a href="../apidocs/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegression.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.html">
           OLSMultipleLinearRegression</a> provides Ordinary Least Squares Regression, and 
-          <a href="../apidocs/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegression.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.html">
           GLSMultipleLinearRegression</a> implements Generalized Least Squares.  See the javadoc for these
           classes for details on the algorithms and formulas used.
          </p>
@@ -534,11 +534,11 @@ System.out.println(regression.getInterceptStdErr() );
            Data for OLS models can be loaded in a single double[] array, consisting of concatenated rows of data, each containing
            the regressand (Y) value, followed by regressor values; or using a double[][] array with rows corresponding to
            observations. GLS models also require a double[][] array representing the covariance matrix of the error terms.  See
-           <a href="../apidocs/org/apache/commons/math3/stat/regression/AbstractMultipleLinearRegression.html#newSampleData(double[], int, int)">
+           <a href="../apidocs/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.html#newSampleData(double[], int, int)">
            AbstractMultipleLinearRegression#newSampleData(double[],int,int)</a>,  
-           <a href="../apidocs/org/apache/commons/math3/stat/regression/OLSMultipleLinearRegression.html#newSampleData(double[], double[][])">
+           <a href="../apidocs/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.html#newSampleData(double[], double[][])">
            OLSMultipleLinearRegression#newSampleData(double[], double[][])</a> and 
-           <a href="../apidocs/org/apache/commons/math3/stat/regression/GLSMultipleLinearRegression.html#newSampleData(double[], double[][], double[][])">
+           <a href="../apidocs/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.html#newSampleData(double[], double[][], double[][])">
            GLSMultipleLinearRegression#newSampleData(double[],double[][],double[][])</a> for details.
          </p>
          <p>
@@ -616,16 +616,16 @@ regression.newSampleData(y, x, omega);
       <subsection name="1.6 Rank transformations">
       <p>
          Some statistical algorithms require that input data be replaced by ranks.
-         The <a href="../apidocs/org/apache/commons/math3/stat/ranking/package-summary.html">
-         org.apache.commons.math3.stat.ranking</a> package provides rank transformation.
-         <a href="../apidocs/org/apache/commons/math3/stat/ranking/RankingAlgorithm.html">
+         The <a href="../apidocs/org/apache/commons/math4/stat/ranking/package-summary.html">
+         org.apache.commons.math4.stat.ranking</a> package provides rank transformation.
+         <a href="../apidocs/org/apache/commons/math4/stat/ranking/RankingAlgorithm.html">
          RankingAlgorithm</a> defines the interface for ranking.  
-         <a href="../apidocs/org/apache/commons/math3/stat/ranking/NaturalRanking.html">
+         <a href="../apidocs/org/apache/commons/math4/stat/ranking/NaturalRanking.html">
          NaturalRanking</a> provides an implementation that has two configuration options.
          <ul>
-         <li><a href="../apidocs/org/apache/commons/math3/stat/ranking/TiesStrategy.html">
+         <li><a href="../apidocs/org/apache/commons/math4/stat/ranking/TiesStrategy.html">
          Ties strategy</a> deterimines how ties in the source data are handled by the ranking</li>
-         <li><a href="../apidocs/org/apache/commons/math3/stat/ranking/NaNStrategy.html">
+         <li><a href="../apidocs/org/apache/commons/math4/stat/ranking/NaNStrategy.html">
          NaN strategy</a> determines how NaN values in the source data are handled.</li>
          </ul>
       </p>
@@ -649,24 +649,24 @@ new NaturalRanking(NaNStrategy.REMOVED,TiesStrategy.SEQUENTIAL).rank(exampleData
         values larger than any other value (including <code>Double.POSITIVE_INFINITY</code>). The
         default <code>TiesStrategy</code> is <code>TiesStrategy.AVERAGE,</code> which assigns tied
         values the average of the ranks applicable to the sequence of ties.  See the 
-        <a href="../apidocs/org/apache/commons/math3/stat/ranking/NaturalRanking.html">
-        NaturalRanking</a> for more examples and <a href="../apidocs/org/apache/commons/math3/stat/ranking/TiesStrategy.html">
-        TiesStrategy</a> and <a href="../apidocs/org/apache/commons/math3/stat/ranking/NaNStrategy.html">NaNStrategy</a>
+        <a href="../apidocs/org/apache/commons/math4/stat/ranking/NaturalRanking.html">
+        NaturalRanking</a> for more examples and <a href="../apidocs/org/apache/commons/math4/stat/ranking/TiesStrategy.html">
+        TiesStrategy</a> and <a href="../apidocs/org/apache/commons/math4/stat/ranking/NaNStrategy.html">NaNStrategy</a>
         for details on these configuration options.
        </p>
       </subsection>  
       <subsection name="1.7 Covariance and correlation">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/stat/correlation/package-summary.html">
-          org.apache.commons.math3.stat.correlation</a> package computes covariances
+          The <a href="../apidocs/org/apache/commons/math4/stat/correlation/package-summary.html">
+          org.apache.commons.math4.stat.correlation</a> package computes covariances
           and correlations for pairs of arrays or columns of a matrix.
-          <a href="../apidocs/org/apache/commons/math3/stat/correlation/Covariance.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/correlation/Covariance.html">
           Covariance</a> computes covariances, 
-          <a href="../apidocs/org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/correlation/PearsonsCorrelation.html">
           PearsonsCorrelation</a> provides Pearson's Product-Moment correlation coefficients,
-          <a href="../apidocs/org/apache/commons/math3/stat/correlation/SpearmansCorrelation.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/correlation/SpearmansCorrelation.html">
           SpearmansCorrelation</a> computes Spearman's rank correlation and
-          <a href="../apidocs/org/apache/commons/math3/stat/correlation/KendallsCorrelation.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/correlation/KendallsCorrelation.html">
           KendallsCorrelation</a> computes Kendall's tau rank correlation.
         </p>
         <p>
@@ -682,21 +682,21 @@ new NaturalRanking(NaNStrategy.REMOVED,TiesStrategy.SEQUENTIAL).rank(exampleData
            defaults to <code>true.</code>      
           </li>
           <li>
-          <a href="../apidocs/org/apache/commons/math3/stat/correlation/PearsonsCorrelation.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/correlation/PearsonsCorrelation.html">
           PearsonsCorrelation</a> computes correlations defined by the formula <br/>
           <code>cor(X, Y) = sum[(x<sub>i</sub> - E(X))(y<sub>i</sub> - E(Y))] / [(n - 1)s(X)s(Y)]</code><br/>
           where <code>E(X)</code> and <code>E(Y)</code> are means of <code>X</code> and <code>Y</code>
           and <code>s(X)</code>, <code>s(Y)</code> are standard deviations.
           </li>
           <li>
-          <a href="../apidocs/org/apache/commons/math3/stat/correlation/SpearmansCorrelation.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/correlation/SpearmansCorrelation.html">
           SpearmansCorrelation</a> applies a rank transformation to the input data and computes Pearson's
           correlation on the ranked data.  The ranking algorithm is configurable. By default, 
-          <a href="../apidocs/org/apache/commons/math3/stat/ranking/NaturalRanking.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/ranking/NaturalRanking.html">
           NaturalRanking</a> with default strategies for handling ties and NaN values is used.
           </li>
           <li>
-          <a href="../apidocs/org/apache/commons/math3/stat/correlation/KendallsCorrelation.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/correlation/KendallsCorrelation.html">
           KendallsCorrelation</a> computes the association between two measured quantities. A tau test
           is a non-parametric hypothesis test for statistical dependence based on the tau coefficient.
           </li> 
@@ -818,8 +818,8 @@ new KendallsCorrelation().correlation(x, y)
       </subsection>
             <subsection name="1.8 Statistical tests">
         <p>
-          The <a href="../apidocs/org/apache/commons/math3/stat/inference/">
-          org.apache.commons.math3.stat.inference</a> package provides implementations for
+          The <a href="../apidocs/org/apache/commons/math4/stat/inference/">
+          org.apache.commons.math4.stat.inference</a> package provides implementations for
           <a href="http://www.itl.nist.gov/div898/handbook/prc/section2/prc22.htm">
           Student's t</a>,
           <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda35f.htm">
@@ -838,23 +838,23 @@ new KendallsCorrelation().correlation(x, y)
           <code>Chi-Square</code>, <code>G</code>, <code>One-Way ANOVA</code>, <code>Mann-Whitney U</code>
           <code>Wilcoxon signed rank</code>, and <code>Kolmogorov-Smirnov</code> tests.
           The respective test classes are
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/TTest.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/TTest.html">
           TTest</a>,
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/ChiSquareTest.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/ChiSquareTest.html">
           ChiSquareTest</a>,
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/GTest.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/GTest.html">
           GTest</a>,
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/OneWayAnova.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/OneWayAnova.html">
           OneWayAnova</a>,
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/MannWhitneyUTest.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/MannWhitneyUTest.html">
           MannWhitneyUTest</a>,
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/WilcoxonSignedRankTest.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/WilcoxonSignedRankTest.html">
           WilcoxonSignedRankTest</a>,
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/BinomialTest.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/BinomialTest.html">
           BinomialTest</a> and
-          <a href="../apidocs/org/apache/commons/math3/stat/inference/KolmogorovSmirnovTest.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/inference/KolmogorovSmirnovTest.html">
           KolmogorovSmirnovTest</a>.                  
-          The <a href="../apidocs/org/apache/commons/math3/stat/inference/TestUtils.html">
+          The <a href="../apidocs/org/apache/commons/math4/stat/inference/TestUtils.html">
           TestUtils</a> class provides static methods to get test instances or
           to compute test statistics directly.  The examples below all use the
           static methods in <code>TestUtils</code> to execute tests.  To get
@@ -937,7 +937,7 @@ System.out.println(TestUtils.t(mu, observed));
            <code>mu.</code>
           </dd>
           <dd>To compare the mean of a dataset described by a
-          <a href="../apidocs/org/apache/commons/math3/stat/descriptive/StatisticalSummary.html">
+          <a href="../apidocs/org/apache/commons/math4/stat/descriptive/StatisticalSummary.html">
           StatisticalSummary</a>  to a fixed value:
           <source>
 double[] observed ={1d, 2d, 3d};

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/transform.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/transform.xml b/src/site/xdoc/userguide/transform.xml
index 1499eb5..56cdec0 100644
--- a/src/site/xdoc/userguide/transform.xml
+++ b/src/site/xdoc/userguide/transform.xml
@@ -30,13 +30,13 @@
          This package provides a few transformers for signal analysis. All transformers
          provide both direct and inverse transforms.
          <ul>
-           <li><a href="../apidocs/org/apache/commons/math3/transform/FastFourierTransformer.html">
+           <li><a href="../apidocs/org/apache/commons/math4/transform/FastFourierTransformer.html">
             FastFourierTransformer</a> (produces <code>Complex</code> results)</li>
-           <li><a href="../apidocs/org/apache/commons/math3/transform/FastCosineTransformer.html">
+           <li><a href="../apidocs/org/apache/commons/math4/transform/FastCosineTransformer.html">
            FastCosineTransformer</a> (produces real results)</li>
-           <li><a href="../apidocs/org/apache/commons/math3/transform/FastSineTransformer.html">
+           <li><a href="../apidocs/org/apache/commons/math4/transform/FastSineTransformer.html">
            FastSineTransformer</a> (produces real results)</li>
-           <li><a href="../apidocs/org/apache/commons/math3/transform/FastHadamardTransformer.html">
+           <li><a href="../apidocs/org/apache/commons/math4/transform/FastHadamardTransformer.html">
            FastHadamardTransformer</a> (produces real results)</li>
          </ul>
       </p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/site/xdoc/userguide/utilities.xml
----------------------------------------------------------------------
diff --git a/src/site/xdoc/userguide/utilities.xml b/src/site/xdoc/userguide/utilities.xml
index a03c2f3..e166e77 100644
--- a/src/site/xdoc/userguide/utilities.xml
+++ b/src/site/xdoc/userguide/utilities.xml
@@ -30,8 +30,8 @@
 
 <subsection name="6.1 Overview" href="overview">
     <p>
-    The <a href="../apidocs/org/apache/commons/math3/util/package-summary.html">
-    org.apache.commons.math3.util</a> package collects a group of array utilities,
+    The <a href="../apidocs/org/apache/commons/math4/util/package-summary.html">
+    org.apache.commons.math4.util</a> package collects a group of array utilities,
     value transformers,  and numerical routines used by implementation classes in
     commons-math.
     </p>
@@ -43,7 +43,7 @@
     array implementation was developed and is provided for reuse in the 
     <code>util</code> package.  The core functionality provided is described in
     the documentation for the interface, 
-    <a href="../apidocs/org/apache/commons/math3/util/DoubleArray.html">
+    <a href="../apidocs/org/apache/commons/math4/util/DoubleArray.html">
     DoubleArray</a>.  This interface adds one method,
     <code>addElementRolling(double)</code> to basic list accessors. 
     The <code>addElementRolling</code> method adds an element 
@@ -51,7 +51,7 @@
      in the list.
     </p>
     <p>
-    The <a href="../apidocs/org/apache/commons/math3/util/ResizableDoubleArray.html">
+    The <a href="../apidocs/org/apache/commons/math4/util/ResizableDoubleArray.html">
     ResizableDoubleArray</a> class provides a configurable, array-backed
     implementation of the <code>DoubleArray</code> interface.
     When <code>addElementRolling</code> is invoked, the underlying
@@ -65,7 +65,7 @@
     automatically, with frequency / effect driven by the configuration
     properties <code>expansionMode</code>, <code>expansionFactor</code> and
     <code>contractionCriteria.</code>  See 
-    <a href="../apidocs/org/apache/commons/math3/util/ResizableDoubleArray.html">
+    <a href="../apidocs/org/apache/commons/math4/util/ResizableDoubleArray.html">
     ResizableDoubleArray</a>
     for details. 
     </p>
@@ -73,7 +73,7 @@
 
 <subsection name="6.3 int/double hash map" href="int_double_hash_map">
     <p>
-    The <a href="../apidocs/org/apache/commons/math3/util/OpenIntToDoubleHashMap.html">
+    The <a href="../apidocs/org/apache/commons/math4/util/OpenIntToDoubleHashMap.html">
     OpenIntToDoubleHashMap</a> class provides a specialized hash map
     implementation for int/double. This implementation has a much smaller memory
     overhead than standard <code>java.util.HashMap</code> class. It uses open addressing
@@ -84,7 +84,7 @@
 
 <subsection name="6.4 Continued Fractions" href="continued_fractions">
   <p>
-    The <a href="../apidocs/org/apache/commons/math3/util/ContinuedFraction.html">
+    The <a href="../apidocs/org/apache/commons/math4/util/ContinuedFraction.html">
     ContinuedFraction</a> class provides a generic way to create and evaluate
     continued fractions.  The easiest way to create a continued fraction is
     to subclass <code>ContinuedFraction</code> and override the
@@ -148,7 +148,7 @@
 <subsection name="6.5 Binomial coefficients, factorials, Stirling numbers and other common math functions" href="binomial_coefficients_factorials_and_other_common_math_functions">
     <p>
     A collection of reusable math functions is provided in the
-    <a href="../apidocs/org/apache/commons/math3/util/ArithmeticUtils.html">ArithmeticUtils</a>
+    <a href="../apidocs/org/apache/commons/math4/util/ArithmeticUtils.html">ArithmeticUtils</a>
     utility class.  ArithmeticUtils currently includes methods to compute the following: <ul>
     <li>
     Binomial coefficients -- "n choose k" available as an (exact) long value,  
@@ -234,7 +234,7 @@
 </subsection>
 
 <subsection name="6.7 Miscellaneous" href="miscellaneous">
-  The <a href="../apidocs/org/apache/commons/math3/util/MultidimensionalCounter.html">
+  The <a href="../apidocs/org/apache/commons/math4/util/MultidimensionalCounter.html">
     MultidimensionalCounter</a> is a utility class that converts a set of indices
   (identifying points in a multidimensional space) to a single index (e.g. identifying
   a location in a one-dimensional array.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/R/KolmogorovSmirnovTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/KolmogorovSmirnovTestCases.R b/src/test/R/KolmogorovSmirnovTestCases.R
index 6b70155..f66b253 100644
--- a/src/test/R/KolmogorovSmirnovTestCases.R
+++ b/src/test/R/KolmogorovSmirnovTestCases.R
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to validate KolmogorovSmirnov tests in
-# org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest
+# org.apache.commons.math4.stat.inference.KolmogorovSmirnovTest
 #
 # To run the test, install R, put this file and testFunctions
 # into the same directory, launch R from this directory and then enter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/R/LevyDistributionTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/LevyDistributionTestCases.R b/src/test/R/LevyDistributionTestCases.R
index 7a6651f..9e9238e 100644
--- a/src/test/R/LevyDistributionTestCases.R
+++ b/src/test/R/LevyDistributionTestCases.R
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to validate Lévy distribution tests in
-# org.apache.commons.math3.distribution.LevyDistributionTest
+# org.apache.commons.math4.distribution.LevyDistributionTest
 #
 # To run the test, install R, put this file and testFunctions
 # into the same directory, launch R from this directory and then enter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/R/gumbelTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/gumbelTestCases.R b/src/test/R/gumbelTestCases.R
index 727c2a0..f243860 100644
--- a/src/test/R/gumbelTestCases.R
+++ b/src/test/R/gumbelTestCases.R
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to validate Gumbel distribution tests in
-# org.apache.commons.math3.distribution.GumbelDistributionTest
+# org.apache.commons.math4.distribution.GumbelDistributionTest
 #
 # To run the test, install R, put this file and testFunctions
 # into the same directory, launch R from this directory and then enter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/R/laplaceTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/laplaceTestCases.R b/src/test/R/laplaceTestCases.R
index ec1f186..b4d4620 100644
--- a/src/test/R/laplaceTestCases.R
+++ b/src/test/R/laplaceTestCases.R
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to validate Laplace distribution tests in
-# org.apache.commons.math3.distribution.LaplaceDistributionTest
+# org.apache.commons.math4.distribution.LaplaceDistributionTest
 #
 # To run the test, install R, put this file and testFunctions
 # into the same directory, launch R from this directory and then enter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/R/logisticsTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/logisticsTestCases.R b/src/test/R/logisticsTestCases.R
index 97e3cf1..f555fea 100644
--- a/src/test/R/logisticsTestCases.R
+++ b/src/test/R/logisticsTestCases.R
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to validate Logistics distribution tests in
-# org.apache.commons.math3.distribution.LogisticsDistributionTest
+# org.apache.commons.math4.distribution.LogisticsDistributionTest
 #
 # To run the test, install R, put this file and testFunctions
 # into the same directory, launch R from this directory and then enter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/R/nakagamiTestCases.R
----------------------------------------------------------------------
diff --git a/src/test/R/nakagamiTestCases.R b/src/test/R/nakagamiTestCases.R
index 033de7e..e1dd2be 100644
--- a/src/test/R/nakagamiTestCases.R
+++ b/src/test/R/nakagamiTestCases.R
@@ -15,7 +15,7 @@
 #
 #------------------------------------------------------------------------------
 # R source file to validate Nakagami distribution tests in
-# org.apache.commons.math3.distribution.NakagamiDistributionTest
+# org.apache.commons.math4.distribution.NakagamiDistributionTest
 #
 # To run the test, install R, put this file and testFunctions
 # into the same directory, launch R from this directory and then enter

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/ExtendedFieldElementAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/ExtendedFieldElementAbstractTest.java b/src/test/java/org/apache/commons/math4/ExtendedFieldElementAbstractTest.java
index 76e9cd5..03b5a1a 100644
--- a/src/test/java/org/apache/commons/math4/ExtendedFieldElementAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/ExtendedFieldElementAbstractTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/PerfTestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/PerfTestUtils.java b/src/test/java/org/apache/commons/math4/PerfTestUtils.java
index 4558305..75afa60 100644
--- a/src/test/java/org/apache/commons/math4/PerfTestUtils.java
+++ b/src/test/java/org/apache/commons/math4/PerfTestUtils.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
 import java.util.Random;
 import java.util.concurrent.Callable;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.stat.descriptive.StatisticalSummary;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
 
 /**
  * Simple benchmarking utilities.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/Retry.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/Retry.java b/src/test/java/org/apache/commons/math4/Retry.java
index 0d5f2ab..7289ab6 100644
--- a/src/test/java/org/apache/commons/math4/Retry.java
+++ b/src/test/java/org/apache/commons/math4/Retry.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
 import java.lang.annotation.*;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/RetryRunner.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/RetryRunner.java b/src/test/java/org/apache/commons/math4/RetryRunner.java
index d02741c..a2c2bc1 100644
--- a/src/test/java/org/apache/commons/math4/RetryRunner.java
+++ b/src/test/java/org/apache/commons/math4/RetryRunner.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
 import org.junit.runners.BlockJUnit4ClassRunner;
 import org.junit.runners.model.FrameworkMethod;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/RetryRunnerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/RetryRunnerTest.java b/src/test/java/org/apache/commons/math4/RetryRunnerTest.java
index f7fa1e0..193d11a 100644
--- a/src/test/java/org/apache/commons/math4/RetryRunnerTest.java
+++ b/src/test/java/org/apache/commons/math4/RetryRunnerTest.java
@@ -15,12 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
 import java.util.Random;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-
+import org.apache.commons.math4.exception.MathIllegalStateException;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/TestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/TestUtils.java b/src/test/java/org/apache/commons/math4/TestUtils.java
index 4dddf56..109e64d 100644
--- a/src/test/java/org/apache/commons/math4/TestUtils.java
+++ b/src/test/java/org/apache/commons/math4/TestUtils.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3;
+package org.apache.commons.math4;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -24,16 +24,16 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.text.DecimalFormat;
 
-
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.complex.ComplexFormat;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.linear.FieldMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.stat.inference.ChiSquareTest;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.complex.ComplexFormat;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.linear.FieldMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.stat.inference.ChiSquareTest;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java b/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java
index 5e2bc96..f1c649a 100644
--- a/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/FunctionUtilsTest.java
@@ -15,30 +15,37 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.MultivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.analysis.function.Add;
-import org.apache.commons.math3.analysis.function.Constant;
-import org.apache.commons.math3.analysis.function.Cos;
-import org.apache.commons.math3.analysis.function.Cosh;
-import org.apache.commons.math3.analysis.function.Divide;
-import org.apache.commons.math3.analysis.function.Identity;
-import org.apache.commons.math3.analysis.function.Inverse;
-import org.apache.commons.math3.analysis.function.Log;
-import org.apache.commons.math3.analysis.function.Max;
-import org.apache.commons.math3.analysis.function.Min;
-import org.apache.commons.math3.analysis.function.Minus;
-import org.apache.commons.math3.analysis.function.Multiply;
-import org.apache.commons.math3.analysis.function.Pow;
-import org.apache.commons.math3.analysis.function.Power;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Sinc;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.DifferentiableMultivariateFunction;
+import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Add;
+import org.apache.commons.math4.analysis.function.Constant;
+import org.apache.commons.math4.analysis.function.Cos;
+import org.apache.commons.math4.analysis.function.Cosh;
+import org.apache.commons.math4.analysis.function.Divide;
+import org.apache.commons.math4.analysis.function.Identity;
+import org.apache.commons.math4.analysis.function.Inverse;
+import org.apache.commons.math4.analysis.function.Log;
+import org.apache.commons.math4.analysis.function.Max;
+import org.apache.commons.math4.analysis.function.Min;
+import org.apache.commons.math4.analysis.function.Minus;
+import org.apache.commons.math4.analysis.function.Multiply;
+import org.apache.commons.math4.analysis.function.Pow;
+import org.apache.commons.math4.analysis.function.Power;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.function.Sinc;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java b/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java
index e38dc11..b2a9e9d 100644
--- a/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java
+++ b/src/test/java/org/apache/commons/math4/analysis/MonitoredFunction.java
@@ -14,7 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
 
 /**
  * Wrapper class for counting functions calls.


[40/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunction.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunction.java
deleted file mode 100644
index 7b402e5..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialSplineFunction.java
+++ /dev/null
@@ -1,246 +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.analysis.polynomials;
-
-import java.util.Arrays;
-
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Represents a polynomial spline function.
- * <p>
- * A <strong>polynomial spline function</strong> consists of a set of
- * <i>interpolating polynomials</i> and an ascending array of domain
- * <i>knot points</i>, determining the intervals over which the spline function
- * is defined by the constituent polynomials.  The polynomials are assumed to
- * have been computed to match the values of another function at the knot
- * points.  The value consistency constraints are not currently enforced by
- * <code>PolynomialSplineFunction</code> itself, but are assumed to hold among
- * the polynomials and knot points passed to the constructor.</p>
- * <p>
- * N.B.:  The polynomials in the <code>polynomials</code> property must be
- * centered on the knot points to compute the spline function values.
- * See below.</p>
- * <p>
- * The domain of the polynomial spline function is
- * <code>[smallest knot, largest knot]</code>.  Attempts to evaluate the
- * function at values outside of this range generate IllegalArgumentExceptions.
- * </p>
- * <p>
- * The value of the polynomial spline function for an argument <code>x</code>
- * is computed as follows:
- * <ol>
- * <li>The knot array is searched to find the segment to which <code>x</code>
- * belongs.  If <code>x</code> is less than the smallest knot point or greater
- * than the largest one, an <code>IllegalArgumentException</code>
- * is thrown.</li>
- * <li> Let <code>j</code> be the index of the largest knot point that is less
- * than or equal to <code>x</code>.  The value returned is <br>
- * <code>polynomials[j](x - knot[j])</code></li></ol></p>
- *
- */
-public class PolynomialSplineFunction implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /**
-     * Spline segment interval delimiters (knots).
-     * Size is n + 1 for n segments.
-     */
-    private final double knots[];
-    /**
-     * The polynomial functions that make up the spline.  The first element
-     * determines the value of the spline over the first subinterval, the
-     * second over the second, etc.   Spline function values are determined by
-     * evaluating these functions at {@code (x - knot[i])} where i is the
-     * knot segment to which x belongs.
-     */
-    private final PolynomialFunction polynomials[];
-    /**
-     * Number of spline segments. It is equal to the number of polynomials and
-     * to the number of partition points - 1.
-     */
-    private final int n;
-
-
-    /**
-     * Construct a polynomial spline function with the given segment delimiters
-     * and interpolating polynomials.
-     * The constructor copies both arrays and assigns the copies to the knots
-     * and polynomials properties, respectively.
-     *
-     * @param knots Spline segment interval delimiters.
-     * @param polynomials Polynomial functions that make up the spline.
-     * @throws NullArgumentException if either of the input arrays is {@code null}.
-     * @throws NumberIsTooSmallException if knots has length less than 2.
-     * @throws DimensionMismatchException if {@code polynomials.length != knots.length - 1}.
-     * @throws NonMonotonicSequenceException if the {@code knots} array is not strictly increasing.
-     *
-     */
-    public PolynomialSplineFunction(double knots[], PolynomialFunction polynomials[])
-        throws NullArgumentException, NumberIsTooSmallException,
-               DimensionMismatchException, NonMonotonicSequenceException{
-        if (knots == null ||
-            polynomials == null) {
-            throw new NullArgumentException();
-        }
-        if (knots.length < 2) {
-            throw new NumberIsTooSmallException(LocalizedFormats.NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION,
-                                                2, knots.length, false);
-        }
-        if (knots.length - 1 != polynomials.length) {
-            throw new DimensionMismatchException(polynomials.length, knots.length);
-        }
-        MathArrays.checkOrder(knots);
-
-        this.n = knots.length -1;
-        this.knots = new double[n + 1];
-        System.arraycopy(knots, 0, this.knots, 0, n + 1);
-        this.polynomials = new PolynomialFunction[n];
-        System.arraycopy(polynomials, 0, this.polynomials, 0, n);
-    }
-
-    /**
-     * Compute the value for the function.
-     * See {@link PolynomialSplineFunction} for details on the algorithm for
-     * computing the value of the function.
-     *
-     * @param v Point for which the function value should be computed.
-     * @return the value.
-     * @throws OutOfRangeException if {@code v} is outside of the domain of the
-     * spline function (smaller than the smallest knot point or larger than the
-     * largest knot point).
-     */
-    public double value(double v) {
-        if (v < knots[0] || v > knots[n]) {
-            throw new OutOfRangeException(v, knots[0], knots[n]);
-        }
-        int i = Arrays.binarySearch(knots, v);
-        if (i < 0) {
-            i = -i - 2;
-        }
-        // This will handle the case where v is the last knot value
-        // There are only n-1 polynomials, so if v is the last knot
-        // then we will use the last polynomial to calculate the value.
-        if ( i >= polynomials.length ) {
-            i--;
-        }
-        return polynomials[i].value(v - knots[i]);
-    }
-
-    /**
-     * Get the derivative of the polynomial spline function.
-     *
-     * @return the derivative function.
-     */
-    public UnivariateFunction derivative() {
-        return polynomialSplineDerivative();
-    }
-
-    /**
-     * Get the derivative of the polynomial spline function.
-     *
-     * @return the derivative function.
-     */
-    public PolynomialSplineFunction polynomialSplineDerivative() {
-        PolynomialFunction derivativePolynomials[] = new PolynomialFunction[n];
-        for (int i = 0; i < n; i++) {
-            derivativePolynomials[i] = polynomials[i].polynomialDerivative();
-        }
-        return new PolynomialSplineFunction(knots, derivativePolynomials);
-    }
-
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        final double t0 = t.getValue();
-        if (t0 < knots[0] || t0 > knots[n]) {
-            throw new OutOfRangeException(t0, knots[0], knots[n]);
-        }
-        int i = Arrays.binarySearch(knots, t0);
-        if (i < 0) {
-            i = -i - 2;
-        }
-        // This will handle the case where t is the last knot value
-        // There are only n-1 polynomials, so if t is the last knot
-        // then we will use the last polynomial to calculate the value.
-        if ( i >= polynomials.length ) {
-            i--;
-        }
-        return polynomials[i].value(t.subtract(knots[i]));
-    }
-
-    /**
-     * Get the number of spline segments.
-     * It is also the number of polynomials and the number of knot points - 1.
-     *
-     * @return the number of spline segments.
-     */
-    public int getN() {
-        return n;
-    }
-
-    /**
-     * Get a copy of the interpolating polynomials array.
-     * It returns a fresh copy of the array. Changes made to the copy will
-     * not affect the polynomials property.
-     *
-     * @return the interpolating polynomials.
-     */
-    public PolynomialFunction[] getPolynomials() {
-        PolynomialFunction p[] = new PolynomialFunction[n];
-        System.arraycopy(polynomials, 0, p, 0, n);
-        return p;
-    }
-
-    /**
-     * Get an array copy of the knot points.
-     * It returns a fresh copy of the array. Changes made to the copy
-     * will not affect the knots property.
-     *
-     * @return the knot points.
-     */
-    public double[] getKnots() {
-        double out[] = new double[n + 1];
-        System.arraycopy(knots, 0, out, 0, n + 1);
-        return out;
-    }
-
-    /**
-     * Indicates whether a point is within the interpolation range.
-     *
-     * @param x Point.
-     * @return {@code true} if {@code x} is a valid point.
-     */
-    public boolean isValidPoint(double x) {
-        if (x < knots[0] ||
-            x > knots[n]) {
-            return false;
-        } else {
-            return true;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java
deleted file mode 100644
index e6eccef..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/polynomials/PolynomialsUtils.java
+++ /dev/null
@@ -1,446 +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.analysis.polynomials;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * A collection of static methods that operate on or return polynomials.
- *
- * @since 2.0
- */
-public class PolynomialsUtils {
-
-    /** Coefficients for Chebyshev polynomials. */
-    private static final List<BigFraction> CHEBYSHEV_COEFFICIENTS;
-
-    /** Coefficients for Hermite polynomials. */
-    private static final List<BigFraction> HERMITE_COEFFICIENTS;
-
-    /** Coefficients for Laguerre polynomials. */
-    private static final List<BigFraction> LAGUERRE_COEFFICIENTS;
-
-    /** Coefficients for Legendre polynomials. */
-    private static final List<BigFraction> LEGENDRE_COEFFICIENTS;
-
-    /** Coefficients for Jacobi polynomials. */
-    private static final Map<JacobiKey, List<BigFraction>> JACOBI_COEFFICIENTS;
-
-    static {
-
-        // initialize recurrence for Chebyshev polynomials
-        // T0(X) = 1, T1(X) = 0 + 1 * X
-        CHEBYSHEV_COEFFICIENTS = new ArrayList<BigFraction>();
-        CHEBYSHEV_COEFFICIENTS.add(BigFraction.ONE);
-        CHEBYSHEV_COEFFICIENTS.add(BigFraction.ZERO);
-        CHEBYSHEV_COEFFICIENTS.add(BigFraction.ONE);
-
-        // initialize recurrence for Hermite polynomials
-        // H0(X) = 1, H1(X) = 0 + 2 * X
-        HERMITE_COEFFICIENTS = new ArrayList<BigFraction>();
-        HERMITE_COEFFICIENTS.add(BigFraction.ONE);
-        HERMITE_COEFFICIENTS.add(BigFraction.ZERO);
-        HERMITE_COEFFICIENTS.add(BigFraction.TWO);
-
-        // initialize recurrence for Laguerre polynomials
-        // L0(X) = 1, L1(X) = 1 - 1 * X
-        LAGUERRE_COEFFICIENTS = new ArrayList<BigFraction>();
-        LAGUERRE_COEFFICIENTS.add(BigFraction.ONE);
-        LAGUERRE_COEFFICIENTS.add(BigFraction.ONE);
-        LAGUERRE_COEFFICIENTS.add(BigFraction.MINUS_ONE);
-
-        // initialize recurrence for Legendre polynomials
-        // P0(X) = 1, P1(X) = 0 + 1 * X
-        LEGENDRE_COEFFICIENTS = new ArrayList<BigFraction>();
-        LEGENDRE_COEFFICIENTS.add(BigFraction.ONE);
-        LEGENDRE_COEFFICIENTS.add(BigFraction.ZERO);
-        LEGENDRE_COEFFICIENTS.add(BigFraction.ONE);
-
-        // initialize map for Jacobi polynomials
-        JACOBI_COEFFICIENTS = new HashMap<JacobiKey, List<BigFraction>>();
-
-    }
-
-    /**
-     * Private constructor, to prevent instantiation.
-     */
-    private PolynomialsUtils() {
-    }
-
-    /**
-     * Create a Chebyshev polynomial of the first kind.
-     * <p><a href="http://mathworld.wolfram.com/ChebyshevPolynomialoftheFirstKind.html">Chebyshev
-     * polynomials of the first kind</a> are orthogonal polynomials.
-     * They can be defined by the following recurrence relations:
-     * <pre>
-     *  T<sub>0</sub>(X)   = 1
-     *  T<sub>1</sub>(X)   = X
-     *  T<sub>k+1</sub>(X) = 2X T<sub>k</sub>(X) - T<sub>k-1</sub>(X)
-     * </pre></p>
-     * @param degree degree of the polynomial
-     * @return Chebyshev polynomial of specified degree
-     */
-    public static PolynomialFunction createChebyshevPolynomial(final int degree) {
-        return buildPolynomial(degree, CHEBYSHEV_COEFFICIENTS,
-                new RecurrenceCoefficientsGenerator() {
-            private final BigFraction[] coeffs = { BigFraction.ZERO, BigFraction.TWO, BigFraction.ONE };
-            /** {@inheritDoc} */
-            public BigFraction[] generate(int k) {
-                return coeffs;
-            }
-        });
-    }
-
-    /**
-     * Create a Hermite polynomial.
-     * <p><a href="http://mathworld.wolfram.com/HermitePolynomial.html">Hermite
-     * polynomials</a> are orthogonal polynomials.
-     * They can be defined by the following recurrence relations:
-     * <pre>
-     *  H<sub>0</sub>(X)   = 1
-     *  H<sub>1</sub>(X)   = 2X
-     *  H<sub>k+1</sub>(X) = 2X H<sub>k</sub>(X) - 2k H<sub>k-1</sub>(X)
-     * </pre></p>
-
-     * @param degree degree of the polynomial
-     * @return Hermite polynomial of specified degree
-     */
-    public static PolynomialFunction createHermitePolynomial(final int degree) {
-        return buildPolynomial(degree, HERMITE_COEFFICIENTS,
-                new RecurrenceCoefficientsGenerator() {
-            /** {@inheritDoc} */
-            public BigFraction[] generate(int k) {
-                return new BigFraction[] {
-                        BigFraction.ZERO,
-                        BigFraction.TWO,
-                        new BigFraction(2 * k)};
-            }
-        });
-    }
-
-    /**
-     * Create a Laguerre polynomial.
-     * <p><a href="http://mathworld.wolfram.com/LaguerrePolynomial.html">Laguerre
-     * polynomials</a> are orthogonal polynomials.
-     * They can be defined by the following recurrence relations:
-     * <pre>
-     *        L<sub>0</sub>(X)   = 1
-     *        L<sub>1</sub>(X)   = 1 - X
-     *  (k+1) L<sub>k+1</sub>(X) = (2k + 1 - X) L<sub>k</sub>(X) - k L<sub>k-1</sub>(X)
-     * </pre></p>
-     * @param degree degree of the polynomial
-     * @return Laguerre polynomial of specified degree
-     */
-    public static PolynomialFunction createLaguerrePolynomial(final int degree) {
-        return buildPolynomial(degree, LAGUERRE_COEFFICIENTS,
-                new RecurrenceCoefficientsGenerator() {
-            /** {@inheritDoc} */
-            public BigFraction[] generate(int k) {
-                final int kP1 = k + 1;
-                return new BigFraction[] {
-                        new BigFraction(2 * k + 1, kP1),
-                        new BigFraction(-1, kP1),
-                        new BigFraction(k, kP1)};
-            }
-        });
-    }
-
-    /**
-     * Create a Legendre polynomial.
-     * <p><a href="http://mathworld.wolfram.com/LegendrePolynomial.html">Legendre
-     * polynomials</a> are orthogonal polynomials.
-     * They can be defined by the following recurrence relations:
-     * <pre>
-     *        P<sub>0</sub>(X)   = 1
-     *        P<sub>1</sub>(X)   = X
-     *  (k+1) P<sub>k+1</sub>(X) = (2k+1) X P<sub>k</sub>(X) - k P<sub>k-1</sub>(X)
-     * </pre></p>
-     * @param degree degree of the polynomial
-     * @return Legendre polynomial of specified degree
-     */
-    public static PolynomialFunction createLegendrePolynomial(final int degree) {
-        return buildPolynomial(degree, LEGENDRE_COEFFICIENTS,
-                               new RecurrenceCoefficientsGenerator() {
-            /** {@inheritDoc} */
-            public BigFraction[] generate(int k) {
-                final int kP1 = k + 1;
-                return new BigFraction[] {
-                        BigFraction.ZERO,
-                        new BigFraction(k + kP1, kP1),
-                        new BigFraction(k, kP1)};
-            }
-        });
-    }
-
-    /**
-     * Create a Jacobi polynomial.
-     * <p><a href="http://mathworld.wolfram.com/JacobiPolynomial.html">Jacobi
-     * polynomials</a> are orthogonal polynomials.
-     * They can be defined by the following recurrence relations:
-     * <pre>
-     *        P<sub>0</sub><sup>vw</sup>(X)   = 1
-     *        P<sub>-1</sub><sup>vw</sup>(X)  = 0
-     *  2k(k + v + w)(2k + v + w - 2) P<sub>k</sub><sup>vw</sup>(X) =
-     *  (2k + v + w - 1)[(2k + v + w)(2k + v + w - 2) X + v<sup>2</sup> - w<sup>2</sup>] P<sub>k-1</sub><sup>vw</sup>(X)
-     *  - 2(k + v - 1)(k + w - 1)(2k + v + w) P<sub>k-2</sub><sup>vw</sup>(X)
-     * </pre></p>
-     * @param degree degree of the polynomial
-     * @param v first exponent
-     * @param w second exponent
-     * @return Jacobi polynomial of specified degree
-     */
-    public static PolynomialFunction createJacobiPolynomial(final int degree, final int v, final int w) {
-
-        // select the appropriate list
-        final JacobiKey key = new JacobiKey(v, w);
-
-        if (!JACOBI_COEFFICIENTS.containsKey(key)) {
-
-            // allocate a new list for v, w
-            final List<BigFraction> list = new ArrayList<BigFraction>();
-            JACOBI_COEFFICIENTS.put(key, list);
-
-            // Pv,w,0(x) = 1;
-            list.add(BigFraction.ONE);
-
-            // P1(x) = (v - w) / 2 + (2 + v + w) * X / 2
-            list.add(new BigFraction(v - w, 2));
-            list.add(new BigFraction(2 + v + w, 2));
-
-        }
-
-        return buildPolynomial(degree, JACOBI_COEFFICIENTS.get(key),
-                               new RecurrenceCoefficientsGenerator() {
-            /** {@inheritDoc} */
-            public BigFraction[] generate(int k) {
-                k++;
-                final int kvw      = k + v + w;
-                final int twoKvw   = kvw + k;
-                final int twoKvwM1 = twoKvw - 1;
-                final int twoKvwM2 = twoKvw - 2;
-                final int den      = 2 * k *  kvw * twoKvwM2;
-
-                return new BigFraction[] {
-                    new BigFraction(twoKvwM1 * (v * v - w * w), den),
-                    new BigFraction(twoKvwM1 * twoKvw * twoKvwM2, den),
-                    new BigFraction(2 * (k + v - 1) * (k + w - 1) * twoKvw, den)
-                };
-            }
-        });
-
-    }
-
-    /** Inner class for Jacobi polynomials keys. */
-    private static class JacobiKey {
-
-        /** First exponent. */
-        private final int v;
-
-        /** Second exponent. */
-        private final int w;
-
-        /** Simple constructor.
-         * @param v first exponent
-         * @param w second exponent
-         */
-        public JacobiKey(final int v, final int w) {
-            this.v = v;
-            this.w = w;
-        }
-
-        /** Get hash code.
-         * @return hash code
-         */
-        @Override
-        public int hashCode() {
-            return (v << 16) ^ w;
-        }
-
-        /** Check if the instance represent the same key as another instance.
-         * @param key other key
-         * @return true if the instance and the other key refer to the same polynomial
-         */
-        @Override
-        public boolean equals(final Object key) {
-
-            if ((key == null) || !(key instanceof JacobiKey)) {
-                return false;
-            }
-
-            final JacobiKey otherK = (JacobiKey) key;
-            return (v == otherK.v) && (w == otherK.w);
-
-        }
-    }
-
-    /**
-     * Compute the coefficients of the polynomial <code>P<sub>s</sub>(x)</code>
-     * whose values at point {@code x} will be the same as the those from the
-     * original polynomial <code>P(x)</code> when computed at {@code x + shift}.
-     * Thus, if <code>P(x) = &Sigma;<sub>i</sub> a<sub>i</sub> x<sup>i</sup></code>,
-     * then
-     * <pre>
-     *  <table>
-     *   <tr>
-     *    <td><code>P<sub>s</sub>(x)</td>
-     *    <td>= &Sigma;<sub>i</sub> b<sub>i</sub> x<sup>i</sup></code></td>
-     *   </tr>
-     *   <tr>
-     *    <td></td>
-     *    <td>= &Sigma;<sub>i</sub> a<sub>i</sub> (x + shift)<sup>i</sup></code></td>
-     *   </tr>
-     *  </table>
-     * </pre>
-     *
-     * @param coefficients Coefficients of the original polynomial.
-     * @param shift Shift value.
-     * @return the coefficients <code>b<sub>i</sub></code> of the shifted
-     * polynomial.
-     */
-    public static double[] shift(final double[] coefficients,
-                                 final double shift) {
-        final int dp1 = coefficients.length;
-        final double[] newCoefficients = new double[dp1];
-
-        // Pascal triangle.
-        final int[][] coeff = new int[dp1][dp1];
-        for (int i = 0; i < dp1; i++){
-            for(int j = 0; j <= i; j++){
-                coeff[i][j] = (int) CombinatoricsUtils.binomialCoefficient(i, j);
-            }
-        }
-
-        // First polynomial coefficient.
-        for (int i = 0; i < dp1; i++){
-            newCoefficients[0] += coefficients[i] * FastMath.pow(shift, i);
-        }
-
-        // Superior order.
-        final int d = dp1 - 1;
-        for (int i = 0; i < d; i++) {
-            for (int j = i; j < d; j++){
-                newCoefficients[i + 1] += coeff[j + 1][j - i] *
-                    coefficients[j + 1] * FastMath.pow(shift, j - i);
-            }
-        }
-
-        return newCoefficients;
-    }
-
-
-    /** Get the coefficients array for a given degree.
-     * @param degree degree of the polynomial
-     * @param coefficients list where the computed coefficients are stored
-     * @param generator recurrence coefficients generator
-     * @return coefficients array
-     */
-    private static PolynomialFunction buildPolynomial(final int degree,
-                                                      final List<BigFraction> coefficients,
-                                                      final RecurrenceCoefficientsGenerator generator) {
-
-        final int maxDegree = (int) FastMath.floor(FastMath.sqrt(2 * coefficients.size())) - 1;
-        synchronized (PolynomialsUtils.class) {
-            if (degree > maxDegree) {
-                computeUpToDegree(degree, maxDegree, generator, coefficients);
-            }
-        }
-
-        // coefficient  for polynomial 0 is  l [0]
-        // coefficients for polynomial 1 are l [1] ... l [2] (degrees 0 ... 1)
-        // coefficients for polynomial 2 are l [3] ... l [5] (degrees 0 ... 2)
-        // coefficients for polynomial 3 are l [6] ... l [9] (degrees 0 ... 3)
-        // coefficients for polynomial 4 are l[10] ... l[14] (degrees 0 ... 4)
-        // coefficients for polynomial 5 are l[15] ... l[20] (degrees 0 ... 5)
-        // coefficients for polynomial 6 are l[21] ... l[27] (degrees 0 ... 6)
-        // ...
-        final int start = degree * (degree + 1) / 2;
-
-        final double[] a = new double[degree + 1];
-        for (int i = 0; i <= degree; ++i) {
-            a[i] = coefficients.get(start + i).doubleValue();
-        }
-
-        // build the polynomial
-        return new PolynomialFunction(a);
-
-    }
-
-    /** Compute polynomial coefficients up to a given degree.
-     * @param degree maximal degree
-     * @param maxDegree current maximal degree
-     * @param generator recurrence coefficients generator
-     * @param coefficients list where the computed coefficients should be appended
-     */
-    private static void computeUpToDegree(final int degree, final int maxDegree,
-                                          final RecurrenceCoefficientsGenerator generator,
-                                          final List<BigFraction> coefficients) {
-
-        int startK = (maxDegree - 1) * maxDegree / 2;
-        for (int k = maxDegree; k < degree; ++k) {
-
-            // start indices of two previous polynomials Pk(X) and Pk-1(X)
-            int startKm1 = startK;
-            startK += k;
-
-            // Pk+1(X) = (a[0] + a[1] X) Pk(X) - a[2] Pk-1(X)
-            BigFraction[] ai = generator.generate(k);
-
-            BigFraction ck     = coefficients.get(startK);
-            BigFraction ckm1   = coefficients.get(startKm1);
-
-            // degree 0 coefficient
-            coefficients.add(ck.multiply(ai[0]).subtract(ckm1.multiply(ai[2])));
-
-            // degree 1 to degree k-1 coefficients
-            for (int i = 1; i < k; ++i) {
-                final BigFraction ckPrev = ck;
-                ck     = coefficients.get(startK + i);
-                ckm1   = coefficients.get(startKm1 + i);
-                coefficients.add(ck.multiply(ai[0]).add(ckPrev.multiply(ai[1])).subtract(ckm1.multiply(ai[2])));
-            }
-
-            // degree k coefficient
-            final BigFraction ckPrev = ck;
-            ck = coefficients.get(startK + k);
-            coefficients.add(ck.multiply(ai[0]).add(ckPrev.multiply(ai[1])));
-
-            // degree k+1 coefficient
-            coefficients.add(ck.multiply(ai[1]));
-
-        }
-
-    }
-
-    /** Interface for recurrence coefficients generation. */
-    private interface RecurrenceCoefficientsGenerator {
-        /**
-         * Generate recurrence coefficients.
-         * @param k highest degree of the polynomials used in the recurrence
-         * @return an array of three coefficients such that
-         * P<sub>k+1</sub>(X) = (a[0] + a[1] X) P<sub>k</sub>(X) - a[2] P<sub>k-1</sub>(X)
-         */
-        BigFraction[] generate(int k);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/polynomials/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/polynomials/package-info.java b/src/main/java/org/apache/commons/math3/analysis/polynomials/package-info.java
deleted file mode 100644
index 85b99f7..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/polynomials/package-info.java
+++ /dev/null
@@ -1,23 +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.
- */
-/**
- *
- *     Univariate real polynomials implementations, seen as differentiable
- *     univariate real functions.
- *
- */
-package org.apache.commons.math3.analysis.polynomials;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractDifferentiableUnivariateSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
deleted file mode 100644
index d0fda00..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractDifferentiableUnivariateSolver.java
+++ /dev/null
@@ -1,82 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Provide a default implementation for several functions useful to generic
- * solvers.
- *
- * @since 3.0
- * @deprecated as of 3.1, replaced by {@link AbstractUnivariateDifferentiableSolver}
- */
-@Deprecated
-public abstract class AbstractDifferentiableUnivariateSolver
-    extends BaseAbstractUnivariateSolver<DifferentiableUnivariateFunction>
-    implements DifferentiableUnivariateSolver {
-    /** Derivative of the function to solve. */
-    private UnivariateFunction functionDerivative;
-
-    /**
-     * Construct a solver with given absolute accuracy.
-     *
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected AbstractDifferentiableUnivariateSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    protected AbstractDifferentiableUnivariateSolver(final double relativeAccuracy,
-                                                     final double absoluteAccuracy,
-                                                     final double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-    }
-
-    /**
-     * Compute the objective function value.
-     *
-     * @param point Point at which the objective function must be evaluated.
-     * @return the objective function value at specified point.
-     * @throws TooManyEvaluationsException if the maximal number of evaluations is exceeded.
-     */
-    protected double computeDerivativeObjectiveValue(double point)
-        throws TooManyEvaluationsException {
-        incrementEvaluationCount();
-        return functionDerivative.value(point);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void setup(int maxEval, DifferentiableUnivariateFunction f,
-                         double min, double max, double startValue) {
-        super.setup(maxEval, f, min, max, startValue);
-        functionDerivative = f.derivative();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractPolynomialSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractPolynomialSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractPolynomialSolver.java
deleted file mode 100644
index d641e87..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractPolynomialSolver.java
+++ /dev/null
@@ -1,80 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-
-/**
- * Base class for solvers.
- *
- * @since 3.0
- */
-public abstract class AbstractPolynomialSolver
-    extends BaseAbstractUnivariateSolver<PolynomialFunction>
-    implements PolynomialSolver {
-    /** Function. */
-    private PolynomialFunction polynomialFunction;
-
-    /**
-     * Construct a solver with given absolute accuracy.
-     *
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected AbstractPolynomialSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected AbstractPolynomialSolver(final double relativeAccuracy,
-                                       final double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    protected AbstractPolynomialSolver(final double relativeAccuracy,
-                                       final double absoluteAccuracy,
-                                       final double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void setup(int maxEval, PolynomialFunction f,
-                             double min, double max, double startValue) {
-        super.setup(maxEval, f, min, max, startValue);
-        polynomialFunction = f;
-    }
-
-    /**
-     * @return the coefficients of the polynomial function.
-     */
-    protected double[] getCoefficients() {
-        return polynomialFunction.getCoefficients();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateDifferentiableSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateDifferentiableSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateDifferentiableSolver.java
deleted file mode 100644
index 9745e9b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateDifferentiableSolver.java
+++ /dev/null
@@ -1,82 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Provide a default implementation for several functions useful to generic
- * solvers.
- *
- * @since 3.1
- */
-public abstract class AbstractUnivariateDifferentiableSolver
-    extends BaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>
-    implements UnivariateDifferentiableSolver {
-
-    /** Function to solve. */
-    private UnivariateDifferentiableFunction function;
-
-    /**
-     * Construct a solver with given absolute accuracy.
-     *
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected AbstractUnivariateDifferentiableSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    protected AbstractUnivariateDifferentiableSolver(final double relativeAccuracy,
-                                                     final double absoluteAccuracy,
-                                                     final double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-    }
-
-    /**
-     * Compute the objective function value.
-     *
-     * @param point Point at which the objective function must be evaluated.
-     * @return the objective function value and derivative at specified point.
-     * @throws TooManyEvaluationsException
-     * if the maximal number of evaluations is exceeded.
-     */
-    protected DerivativeStructure computeObjectiveValueAndDerivative(double point)
-        throws TooManyEvaluationsException {
-        incrementEvaluationCount();
-        return function.value(new DerivativeStructure(1, 1, 0, point));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void setup(int maxEval, UnivariateDifferentiableFunction f,
-                         double min, double max, double startValue) {
-        super.setup(maxEval, f, min, max, startValue);
-        function = f;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateSolver.java
deleted file mode 100644
index 078c70f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/AbstractUnivariateSolver.java
+++ /dev/null
@@ -1,60 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-
-/**
- * Base class for solvers.
- *
- * @since 3.0
- */
-public abstract class AbstractUnivariateSolver
-    extends BaseAbstractUnivariateSolver<UnivariateFunction>
-    implements UnivariateSolver {
-    /**
-     * Construct a solver with given absolute accuracy.
-     *
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected AbstractUnivariateSolver(final double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected AbstractUnivariateSolver(final double relativeAccuracy,
-                                       final double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    protected AbstractUnivariateSolver(final double relativeAccuracy,
-                                       final double absoluteAccuracy,
-                                       final double functionValueAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/AllowedSolution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/AllowedSolution.java b/src/main/java/org/apache/commons/math3/analysis/solvers/AllowedSolution.java
deleted file mode 100644
index a02a29b..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/AllowedSolution.java
+++ /dev/null
@@ -1,75 +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.analysis.solvers;
-
-
-/** The kinds of solutions that a {@link BracketedUnivariateSolver
- * (bracketed univariate real) root-finding algorithm} may accept as solutions.
- * This basically controls whether or not under-approximations and
- * over-approximations are allowed.
- *
- * <p>If all solutions are accepted ({@link #ANY_SIDE}), then the solution
- * that the root-finding algorithm returns for a given root may be equal to the
- * actual root, but it may also be an approximation that is slightly smaller
- * or slightly larger than the actual root. Root-finding algorithms generally
- * only guarantee that the returned solution is within the requested
- * tolerances. In certain cases however, in particular for
- * {@link org.apache.commons.math3.ode.events.EventHandler state events} of
- * {@link org.apache.commons.math3.ode.ODEIntegrator ODE solvers}, it
- * may be necessary to guarantee that a solution is returned that lies on a
- * specific side the solution.</p>
- *
- * @see BracketedUnivariateSolver
- * @since 3.0
- */
-public enum AllowedSolution {
-    /** There are no additional side restriction on the solutions for
-     * root-finding. That is, both under-approximations and over-approximations
-     * are allowed. So, if a function f(x) has a root at x = x0, then the
-     * root-finding result s may be smaller than x0, equal to x0, or greater
-     * than x0.
-     */
-    ANY_SIDE,
-
-    /** Only solutions that are less than or equal to the actual root are
-     * acceptable as solutions for root-finding. In other words,
-     * over-approximations are not allowed. So, if a function f(x) has a root
-     * at x = x0, then the root-finding result s must satisfy s &lt;= x0.
-     */
-    LEFT_SIDE,
-
-    /** Only solutions that are greater than or equal to the actual root are
-     * acceptable as solutions for root-finding. In other words,
-     * under-approximations are not allowed. So, if a function f(x) has a root
-     * at x = x0, then the root-finding result s must satisfy s &gt;= x0.
-     */
-    RIGHT_SIDE,
-
-    /** Only solutions for which values are less than or equal to zero are
-     * acceptable as solutions for root-finding. So, if a function f(x) has
-     * a root at x = x0, then the root-finding result s must satisfy f(s) &lt;= 0.
-     */
-    BELOW_SIDE,
-
-    /** Only solutions for which values are greater than or equal to zero are
-     * acceptable as solutions for root-finding. So, if a function f(x) has
-     * a root at x = x0, then the root-finding result s must satisfy f(s) &gt;= 0.
-     */
-    ABOVE_SIDE;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/BaseAbstractUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/BaseAbstractUnivariateSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/BaseAbstractUnivariateSolver.java
deleted file mode 100644
index 4fb9ecf..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/BaseAbstractUnivariateSolver.java
+++ /dev/null
@@ -1,318 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NoBracketingException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Provide a default implementation for several functions useful to generic
- * solvers.
- * The default values for relative and function tolerances are 1e-14
- * and 1e-15, respectively. It is however highly recommended to not
- * rely on the default, but rather carefully consider values that match
- * user's expectations, as well as the specifics of each implementation.
- *
- * @param <FUNC> Type of function to solve.
- *
- * @since 2.0
- */
-public abstract class BaseAbstractUnivariateSolver<FUNC extends UnivariateFunction>
-    implements BaseUnivariateSolver<FUNC> {
-    /** Default relative accuracy. */
-    private static final double DEFAULT_RELATIVE_ACCURACY = 1e-14;
-    /** Default function value accuracy. */
-    private static final double DEFAULT_FUNCTION_VALUE_ACCURACY = 1e-15;
-    /** Function value accuracy. */
-    private final double functionValueAccuracy;
-    /** Absolute accuracy. */
-    private final double absoluteAccuracy;
-    /** Relative accuracy. */
-    private final double relativeAccuracy;
-    /** Evaluations counter. */
-    private final Incrementor evaluations = new Incrementor();
-    /** Lower end of search interval. */
-    private double searchMin;
-    /** Higher end of search interval. */
-    private double searchMax;
-    /** Initial guess. */
-    private double searchStart;
-    /** Function to solve. */
-    private FUNC function;
-
-    /**
-     * Construct a solver with given absolute accuracy.
-     *
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected BaseAbstractUnivariateSolver(final double absoluteAccuracy) {
-        this(DEFAULT_RELATIVE_ACCURACY,
-             absoluteAccuracy,
-             DEFAULT_FUNCTION_VALUE_ACCURACY);
-    }
-
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     */
-    protected BaseAbstractUnivariateSolver(final double relativeAccuracy,
-                                           final double absoluteAccuracy) {
-        this(relativeAccuracy,
-             absoluteAccuracy,
-             DEFAULT_FUNCTION_VALUE_ACCURACY);
-    }
-
-    /**
-     * Construct a solver with given accuracies.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     * @param functionValueAccuracy Maximum function value error.
-     */
-    protected BaseAbstractUnivariateSolver(final double relativeAccuracy,
-                                           final double absoluteAccuracy,
-                                           final double functionValueAccuracy) {
-        this.absoluteAccuracy = absoluteAccuracy;
-        this.relativeAccuracy = relativeAccuracy;
-        this.functionValueAccuracy = functionValueAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public int getMaxEvaluations() {
-        return evaluations.getMaximalCount();
-    }
-    /** {@inheritDoc} */
-    public int getEvaluations() {
-        return evaluations.getCount();
-    }
-    /**
-     * @return the lower end of the search interval.
-     */
-    public double getMin() {
-        return searchMin;
-    }
-    /**
-     * @return the higher end of the search interval.
-     */
-    public double getMax() {
-        return searchMax;
-    }
-    /**
-     * @return the initial guess.
-     */
-    public double getStartValue() {
-        return searchStart;
-    }
-    /**
-     * {@inheritDoc}
-     */
-    public double getAbsoluteAccuracy() {
-        return absoluteAccuracy;
-    }
-    /**
-     * {@inheritDoc}
-     */
-    public double getRelativeAccuracy() {
-        return relativeAccuracy;
-    }
-    /**
-     * {@inheritDoc}
-     */
-    public double getFunctionValueAccuracy() {
-        return functionValueAccuracy;
-    }
-
-    /**
-     * Compute the objective function value.
-     *
-     * @param point Point at which the objective function must be evaluated.
-     * @return the objective function value at specified point.
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     */
-    protected double computeObjectiveValue(double point)
-        throws TooManyEvaluationsException {
-        incrementEvaluationCount();
-        return function.value(point);
-    }
-
-    /**
-     * Prepare for computation.
-     * Subclasses must call this method if they override any of the
-     * {@code solve} methods.
-     *
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param startValue Start value to use.
-     * @param maxEval Maximum number of evaluations.
-     * @exception NullArgumentException if f is null
-     */
-    protected void setup(int maxEval,
-                         FUNC f,
-                         double min, double max,
-                         double startValue)
-        throws NullArgumentException {
-        // Checks.
-        MathUtils.checkNotNull(f);
-
-        // Reset.
-        searchMin = min;
-        searchMax = max;
-        searchStart = startValue;
-        function = f;
-        evaluations.setMaximalCount(maxEval);
-        evaluations.resetCount();
-    }
-
-    /** {@inheritDoc} */
-    public double solve(int maxEval, FUNC f, double min, double max, double startValue)
-        throws TooManyEvaluationsException,
-               NoBracketingException {
-        // Initialization.
-        setup(maxEval, f, min, max, startValue);
-
-        // Perform computation.
-        return doSolve();
-    }
-
-    /** {@inheritDoc} */
-    public double solve(int maxEval, FUNC f, double min, double max) {
-        return solve(maxEval, f, min, max, min + 0.5 * (max - min));
-    }
-
-    /** {@inheritDoc} */
-    public double solve(int maxEval, FUNC f, double startValue)
-        throws TooManyEvaluationsException,
-               NoBracketingException {
-        return solve(maxEval, f, Double.NaN, Double.NaN, startValue);
-    }
-
-    /**
-     * Method for implementing actual optimization algorithms in derived
-     * classes.
-     *
-     * @return the root.
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     * @throws NoBracketingException if the initial search interval does not bracket
-     * a root and the solver requires it.
-     */
-    protected abstract double doSolve()
-        throws TooManyEvaluationsException, NoBracketingException;
-
-    /**
-     * Check whether the function takes opposite signs at the endpoints.
-     *
-     * @param lower Lower endpoint.
-     * @param upper Upper endpoint.
-     * @return {@code true} if the function values have opposite signs at the
-     * given points.
-     */
-    protected boolean isBracketing(final double lower,
-                                   final double upper) {
-        return UnivariateSolverUtils.isBracketing(function, lower, upper);
-    }
-
-    /**
-     * Check whether the arguments form a (strictly) increasing sequence.
-     *
-     * @param start First number.
-     * @param mid Second number.
-     * @param end Third number.
-     * @return {@code true} if the arguments form an increasing sequence.
-     */
-    protected boolean isSequence(final double start,
-                                 final double mid,
-                                 final double end) {
-        return UnivariateSolverUtils.isSequence(start, mid, end);
-    }
-
-    /**
-     * Check that the endpoints specify an interval.
-     *
-     * @param lower Lower endpoint.
-     * @param upper Upper endpoint.
-     * @throws NumberIsTooLargeException if {@code lower >= upper}.
-     */
-    protected void verifyInterval(final double lower,
-                                  final double upper)
-        throws NumberIsTooLargeException {
-        UnivariateSolverUtils.verifyInterval(lower, upper);
-    }
-
-    /**
-     * Check that {@code lower < initial < upper}.
-     *
-     * @param lower Lower endpoint.
-     * @param initial Initial value.
-     * @param upper Upper endpoint.
-     * @throws NumberIsTooLargeException if {@code lower >= initial} or
-     * {@code initial >= upper}.
-     */
-    protected void verifySequence(final double lower,
-                                  final double initial,
-                                  final double upper)
-        throws NumberIsTooLargeException {
-        UnivariateSolverUtils.verifySequence(lower, initial, upper);
-    }
-
-    /**
-     * Check that the endpoints specify an interval and the function takes
-     * opposite signs at the endpoints.
-     *
-     * @param lower Lower endpoint.
-     * @param upper Upper endpoint.
-     * @throws NullArgumentException if the function has not been set.
-     * @throws NoBracketingException if the function has the same sign at
-     * the endpoints.
-     */
-    protected void verifyBracketing(final double lower,
-                                    final double upper)
-        throws NullArgumentException,
-               NoBracketingException {
-        UnivariateSolverUtils.verifyBracketing(function, lower, upper);
-    }
-
-    /**
-     * Increment the evaluation count by one.
-     * Method {@link #computeObjectiveValue(double)} calls this method internally.
-     * It is provided for subclasses that do not exclusively use
-     * {@code computeObjectiveValue} to solve the function.
-     * See e.g. {@link AbstractUnivariateDifferentiableSolver}.
-     *
-     * @throws TooManyEvaluationsException when the allowed number of function
-     * evaluations has been exhausted.
-     */
-    protected void incrementEvaluationCount()
-        throws TooManyEvaluationsException {
-        try {
-            evaluations.incrementCount();
-        } catch (MaxCountExceededException e) {
-            throw new TooManyEvaluationsException(e.getMax());
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/BaseSecantSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/BaseSecantSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/BaseSecantSolver.java
deleted file mode 100644
index 44a2173..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/BaseSecantSolver.java
+++ /dev/null
@@ -1,278 +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.analysis.solvers;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathInternalError;
-
-/**
- * Base class for all bracketing <em>Secant</em>-based methods for root-finding
- * (approximating a zero of a univariate real function).
- *
- * <p>Implementation of the {@link RegulaFalsiSolver <em>Regula Falsi</em>} and
- * {@link IllinoisSolver <em>Illinois</em>} methods is based on the
- * following article: M. Dowell and P. Jarratt,
- * <em>A modified regula falsi method for computing the root of an
- * equation</em>, BIT Numerical Mathematics, volume 11, number 2,
- * pages 168-174, Springer, 1971.</p>
- *
- * <p>Implementation of the {@link PegasusSolver <em>Pegasus</em>} method is
- * based on the following article: M. Dowell and P. Jarratt,
- * <em>The "Pegasus" method for computing the root of an equation</em>,
- * BIT Numerical Mathematics, volume 12, number 4, pages 503-508, Springer,
- * 1972.</p>
- *
- * <p>The {@link SecantSolver <em>Secant</em>} method is <em>not</em> a
- * bracketing method, so it is not implemented here. It has a separate
- * implementation.</p>
- *
- * @since 3.0
- */
-public abstract class BaseSecantSolver
-    extends AbstractUnivariateSolver
-    implements BracketedUnivariateSolver<UnivariateFunction> {
-
-    /** Default absolute accuracy. */
-    protected static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /** The kinds of solutions that the algorithm may accept. */
-    private AllowedSolution allowed;
-
-    /** The <em>Secant</em>-based root-finding method to use. */
-    private final Method method;
-
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param method <em>Secant</em>-based root-finding method to use.
-     */
-    protected BaseSecantSolver(final double absoluteAccuracy, final Method method) {
-        super(absoluteAccuracy);
-        this.allowed = AllowedSolution.ANY_SIDE;
-        this.method = method;
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     * @param method <em>Secant</em>-based root-finding method to use.
-     */
-    protected BaseSecantSolver(final double relativeAccuracy,
-                               final double absoluteAccuracy,
-                               final Method method) {
-        super(relativeAccuracy, absoluteAccuracy);
-        this.allowed = AllowedSolution.ANY_SIDE;
-        this.method = method;
-    }
-
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Maximum relative error.
-     * @param absoluteAccuracy Maximum absolute error.
-     * @param functionValueAccuracy Maximum function value error.
-     * @param method <em>Secant</em>-based root-finding method to use
-     */
-    protected BaseSecantSolver(final double relativeAccuracy,
-                               final double absoluteAccuracy,
-                               final double functionValueAccuracy,
-                               final Method method) {
-        super(relativeAccuracy, absoluteAccuracy, functionValueAccuracy);
-        this.allowed = AllowedSolution.ANY_SIDE;
-        this.method = method;
-    }
-
-    /** {@inheritDoc} */
-    public double solve(final int maxEval, final UnivariateFunction f,
-                        final double min, final double max,
-                        final AllowedSolution allowedSolution) {
-        return solve(maxEval, f, min, max, min + 0.5 * (max - min), allowedSolution);
-    }
-
-    /** {@inheritDoc} */
-    public double solve(final int maxEval, final UnivariateFunction f,
-                        final double min, final double max, final double startValue,
-                        final AllowedSolution allowedSolution) {
-        this.allowed = allowedSolution;
-        return super.solve(maxEval, f, min, max, startValue);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double solve(final int maxEval, final UnivariateFunction f,
-                        final double min, final double max, final double startValue) {
-        return solve(maxEval, f, min, max, startValue, AllowedSolution.ANY_SIDE);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws ConvergenceException if the algorithm failed due to finite
-     * precision.
-     */
-    @Override
-    protected final double doSolve()
-        throws ConvergenceException {
-        // Get initial solution
-        double x0 = getMin();
-        double x1 = getMax();
-        double f0 = computeObjectiveValue(x0);
-        double f1 = computeObjectiveValue(x1);
-
-        // If one of the bounds is the exact root, return it. Since these are
-        // not under-approximations or over-approximations, we can return them
-        // regardless of the allowed solutions.
-        if (f0 == 0.0) {
-            return x0;
-        }
-        if (f1 == 0.0) {
-            return x1;
-        }
-
-        // Verify bracketing of initial solution.
-        verifyBracketing(x0, x1);
-
-        // Get accuracies.
-        final double ftol = getFunctionValueAccuracy();
-        final double atol = getAbsoluteAccuracy();
-        final double rtol = getRelativeAccuracy();
-
-        // Keep track of inverted intervals, meaning that the left bound is
-        // larger than the right bound.
-        boolean inverted = false;
-
-        // Keep finding better approximations.
-        while (true) {
-            // Calculate the next approximation.
-            final double x = x1 - ((f1 * (x1 - x0)) / (f1 - f0));
-            final double fx = computeObjectiveValue(x);
-
-            // If the new approximation is the exact root, return it. Since
-            // this is not an under-approximation or an over-approximation,
-            // we can return it regardless of the allowed solutions.
-            if (fx == 0.0) {
-                return x;
-            }
-
-            // Update the bounds with the new approximation.
-            if (f1 * fx < 0) {
-                // The value of x1 has switched to the other bound, thus inverting
-                // the interval.
-                x0 = x1;
-                f0 = f1;
-                inverted = !inverted;
-            } else {
-                switch (method) {
-                case ILLINOIS:
-                    f0 *= 0.5;
-                    break;
-                case PEGASUS:
-                    f0 *= f1 / (f1 + fx);
-                    break;
-                case REGULA_FALSI:
-                    // Detect early that algorithm is stuck, instead of waiting
-                    // for the maximum number of iterations to be exceeded.
-                    if (x == x1) {
-                        throw new ConvergenceException();
-                    }
-                    break;
-                default:
-                    // Should never happen.
-                    throw new MathInternalError();
-                }
-            }
-            // Update from [x0, x1] to [x0, x].
-            x1 = x;
-            f1 = fx;
-
-            // If the function value of the last approximation is too small,
-            // given the function value accuracy, then we can't get closer to
-            // the root than we already are.
-            if (FastMath.abs(f1) <= ftol) {
-                switch (allowed) {
-                case ANY_SIDE:
-                    return x1;
-                case LEFT_SIDE:
-                    if (inverted) {
-                        return x1;
-                    }
-                    break;
-                case RIGHT_SIDE:
-                    if (!inverted) {
-                        return x1;
-                    }
-                    break;
-                case BELOW_SIDE:
-                    if (f1 <= 0) {
-                        return x1;
-                    }
-                    break;
-                case ABOVE_SIDE:
-                    if (f1 >= 0) {
-                        return x1;
-                    }
-                    break;
-                default:
-                    throw new MathInternalError();
-                }
-            }
-
-            // If the current interval is within the given accuracies, we
-            // are satisfied with the current approximation.
-            if (FastMath.abs(x1 - x0) < FastMath.max(rtol * FastMath.abs(x1),
-                                                     atol)) {
-                switch (allowed) {
-                case ANY_SIDE:
-                    return x1;
-                case LEFT_SIDE:
-                    return inverted ? x1 : x0;
-                case RIGHT_SIDE:
-                    return inverted ? x0 : x1;
-                case BELOW_SIDE:
-                    return (f1 <= 0) ? x1 : x0;
-                case ABOVE_SIDE:
-                    return (f1 >= 0) ? x1 : x0;
-                default:
-                    throw new MathInternalError();
-                }
-            }
-        }
-    }
-
-    /** <em>Secant</em>-based root-finding methods. */
-    protected enum Method {
-
-        /**
-         * The {@link RegulaFalsiSolver <em>Regula Falsi</em>} or
-         * <em>False Position</em> method.
-         */
-        REGULA_FALSI,
-
-        /** The {@link IllinoisSolver <em>Illinois</em>} method. */
-        ILLINOIS,
-
-        /** The {@link PegasusSolver <em>Pegasus</em>} method. */
-        PEGASUS;
-
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/BaseUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/BaseUnivariateSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/BaseUnivariateSolver.java
deleted file mode 100644
index f00590e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/BaseUnivariateSolver.java
+++ /dev/null
@@ -1,142 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-
-/**
- * Interface for (univariate real) rootfinding algorithms.
- * Implementations will search for only one zero in the given interval.
- *
- * This class is not intended for use outside of the Apache Commons Math
- * library, regular user should rely on more specific interfaces like
- * {@link UnivariateSolver}, {@link PolynomialSolver} or {@link
- * DifferentiableUnivariateSolver}.
- * @param <FUNC> Type of function to solve.
- *
- * @since 3.0
- * @see UnivariateSolver
- * @see PolynomialSolver
- * @see DifferentiableUnivariateSolver
- */
-public interface BaseUnivariateSolver<FUNC extends UnivariateFunction> {
-    /**
-     * Get the maximum number of function evaluations.
-     *
-     * @return the maximum number of function evaluations.
-     */
-    int getMaxEvaluations();
-
-    /**
-     * Get the number of evaluations of the objective function.
-     * The number of evaluations corresponds to the last call to the
-     * {@code optimize} method. It is 0 if the method has not been
-     * called yet.
-     *
-     * @return the number of evaluations of the objective function.
-     */
-    int getEvaluations();
-
-    /**
-     * Get the absolute accuracy of the solver.  Solutions returned by the
-     * solver should be accurate to this tolerance, i.e., if &epsilon; is the
-     * absolute accuracy of the solver and {@code v} is a value returned by
-     * one of the {@code solve} methods, then a root of the function should
-     * exist somewhere in the interval ({@code v} - &epsilon;, {@code v} + &epsilon;).
-     *
-     * @return the absolute accuracy.
-     */
-    double getAbsoluteAccuracy();
-
-    /**
-     * Get the relative accuracy of the solver.  The contract for relative
-     * accuracy is the same as {@link #getAbsoluteAccuracy()}, but using
-     * relative, rather than absolute error.  If &rho; is the relative accuracy
-     * configured for a solver and {@code v} is a value returned, then a root
-     * of the function should exist somewhere in the interval
-     * ({@code v} - &rho; {@code v}, {@code v} + &rho; {@code v}).
-     *
-     * @return the relative accuracy.
-     */
-    double getRelativeAccuracy();
-
-    /**
-     * Get the function value accuracy of the solver.  If {@code v} is
-     * a value returned by the solver for a function {@code f},
-     * then by contract, {@code |f(v)|} should be less than or equal to
-     * the function value accuracy configured for the solver.
-     *
-     * @return the function value accuracy.
-     */
-    double getFunctionValueAccuracy();
-
-    /**
-     * Solve for a zero root in the given interval.
-     * A solver may require that the interval brackets a single zero root.
-     * Solvers that do require bracketing should be able to handle the case
-     * where one of the endpoints is itself a root.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @return a value where the function is zero.
-     * @throws MathIllegalArgumentException
-     * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws TooManyEvaluationsException if
-     * the allowed number of evaluations is exceeded.
-     */
-    double solve(int maxEval, FUNC f, double min, double max)
-        throws MathIllegalArgumentException, TooManyEvaluationsException;
-
-    /**
-     * Solve for a zero in the given interval, start at {@code startValue}.
-     * A solver may require that the interval brackets a single zero root.
-     * Solvers that do require bracketing should be able to handle the case
-     * where one of the endpoints is itself a root.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param startValue Start value to use.
-     * @return a value where the function is zero.
-     * @throws MathIllegalArgumentException
-     * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws TooManyEvaluationsException if
-     * the allowed number of evaluations is exceeded.
-     */
-    double solve(int maxEval, FUNC f, double min, double max, double startValue)
-        throws MathIllegalArgumentException, TooManyEvaluationsException;
-
-    /**
-     * Solve for a zero in the vicinity of {@code startValue}.
-     *
-     * @param f Function to solve.
-     * @param startValue Start value to use.
-     * @return a value where the function is zero.
-     * @param maxEval Maximum number of evaluations.
-     * @throws org.apache.commons.math3.exception.MathIllegalArgumentException
-     * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
-     * the allowed number of evaluations is exceeded.
-     */
-    double solve(int maxEval, FUNC f, double startValue);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/BisectionSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/BisectionSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/BisectionSolver.java
deleted file mode 100644
index 49f4057..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/BisectionSolver.java
+++ /dev/null
@@ -1,91 +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.analysis.solvers;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/Bisection.html">
- * bisection algorithm</a> for finding zeros of univariate real functions.
- * <p>
- * The function should be continuous but not necessarily smooth.</p>
- *
- */
-public class BisectionSolver extends AbstractUnivariateSolver {
-    /** Default absolute accuracy. */
-    private static final double DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-
-    /**
-     * Construct a solver with default accuracy (1e-6).
-     */
-    public BisectionSolver() {
-        this(DEFAULT_ABSOLUTE_ACCURACY);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public BisectionSolver(double absoluteAccuracy) {
-        super(absoluteAccuracy);
-    }
-    /**
-     * Construct a solver.
-     *
-     * @param relativeAccuracy Relative accuracy.
-     * @param absoluteAccuracy Absolute accuracy.
-     */
-    public BisectionSolver(double relativeAccuracy,
-                           double absoluteAccuracy) {
-        super(relativeAccuracy, absoluteAccuracy);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected double doSolve()
-        throws TooManyEvaluationsException {
-        double min = getMin();
-        double max = getMax();
-        verifyInterval(min, max);
-        final double absoluteAccuracy = getAbsoluteAccuracy();
-        double m;
-        double fm;
-        double fmin;
-
-        while (true) {
-            m = UnivariateSolverUtils.midpoint(min, max);
-            fmin = computeObjectiveValue(min);
-            fm = computeObjectiveValue(m);
-
-            if (fm * fmin > 0) {
-                // max and m bracket the root.
-                min = m;
-            } else {
-                // min and m bracket the root.
-                max = m;
-            }
-
-            if (FastMath.abs(max - min) <= absoluteAccuracy) {
-                m = UnivariateSolverUtils.midpoint(min, max);
-                return m;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.java b/src/main/java/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.java
deleted file mode 100644
index 789fc99..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/solvers/BracketedUnivariateSolver.java
+++ /dev/null
@@ -1,92 +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.analysis.solvers;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-
-/** Interface for {@link UnivariateSolver (univariate real) root-finding
- * algorithms} that maintain a bracketed solution. There are several advantages
- * to having such root-finding algorithms:
- * <ul>
- *  <li>The bracketed solution guarantees that the root is kept within the
- *      interval. As such, these algorithms generally also guarantee
- *      convergence.</li>
- *  <li>The bracketed solution means that we have the opportunity to only
- *      return roots that are greater than or equal to the actual root, or
- *      are less than or equal to the actual root. That is, we can control
- *      whether under-approximations and over-approximations are
- *      {@link AllowedSolution allowed solutions}. Other root-finding
- *      algorithms can usually only guarantee that the solution (the root that
- *      was found) is around the actual root.</li>
- * </ul>
- *
- * <p>For backwards compatibility, all root-finding algorithms must have
- * {@link AllowedSolution#ANY_SIDE ANY_SIDE} as default for the allowed
- * solutions.</p>
- * @param <FUNC> Type of function to solve.
- *
- * @see AllowedSolution
- * @since 3.0
- */
-public interface BracketedUnivariateSolver<FUNC extends UnivariateFunction>
-    extends BaseUnivariateSolver<FUNC> {
-
-    /**
-     * Solve for a zero in the given interval.
-     * A solver may require that the interval brackets a single zero root.
-     * Solvers that do require bracketing should be able to handle the case
-     * where one of the endpoints is itself a root.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param allowedSolution The kind of solutions that the root-finding algorithm may
-     * accept as solutions.
-     * @return A value where the function is zero.
-     * @throws org.apache.commons.math3.exception.MathIllegalArgumentException
-     * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
-     * the allowed number of evaluations is exceeded.
-     */
-    double solve(int maxEval, FUNC f, double min, double max,
-                 AllowedSolution allowedSolution);
-
-    /**
-     * Solve for a zero in the given interval, start at {@code startValue}.
-     * A solver may require that the interval brackets a single zero root.
-     * Solvers that do require bracketing should be able to handle the case
-     * where one of the endpoints is itself a root.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f Function to solve.
-     * @param min Lower bound for the interval.
-     * @param max Upper bound for the interval.
-     * @param startValue Start value to use.
-     * @param allowedSolution The kind of solutions that the root-finding algorithm may
-     * accept as solutions.
-     * @return A value where the function is zero.
-     * @throws org.apache.commons.math3.exception.MathIllegalArgumentException
-     * if the arguments do not satisfy the requirements specified by the solver.
-     * @throws org.apache.commons.math3.exception.TooManyEvaluationsException if
-     * the allowed number of evaluations is exceeded.
-     */
-    double solve(int maxEval, FUNC f, double min, double max, double startValue,
-                 AllowedSolution allowedSolution);
-
-}


[71/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolator.java
index 3ff3a85..38fe2ec 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/DormandPrince853StepInterpolator.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.ode.AbstractIntegrator;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.ode.AbstractIntegrator;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /**
  * This class represents an interpolator over the last step during an

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
index 098d2e5..a82f168 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/EmbeddedRungeKuttaIntegrator.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-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.ExpandableStatefulODE;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+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.ExpandableStatefulODE;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements the common part of all embedded Runge-Kutta

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerIntegrator.java
index 22c15c5..1c05ad4 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerIntegrator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolator.java
index 3c45780..af78449 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/EulerStepInterpolator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /**
  * This class implements a linear interpolator for step.
@@ -51,7 +51,7 @@ class EulerStepInterpolator
   /** Simple constructor.
    * This constructor builds an instance that is not usable yet, the
    * {@link
-   * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
+   * org.apache.commons.math4.ode.sampling.AbstractStepInterpolator#reinitialize}
    * method should be called before using the instance in order to
    * initialize the internal arrays. This constructor is used only
    * in order to delay the initialization in some cases. The {@link

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/GillIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillIntegrator.java
index 5273e02..1ebc48f 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillIntegrator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolator.java
index 49081f5..7131388 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/GillStepInterpolator.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements a step interpolator for the Gill fourth
@@ -67,7 +67,7 @@ class GillStepInterpolator
   /** Simple constructor.
    * This constructor builds an instance that is not usable yet, the
    * {@link
-   * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
+   * org.apache.commons.math4.ode.sampling.AbstractStepInterpolator#reinitialize}
    * method should be called before using the instance in order to
    * initialize the internal arrays. This constructor is used only
    * in order to delay the initialization in some cases. The {@link

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegrator.java
index 50a463e..47defd2 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerIntegrator.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
-
-import org.apache.commons.math3.analysis.solvers.UnivariateSolver;
-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.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.events.EventHandler;
-import org.apache.commons.math3.ode.sampling.AbstractStepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepHandler;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.ode.nonstiff;
+
+import org.apache.commons.math4.analysis.solvers.UnivariateSolver;
+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.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.events.EventHandler;
+import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepHandler;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements a Gragg-Bulirsch-Stoer integrator for

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolator.java
index c1d61b3..95c41c8 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/GraggBulirschStoerStepInterpolator.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.sampling.AbstractStepInterpolator;
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements an interpolator for the Gragg-Bulirsch-Stoer

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54Integrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54Integrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54Integrator.java
index c48c4f9..f5354f3 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54Integrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54Integrator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolator.java
index cecbafb..19acf08 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/HighamHall54StepInterpolator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /**
  * This class represents an interpolator over the last step during an
@@ -37,7 +37,7 @@ class HighamHall54StepInterpolator
   /** Simple constructor.
    * This constructor builds an instance that is not usable yet, the
    * {@link
-   * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
+   * org.apache.commons.math4.ode.sampling.AbstractStepInterpolator#reinitialize}
    * method should be called before using the instance in order to
    * initialize the internal arrays. This constructor is used only
    * in order to delay the initialization in some cases. The {@link

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherIntegrator.java
index d3d0d6a..631d6b2 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherIntegrator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolator.java
index 6f54b70..d3fd546 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/LutherStepInterpolator.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class represents an interpolator over the last step during an
@@ -43,7 +43,7 @@ class LutherStepInterpolator extends RungeKuttaStepInterpolator {
     /** Simple constructor.
      * This constructor builds an instance that is not usable yet, the
      * {@link
-     * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
+     * org.apache.commons.math4.ode.sampling.AbstractStepInterpolator#reinitialize}
      * method should be called before using the instance in order to
      * initialize the internal arrays. This constructor is used only
      * in order to delay the initialization in some cases. The {@link

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegrator.java
index fa834a1..ff41520 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointIntegrator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolator.java
index 7346f7a..d872d6e 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/MidpointStepInterpolator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /**
  * This class implements a step interpolator for second order
@@ -53,7 +53,7 @@ class MidpointStepInterpolator
   /** Simple constructor.
    * This constructor builds an instance that is not usable yet, the
    * {@link
-   * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
+   * org.apache.commons.math4.ode.sampling.AbstractStepInterpolator#reinitialize}
    * method should be called before using the instance in order to
    * initialize the internal arrays. This constructor is used only
    * in order to delay the initialization in some cases. The {@link

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaIntegrator.java
index 5f7d5d8..4b8b6c3 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaIntegrator.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
-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.AbstractIntegrator;
-import org.apache.commons.math3.ode.ExpandableStatefulODE;
-import org.apache.commons.math3.ode.FirstOrderDifferentialEquations;
-import org.apache.commons.math3.util.FastMath;
+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.AbstractIntegrator;
+import org.apache.commons.math4.ode.ExpandableStatefulODE;
+import org.apache.commons.math4.ode.FirstOrderDifferentialEquations;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements the common part of all fixed step Runge-Kutta

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaStepInterpolator.java
index c15c590..5d09d94 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/RungeKuttaStepInterpolator.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.apache.commons.math3.ode.AbstractIntegrator;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.ode.sampling.AbstractStepInterpolator;
+import org.apache.commons.math4.ode.AbstractIntegrator;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.ode.sampling.AbstractStepInterpolator;
 
 /** This class represents an interpolator over the last step during an
  * ODE integration for Runge-Kutta and embedded Runge-Kutta integrators.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegrator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegrator.java
index c5f8216..cb14511 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegrator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesIntegrator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolator.java
index 0f263d1..33fee20 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/ThreeEighthesStepInterpolator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;
 
-import org.apache.commons.math3.ode.sampling.StepInterpolator;
+import org.apache.commons.math4.ode.sampling.StepInterpolator;
 
 /**
  * This class implements a step interpolator for the 3/8 fourth
@@ -63,7 +63,7 @@ class ThreeEighthesStepInterpolator
   /** Simple constructor.
    * This constructor builds an instance that is not usable yet, the
    * {@link
-   * org.apache.commons.math3.ode.sampling.AbstractStepInterpolator#reinitialize}
+   * org.apache.commons.math4.ode.sampling.AbstractStepInterpolator#reinitialize}
    * method should be called before using the instance in order to
    * initialize the internal arrays. This constructor is used only
    * in order to delay the initialization in some cases. The {@link

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/nonstiff/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/nonstiff/package-info.java b/src/main/java/org/apache/commons/math4/ode/nonstiff/package-info.java
index b2387ce..41e452c 100644
--- a/src/main/java/org/apache/commons/math4/ode/nonstiff/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ode/nonstiff/package-info.java
@@ -22,4 +22,4 @@
  *
  *
  */
-package org.apache.commons.math3.ode.nonstiff;
+package org.apache.commons.math4.ode.nonstiff;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/package-info.java b/src/main/java/org/apache/commons/math4/ode/package-info.java
index c40e764..106a757 100644
--- a/src/main/java/org/apache/commons/math4/ode/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ode/package-info.java
@@ -36,7 +36,7 @@
  * computing the state vector at discrete times, they also provide a
  * cheap mean to get the state between the time steps. They do so through
  * classes extending the {@link
- * org.apache.commons.math3.ode.sampling.StepInterpolator StepInterpolator}
+ * org.apache.commons.math4.ode.sampling.StepInterpolator StepInterpolator}
  * abstract class, which are made available to the user at the end of
  * each step.
  * </p>
@@ -56,10 +56,10 @@
  * <p>
  * The user should describe his problem in his own classes
  * (<code>UserProblem</code> in the diagram below) which should implement
- * the {@link org.apache.commons.math3.ode.FirstOrderDifferentialEquations
+ * the {@link org.apache.commons.math4.ode.FirstOrderDifferentialEquations
  * FirstOrderDifferentialEquations} interface. Then he should pass it to
  * the integrator he prefers among all the classes that implement the
- * {@link org.apache.commons.math3.ode.FirstOrderIntegrator
+ * {@link org.apache.commons.math4.ode.FirstOrderIntegrator
  * FirstOrderIntegrator} interface.
  * </p>
  *
@@ -67,23 +67,23 @@
  * The solution of the integration problem is provided by two means. The
  * first one is aimed towards simple use: the state vector at the end of
  * the integration process is copied in the <code>y</code> array of the
- * {@link org.apache.commons.math3.ode.FirstOrderIntegrator#integrate
+ * {@link org.apache.commons.math4.ode.FirstOrderIntegrator#integrate
  * FirstOrderIntegrator.integrate} method. The second one should be used
  * when more in-depth information is needed throughout the integration
  * process. The user can register an object implementing the {@link
- * org.apache.commons.math3.ode.sampling.StepHandler StepHandler} interface or a
- * {@link org.apache.commons.math3.ode.sampling.StepNormalizer StepNormalizer}
+ * org.apache.commons.math4.ode.sampling.StepHandler StepHandler} interface or a
+ * {@link org.apache.commons.math4.ode.sampling.StepNormalizer StepNormalizer}
  * object wrapping a user-specified object implementing the {@link
- * org.apache.commons.math3.ode.sampling.FixedStepHandler FixedStepHandler}
+ * org.apache.commons.math4.ode.sampling.FixedStepHandler FixedStepHandler}
  * interface into the integrator before calling the {@link
- * org.apache.commons.math3.ode.FirstOrderIntegrator#integrate
+ * org.apache.commons.math4.ode.FirstOrderIntegrator#integrate
  * FirstOrderIntegrator.integrate} method. The user object will be called
  * appropriately during the integration process, allowing the user to
  * process intermediate results. The default step handler does nothing.
  * </p>
  *
  * <p>
- * {@link org.apache.commons.math3.ode.ContinuousOutputModel
+ * {@link org.apache.commons.math4.ode.ContinuousOutputModel
  * ContinuousOutputModel} is a special-purpose step handler that is able
  * to store all steps and to provide transparent access to any
  * intermediate result once the integration is over. An important feature
@@ -98,10 +98,10 @@
  *
  * <p>
  * Other default implementations of the {@link
- * org.apache.commons.math3.ode.sampling.StepHandler StepHandler} interface are
+ * org.apache.commons.math4.ode.sampling.StepHandler StepHandler} interface are
  * available for general needs ({@link
- * org.apache.commons.math3.ode.sampling.DummyStepHandler DummyStepHandler}, {@link
- * org.apache.commons.math3.ode.sampling.StepNormalizer StepNormalizer}) and custom
+ * org.apache.commons.math4.ode.sampling.DummyStepHandler DummyStepHandler}, {@link
+ * org.apache.commons.math4.ode.sampling.StepNormalizer StepNormalizer}) and custom
  * implementations can be developed for specific needs. As an example,
  * if an application is to be completely driven by the integration
  * process, then most of the application code will be run inside a step
@@ -113,14 +113,14 @@
  * creation time. The more efficient integrators use variable steps that
  * are handled internally in order to control the integration error with
  * respect to a specified accuracy (these integrators extend the {@link
- * org.apache.commons.math3.ode.nonstiff.AdaptiveStepsizeIntegrator
+ * org.apache.commons.math4.ode.nonstiff.AdaptiveStepsizeIntegrator
  * AdaptiveStepsizeIntegrator} abstract class). In this case, the step
  * handler which is called after each successful step shows up the
  * variable stepsize. The {@link
- * org.apache.commons.math3.ode.sampling.StepNormalizer StepNormalizer} class can
+ * org.apache.commons.math4.ode.sampling.StepNormalizer StepNormalizer} class can
  * be used to convert the variable stepsize into a fixed stepsize that
  * can be handled by classes implementing the {@link
- * org.apache.commons.math3.ode.sampling.FixedStepHandler FixedStepHandler}
+ * org.apache.commons.math4.ode.sampling.FixedStepHandler FixedStepHandler}
  * interface. Adaptive stepsize integrators can automatically compute the
  * initial stepsize by themselves, however the user can specify it if he
  * prefers to retain full control over the integration or if the
@@ -131,34 +131,34 @@
  * <table border="1" align="center">
  * <tr BGCOLOR="#CCCCFF"><td colspan=2><font size="+2">Fixed Step Integrators</font></td></tr>
  * <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>Order</td></font></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.EulerIntegrator Euler}</td><td>1</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.MidpointIntegrator Midpoint}</td><td>2</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.ClassicalRungeKuttaIntegrator Classical Runge-Kutta}</td><td>4</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.GillIntegrator Gill}</td><td>4</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.ThreeEighthesIntegrator 3/8}</td><td>4</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.LutherIntegrator Luther}</td><td>6</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.EulerIntegrator Euler}</td><td>1</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.MidpointIntegrator Midpoint}</td><td>2</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.ClassicalRungeKuttaIntegrator Classical Runge-Kutta}</td><td>4</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.GillIntegrator Gill}</td><td>4</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.ThreeEighthesIntegrator 3/8}</td><td>4</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.LutherIntegrator Luther}</td><td>6</td></tr>
  * </table>
  * </p>
  *
  * <table border="1" align="center">
  * <tr BGCOLOR="#CCCCFF"><td colspan=3><font size="+2">Adaptive Stepsize Integrators</font></td></tr>
  * <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>Integration Order</td><td>Error Estimation Order</td></font></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.HighamHall54Integrator Higham and Hall}</td><td>5</td><td>4</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.DormandPrince54Integrator Dormand-Prince 5(4)}</td><td>5</td><td>4</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.DormandPrince853Integrator Dormand-Prince 8(5,3)}</td><td>8</td><td>5 and 3</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.GraggBulirschStoerIntegrator Gragg-Bulirsch-Stoer}</td><td>variable (up to 18 by default)</td><td>variable</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator Adams-Bashforth}</td><td>variable</td><td>variable</td></tr>
- * <tr><td>{@link org.apache.commons.math3.ode.nonstiff.AdamsMoultonIntegrator Adams-Moulton}</td><td>variable</td><td>variable</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.HighamHall54Integrator Higham and Hall}</td><td>5</td><td>4</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.DormandPrince54Integrator Dormand-Prince 5(4)}</td><td>5</td><td>4</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.DormandPrince853Integrator Dormand-Prince 8(5,3)}</td><td>8</td><td>5 and 3</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.GraggBulirschStoerIntegrator Gragg-Bulirsch-Stoer}</td><td>variable (up to 18 by default)</td><td>variable</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.AdamsBashforthIntegrator Adams-Bashforth}</td><td>variable</td><td>variable</td></tr>
+ * <tr><td>{@link org.apache.commons.math4.ode.nonstiff.AdamsMoultonIntegrator Adams-Moulton}</td><td>variable</td><td>variable</td></tr>
  * </table>
  * </p>
  *
  * <p>
- * In the table above, the {@link org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator
- * Adams-Bashforth} and {@link org.apache.commons.math3.ode.nonstiff.AdamsMoultonIntegrator
+ * In the table above, the {@link org.apache.commons.math4.ode.nonstiff.AdamsBashforthIntegrator
+ * Adams-Bashforth} and {@link org.apache.commons.math4.ode.nonstiff.AdamsMoultonIntegrator
  * Adams-Moulton} integrators appear as variable-step ones. This is an experimental extension
  * to the classical algorithms using the Nordsieck vector representation.
  * </p>
  *
  *
  */
-package org.apache.commons.math3.ode;
+package org.apache.commons.math4.ode;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java
index 1fbc04a..fdd0030 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/AbstractStepInterpolator.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.ode.EquationsMapper;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.ode.EquationsMapper;
 
 /** This abstract class represents an interpolator over the last step
  * during an ODE integration.
@@ -32,8 +32,8 @@ import org.apache.commons.math3.ode.EquationsMapper;
  * retrieve the state vector at intermediate times between the
  * previous and the current grid points (dense output).</p>
  *
- * @see org.apache.commons.math3.ode.FirstOrderIntegrator
- * @see org.apache.commons.math3.ode.SecondOrderIntegrator
+ * @see org.apache.commons.math4.ode.FirstOrderIntegrator
+ * @see org.apache.commons.math4.ode.SecondOrderIntegrator
  * @see StepHandler
  *
  * @since 1.2
@@ -103,7 +103,7 @@ public abstract class AbstractStepInterpolator
    * instance in order to initialize the internal arrays. This
    * constructor is used only in order to delay the initialization in
    * some cases. As an example, the {@link
-   * org.apache.commons.math3.ode.nonstiff.EmbeddedRungeKuttaIntegrator}
+   * org.apache.commons.math4.ode.nonstiff.EmbeddedRungeKuttaIntegrator}
    * class uses the prototyping design pattern to create the step
    * interpolators by cloning an uninitialized model and latter
    * initializing the copy.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java b/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java
index c1d4fe3..7134619 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/DummyStepHandler.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 /**
  * This class is a step handler that does nothing.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/FixedStepHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/FixedStepHandler.java b/src/main/java/org/apache/commons/math4/ode/sampling/FixedStepHandler.java
index bbe6ac5..20f29bf 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/FixedStepHandler.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/FixedStepHandler.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolator.java
index 39b05ab..1937844 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/NordsieckStepInterpolator.java
@@ -15,17 +15,17 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.ode.EquationsMapper;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.ode.EquationsMapper;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements an interpolator for integrators using Nordsieck representation.
@@ -33,8 +33,8 @@ import org.apache.commons.math3.util.FastMath;
  * <p>This interpolator computes dense output around the current point.
  * The interpolation equation is based on Taylor series formulas.
  *
- * @see org.apache.commons.math3.ode.nonstiff.AdamsBashforthIntegrator
- * @see org.apache.commons.math3.ode.nonstiff.AdamsMoultonIntegrator
+ * @see org.apache.commons.math4.ode.nonstiff.AdamsBashforthIntegrator
+ * @see org.apache.commons.math4.ode.nonstiff.AdamsMoultonIntegrator
  * @since 2.0
  */
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/StepHandler.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/StepHandler.java b/src/main/java/org/apache/commons/math4/ode/sampling/StepHandler.java
index f4c63df..09b7b2b 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/StepHandler.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/StepHandler.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 
 /**
@@ -33,8 +33,8 @@ import org.apache.commons.math3.exception.MaxCountExceededException;
  * last one, store the points in an ephemeris, or forward them to
  * specialized processing or output methods.</p>
  *
- * @see org.apache.commons.math3.ode.FirstOrderIntegrator
- * @see org.apache.commons.math3.ode.SecondOrderIntegrator
+ * @see org.apache.commons.math4.ode.FirstOrderIntegrator
+ * @see org.apache.commons.math4.ode.SecondOrderIntegrator
  * @see StepInterpolator
  * @since 1.2
  */
@@ -60,7 +60,7 @@ public interface StepHandler {
      * object on each call, so if the instance wants to keep it across
      * all calls (for example to provide at the end of the integration a
      * continuous model valid throughout the integration range, as the
-     * {@link org.apache.commons.math3.ode.ContinuousOutputModel
+     * {@link org.apache.commons.math4.ode.ContinuousOutputModel
      * ContinuousOutputModel} class does), it should build a local copy
      * using the clone method of the interpolator and store this copy.
      * Keeping only a reference to the interpolator and reusing it will

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/StepInterpolator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/StepInterpolator.java b/src/main/java/org/apache/commons/math4/ode/sampling/StepInterpolator.java
index 5d27bf2..c253942 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/StepInterpolator.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/StepInterpolator.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 import java.io.Externalizable;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 /** This interface represents an interpolator over the last step
  * during an ODE integration.
@@ -39,8 +39,8 @@ import org.apache.commons.math3.exception.MaxCountExceededException;
  * {@link #copy()} method.
  * </p>
  *
- * @see org.apache.commons.math3.ode.FirstOrderIntegrator
- * @see org.apache.commons.math3.ode.SecondOrderIntegrator
+ * @see org.apache.commons.math4.ode.FirstOrderIntegrator
+ * @see org.apache.commons.math4.ode.SecondOrderIntegrator
  * @see StepHandler
  * @since 1.2
  */
@@ -125,8 +125,8 @@ public interface StepInterpolator extends Externalizable {
    * to be preserved across several calls to the associated
    * {@link #setInterpolatedTime(double)} method.</p>
    * @param index index of the secondary set, as returned by {@link
-   * org.apache.commons.math3.ode.ExpandableStatefulODE#addSecondaryEquations(
-   * org.apache.commons.math3.ode.SecondaryEquations)
+   * org.apache.commons.math4.ode.ExpandableStatefulODE#addSecondaryEquations(
+   * org.apache.commons.math4.ode.SecondaryEquations)
    * ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)}
    * @return interpolated secondary state at the current interpolation date
    * @see #getInterpolatedState()
@@ -143,8 +143,8 @@ public interface StepInterpolator extends Externalizable {
    * it should not be modified and it should be copied if it needs
    * to be preserved across several calls.</p>
    * @param index index of the secondary set, as returned by {@link
-   * org.apache.commons.math3.ode.ExpandableStatefulODE#addSecondaryEquations(
-   * org.apache.commons.math3.ode.SecondaryEquations)
+   * org.apache.commons.math4.ode.ExpandableStatefulODE#addSecondaryEquations(
+   * org.apache.commons.math4.ode.SecondaryEquations)
    * ExpandableStatefulODE.addSecondaryEquations(SecondaryEquations)}
    * @return interpolated secondary derivatives at the current interpolation date
    * @see #getInterpolatedState()

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
index 307c0d9..1766248 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizer.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * This class wraps an object implementing {@link FixedStepHandler}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerBounds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerBounds.java b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerBounds.java
index ff1ee2c..0a9ccfd 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerBounds.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerBounds.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 /** {@link StepNormalizer Step normalizer} bounds settings. They influence
  * whether the underlying fixed step size step handler is called for the first

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerMode.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerMode.java b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerMode.java
index 0a2ddc9..c3d19b6 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerMode.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/StepNormalizerMode.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;
 
 
 /** {@link StepNormalizer Step normalizer} modes. Determines how the step size

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/ode/sampling/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/ode/sampling/package-info.java b/src/main/java/org/apache/commons/math4/ode/sampling/package-info.java
index 29c65e0..6a05287 100644
--- a/src/main/java/org/apache/commons/math4/ode/sampling/package-info.java
+++ b/src/main/java/org/apache/commons/math4/ode/sampling/package-info.java
@@ -25,8 +25,8 @@
  * In addition to computing the evolution of the state vector at some grid points, all
  * ODE integrators also build up interpolation models of this evolution <em>inside</em> the
  * last computed step. If users are interested in these interpolators, they can register a
- * {@link org.apache.commons.math3.ode.sampling.StepHandler StepHandler} instance using the
- * {@link org.apache.commons.math3.ode.FirstOrderIntegrator#addStepHandler addStepHandler}
+ * {@link org.apache.commons.math4.ode.sampling.StepHandler StepHandler} instance using the
+ * {@link org.apache.commons.math4.ode.FirstOrderIntegrator#addStepHandler addStepHandler}
  * method which is supported by all integrators. The integrator will call this instance
  * at the end of each accepted step and provide it the interpolator. The user can do
  * whatever he wants with this interpolator, which computes both the state and its
@@ -44,17 +44,17 @@
  *
  * <p>
  * Since some integrators may use variable step size, the generic {@link
- * org.apache.commons.math3.ode.sampling.StepHandler StepHandler} interface can be called
+ * org.apache.commons.math4.ode.sampling.StepHandler StepHandler} interface can be called
  * either at regular or irregular rate. This interface allows to navigate to any location
  * within the last computed step, thanks to the provided {@link
- * org.apache.commons.math3.ode.sampling.StepInterpolator StepInterpolator} object.
+ * org.apache.commons.math4.ode.sampling.StepInterpolator StepInterpolator} object.
  * If regular output is desired (for example in order to write an ephemeris file), then
- * the simpler {@link org.apache.commons.math3.ode.sampling.FixedStepHandler FixedStepHandler}
+ * the simpler {@link org.apache.commons.math4.ode.sampling.FixedStepHandler FixedStepHandler}
  * interface can be used. Objects implementing this interface should be wrapped within a
- * {@link org.apache.commons.math3.ode.sampling.StepNormalizer StepNormalizer} instance
+ * {@link org.apache.commons.math4.ode.sampling.StepNormalizer StepNormalizer} instance
  * in order to be registered to the integrator.
  * </p>
  *
  *
  */
-package org.apache.commons.math3.ode.sampling;
+package org.apache.commons.math4.ode.sampling;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java b/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java
index 4885959..6e0b9ab 100644
--- a/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java
+++ b/src/main/java/org/apache/commons/math4/optim/AbstractConvergenceChecker.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
 /**
  * Base class for all convergence checker implementations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java b/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java
index d40c427..3432404 100644
--- a/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java
+++ b/src/main/java/org/apache/commons/math4/optim/AbstractOptimizationProblem.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.TooManyIterationsException;
-import org.apache.commons.math3.util.Incrementor;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.TooManyIterationsException;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Base class for implementing optimization problems. It contains the boiler-plate code

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/BaseMultiStartMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/BaseMultiStartMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/BaseMultiStartMultivariateOptimizer.java
index f98e4c3..4ceab3e 100644
--- a/src/main/java/org/apache/commons/math4/optim/BaseMultiStartMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/BaseMultiStartMultivariateOptimizer.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.random.RandomVectorGenerator;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.random.RandomVectorGenerator;
 
 /**
  * Base class multi-start optimizer for a multivariate function.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/BaseMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/BaseMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/BaseMultivariateOptimizer.java
index ec52e0a..32908b7 100644
--- a/src/main/java/org/apache/commons/math4/optim/BaseMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/BaseMultivariateOptimizer.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 
 /**
  * Base class for implementing optimizers for multivariate functions.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java b/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java
index e317298..00c0a3c 100644
--- a/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/BaseOptimizer.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.TooManyIterationsException;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.exception.TooManyIterationsException;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Base class for implementing optimizers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/ConvergenceChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/ConvergenceChecker.java b/src/main/java/org/apache/commons/math4/optim/ConvergenceChecker.java
index 67331e2..b61e419 100644
--- a/src/main/java/org/apache/commons/math4/optim/ConvergenceChecker.java
+++ b/src/main/java/org/apache/commons/math4/optim/ConvergenceChecker.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
 /**
  * This interface specifies how to check if an optimization algorithm has
@@ -36,9 +36,9 @@ package org.apache.commons.math3.optim;
  *
  * @param <PAIR> Type of the (point, objective value) pair.
  *
- * @see org.apache.commons.math3.optim.SimplePointChecker
- * @see org.apache.commons.math3.optim.SimpleValueChecker
- * @see org.apache.commons.math3.optim.SimpleVectorValueChecker
+ * @see org.apache.commons.math4.optim.SimplePointChecker
+ * @see org.apache.commons.math4.optim.SimpleValueChecker
+ * @see org.apache.commons.math4.optim.SimpleVectorValueChecker
  *
  * @since 3.0
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/InitialGuess.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/InitialGuess.java b/src/main/java/org/apache/commons/math4/optim/InitialGuess.java
index e76cc0d..d1d8fe0 100644
--- a/src/main/java/org/apache/commons/math4/optim/InitialGuess.java
+++ b/src/main/java/org/apache/commons/math4/optim/InitialGuess.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
 /**
  * Starting point (first guess) of the optimization procedure.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/MaxEval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/MaxEval.java b/src/main/java/org/apache/commons/math4/optim/MaxEval.java
index 5d730fb..2ef4e97 100644
--- a/src/main/java/org/apache/commons/math4/optim/MaxEval.java
+++ b/src/main/java/org/apache/commons/math4/optim/MaxEval.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 
 /**
  * Maximum number of evaluations of the function to be optimized.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/MaxIter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/MaxIter.java b/src/main/java/org/apache/commons/math4/optim/MaxIter.java
index 40c2292..315359a 100644
--- a/src/main/java/org/apache/commons/math4/optim/MaxIter.java
+++ b/src/main/java/org/apache/commons/math4/optim/MaxIter.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 
 /**
  * Maximum number of iterations performed by an (iterative) algorithm.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/OptimizationData.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/OptimizationData.java b/src/main/java/org/apache/commons/math4/optim/OptimizationData.java
index d97687b..fbba855 100644
--- a/src/main/java/org/apache/commons/math4/optim/OptimizationData.java
+++ b/src/main/java/org/apache/commons/math4/optim/OptimizationData.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
 /**
  * Marker interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/OptimizationProblem.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/OptimizationProblem.java b/src/main/java/org/apache/commons/math4/optim/OptimizationProblem.java
index 24b13f5..35623b4 100644
--- a/src/main/java/org/apache/commons/math4/optim/OptimizationProblem.java
+++ b/src/main/java/org/apache/commons/math4/optim/OptimizationProblem.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.util.Incrementor;
+import org.apache.commons.math4.util.Incrementor;
 
 /**
  * Common settings for all optimization problems. Includes divergence and convergence

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/PointValuePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/PointValuePair.java b/src/main/java/org/apache/commons/math4/optim/PointValuePair.java
index 0f27a52..b3e01a0 100644
--- a/src/main/java/org/apache/commons/math4/optim/PointValuePair.java
+++ b/src/main/java/org/apache/commons/math4/optim/PointValuePair.java
@@ -14,17 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
 import java.io.Serializable;
-import org.apache.commons.math3.util.Pair;
+
+import org.apache.commons.math4.util.Pair;
 
 /**
  * This class holds a point and the value of an objective function at
  * that point.
  *
  * @see PointVectorValuePair
- * @see org.apache.commons.math3.analysis.MultivariateFunction
+ * @see org.apache.commons.math4.analysis.MultivariateFunction
  * @since 3.0
  */
 public class PointValuePair extends Pair<double[], Double> implements Serializable {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/PointVectorValuePair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/PointVectorValuePair.java b/src/main/java/org/apache/commons/math4/optim/PointVectorValuePair.java
index 0dd70f4..62741d7 100644
--- a/src/main/java/org/apache/commons/math4/optim/PointVectorValuePair.java
+++ b/src/main/java/org/apache/commons/math4/optim/PointVectorValuePair.java
@@ -14,17 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
 import java.io.Serializable;
-import org.apache.commons.math3.util.Pair;
+
+import org.apache.commons.math4.util.Pair;
 
 /**
  * This class holds a point and the vectorial value of an objective function at
  * that point.
  *
  * @see PointValuePair
- * @see org.apache.commons.math3.analysis.MultivariateVectorFunction
+ * @see org.apache.commons.math4.analysis.MultivariateVectorFunction
  * @since 3.0
  */
 public class PointVectorValuePair extends Pair<double[], double[]> implements Serializable {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/SimpleBounds.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/SimpleBounds.java b/src/main/java/org/apache/commons/math4/optim/SimpleBounds.java
index 4099c1c..c166341 100644
--- a/src/main/java/org/apache/commons/math4/optim/SimpleBounds.java
+++ b/src/main/java/org/apache/commons/math4/optim/SimpleBounds.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
 import java.util.Arrays;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/SimplePointChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/SimplePointChecker.java b/src/main/java/org/apache/commons/math4/optim/SimplePointChecker.java
index 0998bc4..e1463c9 100644
--- a/src/main/java/org/apache/commons/math4/optim/SimplePointChecker.java
+++ b/src/main/java/org/apache/commons/math4/optim/SimplePointChecker.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
 
 /**
  * Simple implementation of the {@link ConvergenceChecker} interface using

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/SimpleValueChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/SimpleValueChecker.java b/src/main/java/org/apache/commons/math4/optim/SimpleValueChecker.java
index 2b5fc14..a62c8ca 100644
--- a/src/main/java/org/apache/commons/math4/optim/SimpleValueChecker.java
+++ b/src/main/java/org/apache/commons/math4/optim/SimpleValueChecker.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Simple implementation of the {@link ConvergenceChecker} interface using

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/SimpleVectorValueChecker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/SimpleVectorValueChecker.java b/src/main/java/org/apache/commons/math4/optim/SimpleVectorValueChecker.java
index 8d9beba..460fb38 100644
--- a/src/main/java/org/apache/commons/math4/optim/SimpleVectorValueChecker.java
+++ b/src/main/java/org/apache/commons/math4/optim/SimpleVectorValueChecker.java
@@ -15,10 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim;
+package org.apache.commons.math4.optim;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Simple implementation of the {@link ConvergenceChecker} interface using

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraint.java b/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraint.java
index ae5a28a..63c0b83 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraint.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraint.java
@@ -14,15 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.ArrayRealVector;
+
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * A linear constraint for a linear optimization problem.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java b/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java
index d54bd61..7a31698 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/LinearConstraintSet.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.Collection;
 import java.util.Collections;
 
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Class that represents a set of {@link LinearConstraint linear constraints}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java b/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
index dc4f429..7b63872 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/LinearObjectiveFunction.java
@@ -14,17 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.io.Serializable;
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.optim.OptimizationData;
+
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * An objective function for a linear optimization problem.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/LinearOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/LinearOptimizer.java b/src/main/java/org/apache/commons/math4/optim/linear/LinearOptimizer.java
index 7e80687..f923cca 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/LinearOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/LinearOptimizer.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.util.Collection;
 import java.util.Collections;
-import org.apache.commons.math3.exception.TooManyIterationsException;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer;
+
+import org.apache.commons.math4.exception.TooManyIterationsException;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.nonlinear.scalar.MultivariateOptimizer;
 
 /**
  * Base class for implementing linear optimizers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/NoFeasibleSolutionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/NoFeasibleSolutionException.java b/src/main/java/org/apache/commons/math4/optim/linear/NoFeasibleSolutionException.java
index cbe8321..c10729a 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/NoFeasibleSolutionException.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/NoFeasibleSolutionException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown by optimizers when no solution fulfills the constraints.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/NonNegativeConstraint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/NonNegativeConstraint.java b/src/main/java/org/apache/commons/math4/optim/linear/NonNegativeConstraint.java
index dafcb63..6bd4631 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/NonNegativeConstraint.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/NonNegativeConstraint.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * A constraint for a linear optimization problem indicating whether all

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/PivotSelectionRule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/PivotSelectionRule.java b/src/main/java/org/apache/commons/math4/optim/linear/PivotSelectionRule.java
index a2a2765..07c55ca 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/PivotSelectionRule.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/PivotSelectionRule.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Pivot selection rule to the use for a Simplex solver.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/Relationship.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/Relationship.java b/src/main/java/org/apache/commons/math4/optim/linear/Relationship.java
index 58612c7..f46a649 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/Relationship.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/Relationship.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 /**
  * Types of relationships between two cells in a Solver {@link LinearConstraint}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java b/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
index e95b657..d4b4259 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexSolver.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.TooManyIterationsException;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.TooManyIterationsException;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Solves a linear problem using the "Two-Phase Simplex" method.
@@ -33,12 +33,12 @@ import org.apache.commons.math3.util.Precision;
  * <ul>
  *   <li>objective function: {@link LinearObjectiveFunction} - mandatory</li>
  *   <li>linear constraints {@link LinearConstraintSet} - mandatory</li>
- *   <li>type of optimization: {@link org.apache.commons.math3.optim.nonlinear.scalar.GoalType GoalType}
- *    - optional, default: {@link org.apache.commons.math3.optim.nonlinear.scalar.GoalType#MINIMIZE MINIMIZE}</li>
+ *   <li>type of optimization: {@link org.apache.commons.math4.optim.nonlinear.scalar.GoalType GoalType}
+ *    - optional, default: {@link org.apache.commons.math4.optim.nonlinear.scalar.GoalType#MINIMIZE MINIMIZE}</li>
  *   <li>whether to allow negative values as solution: {@link NonNegativeConstraint} - optional, default: true</li>
  *   <li>pivot selection rule: {@link PivotSelectionRule} - optional, default {@link PivotSelectionRule#DANTZIG}</li>
  *   <li>callback for the best solution: {@link SolutionCallback} - optional</li>
- *   <li>maximum number of iterations: {@link org.apache.commons.math3.optim.MaxIter} - optional, default: {@link Integer#MAX_VALUE}</li>
+ *   <li>maximum number of iterations: {@link org.apache.commons.math4.optim.MaxIter} - optional, default: {@link Integer#MAX_VALUE}</li>
  * </ul>
  * <p>
  * <b>Note:</b> Depending on the problem definition, the default convergence criteria

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
index 57ffcd9..e869a74 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SimplexTableau.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -28,12 +28,12 @@ import java.util.List;
 import java.util.Set;
 import java.util.TreeSet;
 
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.optim.nonlinear.scalar.GoalType;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.optim.PointValuePair;
+import org.apache.commons.math4.optim.nonlinear.scalar.GoalType;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * A tableau for use in the Simplex method.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/SolutionCallback.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/SolutionCallback.java b/src/main/java/org/apache/commons/math4/optim/linear/SolutionCallback.java
index 3536da0..b84af27 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/SolutionCallback.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/SolutionCallback.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.PointValuePair;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
 
 /**
  * A constraint for a linear optimization problem indicating whether all

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/UnboundedSolutionException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/UnboundedSolutionException.java b/src/main/java/org/apache/commons/math4/optim/linear/UnboundedSolutionException.java
index 546cdd2..b68e0fe 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/UnboundedSolutionException.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/UnboundedSolutionException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * This class represents exceptions thrown by optimizers when a solution escapes to infinity.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/linear/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/linear/package-info.java b/src/main/java/org/apache/commons/math4/optim/linear/package-info.java
index b900589..d0eea18 100644
--- a/src/main/java/org/apache/commons/math4/optim/linear/package-info.java
+++ b/src/main/java/org/apache/commons/math4/optim/linear/package-info.java
@@ -18,4 +18,4 @@
 /**
  * Optimization algorithms for linear constrained problems.
  */
-package org.apache.commons.math3.optim.linear;
+package org.apache.commons.math4.optim.linear;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GoalType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GoalType.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GoalType.java
index c0457b4..3adea01 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GoalType.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GoalType.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.optim.OptimizationData;
+import org.apache.commons.math4.optim.OptimizationData;
 
 /**
  * Goal type for an optimization problem (minimization or maximization of

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GradientMultivariateOptimizer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GradientMultivariateOptimizer.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GradientMultivariateOptimizer.java
index 38a8bf7..d6a9fcf 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GradientMultivariateOptimizer.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/GradientMultivariateOptimizer.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.optim.ConvergenceChecker;
-import org.apache.commons.math3.optim.OptimizationData;
-import org.apache.commons.math3.optim.PointValuePair;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.optim.ConvergenceChecker;
+import org.apache.commons.math4.optim.OptimizationData;
+import org.apache.commons.math4.optim.PointValuePair;
 
 /**
  * Base class for implementing optimizers for multivariate scalar

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java
index 4be1f12..fc59f2c 100644
--- a/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java
+++ b/src/main/java/org/apache/commons/math4/optim/nonlinear/scalar/LeastSquaresConverter.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.optim.nonlinear.scalar;
+package org.apache.commons.math4.optim.nonlinear.scalar;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.analysis.MultivariateVectorFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.MultivariateVectorFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  * This class converts


[62/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java b/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java
index f6010e0..5339436 100644
--- a/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java
+++ b/src/test/java/org/apache/commons/math4/analysis/QuinticFunction.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
 
 /**
  * Auxiliary class for testing solvers.
@@ -26,7 +26,7 @@ import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiabl
 public class QuinticFunction implements UnivariateDifferentiableFunction {
 
     /* Evaluate quintic.
-     * @see org.apache.commons.math3.UnivariateFunction#value(double)
+     * @see org.apache.commons.math4.UnivariateFunction#value(double)
      */
     public double value(double x) {
         return (x-1)*(x-0.5)*x*(x+0.5)*(x+1);

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java b/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java
index d2af31a..cb44ab2 100644
--- a/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java
+++ b/src/test/java/org/apache/commons/math4/analysis/SumSincFunction.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
-import org.apache.commons.math3.analysis.function.Sinc;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sinc;
 
 /**
  * Auxiliary class for testing optimizers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java b/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java
index a5ddc97..61fdc48 100644
--- a/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java
+++ b/src/test/java/org/apache/commons/math4/analysis/XMinus5Function.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis;
+package org.apache.commons.math4.analysis;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
 
 /**
  * Auxiliary class for testing solvers.
@@ -26,7 +26,7 @@ import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiabl
 public class XMinus5Function implements UnivariateDifferentiableFunction {
 
     /* Evaluate x - 5 fuction.
-     * @see org.apache.commons.math3.UnivariateFunction#value(double)
+     * @see org.apache.commons.math4.UnivariateFunction#value(double)
      */
     public double value(double x) {
         return x - 5;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java
index 9d03c29..e54d7a3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/DSCompilerTest.java
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.CombinatoricsUtils;
+import org.apache.commons.math4.analysis.differentiation.DSCompiler;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.util.CombinatoricsUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
index 39b4d5f..dc251bb 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/DerivativeStructureTest.java
@@ -15,20 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.ExtendedFieldElementAbstractTest;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ExtendedFieldElementAbstractTest;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.CombinatoricsUtils;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
index 9702305..acea0d7 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/FiniteDifferencesDifferentiatorTest.java
@@ -15,20 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.differentiation;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.UnivariateMatrixFunction;
-import org.apache.commons.math3.analysis.UnivariateVectorFunction;
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.differentiation;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.UnivariateMatrixFunction;
+import org.apache.commons.math4.analysis.UnivariateVectorFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.FiniteDifferencesDifferentiator;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableMatrixFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.analysis.differentiation.UnivariateFunctionDifferentiator;
+import org.apache.commons.math4.analysis.function.Gaussian;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java
index 7faf9b6..69372e4 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/GradientFunctionTest.java
@@ -15,12 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.GradientFunction;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java
index b7c00fe..d3359c5 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/JacobianFunctionTest.java
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import org.junit.Assert;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.JacobianFunction;
+import org.apache.commons.math4.analysis.differentiation.MultivariateDifferentiableVectorFunction;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java b/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java
index 559da87..a82a163 100644
--- a/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/differentiation/SparseGradientTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.differentiation;
+package org.apache.commons.math4.analysis.differentiation;
 
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.ExtendedFieldElementAbstractTest;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.ExtendedFieldElementAbstractTest;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.differentiation.SparseGradient;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java b/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java
index ef7536d..c3b8574 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/GaussianTest.java
@@ -15,15 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Gaussian;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java b/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
index 99d7137..c195d20 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/HarmonicOscillatorTest.java
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.function.HarmonicOscillator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java b/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java
index f721719..61c1384 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/LogisticTest.java
@@ -15,15 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.util.FastMath;
-
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.function.Logistic;
+import org.apache.commons.math4.analysis.function.Sigmoid;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/LogitTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/LogitTest.java b/src/test/java/org/apache/commons/math4/analysis/function/LogitTest.java
index e38265d..9639fa8 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/LogitTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/LogitTest.java
@@ -15,19 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well1024a;
-import org.apache.commons.math3.util.FastMath;
-
+package org.apache.commons.math4.analysis.function;
+
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Logit;
+import org.apache.commons.math4.analysis.function.Sigmoid;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well1024a;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java b/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java
index 59f6312..b9f458b 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/SigmoidTest.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
+package org.apache.commons.math4.analysis.function;
 
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.function.Sigmoid;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java b/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java
index d5d37f8..864f76e 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/SincTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.function;
+package org.apache.commons.math4.analysis.function;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.dfp.Dfp;
-import org.apache.commons.math3.dfp.DfpField;
-import org.apache.commons.math3.dfp.DfpMath;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.function.Sinc;
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpField;
+import org.apache.commons.math4.dfp.DfpMath;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java b/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java
index a888977..04d0769 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/SqrtTest.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.function;
 
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
+import org.apache.commons.math4.analysis.function.Sqrt;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java
index 247a0a9..e6e4bfc 100644
--- a/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/function/StepFunctionTest.java
@@ -15,14 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
+package org.apache.commons.math4.analysis.function;
 
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.StepFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java
index 7a15a29..e59eb94 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/IterativeLegendreGaussIntegratorTest.java
@@ -14,17 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.function.Gaussian;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Gaussian;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.integration.BaseAbstractUnivariateIntegrator;
+import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
+import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegratorTest.java
index c7d48bb..f0b8af0 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/LegendreGaussIntegratorTest.java
@@ -14,16 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.integration.BaseAbstractUnivariateIntegrator;
+import org.apache.commons.math4.analysis.integration.LegendreGaussIntegrator;
+import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.exception.TooManyEvaluationsException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java
index 36daa3e..afd590a 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/MidPointIntegratorTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.integration.MidPointIntegrator;
+import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/RombergIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/RombergIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/RombergIntegratorTest.java
index f83f3e6..1e5200e 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/RombergIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/RombergIntegratorTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.integration.RombergIntegrator;
+import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/SimpsonIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/SimpsonIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/SimpsonIntegratorTest.java
index b80e7e8..22947b3 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/SimpsonIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/SimpsonIntegratorTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.integration.SimpsonIntegrator;
+import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegratorTest.java
index b340104..bb21487 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/TrapezoidIntegratorTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration;
+package org.apache.commons.math4.analysis.integration;
 
-import org.apache.commons.math3.analysis.QuinticFunction;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.QuinticFunction;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.integration.TrapezoidIntegrator;
+import org.apache.commons.math4.analysis.integration.UnivariateIntegrator;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java
index 0511141..89c05de 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/BaseRuleFactoryTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
 import java.util.List;
 import java.util.ArrayList;
@@ -25,7 +25,9 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.Future;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicInteger;
-import org.apache.commons.math3.util.Pair;
+
+import org.apache.commons.math4.analysis.integration.gauss.BaseRuleFactory;
+import org.apache.commons.math4.util.Pair;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java
index 459106c..8270d3b 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussIntegratorTest.java
@@ -14,11 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Constant;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Constant;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegrator;
+import org.apache.commons.math4.util.Pair;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussianQuadratureAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussianQuadratureAbstractTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussianQuadratureAbstractTest.java
index 9ff9076..10d9bc4 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussianQuadratureAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/GaussianQuadratureAbstractTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
-import org.apache.commons.math3.analysis.function.Power;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.function.Power;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegrator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java
index e2b15c2..8eb304f 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteParametricTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -22,7 +22,9 @@ import java.util.Collection;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegratorFactory;
+import org.apache.commons.math4.analysis.integration.gauss.HermiteRuleFactory;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Test of the {@link HermiteRuleFactory}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteTest.java
index 659ac78..b140443 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/HermiteTest.java
@@ -14,10 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegrator;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegratorFactory;
+import org.apache.commons.math4.analysis.integration.gauss.HermiteRuleFactory;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java
index c545a5f..976488f 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionParametricTest.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegratorFactory;
+import org.apache.commons.math4.analysis.integration.gauss.LegendreHighPrecisionRuleFactory;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionTest.java
index 17a0c87..acdecdc 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreHighPrecisionTest.java
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
-
-import org.apache.commons.math3.analysis.function.Cos;
-import org.apache.commons.math3.analysis.function.Inverse;
-import org.apache.commons.math3.analysis.function.Log;
-import org.apache.commons.math3.analysis.UnivariateFunction;
+package org.apache.commons.math4.analysis.integration.gauss;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Cos;
+import org.apache.commons.math4.analysis.function.Inverse;
+import org.apache.commons.math4.analysis.function.Log;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegrator;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegratorFactory;
+import org.apache.commons.math4.analysis.integration.gauss.LegendreHighPrecisionRuleFactory;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java
index a01988c..3f0fc63 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreParametricTest.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
+package org.apache.commons.math4.analysis.integration.gauss;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegratorFactory;
+import org.apache.commons.math4.analysis.integration.gauss.LegendreRuleFactory;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreTest.java b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreTest.java
index 2ade4e3..f21753b 100644
--- a/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/integration/gauss/LegendreTest.java
@@ -14,12 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.integration.gauss;
-
-import org.apache.commons.math3.analysis.function.Cos;
-import org.apache.commons.math3.analysis.function.Inverse;
-import org.apache.commons.math3.analysis.function.Log;
-import org.apache.commons.math3.analysis.UnivariateFunction;
+package org.apache.commons.math4.analysis.integration.gauss;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Cos;
+import org.apache.commons.math4.analysis.function.Inverse;
+import org.apache.commons.math4.analysis.function.Log;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegrator;
+import org.apache.commons.math4.analysis.integration.gauss.GaussIntegratorFactory;
+import org.apache.commons.math4.analysis.integration.gauss.LegendreRuleFactory;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
index adf39d6..87fd5b9 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/AkimaSplineInterpolatorTest.java
@@ -14,18 +14,20 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.AkimaSplineInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
index 6d56ed8..dd63a6c 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatingFunctionTest.java
@@ -14,17 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.BicubicInterpolatingFunction;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.Ignore;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java
index e2a3550..9d94b03 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicInterpolatorTest.java
@@ -14,14 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.BicubicInterpolatingFunction;
+import org.apache.commons.math4.analysis.interpolation.BicubicInterpolator;
+import org.apache.commons.math4.analysis.interpolation.BivariateGridInterpolator;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
index 8c78aed..92bf82b 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.BicubicSplineFunction;
+import org.apache.commons.math4.analysis.interpolation.BicubicSplineInterpolatingFunction;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.Ignore;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatorTest.java
index c4a56bb..91f1f66 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/BicubicSplineInterpolatorTest.java
@@ -14,14 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.BicubicSplineInterpolator;
+import org.apache.commons.math4.analysis.interpolation.BivariateGridInterpolator;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolatorTest.java
index 9d53f46..7db781a 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/DividedDifferenceInterpolatorTest.java
@@ -14,13 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Expm1;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Expm1;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.interpolation.DividedDifferenceInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java
index 2671126..0c3b27b 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/FieldHermiteInterpolatorTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.dfp.Dfp;
-import org.apache.commons.math3.dfp.DfpField;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.interpolation.FieldHermiteInterpolator;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.dfp.Dfp;
+import org.apache.commons.math4.dfp.DfpField;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.fraction.BigFraction;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolatorTest.java
index 7cf5a44..8dbb6ac 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/HermiteInterpolatorTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
 import java.util.Random;
 
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
+import org.apache.commons.math4.analysis.interpolation.HermiteInterpolator;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolatorTest.java
index 3dc3884..38b44aa 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/LinearInterpolatorTest.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.LinearInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolatorTest.java
index 7cdea6e..6c3c40f 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/LoessInterpolatorTest.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotFiniteNumberException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.interpolation.LoessInterpolator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java
index d894d14..2626869 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/MicrosphereInterpolatorTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.analysis.MultivariateFunction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.MultivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.MicrosphereInterpolator;
+import org.apache.commons.math4.analysis.interpolation.MultivariateInterpolator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolatorTest.java
index 3054009..764da07 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/NevilleInterpolatorTest.java
@@ -14,13 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.function.Expm1;
-import org.apache.commons.math3.analysis.function.Sin;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.function.Expm1;
+import org.apache.commons.math4.analysis.function.Sin;
+import org.apache.commons.math4.analysis.interpolation.NevilleInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
index 35cb18e..c39e644 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatingFunctionTest.java
@@ -14,18 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.PiecewiseBicubicSplineInterpolatingFunction;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java
index 367971b..eee82f9 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/PiecewiseBicubicSplineInterpolatorTest.java
@@ -14,17 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.analysis.BivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.BivariateGridInterpolator;
+import org.apache.commons.math4.analysis.interpolation.PiecewiseBicubicSplineInterpolator;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
index 51c9760..9cdd888 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolatorTest.java
@@ -14,12 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.BivariateFunction;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.BivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.BivariateGridInterpolator;
+import org.apache.commons.math4.analysis.interpolation.SmoothingPolynomialBicubicSplineInterpolator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java
index f9b2e3e..46d3455 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/SplineInterpolatorTest.java
@@ -14,16 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math3.analysis.polynomials.PolynomialSplineFunction;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.SplineInterpolator;
+import org.apache.commons.math4.analysis.interpolation.UnivariateInterpolator;
+import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math4.analysis.polynomials.PolynomialSplineFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
index 9760555..bf3da2a 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatingFunctionTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.analysis.TrivariateFunction;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.TrivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.TricubicInterpolatingFunction;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java
index d66e2d6..d975c18 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicInterpolatorTest.java
@@ -14,12 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.TrivariateFunction;
+package org.apache.commons.math4.analysis.interpolation;
+
+import org.apache.commons.math4.analysis.TrivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.TricubicInterpolatingFunction;
+import org.apache.commons.math4.analysis.interpolation.TricubicInterpolator;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
index 90bce9e..945e9d5 100644
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
+++ b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.analysis.interpolation;
+package org.apache.commons.math4.analysis.interpolation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.analysis.TrivariateFunction;
+import org.apache.commons.math4.analysis.TrivariateFunction;
+import org.apache.commons.math4.analysis.interpolation.TricubicSplineInterpolatingFunction;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 


[54/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/BitsStreamGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/BitsStreamGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/BitsStreamGeneratorTest.java
index da4bc94..cc47304 100644
--- a/src/test/java/org/apache/commons/math4/random/BitsStreamGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/BitsStreamGeneratorTest.java
@@ -14,10 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Random;
 
+import org.apache.commons.math4.random.BitsStreamGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+
 /**
  * Test cases for the BitStreamGenerator class
  *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/CorrelatedRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/CorrelatedRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/CorrelatedRandomVectorGeneratorTest.java
index 0496e98..4321a5a 100644
--- a/src/test/java/org/apache/commons/math4/random/CorrelatedRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/CorrelatedRandomVectorGeneratorTest.java
@@ -15,19 +15,23 @@
 //specific language governing permissions and limitations
 //under the License.
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.stat.correlation.StorelessCovariance;
-import org.apache.commons.math3.stat.descriptive.moment.VectorialCovariance;
-import org.apache.commons.math3.stat.descriptive.moment.VectorialMean;
-import org.apache.commons.math3.util.FastMath;
-
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.random.CorrelatedRandomVectorGenerator;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.NormalizedRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.stat.correlation.StorelessCovariance;
+import org.apache.commons.math4.stat.descriptive.moment.VectorialCovariance;
+import org.apache.commons.math4.stat.descriptive.moment.VectorialMean;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java b/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
index 42e9a7f..b4ed00f 100644
--- a/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
+++ b/src/test/java/org/apache/commons/math4/random/EmpiricalDistributionTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -24,18 +24,20 @@ import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.integration.BaseAbstractUnivariateIntegrator;
-import org.apache.commons.math3.analysis.integration.IterativeLegendreGaussIntegrator;
-import org.apache.commons.math3.distribution.ConstantRealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.RealDistributionAbstractTest;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.analysis.integration.BaseAbstractUnivariateIntegrator;
+import org.apache.commons.math4.analysis.integration.IterativeLegendreGaussIntegrator;
+import org.apache.commons.math4.distribution.ConstantRealDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.RealDistributionAbstractTest;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.random.EmpiricalDistribution;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/GaussianRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/GaussianRandomGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/GaussianRandomGeneratorTest.java
index ecb325e..9c46f0d 100644
--- a/src/test/java/org/apache/commons/math4/random/GaussianRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/GaussianRandomGeneratorTest.java
@@ -15,9 +15,12 @@
 //specific language governing permissions and limitations
 //under the License.
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.stat.StatUtils;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.stat.StatUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/HaltonSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/HaltonSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/HaltonSequenceGeneratorTest.java
index bbe8187..cf59363 100644
--- a/src/test/java/org/apache/commons/math4/random/HaltonSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/HaltonSequenceGeneratorTest.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import org.junit.Assert;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.HaltonSequenceGenerator;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 f2edbbd..f8e7e65 100644
--- a/src/test/java/org/apache/commons/math4/random/ISAACTest.java
+++ b/src/test/java/org/apache/commons/math4/random/ISAACTest.java
@@ -15,8 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.ISAACRandom;
+import org.apache.commons.math4.random.RandomGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 3a72e11..b04e753 100644
--- a/src/test/java/org/apache/commons/math4/random/MersenneTwisterTest.java
+++ b/src/test/java/org/apache/commons/math4/random/MersenneTwisterTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/RandomAdaptorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/RandomAdaptorTest.java b/src/test/java/org/apache/commons/math4/random/RandomAdaptorTest.java
index 02109ef..1218398 100644
--- a/src/test/java/org/apache/commons/math4/random/RandomAdaptorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/RandomAdaptorTest.java
@@ -14,10 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Random;
 
+import org.apache.commons.math4.random.RandomAdaptor;
+import org.apache.commons.math4.random.RandomGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
index a0b6e26..fda418c 100644
--- a/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/RandomDataGeneratorTest.java
@@ -14,38 +14,41 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.text.DecimalFormat;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 
-import org.apache.commons.math3.Retry;
-import org.apache.commons.math3.RetryRunner;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.distribution.BetaDistribution;
-import org.apache.commons.math3.distribution.BinomialDistribution;
-import org.apache.commons.math3.distribution.BinomialDistributionTest;
-import org.apache.commons.math3.distribution.CauchyDistribution;
-import org.apache.commons.math3.distribution.ChiSquaredDistribution;
-import org.apache.commons.math3.distribution.ExponentialDistribution;
-import org.apache.commons.math3.distribution.FDistribution;
-import org.apache.commons.math3.distribution.GammaDistribution;
-import org.apache.commons.math3.distribution.HypergeometricDistribution;
-import org.apache.commons.math3.distribution.HypergeometricDistributionTest;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.distribution.PascalDistribution;
-import org.apache.commons.math3.distribution.PascalDistributionTest;
-import org.apache.commons.math3.distribution.PoissonDistribution;
-import org.apache.commons.math3.distribution.TDistribution;
-import org.apache.commons.math3.distribution.WeibullDistribution;
-import org.apache.commons.math3.distribution.ZipfDistribution;
-import org.apache.commons.math3.distribution.ZipfDistributionTest;
-import org.apache.commons.math3.stat.Frequency;
-import org.apache.commons.math3.stat.inference.ChiSquareTest;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.Retry;
+import org.apache.commons.math4.RetryRunner;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.distribution.BetaDistribution;
+import org.apache.commons.math4.distribution.BinomialDistribution;
+import org.apache.commons.math4.distribution.BinomialDistributionTest;
+import org.apache.commons.math4.distribution.CauchyDistribution;
+import org.apache.commons.math4.distribution.ChiSquaredDistribution;
+import org.apache.commons.math4.distribution.ExponentialDistribution;
+import org.apache.commons.math4.distribution.FDistribution;
+import org.apache.commons.math4.distribution.GammaDistribution;
+import org.apache.commons.math4.distribution.HypergeometricDistribution;
+import org.apache.commons.math4.distribution.HypergeometricDistributionTest;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.PascalDistribution;
+import org.apache.commons.math4.distribution.PascalDistributionTest;
+import org.apache.commons.math4.distribution.PoissonDistribution;
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.distribution.WeibullDistribution;
+import org.apache.commons.math4.distribution.ZipfDistribution;
+import org.apache.commons.math4.distribution.ZipfDistributionTest;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.random.RandomDataGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.stat.Frequency;
+import org.apache.commons.math4.stat.inference.ChiSquareTest;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 import org.junit.runner.RunWith;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 0094553..eabbd85 100644
--- a/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/random/RandomGeneratorAbstractTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.stat.Frequency;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.random.RandomDataGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.stat.Frequency;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/RandomGeneratorFactoryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/RandomGeneratorFactoryTest.java b/src/test/java/org/apache/commons/math4/random/RandomGeneratorFactoryTest.java
index dc841bc..fc94e88 100644
--- a/src/test/java/org/apache/commons/math4/random/RandomGeneratorFactoryTest.java
+++ b/src/test/java/org/apache/commons/math4/random/RandomGeneratorFactoryTest.java
@@ -14,10 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Random;
 
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.RandomGeneratorFactory;
+
 /**
  * Test cases for the {@link RandomGeneratorFactory} class.
  *

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/SobolSequenceGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/SobolSequenceGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/SobolSequenceGeneratorTest.java
index c09d09b..7ee4d10 100644
--- a/src/test/java/org/apache/commons/math4/random/SobolSequenceGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/SobolSequenceGeneratorTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import org.junit.Assert;
 
 import java.io.InputStream;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.SobolSequenceGenerator;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -75,7 +76,7 @@ public class SobolSequenceGeneratorTest {
     @Test
     public void testConstructor2() throws Exception{
         try {
-            final String RESOURCE_NAME = "/assets/org/apache/commons/math3/random/new-joe-kuo-6.1000";
+            final String RESOURCE_NAME = "/assets/org/apache/commons/math4/random/new-joe-kuo-6.1000";
             final InputStream is = getClass().getResourceAsStream(RESOURCE_NAME);
             new SobolSequenceGenerator(1001, is);
             Assert.fail("an exception should have been thrown");

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/StableRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/StableRandomGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/StableRandomGeneratorTest.java
index 5531ceb..9ede227 100644
--- a/src/test/java/org/apache/commons/math4/random/StableRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/StableRandomGeneratorTest.java
@@ -14,11 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.stat.StatUtils;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.StableRandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.stat.StatUtils;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java
index c91103b..2c1fe43 100644
--- a/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/SynchronizedRandomGeneratorTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -24,6 +24,9 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 
+import org.apache.commons.math4.random.MersenneTwister;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.SynchronizedRandomGenerator;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/TestRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/TestRandomGenerator.java b/src/test/java/org/apache/commons/math4/random/TestRandomGenerator.java
index a15dd17..fc820b2 100644
--- a/src/test/java/org/apache/commons/math4/random/TestRandomGenerator.java
+++ b/src/test/java/org/apache/commons/math4/random/TestRandomGenerator.java
@@ -14,9 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 import java.util.Random;
 
+import org.apache.commons.math4.random.AbstractRandomGenerator;
+
 /**
  * Dummy AbstractRandomGenerator concrete subclass that just wraps a
  * java.util.Random instance.  Used by AbstractRandomGeneratorTest to test

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGeneratorTest.java
index 4195273..bc80769 100644
--- a/src/test/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGeneratorTest.java
@@ -15,12 +15,15 @@
 //specific language governing permissions and limitations
 //under the License.
 
-package org.apache.commons.math3.random;
-
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.stat.descriptive.moment.VectorialCovariance;
-import org.apache.commons.math3.stat.descriptive.moment.VectorialMean;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.random.GaussianRandomGenerator;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.UncorrelatedRandomVectorGenerator;
+import org.apache.commons.math4.stat.descriptive.moment.VectorialCovariance;
+import org.apache.commons.math4.stat.descriptive.moment.VectorialMean;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/UniformRandomGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/UniformRandomGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/UniformRandomGeneratorTest.java
index 554a3eb..fbe9271 100644
--- a/src/test/java/org/apache/commons/math4/random/UniformRandomGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/UniformRandomGeneratorTest.java
@@ -15,9 +15,12 @@
 //specific language governing permissions and limitations
 //under the License.
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.stat.StatUtils;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.UniformRandomGenerator;
+import org.apache.commons.math4.stat.StatUtils;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/UnitSphereRandomVectorGeneratorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/UnitSphereRandomVectorGeneratorTest.java b/src/test/java/org/apache/commons/math4/random/UnitSphereRandomVectorGeneratorTest.java
index 4676a82..aa60e1f 100644
--- a/src/test/java/org/apache/commons/math4/random/UnitSphereRandomVectorGeneratorTest.java
+++ b/src/test/java/org/apache/commons/math4/random/UnitSphereRandomVectorGeneratorTest.java
@@ -14,9 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.random.JDKRandomGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.UnitSphereRandomVectorGenerator;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/ValueServerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/ValueServerTest.java b/src/test/java/org/apache/commons/math4/random/ValueServerTest.java
index 145b9b8..43d3554 100644
--- a/src/test/java/org/apache/commons/math4/random/ValueServerTest.java
+++ b/src/test/java/org/apache/commons/math4/random/ValueServerTest.java
@@ -14,15 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.net.URL;
 import java.util.Arrays;
 
-import org.apache.commons.math3.RetryRunner;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.RetryRunner;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.random.ValueServer;
+import org.apache.commons.math4.random.Well19937c;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/Well1024aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/Well1024aTest.java b/src/test/java/org/apache/commons/math4/random/Well1024aTest.java
index 239194c..d5e0e67 100644
--- a/src/test/java/org/apache/commons/math4/random/Well1024aTest.java
+++ b/src/test/java/org/apache/commons/math4/random/Well1024aTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well1024a;
 import org.junit.Assert;
-
 import org.junit.Test;
 
 public class Well1024aTest extends RandomGeneratorAbstractTest {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/Well19937aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/Well19937aTest.java b/src/test/java/org/apache/commons/math4/random/Well19937aTest.java
index ff9fe95..170457a 100644
--- a/src/test/java/org/apache/commons/math4/random/Well19937aTest.java
+++ b/src/test/java/org/apache/commons/math4/random/Well19937aTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937a;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/Well19937cTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/Well19937cTest.java b/src/test/java/org/apache/commons/math4/random/Well19937cTest.java
index a9f7a8e..45d188b 100644
--- a/src/test/java/org/apache/commons/math4/random/Well19937cTest.java
+++ b/src/test/java/org/apache/commons/math4/random/Well19937cTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/Well44497aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/Well44497aTest.java b/src/test/java/org/apache/commons/math4/random/Well44497aTest.java
index ac46eb7..436b64a 100644
--- a/src/test/java/org/apache/commons/math4/random/Well44497aTest.java
+++ b/src/test/java/org/apache/commons/math4/random/Well44497aTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497a;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/Well44497bTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/Well44497bTest.java b/src/test/java/org/apache/commons/math4/random/Well44497bTest.java
index 23be971..d9e519f 100644
--- a/src/test/java/org/apache/commons/math4/random/Well44497bTest.java
+++ b/src/test/java/org/apache/commons/math4/random/Well44497bTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well44497b;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/random/Well512aTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/random/Well512aTest.java b/src/test/java/org/apache/commons/math4/random/Well512aTest.java
index 01cfe75..f3b106c 100644
--- a/src/test/java/org/apache/commons/math4/random/Well512aTest.java
+++ b/src/test/java/org/apache/commons/math4/random/Well512aTest.java
@@ -14,8 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well512a;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/special/BesselJTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/special/BesselJTest.java b/src/test/java/org/apache/commons/math4/special/BesselJTest.java
index 7477bf4..a50ccc4 100644
--- a/src/test/java/org/apache/commons/math4/special/BesselJTest.java
+++ b/src/test/java/org/apache/commons/math4/special/BesselJTest.java
@@ -14,9 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.special;
+package org.apache.commons.math4.special;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.special.BesselJ;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/special/BetaTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/special/BetaTest.java b/src/test/java/org/apache/commons/math4/special/BetaTest.java
index d313639..5a42dbc 100644
--- a/src/test/java/org/apache/commons/math4/special/BetaTest.java
+++ b/src/test/java/org/apache/commons/math4/special/BetaTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.special;
+package org.apache.commons.math4.special;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.special.Beta;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/special/ErfTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/special/ErfTest.java b/src/test/java/org/apache/commons/math4/special/ErfTest.java
index 3e26662..e9d6813 100644
--- a/src/test/java/org/apache/commons/math4/special/ErfTest.java
+++ b/src/test/java/org/apache/commons/math4/special/ErfTest.java
@@ -15,11 +15,11 @@
  *  limitations under the License.
  */
 
-package org.apache.commons.math3.special;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+package org.apache.commons.math4.special;
 
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.special.Erf;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/special/GammaTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/special/GammaTest.java b/src/test/java/org/apache/commons/math4/special/GammaTest.java
index 539f316..70275f3 100644
--- a/src/test/java/org/apache/commons/math4/special/GammaTest.java
+++ b/src/test/java/org/apache/commons/math4/special/GammaTest.java
@@ -14,12 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.special;
+package org.apache.commons.math4.special;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/CertifiedDataTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/CertifiedDataTest.java b/src/test/java/org/apache/commons/math4/stat/CertifiedDataTest.java
index 8954edd..eb368c2 100644
--- a/src/test/java/org/apache/commons/math4/stat/CertifiedDataTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/CertifiedDataTest.java
@@ -14,15 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat;
+package org.apache.commons.math4.stat;
 
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 
-
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java b/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java
index 6e4b56d..ae1a4d9 100644
--- a/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/FrequencyTest.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat;
+package org.apache.commons.math4.stat;
 
 import java.io.BufferedReader;
 import java.io.StringReader;
@@ -22,9 +22,9 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.stat.Frequency;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java b/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
index dccb7b6..9837b85 100644
--- a/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/StatUtilsTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat;
+package org.apache.commons.math4.stat;
 
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.stat.StatUtils;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/clustering/DBSCANClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/clustering/DBSCANClustererTest.java b/src/test/java/org/apache/commons/math4/stat/clustering/DBSCANClustererTest.java
index 657e2de..0534a5b 100644
--- a/src/test/java/org/apache/commons/math4/stat/clustering/DBSCANClustererTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/clustering/DBSCANClustererTest.java
@@ -14,13 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.util.Arrays;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.stat.clustering.Cluster;
+import org.apache.commons.math4.stat.clustering.DBSCANClusterer;
+import org.apache.commons.math4.stat.clustering.EuclideanDoublePoint;
+import org.apache.commons.math4.stat.clustering.EuclideanIntegerPoint;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePointTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePointTest.java b/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePointTest.java
index 8c37594..290b284 100644
--- a/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePointTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePointTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.clustering.EuclideanDoublePoint;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPointTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPointTest.java b/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPointTest.java
index 038f8a8..e38c0d0 100644
--- a/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPointTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPointTest.java
@@ -15,14 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.clustering.EuclideanIntegerPoint;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClustererTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClustererTest.java b/src/test/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClustererTest.java
index d14f77b..02538d9 100644
--- a/src/test/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClustererTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClustererTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 
 import java.util.ArrayList;
@@ -24,7 +24,11 @@ import java.util.Collection;
 import java.util.List;
 import java.util.Random;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.stat.clustering.Cluster;
+import org.apache.commons.math4.stat.clustering.Clusterable;
+import org.apache.commons.math4.stat.clustering.EuclideanIntegerPoint;
+import org.apache.commons.math4.stat.clustering.KMeansPlusPlusClusterer;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/correlation/CovarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/correlation/CovarianceTest.java b/src/test/java/org/apache/commons/math4/stat/correlation/CovarianceTest.java
index f69e623..f0c6fbe 100644
--- a/src/test/java/org/apache/commons/math4/stat/correlation/CovarianceTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/correlation/CovarianceTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
+package org.apache.commons.math4.stat.correlation;
+
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.correlation.Covariance;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/correlation/KendallsCorrelationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/correlation/KendallsCorrelationTest.java b/src/test/java/org/apache/commons/math4/stat/correlation/KendallsCorrelationTest.java
index 85723e7..ffc9cbb 100644
--- a/src/test/java/org/apache/commons/math4/stat/correlation/KendallsCorrelationTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/correlation/KendallsCorrelationTest.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.correlation.KendallsCorrelation;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelationTest.java b/src/test/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelationTest.java
index bce9c42..d36513b 100644
--- a/src/test/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelationTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelationTest.java
@@ -14,13 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.distribution.TDistribution;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.correlation.Covariance;
+import org.apache.commons.math4.stat.correlation.PearsonsCorrelation;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/correlation/SpearmansRankCorrelationTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/correlation/SpearmansRankCorrelationTest.java b/src/test/java/org/apache/commons/math4/stat/correlation/SpearmansRankCorrelationTest.java
index 36b0c56..59cf485 100644
--- a/src/test/java/org/apache/commons/math4/stat/correlation/SpearmansRankCorrelationTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/correlation/SpearmansRankCorrelationTest.java
@@ -14,14 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
-import org.apache.commons.math3.stat.ranking.NaturalRanking;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.correlation.SpearmansCorrelation;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.stat.ranking.NaturalRanking;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/correlation/StorelessCovarianceTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/correlation/StorelessCovarianceTest.java b/src/test/java/org/apache/commons/math4/stat/correlation/StorelessCovarianceTest.java
index 06052e9..09a2297 100644
--- a/src/test/java/org/apache/commons/math4/stat/correlation/StorelessCovarianceTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/correlation/StorelessCovarianceTest.java
@@ -14,12 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.random.ISAACRandom;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.random.ISAACRandom;
+import org.apache.commons.math4.stat.correlation.StorelessBivariateCovariance;
+import org.apache.commons.math4.stat.correlation.StorelessCovariance;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java b/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java
index 51cf59b..32cfbdd 100644
--- a/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/data/CertifiedDataAbstractTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.data;
+package org.apache.commons.math4.stat.data;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -26,10 +26,9 @@ import java.net.URL;
 import java.util.HashMap;
 import java.util.Map;
 
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math3.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Before;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/data/LewTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/data/LewTest.java b/src/test/java/org/apache/commons/math4/stat/data/LewTest.java
index dcc8574..3009303 100644
--- a/src/test/java/org/apache/commons/math4/stat/data/LewTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/data/LewTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.data;
+package org.apache.commons.math4.stat.data;
 
 /**
  */
@@ -23,6 +23,6 @@ public class LewTest extends CertifiedDataAbstractTest {
 
     @Override
     protected String getResourceName() {
-        return "org/apache/commons/math3/stat/data/Lew.txt";
+        return "org/apache/commons/math4/stat/data/Lew.txt";
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/data/LotteryTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/data/LotteryTest.java b/src/test/java/org/apache/commons/math4/stat/data/LotteryTest.java
index b4bb76f..9807015 100644
--- a/src/test/java/org/apache/commons/math4/stat/data/LotteryTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/data/LotteryTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.data;
+package org.apache.commons.math4.stat.data;
 
 /**
  */
@@ -23,6 +23,6 @@ public class LotteryTest extends CertifiedDataAbstractTest {
 
     @Override
     protected String getResourceName() {
-        return "org/apache/commons/math3/stat/data/Lottery.txt";
+        return "org/apache/commons/math4/stat/data/Lottery.txt";
     }
 }

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
index ef379cc..dca0ece 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatisticTest.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
index ce48dbe..1a8324d 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatisticsTest.java
@@ -15,18 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.util.ArrayList;
 import java.util.Collection;
 
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.UniformRealDistribution;
-import org.apache.commons.math3.distribution.IntegerDistribution;
-import org.apache.commons.math3.distribution.UniformIntegerDistribution;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformIntegerDistribution;
+import org.apache.commons.math4.distribution.UniformRealDistribution;
+import org.apache.commons.math4.stat.descriptive.AggregateSummaryStatistics;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummaryValues;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
index d9e6aa9..5afedd5 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatisticsTest.java
@@ -11,21 +11,23 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.util.Locale;
 
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.stat.descriptive.rank.Percentile;
-import org.apache.commons.math3.stat.descriptive.moment.GeometricMean;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.stat.descriptive.rank.Max;
-import org.apache.commons.math3.stat.descriptive.rank.Min;
-import org.apache.commons.math3.stat.descriptive.summary.Sum;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfSquares;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.GeometricMean;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.stat.descriptive.rank.Max;
+import org.apache.commons.math4.stat.descriptive.rank.Min;
+import org.apache.commons.math4.stat.descriptive.rank.Percentile;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
+import org.apache.commons.math4.util.Precision;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java
index b24b753..7bdd800 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImpl.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math3.util.DefaultTransformer;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.NumberTransformer;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.util.DefaultTransformer;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.NumberTransformer;
 
 /**
  */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java
index c5a4f80..964d066 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/ListUnivariateImplTest.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.util.ArrayList;
 import java.util.List;
 
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java
index 152ff87..8e69064 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/MixedListUnivariateImplTest.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.List;
 
-
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.NumberTransformer;
-import org.apache.commons.math3.util.TransformerMap;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.NumberTransformer;
+import org.apache.commons.math4.util.TransformerMap;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatisticsTest.java
index 68252ef..3982428 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatisticsTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 
 import java.util.Locale;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.util.FastMath;
-
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.stat.descriptive.MultivariateSummaryStatistics;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Test;
 import org.junit.Assert;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValuesTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValuesTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValuesTest.java
index e3b766e..1c27d8c 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValuesTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValuesTest.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 
 import java.util.Locale;
 
-
-import org.apache.commons.math3.TestUtils;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummaryValues;
 import org.junit.Assert;
 import org.junit.Test;
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
index c42b80e..8ac3269 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatisticAbstractTest.java
@@ -14,11 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.stat.descriptive.moment.SecondMoment;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.SecondMoment;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/SummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/SummaryStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/SummaryStatisticsTest.java
index e1a1f98..d546ca3 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/SummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/SummaryStatisticsTest.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 
-import org.apache.commons.math3.TestUtils;
-
-import org.apache.commons.math3.stat.descriptive.moment.GeometricMean;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.stat.descriptive.summary.Sum;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.stat.descriptive.StatisticalSummary;
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.stat.descriptive.moment.GeometricMean;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatisticsTest.java
index aad7424..528516f 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatisticsTest.java
@@ -11,7 +11,10 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
+
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.stat.descriptive.SynchronizedDescriptiveStatistics;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatisticsTest.java
index 34d40b4..f674b18 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatisticsTest.java
@@ -11,7 +11,10 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
+
+import org.apache.commons.math4.stat.descriptive.MultivariateSummaryStatistics;
+import org.apache.commons.math4.stat.descriptive.SynchronizedMultivariateSummaryStatistics;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatisticsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatisticsTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatisticsTest.java
index 8cd3c82..30fd09e 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatisticsTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatisticsTest.java
@@ -11,7 +11,10 @@
  * KIND, either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
+
+import org.apache.commons.math4.stat.descriptive.SummaryStatistics;
+import org.apache.commons.math4.stat.descriptive.SynchronizedSummaryStatistics;
 
 /**
  * Test cases for the {@link SynchronizedSummaryStatisticsTest} class.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java
index ac15c85..bca7dc8 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/UnivariateStatisticAbstractTest.java
@@ -14,18 +14,19 @@ s * Unless required by applicable law or agreed to in writing, software
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.util.ArrayList;
 import java.util.List;
 
-
-import org.apache.commons.math3.TestUtils;
-import org.apache.commons.math3.distribution.IntegerDistribution;
-import org.apache.commons.math3.distribution.UniformIntegerDistribution;
-import org.apache.commons.math3.distribution.RealDistribution;
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.TestUtils;
+import org.apache.commons.math4.distribution.IntegerDistribution;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.distribution.RealDistribution;
+import org.apache.commons.math4.distribution.UniformIntegerDistribution;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.WeightedEvaluation;
+import org.apache.commons.math4.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FirstMomentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FirstMomentTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FirstMomentTest.java
index 5ff6eb6..ca0566f 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FirstMomentTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FirstMomentTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.FirstMoment;
 import org.junit.Assert;
 import org.junit.Test;
 
@@ -30,7 +31,7 @@ public class FirstMomentTest extends StorelessUnivariateStatisticAbstractTest{
     protected FirstMoment stat;
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
      */
     @Override
     public UnivariateStatistic getUnivariateStatistic() {
@@ -38,7 +39,7 @@ public class FirstMomentTest extends StorelessUnivariateStatisticAbstractTest{
     }
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
      */
     @Override
     public double expectedValue() {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FourthMomentTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FourthMomentTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FourthMomentTest.java
index 61c5070..a3b51c8 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FourthMomentTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/FourthMomentTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.FourthMoment;
 
 /**
  * Test cases for the {@link FourthMoment} class.
@@ -28,7 +29,7 @@ public class FourthMomentTest extends StorelessUnivariateStatisticAbstractTest{
     protected FourthMoment stat;
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#getUnivariateStatistic()
      */
     @Override
     public UnivariateStatistic getUnivariateStatistic() {
@@ -36,7 +37,7 @@ public class FourthMomentTest extends StorelessUnivariateStatisticAbstractTest{
     }
 
     /**
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatisticAbstractTest#expectedValue()
      */
     @Override
     public double expectedValue() {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMeanTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMeanTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMeanTest.java
index 4622637..b8462a9 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMeanTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/GeometricMeanTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.GeometricMean;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/InteractionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/InteractionTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/InteractionTest.java
index f6d8433..3d168cb 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/InteractionTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/InteractionTest.java
@@ -14,8 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
+import org.apache.commons.math4.stat.descriptive.moment.FourthMoment;
+import org.apache.commons.math4.stat.descriptive.moment.Kurtosis;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.Skewness;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/KurtosisTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/KurtosisTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/KurtosisTest.java
index 48193ec..eb34f86 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/KurtosisTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/KurtosisTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.Kurtosis;
 import org.junit.Assert;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/test/java/org/apache/commons/math4/stat/descriptive/moment/MeanTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/MeanTest.java b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/MeanTest.java
index ef589d9..6f95f75 100644
--- a/src/test/java/org/apache/commons/math4/stat/descriptive/moment/MeanTest.java
+++ b/src/test/java/org/apache/commons/math4/stat/descriptive/moment/MeanTest.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive.moment;
+package org.apache.commons.math4.stat.descriptive.moment;
 
-import org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatisticAbstractTest;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
 import org.junit.Assert;
 import org.junit.Test;
 


[22/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java b/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java
deleted file mode 100644
index 2a63bbb..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/UniformCrossover.java
+++ /dev/null
@@ -1,134 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-
-/**
- * Perform Uniform Crossover [UX] on the specified chromosomes. A fixed mixing
- * ratio is used to combine genes from the first and second parents, e.g. using a
- * ratio of 0.5 would result in approximately 50% of genes coming from each
- * parent. This is typically a poor method of crossover, but empirical evidence
- * suggests that it is more exploratory and results in a larger part of the
- * problem space being searched.
- * <p>
- * This crossover policy evaluates each gene of the parent chromosomes by chosing a
- * uniform random number {@code p} in the range [0, 1]. If {@code p} &lt; {@code ratio},
- * the parent genes are swapped. This means with a ratio of 0.7, 30% of the genes from the
- * first parent and 70% from the second parent will be selected for the first offspring (and
- * vice versa for the second offspring).
- * <p>
- * This policy works only on {@link AbstractListChromosome}, and therefore it
- * is parameterized by T. Moreover, the chromosomes must have same lengths.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Crossover_%28genetic_algorithm%29">Crossover techniques (Wikipedia)</a>
- * @see <a href="http://www.obitko.com/tutorials/genetic-algorithms/crossover-mutation.php">Crossover (Obitko.com)</a>
- * @see <a href="http://www.tomaszgwiazda.com/uniformX.htm">Uniform crossover</a>
- * @param <T> generic type of the {@link AbstractListChromosome}s for crossover
- * @since 3.1
- */
-public class UniformCrossover<T> implements CrossoverPolicy {
-
-    /** The mixing ratio. */
-    private final double ratio;
-
-    /**
-     * Creates a new {@link UniformCrossover} policy using the given mixing ratio.
-     *
-     * @param ratio the mixing ratio
-     * @throws OutOfRangeException if the mixing ratio is outside the [0, 1] range
-     */
-    public UniformCrossover(final double ratio) throws OutOfRangeException {
-        if (ratio < 0.0d || ratio > 1.0d) {
-            throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE, ratio, 0.0d, 1.0d);
-        }
-        this.ratio = ratio;
-    }
-
-    /**
-     * Returns the mixing ratio used by this {@link CrossoverPolicy}.
-     *
-     * @return the mixing ratio
-     */
-    public double getRatio() {
-        return ratio;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws MathIllegalArgumentException iff one of the chromosomes is
-     *   not an instance of {@link AbstractListChromosome}
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    @SuppressWarnings("unchecked")
-    public ChromosomePair crossover(final Chromosome first, final Chromosome second)
-        throws DimensionMismatchException, MathIllegalArgumentException {
-
-        if (!(first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
-        }
-        return mate((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
-    }
-
-    /**
-     * Helper for {@link #crossover(Chromosome, Chromosome)}. Performs the actual crossover.
-     *
-     * @param first the first chromosome
-     * @param second the second chromosome
-     * @return the pair of new chromosomes that resulted from the crossover
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    private ChromosomePair mate(final AbstractListChromosome<T> first,
-                                final AbstractListChromosome<T> second) throws DimensionMismatchException {
-        final int length = first.getLength();
-        if (length != second.getLength()) {
-            throw new DimensionMismatchException(second.getLength(), length);
-        }
-
-        // array representations of the parents
-        final List<T> parent1Rep = first.getRepresentation();
-        final List<T> parent2Rep = second.getRepresentation();
-        // and of the children
-        final List<T> child1Rep = new ArrayList<T>(length);
-        final List<T> child2Rep = new ArrayList<T>(length);
-
-        final RandomGenerator random = GeneticAlgorithm.getRandomGenerator();
-
-        for (int index = 0; index < length; index++) {
-
-            if (random.nextDouble() < ratio) {
-                // swap the bits -> take other parent
-                child1Rep.add(parent2Rep.get(index));
-                child2Rep.add(parent1Rep.get(index));
-            } else {
-                child1Rep.add(parent1Rep.get(index));
-                child2Rep.add(parent2Rep.get(index));
-            }
-        }
-
-        return new ChromosomePair(first.newFixedLengthChromosome(child1Rep),
-                                  second.newFixedLengthChromosome(child2Rep));
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/package-info.java b/src/main/java/org/apache/commons/math3/genetics/package-info.java
deleted file mode 100644
index 5c145e8..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/package-info.java
+++ /dev/null
@@ -1,20 +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.
- */
-/**
- * This package provides Genetic Algorithms components and implementations.
- */
-package org.apache.commons.math3.genetics;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/Point.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/Point.java b/src/main/java/org/apache/commons/math3/geometry/Point.java
deleted file mode 100644
index 1504d2e..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/Point.java
+++ /dev/null
@@ -1,46 +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.geometry;
-
-import java.io.Serializable;
-
-/** This interface represents a generic geometrical point.
- * @param <S> Type of the space.
- * @see Space
- * @see Vector
- * @since 3.3
- */
-public interface Point<S extends Space> extends Serializable {
-
-    /** Get the space to which the point belongs.
-     * @return containing space
-     */
-    Space getSpace();
-
-    /**
-     * Returns true if any coordinate of this point is NaN; false otherwise
-     * @return  true if any coordinate of this point is NaN; false otherwise
-     */
-    boolean isNaN();
-
-    /** Compute the distance between the instance and another point.
-     * @param p second point
-     * @return the distance between the instance and p
-     */
-    double distance(Point<S> p);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/Space.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/Space.java b/src/main/java/org/apache/commons/math3/geometry/Space.java
deleted file mode 100644
index 7f72439..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/Space.java
+++ /dev/null
@@ -1,42 +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.geometry;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-
-/** This interface represents a generic space, with affine and vectorial counterparts.
- * @see Vector
- * @since 3.0
- */
-public interface Space extends Serializable {
-
-    /** Get the dimension of the space.
-     * @return dimension of the space
-     */
-    int getDimension();
-
-    /** Get the n-1 dimension subspace of this space.
-     * @return n-1 dimension sub-space of this space
-     * @see #getDimension()
-     * @exception MathUnsupportedOperationException for dimension-1 spaces
-     * which do not have sub-spaces
-     */
-    Space getSubSpace() throws MathUnsupportedOperationException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/Vector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/Vector.java b/src/main/java/org/apache/commons/math3/geometry/Vector.java
deleted file mode 100644
index f22f7a1..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/Vector.java
+++ /dev/null
@@ -1,155 +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.geometry;
-
-import java.text.NumberFormat;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-
-/** This interface represents a generic vector in a vectorial space or a point in an affine space.
- * @param <S> Type of the space.
- * @see Space
- * @see Point
- * @since 3.0
- */
-public interface Vector<S extends Space> extends Point<S> {
-
-    /** Get the null vector of the vectorial space or origin point of the affine space.
-     * @return null vector of the vectorial space or origin point of the affine space
-     */
-    Vector<S> getZero();
-
-    /** Get the L<sub>1</sub> norm for the vector.
-     * @return L<sub>1</sub> norm for the vector
-     */
-    double getNorm1();
-
-    /** Get the L<sub>2</sub> norm for the vector.
-     * @return Euclidean norm for the vector
-     */
-    double getNorm();
-
-    /** Get the square of the norm for the vector.
-     * @return square of the Euclidean norm for the vector
-     */
-    double getNormSq();
-
-    /** Get the L<sub>&infin;</sub> norm for the vector.
-     * @return L<sub>&infin;</sub> norm for the vector
-     */
-    double getNormInf();
-
-    /** Add a vector to the instance.
-     * @param v vector to add
-     * @return a new vector
-     */
-    Vector<S> add(Vector<S> v);
-
-    /** Add a scaled vector to the instance.
-     * @param factor scale factor to apply to v before adding it
-     * @param v vector to add
-     * @return a new vector
-     */
-    Vector<S> add(double factor, Vector<S> v);
-
-    /** Subtract a vector from the instance.
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    Vector<S> subtract(Vector<S> v);
-
-    /** Subtract a scaled vector from the instance.
-     * @param factor scale factor to apply to v before subtracting it
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    Vector<S> subtract(double factor, Vector<S> v);
-
-    /** Get the opposite of the instance.
-     * @return a new vector which is opposite to the instance
-     */
-    Vector<S> negate();
-
-    /** Get a normalized vector aligned with the instance.
-     * @return a new normalized vector
-     * @exception MathArithmeticException if the norm is zero
-     */
-    Vector<S> normalize() throws MathArithmeticException;
-
-    /** Multiply the instance by a scalar.
-     * @param a scalar
-     * @return a new vector
-     */
-    Vector<S> scalarMultiply(double a);
-
-    /**
-     * Returns true if any coordinate of this vector is infinite and none are NaN;
-     * false otherwise
-     * @return  true if any coordinate of this vector is infinite and none are NaN;
-     * false otherwise
-     */
-    boolean isInfinite();
-
-    /** Compute the distance between the instance and another vector according to the L<sub>1</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNorm1()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>1</sub> norm
-     */
-    double distance1(Vector<S> v);
-
-    /** Compute the distance between the instance and another vector according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>2</sub> norm
-     */
-    double distance(Vector<S> v);
-
-    /** Compute the distance between the instance and another vector according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>&infin;</sub> norm
-     */
-    double distanceInf(Vector<S> v);
-
-    /** Compute the square of the distance between the instance and another vector.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the square of the distance between the instance and p
-     */
-    double distanceSq(Vector<S> v);
-
-    /** Compute the dot-product of the instance and another vector.
-     * @param v second vector
-     * @return the dot product this.v
-     */
-    double dotProduct(Vector<S> v);
-
-    /** Get a string representation of this vector.
-     * @param format the custom format for components
-     * @return a string representation of this vector
-     */
-    String toString(final NumberFormat format);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/VectorFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/VectorFormat.java b/src/main/java/org/apache/commons/math3/geometry/VectorFormat.java
deleted file mode 100644
index b58d765..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/VectorFormat.java
+++ /dev/null
@@ -1,290 +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.geometry;
-
-import java.text.FieldPosition;
-import java.text.NumberFormat;
-import java.text.ParsePosition;
-import java.util.Locale;
-
-import org.apache.commons.math3.util.CompositeFormat;
-import org.apache.commons.math3.exception.MathParseException;
-
-/**
- * Formats a vector in components list format "{x; y; ...}".
- * <p>The prefix and suffix "{" and "}" and the separator "; " can be replaced by
- * any user-defined strings. The number format for components can be configured.</p>
- * <p>White space is ignored at parse time, even if it is in the prefix, suffix
- * or separator specifications. So even if the default separator does include a space
- * character that is used at format time, both input string "{1;1;1}" and
- * " { 1 ; 1 ; 1 } " will be parsed without error and the same vector will be
- * returned. In the second case, however, the parse position after parsing will be
- * just after the closing curly brace, i.e. just before the trailing space.</p>
- * <p><b>Note:</b> using "," as a separator may interfere with the grouping separator
- * of the default {@link NumberFormat} for the current locale. Thus it is advised
- * to use a {@link NumberFormat} instance with disabled grouping in such a case.</p>
- *
- * @param <S> Type of the space.
- * @since 3.0
- */
-public abstract class VectorFormat<S extends Space> {
-
-    /** The default prefix: "{". */
-    public static final String DEFAULT_PREFIX = "{";
-
-    /** The default suffix: "}". */
-    public static final String DEFAULT_SUFFIX = "}";
-
-    /** The default separator: ", ". */
-    public static final String DEFAULT_SEPARATOR = "; ";
-
-    /** Prefix. */
-    private final String prefix;
-
-    /** Suffix. */
-    private final String suffix;
-
-    /** Separator. */
-    private final String separator;
-
-    /** Trimmed prefix. */
-    private final String trimmedPrefix;
-
-    /** Trimmed suffix. */
-    private final String trimmedSuffix;
-
-    /** Trimmed separator. */
-    private final String trimmedSeparator;
-
-    /** The format used for components. */
-    private final NumberFormat format;
-
-    /**
-     * Create an instance with default settings.
-     * <p>The instance uses the default prefix, suffix and separator:
-     * "{", "}", and "; " and the default number format for components.</p>
-     */
-    protected VectorFormat() {
-        this(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR,
-             CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with a custom number format for components.
-     * @param format the custom format for components.
-     */
-    protected VectorFormat(final NumberFormat format) {
-        this(DEFAULT_PREFIX, DEFAULT_SUFFIX, DEFAULT_SEPARATOR, format);
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix and separator.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     * @param separator separator to use instead of the default "; "
-     */
-    protected VectorFormat(final String prefix, final String suffix,
-                          final String separator) {
-        this(prefix, suffix, separator, CompositeFormat.getDefaultNumberFormat());
-    }
-
-    /**
-     * Create an instance with custom prefix, suffix, separator and format
-     * for components.
-     * @param prefix prefix to use instead of the default "{"
-     * @param suffix suffix to use instead of the default "}"
-     * @param separator separator to use instead of the default "; "
-     * @param format the custom format for components.
-     */
-    protected VectorFormat(final String prefix, final String suffix,
-                          final String separator, final NumberFormat format) {
-        this.prefix      = prefix;
-        this.suffix      = suffix;
-        this.separator   = separator;
-        trimmedPrefix    = prefix.trim();
-        trimmedSuffix    = suffix.trim();
-        trimmedSeparator = separator.trim();
-        this.format      = format;
-    }
-
-    /**
-     * Get the set of locales for which point/vector formats are available.
-     * <p>This is the same set as the {@link NumberFormat} set.</p>
-     * @return available point/vector format locales.
-     */
-    public static Locale[] getAvailableLocales() {
-        return NumberFormat.getAvailableLocales();
-    }
-
-    /**
-     * Get the format prefix.
-     * @return format prefix.
-     */
-    public String getPrefix() {
-        return prefix;
-    }
-
-    /**
-     * Get the format suffix.
-     * @return format suffix.
-     */
-    public String getSuffix() {
-        return suffix;
-    }
-
-    /**
-     * Get the format separator between components.
-     * @return format separator.
-     */
-    public String getSeparator() {
-        return separator;
-    }
-
-    /**
-     * Get the components format.
-     * @return components format.
-     */
-    public NumberFormat getFormat() {
-        return format;
-    }
-
-    /**
-     * Formats a {@link Vector} object to produce a string.
-     * @param vector the object to format.
-     * @return a formatted string.
-     */
-    public String format(Vector<S> vector) {
-        return format(vector, new StringBuffer(), new FieldPosition(0)).toString();
-    }
-
-    /**
-     * Formats a {@link Vector} object to produce a string.
-     * @param vector the object to format.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @return the value passed in as toAppendTo.
-     */
-    public abstract StringBuffer format(Vector<S> vector,
-                                        StringBuffer toAppendTo, FieldPosition pos);
-
-    /**
-     * Formats the coordinates of a {@link Vector} to produce a string.
-     * @param toAppendTo where the text is to be appended
-     * @param pos On input: an alignment field, if desired. On output: the
-     *            offsets of the alignment field
-     * @param coordinates coordinates of the object to format.
-     * @return the value passed in as toAppendTo.
-     */
-    protected StringBuffer format(StringBuffer toAppendTo, FieldPosition pos,
-                                  double ... coordinates) {
-
-        pos.setBeginIndex(0);
-        pos.setEndIndex(0);
-
-        // format prefix
-        toAppendTo.append(prefix);
-
-        // format components
-        for (int i = 0; i < coordinates.length; ++i) {
-            if (i > 0) {
-                toAppendTo.append(separator);
-            }
-            CompositeFormat.formatDouble(coordinates[i], format, toAppendTo, pos);
-        }
-
-        // format suffix
-        toAppendTo.append(suffix);
-
-        return toAppendTo;
-
-    }
-
-    /**
-     * Parses a string to produce a {@link Vector} object.
-     * @param source the string to parse
-     * @return the parsed {@link Vector} object.
-     * @throws MathParseException if the beginning of the specified string
-     * cannot be parsed.
-     */
-    public abstract Vector<S> parse(String source) throws MathParseException;
-
-    /**
-     * Parses a string to produce a {@link Vector} object.
-     * @param source the string to parse
-     * @param pos input/output parsing parameter.
-     * @return the parsed {@link Vector} object.
-     */
-    public abstract Vector<S> parse(String source, ParsePosition pos);
-
-    /**
-     * Parses a string to produce an array of coordinates.
-     * @param dimension dimension of the space
-     * @param source the string to parse
-     * @param pos input/output parsing parameter.
-     * @return coordinates array.
-     */
-    protected double[] parseCoordinates(int dimension, String source, ParsePosition pos) {
-
-        int initialIndex = pos.getIndex();
-        double[] coordinates = new double[dimension];
-
-        // parse prefix
-        CompositeFormat.parseAndIgnoreWhitespace(source, pos);
-        if (!CompositeFormat.parseFixedstring(source, trimmedPrefix, pos)) {
-            return null;
-        }
-
-        for (int i = 0; i < dimension; ++i) {
-
-            // skip whitespace
-            CompositeFormat.parseAndIgnoreWhitespace(source, pos);
-
-            // parse separator
-            if (i > 0 && !CompositeFormat.parseFixedstring(source, trimmedSeparator, pos)) {
-                return null;
-            }
-
-            // skip whitespace
-            CompositeFormat.parseAndIgnoreWhitespace(source, pos);
-
-            // parse coordinate
-            Number c = CompositeFormat.parseNumber(source, format, pos);
-            if (c == null) {
-                // invalid coordinate
-                // set index back to initial, error index should already be set
-                pos.setIndex(initialIndex);
-                return null;
-            }
-
-            // store coordinate
-            coordinates[i] = c.doubleValue();
-
-        }
-
-        // parse suffix
-        CompositeFormat.parseAndIgnoreWhitespace(source, pos);
-        if (!CompositeFormat.parseFixedstring(source, trimmedSuffix, pos)) {
-            return null;
-        }
-
-        return coordinates;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/enclosing/Encloser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/enclosing/Encloser.java b/src/main/java/org/apache/commons/math3/geometry/enclosing/Encloser.java
deleted file mode 100644
index 9b2588a..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/enclosing/Encloser.java
+++ /dev/null
@@ -1,36 +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.geometry.enclosing;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/** Interface for algorithms computing enclosing balls.
- * @param <S> Space type.
- * @param <P> Point type.
- * @see EnclosingBall
- * @since 3.3
- */
-public interface Encloser<S extends Space, P extends Point<S>> {
-
-    /** Find a ball enclosing a list of points.
-     * @param points points to enclose
-     * @return enclosing ball
-     */
-    EnclosingBall<S, P> enclose(Iterable<P> points);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/enclosing/EnclosingBall.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/enclosing/EnclosingBall.java b/src/main/java/org/apache/commons/math3/geometry/enclosing/EnclosingBall.java
deleted file mode 100644
index eedbd46..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/enclosing/EnclosingBall.java
+++ /dev/null
@@ -1,103 +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.geometry.enclosing;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/** This class represents a ball enclosing some points.
- * @param <S> Space type.
- * @param <P> Point type.
- * @see Space
- * @see Point
- * @see Encloser
- * @since 3.3
- */
-public class EnclosingBall<S extends Space, P extends Point<S>> implements Serializable {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20140126L;
-
-    /** Center of the ball. */
-    private final P center;
-
-    /** Radius of the ball. */
-    private final double radius;
-
-    /** Support points used to define the ball. */
-    private final P[] support;
-
-    /** Simple constructor.
-     * @param center center of the ball
-     * @param radius radius of the ball
-     * @param support support points used to define the ball
-     */
-    public EnclosingBall(final P center, final double radius, final P ... support) {
-        this.center  = center;
-        this.radius  = radius;
-        this.support = support.clone();
-    }
-
-    /** Get the center of the ball.
-     * @return center of the ball
-     */
-    public P getCenter() {
-        return center;
-    }
-
-    /** Get the radius of the ball.
-     * @return radius of the ball (can be negative if the ball is empty)
-     */
-    public double getRadius() {
-        return radius;
-    }
-
-    /** Get the support points used to define the ball.
-     * @return support points used to define the ball
-     */
-    public P[] getSupport() {
-        return support.clone();
-    }
-
-    /** Get the number of support points used to define the ball.
-     * @return number of support points used to define the ball
-     */
-    public int getSupportSize() {
-        return support.length;
-    }
-
-    /** Check if a point is within the ball or at boundary.
-     * @param point point to test
-     * @return true if the point is within the ball or at boundary
-     */
-    public boolean contains(final P point) {
-        return point.distance(center) <= radius;
-    }
-
-    /** Check if a point is within an enlarged ball or at boundary.
-     * @param point point to test
-     * @param margin margin to consider
-     * @return true if the point is within the ball enlarged
-     * by the margin or at boundary
-     */
-    public boolean contains(final P point, final double margin) {
-        return point.distance(center) <= radius + margin;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/enclosing/SupportBallGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/enclosing/SupportBallGenerator.java b/src/main/java/org/apache/commons/math3/geometry/enclosing/SupportBallGenerator.java
deleted file mode 100644
index 3a0f875..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/enclosing/SupportBallGenerator.java
+++ /dev/null
@@ -1,42 +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.geometry.enclosing;
-
-import java.util.List;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/** Interface for generating balls based on support points.
- * <p>
- * This generator is used in the {@link WelzlEncloser Emo Welzl} algorithm
- * and its derivatives.
- * </p>
- * @param <S> Space type.
- * @param <P> Point type.
- * @see EnclosingBall
- * @since 3.3
- */
-public interface SupportBallGenerator<S extends Space, P extends Point<S>> {
-
-    /** Create a ball whose boundary lies on prescribed support points.
-     * @param support support points (may be empty)
-     * @return ball whose boundary lies on the prescribed support points
-     */
-    EnclosingBall<S, P> ballOnSupport(List<P> support);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/enclosing/WelzlEncloser.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/enclosing/WelzlEncloser.java b/src/main/java/org/apache/commons/math3/geometry/enclosing/WelzlEncloser.java
deleted file mode 100644
index 987e7d9..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/enclosing/WelzlEncloser.java
+++ /dev/null
@@ -1,181 +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.geometry.enclosing;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/** Class implementing Emo Welzl algorithm to find the smallest enclosing ball in linear time.
- * <p>
- * The class implements the algorithm described in paper <a
- * href="http://www.inf.ethz.ch/personal/emo/PublFiles/SmallEnclDisk_LNCS555_91.pdf">Smallest
- * Enclosing Disks (Balls and Ellipsoids)</a> by Emo Welzl, Lecture Notes in Computer Science
- * 555 (1991) 359-370. The pivoting improvement published in the paper <a
- * href="http://www.inf.ethz.ch/personal/gaertner/texts/own_work/esa99_final.pdf">Fast and
- * Robust Smallest Enclosing Balls</a>, by Bernd Gärtner and further modified in
- * paper <a
- * href=http://www.idt.mdh.se/kurser/ct3340/ht12/MINICONFERENCE/FinalPapers/ircse12_submission_30.pdf">
- * Efficient Computation of Smallest Enclosing Balls in Three Dimensions</a> by Linus Källberg
- * to avoid performing local copies of data have been included.
- * </p>
- * @param <S> Space type.
- * @param <P> Point type.
- * @since 3.3
- */
-public class WelzlEncloser<S extends Space, P extends Point<S>> implements Encloser<S, P> {
-
-    /** Tolerance below which points are consider to be identical. */
-    private final double tolerance;
-
-    /** Generator for balls on support. */
-    private final SupportBallGenerator<S, P> generator;
-
-    /** Simple constructor.
-     * @param tolerance below which points are consider to be identical
-     * @param generator generator for balls on support
-     */
-    public WelzlEncloser(final double tolerance, final SupportBallGenerator<S, P> generator) {
-        this.tolerance = tolerance;
-        this.generator = generator;
-    }
-
-    /** {@inheritDoc} */
-    public EnclosingBall<S, P> enclose(final Iterable<P> points) {
-
-        if (points == null || !points.iterator().hasNext()) {
-            // return an empty ball
-            return generator.ballOnSupport(new ArrayList<P>());
-        }
-
-        // Emo Welzl algorithm with Bernd Gärtner and Linus Källberg improvements
-        return pivotingBall(points);
-
-    }
-
-    /** Compute enclosing ball using Gärtner's pivoting heuristic.
-     * @param points points to be enclosed
-     * @return enclosing ball
-     */
-    private EnclosingBall<S, P> pivotingBall(final Iterable<P> points) {
-
-        final P first = points.iterator().next();
-        final List<P> extreme = new ArrayList<P>(first.getSpace().getDimension() + 1);
-        final List<P> support = new ArrayList<P>(first.getSpace().getDimension() + 1);
-
-        // start with only first point selected as a candidate support
-        extreme.add(first);
-        EnclosingBall<S, P> ball = moveToFrontBall(extreme, extreme.size(), support);
-
-        while (true) {
-
-            // select the point farthest to current ball
-            final P farthest = selectFarthest(points, ball);
-
-            if (ball.contains(farthest, tolerance)) {
-                // we have found a ball containing all points
-                return ball;
-            }
-
-            // recurse search, restricted to the small subset containing support and farthest point
-            support.clear();
-            support.add(farthest);
-            EnclosingBall<S, P> savedBall = ball;
-            ball = moveToFrontBall(extreme, extreme.size(), support);
-            if (ball.getRadius() < savedBall.getRadius()) {
-                // this should never happen
-                throw new MathInternalError();
-            }
-
-            // it was an interesting point, move it to the front
-            // according to Gärtner's heuristic
-            extreme.add(0, farthest);
-
-            // prune the least interesting points
-            extreme.subList(ball.getSupportSize(), extreme.size()).clear();
-
-
-        }
-    }
-
-    /** Compute enclosing ball using Welzl's move to front heuristic.
-     * @param extreme subset of extreme points
-     * @param nbExtreme number of extreme points to consider
-     * @param support points that must belong to the ball support
-     * @return enclosing ball, for the extreme subset only
-     */
-    private EnclosingBall<S, P> moveToFrontBall(final List<P> extreme, final int nbExtreme,
-                                                final List<P> support) {
-
-        // create a new ball on the prescribed support
-        EnclosingBall<S, P> ball = generator.ballOnSupport(support);
-
-        if (ball.getSupportSize() <= ball.getCenter().getSpace().getDimension()) {
-
-            for (int i = 0; i < nbExtreme; ++i) {
-                final P pi = extreme.get(i);
-                if (!ball.contains(pi, tolerance)) {
-
-                    // we have found an outside point,
-                    // enlarge the ball by adding it to the support
-                    support.add(pi);
-                    ball = moveToFrontBall(extreme, i, support);
-                    support.remove(support.size() - 1);
-
-                    // it was an interesting point, move it to the front
-                    // according to Welzl's heuristic
-                    for (int j = i; j > 0; --j) {
-                        extreme.set(j, extreme.get(j - 1));
-                    }
-                    extreme.set(0, pi);
-
-                }
-            }
-
-        }
-
-        return ball;
-
-    }
-
-    /** Select the point farthest to the current ball.
-     * @param points points to be enclosed
-     * @param ball current ball
-     * @return farthest point
-     */
-    public P selectFarthest(final Iterable<P> points, final EnclosingBall<S, P> ball) {
-
-        final P center = ball.getCenter();
-        P farthest   = null;
-        double dMax  = -1.0;
-
-        for (final P point : points) {
-            final double d = point.distance(center);
-            if (d > dMax) {
-                farthest = point;
-                dMax     = d;
-            }
-        }
-
-        return farthest;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/enclosing/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/enclosing/package-info.java b/src/main/java/org/apache/commons/math3/geometry/enclosing/package-info.java
deleted file mode 100644
index 20462a1..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/enclosing/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- *
- * <p>
- * This package provides interfaces and classes related to the smallest enclosing ball problem.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.enclosing;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Euclidean1D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Euclidean1D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Euclidean1D.java
deleted file mode 100644
index 14d130d..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Euclidean1D.java
+++ /dev/null
@@ -1,100 +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.geometry.euclidean.oned;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Space;
-
-/**
- * This class implements a one-dimensional space.
- * @since 3.0
- */
-public class Euclidean1D implements Serializable, Space {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -1178039568877797126L;
-
-    /** Private constructor for the singleton.
-     */
-    private Euclidean1D() {
-    }
-
-    /** Get the unique instance.
-     * @return the unique instance
-     */
-    public static Euclidean1D getInstance() {
-        return LazyHolder.INSTANCE;
-    }
-
-    /** {@inheritDoc} */
-    public int getDimension() {
-        return 1;
-    }
-
-    /** {@inheritDoc}
-     * <p>
-     * As the 1-dimension Euclidean space does not have proper sub-spaces,
-     * this method always throws a {@link NoSubSpaceException}
-     * </p>
-     * @return nothing
-     * @throws NoSubSpaceException in all cases
-     */
-    public Space getSubSpace() throws NoSubSpaceException {
-        throw new NoSubSpaceException();
-    }
-
-    // CHECKSTYLE: stop HideUtilityClassConstructor
-    /** Holder for the instance.
-     * <p>We use here the Initialization On Demand Holder Idiom.</p>
-     */
-    private static class LazyHolder {
-        /** Cached field instance. */
-        private static final Euclidean1D INSTANCE = new Euclidean1D();
-    }
-    // CHECKSTYLE: resume HideUtilityClassConstructor
-
-    /** Handle deserialization of the singleton.
-     * @return the singleton instance
-     */
-    private Object readResolve() {
-        // return the singleton instance
-        return LazyHolder.INSTANCE;
-    }
-
-    /** Specialized exception for inexistent sub-space.
-     * <p>
-     * This exception is thrown when attempting to get the sub-space of a one-dimensional space
-     * </p>
-     */
-    public static class NoSubSpaceException extends MathUnsupportedOperationException {
-
-        /** Serializable UID. */
-        private static final long serialVersionUID = 20140225L;
-
-        /** Simple constructor.
-         */
-        public NoSubSpaceException() {
-            super(LocalizedFormats.NOT_SUPPORTED_IN_DIMENSION_N, 1);
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java
deleted file mode 100644
index 18ebac7..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/Interval.java
+++ /dev/null
@@ -1,129 +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.geometry.euclidean.oned;
-
-import org.apache.commons.math3.geometry.partitioning.Region.Location;
-
-
-/** This class represents a 1D interval.
- * @see IntervalsSet
- * @since 3.0
- */
-public class Interval {
-
-    /** The lower bound of the interval. */
-    private final double lower;
-
-    /** The upper bound of the interval. */
-    private final double upper;
-
-    /** Simple constructor.
-     * @param lower lower bound of the interval
-     * @param upper upper bound of the interval
-     */
-    public Interval(final double lower, final double upper) {
-        this.lower = lower;
-        this.upper = upper;
-    }
-
-    /** Get the lower bound of the interval.
-     * @return lower bound of the interval
-     * @since 3.1
-     */
-    public double getInf() {
-        return lower;
-    }
-
-    /** Get the lower bound of the interval.
-     * @return lower bound of the interval
-     * @deprecated as of 3.1, replaced by {@link #getInf()}
-     */
-    @Deprecated
-    public double getLower() {
-        return getInf();
-    }
-
-    /** Get the upper bound of the interval.
-     * @return upper bound of the interval
-     * @since 3.1
-     */
-    public double getSup() {
-        return upper;
-    }
-
-    /** Get the upper bound of the interval.
-     * @return upper bound of the interval
-     * @deprecated as of 3.1, replaced by {@link #getSup()}
-     */
-    @Deprecated
-    public double getUpper() {
-        return getSup();
-    }
-
-    /** Get the size of the interval.
-     * @return size of the interval
-     * @since 3.1
-     */
-    public double getSize() {
-        return upper - lower;
-    }
-
-    /** Get the length of the interval.
-     * @return length of the interval
-     * @deprecated as of 3.1, replaced by {@link #getSize()}
-     */
-    @Deprecated
-    public double getLength() {
-        return getSize();
-    }
-
-    /** Get the barycenter of the interval.
-     * @return barycenter of the interval
-     * @since 3.1
-     */
-    public double getBarycenter() {
-        return 0.5 * (lower + upper);
-    }
-
-    /** Get the midpoint of the interval.
-     * @return midpoint of the interval
-     * @deprecated as of 3.1, replaced by {@link #getBarycenter()}
-     */
-    @Deprecated
-    public double getMidPoint() {
-        return getBarycenter();
-    }
-
-    /** Check a point with respect to the interval.
-     * @param point point to check
-     * @param tolerance tolerance below which points are considered to
-     * belong to the boundary
-     * @return a code representing the point status: either {@link
-     * Location#INSIDE}, {@link Location#OUTSIDE} or {@link Location#BOUNDARY}
-     * @since 3.1
-     */
-    public Location checkPoint(final double point, final double tolerance) {
-        if (point < lower - tolerance || point > upper + tolerance) {
-            return Location.OUTSIDE;
-        } else if (point > lower + tolerance && point < upper - tolerance) {
-            return Location.INSIDE;
-        } else {
-            return Location.BOUNDARY;
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalsSet.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalsSet.java
deleted file mode 100644
index 383ea9f..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/IntervalsSet.java
+++ /dev/null
@@ -1,686 +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.geometry.euclidean.oned;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BoundaryProjection;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.Precision;
-
-/** This class represents a 1D region: a set of intervals.
- * @since 3.0
- */
-public class IntervalsSet extends AbstractRegion<Euclidean1D, Euclidean1D> implements Iterable<double[]> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Build an intervals set representing the whole real line.
-     * @param tolerance tolerance below which points are considered identical.
-     * @since 3.3
-     */
-    public IntervalsSet(final double tolerance) {
-        super(tolerance);
-    }
-
-    /** Build an intervals set corresponding to a single interval.
-     * @param lower lower bound of the interval, must be lesser or equal
-     * to {@code upper} (may be {@code Double.NEGATIVE_INFINITY})
-     * @param upper upper bound of the interval, must be greater or equal
-     * to {@code lower} (may be {@code Double.POSITIVE_INFINITY})
-     * @param tolerance tolerance below which points are considered identical.
-     * @since 3.3
-     */
-    public IntervalsSet(final double lower, final double upper, final double tolerance) {
-        super(buildTree(lower, upper, tolerance), tolerance);
-    }
-
-    /** Build an intervals set from an inside/outside BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * @param tree inside/outside BSP tree representing the intervals set
-     * @param tolerance tolerance below which points are considered identical.
-     * @since 3.3
-     */
-    public IntervalsSet(final BSPTree<Euclidean1D> tree, final double tolerance) {
-        super(tree, tolerance);
-    }
-
-    /** Build an intervals set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polygons with holes
-     * or a set of disjoints polyhedrons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
-     * checkPoint} method will not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements
-     * @param tolerance tolerance below which points are considered identical.
-     * @since 3.3
-     */
-    public IntervalsSet(final Collection<SubHyperplane<Euclidean1D>> boundary,
-                        final double tolerance) {
-        super(boundary, tolerance);
-    }
-
-    /** Build an intervals set representing the whole real line.
-     * @deprecated as of 3.1 replaced with {@link #IntervalsSet(double)}
-     */
-    @Deprecated
-    public IntervalsSet() {
-        this(DEFAULT_TOLERANCE);
-    }
-
-    /** Build an intervals set corresponding to a single interval.
-     * @param lower lower bound of the interval, must be lesser or equal
-     * to {@code upper} (may be {@code Double.NEGATIVE_INFINITY})
-     * @param upper upper bound of the interval, must be greater or equal
-     * to {@code lower} (may be {@code Double.POSITIVE_INFINITY})
-     * @deprecated as of 3.3 replaced with {@link #IntervalsSet(double, double, double)}
-     */
-    @Deprecated
-    public IntervalsSet(final double lower, final double upper) {
-        this(lower, upper, DEFAULT_TOLERANCE);
-    }
-
-    /** Build an intervals set from an inside/outside BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * @param tree inside/outside BSP tree representing the intervals set
-     * @deprecated as of 3.3, replaced with {@link #IntervalsSet(BSPTree, double)}
-     */
-    @Deprecated
-    public IntervalsSet(final BSPTree<Euclidean1D> tree) {
-        this(tree, DEFAULT_TOLERANCE);
-    }
-
-    /** Build an intervals set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polygons with holes
-     * or a set of disjoints polyhedrons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link
-     * org.apache.commons.math3.geometry.partitioning.Region#checkPoint(org.apache.commons.math3.geometry.Point)
-     * checkPoint} method will not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements
-     * @deprecated as of 3.3, replaced with {@link #IntervalsSet(Collection, double)}
-     */
-    @Deprecated
-    public IntervalsSet(final Collection<SubHyperplane<Euclidean1D>> boundary) {
-        this(boundary, DEFAULT_TOLERANCE);
-    }
-
-    /** Build an inside/outside tree representing a single interval.
-     * @param lower lower bound of the interval, must be lesser or equal
-     * to {@code upper} (may be {@code Double.NEGATIVE_INFINITY})
-     * @param upper upper bound of the interval, must be greater or equal
-     * to {@code lower} (may be {@code Double.POSITIVE_INFINITY})
-     * @param tolerance tolerance below which points are considered identical.
-     * @return the built tree
-     */
-    private static BSPTree<Euclidean1D> buildTree(final double lower, final double upper,
-                                                  final double tolerance) {
-        if (Double.isInfinite(lower) && (lower < 0)) {
-            if (Double.isInfinite(upper) && (upper > 0)) {
-                // the tree must cover the whole real line
-                return new BSPTree<Euclidean1D>(Boolean.TRUE);
-            }
-            // the tree must be open on the negative infinity side
-            final SubHyperplane<Euclidean1D> upperCut =
-                new OrientedPoint(new Vector1D(upper), true, tolerance).wholeHyperplane();
-            return new BSPTree<Euclidean1D>(upperCut,
-                               new BSPTree<Euclidean1D>(Boolean.FALSE),
-                               new BSPTree<Euclidean1D>(Boolean.TRUE),
-                               null);
-        }
-        final SubHyperplane<Euclidean1D> lowerCut =
-            new OrientedPoint(new Vector1D(lower), false, tolerance).wholeHyperplane();
-        if (Double.isInfinite(upper) && (upper > 0)) {
-            // the tree must be open on the positive infinity side
-            return new BSPTree<Euclidean1D>(lowerCut,
-                                            new BSPTree<Euclidean1D>(Boolean.FALSE),
-                                            new BSPTree<Euclidean1D>(Boolean.TRUE),
-                                            null);
-        }
-
-        // the tree must be bounded on the two sides
-        final SubHyperplane<Euclidean1D> upperCut =
-            new OrientedPoint(new Vector1D(upper), true, tolerance).wholeHyperplane();
-        return new BSPTree<Euclidean1D>(lowerCut,
-                                        new BSPTree<Euclidean1D>(Boolean.FALSE),
-                                        new BSPTree<Euclidean1D>(upperCut,
-                                                                 new BSPTree<Euclidean1D>(Boolean.FALSE),
-                                                                 new BSPTree<Euclidean1D>(Boolean.TRUE),
-                                                                 null),
-                                        null);
-
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public IntervalsSet buildNew(final BSPTree<Euclidean1D> tree) {
-        return new IntervalsSet(tree, getTolerance());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void computeGeometricalProperties() {
-        if (getTree(false).getCut() == null) {
-            setBarycenter((Point<Euclidean1D>) Vector1D.NaN);
-            setSize(((Boolean) getTree(false).getAttribute()) ? Double.POSITIVE_INFINITY : 0);
-        } else {
-            double size = 0.0;
-            double sum = 0.0;
-            for (final Interval interval : asList()) {
-                size += interval.getSize();
-                sum  += interval.getSize() * interval.getBarycenter();
-            }
-            setSize(size);
-            if (Double.isInfinite(size)) {
-                setBarycenter((Point<Euclidean1D>) Vector1D.NaN);
-            } else if (size >= Precision.SAFE_MIN) {
-                setBarycenter((Point<Euclidean1D>) new Vector1D(sum / size));
-            } else {
-                setBarycenter((Point<Euclidean1D>) ((OrientedPoint) getTree(false).getCut().getHyperplane()).getLocation());
-            }
-        }
-    }
-
-    /** Get the lowest value belonging to the instance.
-     * @return lowest value belonging to the instance
-     * ({@code Double.NEGATIVE_INFINITY} if the instance doesn't
-     * have any low bound, {@code Double.POSITIVE_INFINITY} if the
-     * instance is empty)
-     */
-    public double getInf() {
-        BSPTree<Euclidean1D> node = getTree(false);
-        double  inf  = Double.POSITIVE_INFINITY;
-        while (node.getCut() != null) {
-            final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane();
-            inf  = op.getLocation().getX();
-            node = op.isDirect() ? node.getMinus() : node.getPlus();
-        }
-        return ((Boolean) node.getAttribute()) ? Double.NEGATIVE_INFINITY : inf;
-    }
-
-    /** Get the highest value belonging to the instance.
-     * @return highest value belonging to the instance
-     * ({@code Double.POSITIVE_INFINITY} if the instance doesn't
-     * have any high bound, {@code Double.NEGATIVE_INFINITY} if the
-     * instance is empty)
-     */
-    public double getSup() {
-        BSPTree<Euclidean1D> node = getTree(false);
-        double  sup  = Double.NEGATIVE_INFINITY;
-        while (node.getCut() != null) {
-            final OrientedPoint op = (OrientedPoint) node.getCut().getHyperplane();
-            sup  = op.getLocation().getX();
-            node = op.isDirect() ? node.getPlus() : node.getMinus();
-        }
-        return ((Boolean) node.getAttribute()) ? Double.POSITIVE_INFINITY : sup;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    @Override
-    public BoundaryProjection<Euclidean1D> projectToBoundary(final Point<Euclidean1D> point) {
-
-        // get position of test point
-        final double x = ((Vector1D) point).getX();
-
-        double previous = Double.NEGATIVE_INFINITY;
-        for (final double[] a : this) {
-            if (x < a[0]) {
-                // the test point lies between the previous and the current intervals
-                // offset will be positive
-                final double previousOffset = x - previous;
-                final double currentOffset  = a[0] - x;
-                if (previousOffset < currentOffset) {
-                    return new BoundaryProjection<Euclidean1D>(point, finiteOrNullPoint(previous), previousOffset);
-                } else {
-                    return new BoundaryProjection<Euclidean1D>(point, finiteOrNullPoint(a[0]), currentOffset);
-                }
-            } else if (x <= a[1]) {
-                // the test point lies within the current interval
-                // offset will be negative
-                final double offset0 = a[0] - x;
-                final double offset1 = x - a[1];
-                if (offset0 < offset1) {
-                    return new BoundaryProjection<Euclidean1D>(point, finiteOrNullPoint(a[1]), offset1);
-                } else {
-                    return new BoundaryProjection<Euclidean1D>(point, finiteOrNullPoint(a[0]), offset0);
-                }
-            }
-            previous = a[1];
-        }
-
-        // the test point if past the last sub-interval
-        return new BoundaryProjection<Euclidean1D>(point, finiteOrNullPoint(previous), x - previous);
-
-    }
-
-    /** Build a finite point.
-     * @param x abscissa of the point
-     * @return a new point for finite abscissa, null otherwise
-     */
-    private Vector1D finiteOrNullPoint(final double x) {
-        return Double.isInfinite(x) ? null : new Vector1D(x);
-    }
-
-    /** Build an ordered list of intervals representing the instance.
-     * <p>This method builds this intervals set as an ordered list of
-     * {@link Interval Interval} elements. If the intervals set has no
-     * lower limit, the first interval will have its low bound equal to
-     * {@code Double.NEGATIVE_INFINITY}. If the intervals set has
-     * no upper limit, the last interval will have its upper bound equal
-     * to {@code Double.POSITIVE_INFINITY}. An empty tree will
-     * build an empty list while a tree representing the whole real line
-     * will build a one element list with both bounds being
-     * infinite.</p>
-     * @return a new ordered list containing {@link Interval Interval}
-     * elements
-     */
-    public List<Interval> asList() {
-        final List<Interval> list = new ArrayList<Interval>();
-        for (final double[] a : this) {
-            list.add(new Interval(a[0], a[1]));
-        }
-        return list;
-    }
-
-    /** Get the first leaf node of a tree.
-     * @param root tree root
-     * @return first leaf node
-     */
-    private BSPTree<Euclidean1D> getFirstLeaf(final BSPTree<Euclidean1D> root) {
-
-        if (root.getCut() == null) {
-            return root;
-        }
-
-        // find the smallest internal node
-        BSPTree<Euclidean1D> smallest = null;
-        for (BSPTree<Euclidean1D> n = root; n != null; n = previousInternalNode(n)) {
-            smallest = n;
-        }
-
-        return leafBefore(smallest);
-
-    }
-
-    /** Get the node corresponding to the first interval boundary.
-     * @return smallest internal node,
-     * or null if there are no internal nodes (i.e. the set is either empty or covers the real line)
-     */
-    private BSPTree<Euclidean1D> getFirstIntervalBoundary() {
-
-        // start search at the tree root
-        BSPTree<Euclidean1D> node = getTree(false);
-        if (node.getCut() == null) {
-            return null;
-        }
-
-        // walk tree until we find the smallest internal node
-        node = getFirstLeaf(node).getParent();
-
-        // walk tree until we find an interval boundary
-        while (node != null && !(isIntervalStart(node) || isIntervalEnd(node))) {
-            node = nextInternalNode(node);
-        }
-
-        return node;
-
-    }
-
-    /** Check if an internal node corresponds to the start abscissa of an interval.
-     * @param node internal node to check
-     * @return true if the node corresponds to the start abscissa of an interval
-     */
-    private boolean isIntervalStart(final BSPTree<Euclidean1D> node) {
-
-        if ((Boolean) leafBefore(node).getAttribute()) {
-            // it has an inside cell before it, it may end an interval but not start it
-            return false;
-        }
-
-        if (!(Boolean) leafAfter(node).getAttribute()) {
-            // it has an outside cell after it, it is a dummy cut away from real intervals
-            return false;
-        }
-
-        // the cell has an outside before and an inside after it
-        // it is the start of an interval
-        return true;
-
-    }
-
-    /** Check if an internal node corresponds to the end abscissa of an interval.
-     * @param node internal node to check
-     * @return true if the node corresponds to the end abscissa of an interval
-     */
-    private boolean isIntervalEnd(final BSPTree<Euclidean1D> node) {
-
-        if (!(Boolean) leafBefore(node).getAttribute()) {
-            // it has an outside cell before it, it may start an interval but not end it
-            return false;
-        }
-
-        if ((Boolean) leafAfter(node).getAttribute()) {
-            // it has an inside cell after it, it is a dummy cut in the middle of an interval
-            return false;
-        }
-
-        // the cell has an inside before and an outside after it
-        // it is the end of an interval
-        return true;
-
-    }
-
-    /** Get the next internal node.
-     * @param node current internal node
-     * @return next internal node in ascending order, or null
-     * if this is the last internal node
-     */
-    private BSPTree<Euclidean1D> nextInternalNode(BSPTree<Euclidean1D> node) {
-
-        if (childAfter(node).getCut() != null) {
-            // the next node is in the sub-tree
-            return leafAfter(node).getParent();
-        }
-
-        // there is nothing left deeper in the tree, we backtrack
-        while (isAfterParent(node)) {
-            node = node.getParent();
-        }
-        return node.getParent();
-
-    }
-
-    /** Get the previous internal node.
-     * @param node current internal node
-     * @return previous internal node in ascending order, or null
-     * if this is the first internal node
-     */
-    private BSPTree<Euclidean1D> previousInternalNode(BSPTree<Euclidean1D> node) {
-
-        if (childBefore(node).getCut() != null) {
-            // the next node is in the sub-tree
-            return leafBefore(node).getParent();
-        }
-
-        // there is nothing left deeper in the tree, we backtrack
-        while (isBeforeParent(node)) {
-            node = node.getParent();
-        }
-        return node.getParent();
-
-    }
-
-    /** Find the leaf node just before an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return leaf node just before the internal node
-     */
-    private BSPTree<Euclidean1D> leafBefore(BSPTree<Euclidean1D> node) {
-
-        node = childBefore(node);
-        while (node.getCut() != null) {
-            node = childAfter(node);
-        }
-
-        return node;
-
-    }
-
-    /** Find the leaf node just after an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return leaf node just after the internal node
-     */
-    private BSPTree<Euclidean1D> leafAfter(BSPTree<Euclidean1D> node) {
-
-        node = childAfter(node);
-        while (node.getCut() != null) {
-            node = childBefore(node);
-        }
-
-        return node;
-
-    }
-
-    /** Check if a node is the child before its parent in ascending order.
-     * @param node child node considered
-     * @return true is the node has a parent end is before it in ascending order
-     */
-    private boolean isBeforeParent(final BSPTree<Euclidean1D> node) {
-        final BSPTree<Euclidean1D> parent = node.getParent();
-        if (parent == null) {
-            return false;
-        } else {
-            return node == childBefore(parent);
-        }
-    }
-
-    /** Check if a node is the child after its parent in ascending order.
-     * @param node child node considered
-     * @return true is the node has a parent end is after it in ascending order
-     */
-    private boolean isAfterParent(final BSPTree<Euclidean1D> node) {
-        final BSPTree<Euclidean1D> parent = node.getParent();
-        if (parent == null) {
-            return false;
-        } else {
-            return node == childAfter(parent);
-        }
-    }
-
-    /** Find the child node just before an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return child node just before the internal node
-     */
-    private BSPTree<Euclidean1D> childBefore(BSPTree<Euclidean1D> node) {
-        if (isDirect(node)) {
-            // smaller abscissas are on minus side, larger abscissas are on plus side
-            return node.getMinus();
-        } else {
-            // smaller abscissas are on plus side, larger abscissas are on minus side
-            return node.getPlus();
-        }
-    }
-
-    /** Find the child node just after an internal node.
-     * @param node internal node at which the sub-tree starts
-     * @return child node just after the internal node
-     */
-    private BSPTree<Euclidean1D> childAfter(BSPTree<Euclidean1D> node) {
-        if (isDirect(node)) {
-            // smaller abscissas are on minus side, larger abscissas are on plus side
-            return node.getPlus();
-        } else {
-            // smaller abscissas are on plus side, larger abscissas are on minus side
-            return node.getMinus();
-        }
-    }
-
-    /** Check if an internal node has a direct oriented point.
-     * @param node internal node to check
-     * @return true if the oriented point is direct
-     */
-    private boolean isDirect(final BSPTree<Euclidean1D> node) {
-        return ((OrientedPoint) node.getCut().getHyperplane()).isDirect();
-    }
-
-    /** Get the abscissa of an internal node.
-     * @param node internal node to check
-     * @return abscissa
-     */
-    private double getAngle(final BSPTree<Euclidean1D> node) {
-        return ((OrientedPoint) node.getCut().getHyperplane()).getLocation().getX();
-    }
-
-    /** {@inheritDoc}
-     * <p>
-     * The iterator returns the limit values of sub-intervals in ascending order.
-     * </p>
-     * <p>
-     * The iterator does <em>not</em> support the optional {@code remove} operation.
-     * </p>
-     * @since 3.3
-     */
-    public Iterator<double[]> iterator() {
-        return new SubIntervalsIterator();
-    }
-
-    /** Local iterator for sub-intervals. */
-    private class SubIntervalsIterator implements Iterator<double[]> {
-
-        /** Current node. */
-        private BSPTree<Euclidean1D> current;
-
-        /** Sub-interval no yet returned. */
-        private double[] pending;
-
-        /** Simple constructor.
-         */
-        public SubIntervalsIterator() {
-
-            current = getFirstIntervalBoundary();
-
-            if (current == null) {
-                // all the leaf tree nodes share the same inside/outside status
-                if ((Boolean) getFirstLeaf(getTree(false)).getAttribute()) {
-                    // it is an inside node, it represents the full real line
-                    pending = new double[] {
-                        Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY
-                    };
-                } else {
-                    pending = null;
-                }
-            } else if (isIntervalEnd(current)) {
-                // the first boundary is an interval end,
-                // so the first interval starts at infinity
-                pending = new double[] {
-                    Double.NEGATIVE_INFINITY, getAngle(current)
-                };
-            } else {
-                selectPending();
-            }
-        }
-
-        /** Walk the tree to select the pending sub-interval.
-         */
-        private void selectPending() {
-
-            // look for the start of the interval
-            BSPTree<Euclidean1D> start = current;
-            while (start != null && !isIntervalStart(start)) {
-                start = nextInternalNode(start);
-            }
-
-            if (start == null) {
-                // we have exhausted the iterator
-                current = null;
-                pending = null;
-                return;
-            }
-
-            // look for the end of the interval
-            BSPTree<Euclidean1D> end = start;
-            while (end != null && !isIntervalEnd(end)) {
-                end = nextInternalNode(end);
-            }
-
-            if (end != null) {
-
-                // we have identified the interval
-                pending = new double[] {
-                    getAngle(start), getAngle(end)
-                };
-
-                // prepare search for next interval
-                current = end;
-
-            } else {
-
-                // the final interval is open toward infinity
-                pending = new double[] {
-                    getAngle(start), Double.POSITIVE_INFINITY
-                };
-
-                // there won't be any other intervals
-                current = null;
-
-            }
-
-        }
-
-        /** {@inheritDoc} */
-        public boolean hasNext() {
-            return pending != null;
-        }
-
-        /** {@inheritDoc} */
-        public double[] next() {
-            if (pending == null) {
-                throw new NoSuchElementException();
-            }
-            final double[] next = pending;
-            selectPending();
-            return next;
-        }
-
-        /** {@inheritDoc} */
-        public void remove() {
-            throw new UnsupportedOperationException();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/OrientedPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/OrientedPoint.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/OrientedPoint.java
deleted file mode 100644
index 512bf5d..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/oned/OrientedPoint.java
+++ /dev/null
@@ -1,153 +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.geometry.euclidean.oned;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-
-/** This class represents a 1D oriented hyperplane.
- * <p>An hyperplane in 1D is a simple point, its orientation being a
- * boolean.</p>
- * <p>Instances of this class are guaranteed to be immutable.</p>
- * @since 3.0
- */
-public class OrientedPoint implements Hyperplane<Euclidean1D> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Vector location. */
-    private Vector1D location;
-
-    /** Orientation. */
-    private boolean direct;
-
-    /** Tolerance below which points are considered to belong to the hyperplane. */
-    private final double tolerance;
-
-    /** Simple constructor.
-     * @param location location of the hyperplane
-     * @param direct if true, the plus side of the hyperplane is towards
-     * abscissas greater than {@code location}
-     * @param tolerance tolerance below which points are considered to belong to the hyperplane
-     * @since 3.3
-     */
-    public OrientedPoint(final Vector1D location, final boolean direct, final double tolerance) {
-        this.location  = location;
-        this.direct    = direct;
-        this.tolerance = tolerance;
-    }
-
-    /** Simple constructor.
-     * @param location location of the hyperplane
-     * @param direct if true, the plus side of the hyperplane is towards
-     * abscissas greater than {@code location}
-     * @deprecated as of 3.3, replaced with {@link #OrientedPoint(Vector1D, boolean, double)}
-     */
-    @Deprecated
-    public OrientedPoint(final Vector1D location, final boolean direct) {
-        this(location, direct, DEFAULT_TOLERANCE);
-    }
-
-    /** Copy the instance.
-     * <p>Since instances are immutable, this method directly returns
-     * the instance.</p>
-     * @return the instance itself
-     */
-    public OrientedPoint copySelf() {
-        return this;
-    }
-
-    /** Get the offset (oriented distance) of a vector.
-     * @param vector vector to check
-     * @return offset of the vector
-     */
-    public double getOffset(Vector<Euclidean1D> vector) {
-        return getOffset((Point<Euclidean1D>) vector);
-    }
-
-    /** {@inheritDoc} */
-    public double getOffset(final Point<Euclidean1D> point) {
-        final double delta = ((Vector1D) point).getX() - location.getX();
-        return direct ? delta : -delta;
-    }
-
-    /** Build a region covering the whole hyperplane.
-     * <p>Since this class represent zero dimension spaces which does
-     * not have lower dimension sub-spaces, this method returns a dummy
-     * implementation of a {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane SubHyperplane}.
-     * This implementation is only used to allow the {@link
-     * org.apache.commons.math3.geometry.partitioning.SubHyperplane
-     * SubHyperplane} class implementation to work properly, it should
-     * <em>not</em> be used otherwise.</p>
-     * @return a dummy sub hyperplane
-     */
-    public SubOrientedPoint wholeHyperplane() {
-        return new SubOrientedPoint(this, null);
-    }
-
-    /** Build a region covering the whole space.
-     * @return a region containing the instance (really an {@link
-     * IntervalsSet IntervalsSet} instance)
-     */
-    public IntervalsSet wholeSpace() {
-        return new IntervalsSet(tolerance);
-    }
-
-    /** {@inheritDoc} */
-    public boolean sameOrientationAs(final Hyperplane<Euclidean1D> other) {
-        return !(direct ^ ((OrientedPoint) other).direct);
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    public Point<Euclidean1D> project(Point<Euclidean1D> point) {
-        return location;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /** Get the hyperplane location on the real line.
-     * @return the hyperplane location
-     */
-    public Vector1D getLocation() {
-        return location;
-    }
-
-    /** Check if the hyperplane orientation is direct.
-     * @return true if the plus side of the hyperplane is towards
-     * abscissae greater than hyperplane location
-     */
-    public boolean isDirect() {
-        return direct;
-    }
-
-    /** Revert the instance.
-     */
-    public void revertSelf() {
-        direct = !direct;
-    }
-
-}


[19/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3D.java
deleted file mode 100644
index 0bd04e5..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/FieldVector3D.java
+++ /dev/null
@@ -1,1185 +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.geometry.euclidean.threed;
-
-import java.io.Serializable;
-import java.text.NumberFormat;
-
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * This class is a re-implementation of {@link Vector3D} using {@link RealFieldElement}.
- * <p>Instance of this class are guaranteed to be immutable.</p>
- * @param <T> the type of the field elements
- * @since 3.2
- */
-public class FieldVector3D<T extends RealFieldElement<T>> implements Serializable {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20130224L;
-
-    /** Abscissa. */
-    private final T x;
-
-    /** Ordinate. */
-    private final T y;
-
-    /** Height. */
-    private final T z;
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param x abscissa
-     * @param y ordinate
-     * @param z height
-     * @see #getX()
-     * @see #getY()
-     * @see #getZ()
-     */
-    public FieldVector3D(final T x, final T y, final T z) {
-        this.x = x;
-        this.y = y;
-        this.z = z;
-    }
-
-    /** Simple constructor.
-     * Build a vector from its coordinates
-     * @param v coordinates array
-     * @exception DimensionMismatchException if array does not have 3 elements
-     * @see #toArray()
-     */
-    public FieldVector3D(final T[] v) throws DimensionMismatchException {
-        if (v.length != 3) {
-            throw new DimensionMismatchException(v.length, 3);
-        }
-        this.x = v[0];
-        this.y = v[1];
-        this.z = v[2];
-    }
-
-    /** Simple constructor.
-     * Build a vector from its azimuthal coordinates
-     * @param alpha azimuth (&alpha;) around Z
-     *              (0 is +X, &pi;/2 is +Y, &pi; is -X and 3&pi;/2 is -Y)
-     * @param delta elevation (&delta;) above (XY) plane, from -&pi;/2 to +&pi;/2
-     * @see #getAlpha()
-     * @see #getDelta()
-     */
-    public FieldVector3D(final T alpha, final T delta) {
-        T cosDelta = delta.cos();
-        this.x = alpha.cos().multiply(cosDelta);
-        this.y = alpha.sin().multiply(cosDelta);
-        this.z = delta.sin();
-    }
-
-    /** Multiplicative constructor
-     * Build a vector from another one and a scale factor.
-     * The vector built will be a * u
-     * @param a scale factor
-     * @param u base (unscaled) vector
-     */
-    public FieldVector3D(final T a, final FieldVector3D<T>u) {
-        this.x = a.multiply(u.x);
-        this.y = a.multiply(u.y);
-        this.z = a.multiply(u.z);
-    }
-
-    /** Multiplicative constructor
-     * Build a vector from another one and a scale factor.
-     * The vector built will be a * u
-     * @param a scale factor
-     * @param u base (unscaled) vector
-     */
-    public FieldVector3D(final T a, final Vector3D u) {
-        this.x = a.multiply(u.getX());
-        this.y = a.multiply(u.getY());
-        this.z = a.multiply(u.getZ());
-    }
-
-    /** Multiplicative constructor
-     * Build a vector from another one and a scale factor.
-     * The vector built will be a * u
-     * @param a scale factor
-     * @param u base (unscaled) vector
-     */
-    public FieldVector3D(final double a, final FieldVector3D<T> u) {
-        this.x = u.x.multiply(a);
-        this.y = u.y.multiply(a);
-        this.z = u.z.multiply(a);
-    }
-
-    /** Linear constructor
-     * Build a vector from two other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     */
-    public FieldVector3D(final T a1, final FieldVector3D<T> u1,
-                         final T a2, final FieldVector3D<T> u2) {
-        final T prototype = a1;
-        this.x = prototype.linearCombination(a1, u1.getX(), a2, u2.getX());
-        this.y = prototype.linearCombination(a1, u1.getY(), a2, u2.getY());
-        this.z = prototype.linearCombination(a1, u1.getZ(), a2, u2.getZ());
-    }
-
-    /** Linear constructor
-     * Build a vector from two other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     */
-    public FieldVector3D(final T a1, final Vector3D u1,
-                         final T a2, final Vector3D u2) {
-        final T prototype = a1;
-        this.x = prototype.linearCombination(u1.getX(), a1, u2.getX(), a2);
-        this.y = prototype.linearCombination(u1.getY(), a1, u2.getY(), a2);
-        this.z = prototype.linearCombination(u1.getZ(), a1, u2.getZ(), a2);
-    }
-
-    /** Linear constructor
-     * Build a vector from two other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     */
-    public FieldVector3D(final double a1, final FieldVector3D<T> u1,
-                         final double a2, final FieldVector3D<T> u2) {
-        final T prototype = u1.getX();
-        this.x = prototype.linearCombination(a1, u1.getX(), a2, u2.getX());
-        this.y = prototype.linearCombination(a1, u1.getY(), a2, u2.getY());
-        this.z = prototype.linearCombination(a1, u1.getZ(), a2, u2.getZ());
-    }
-
-    /** Linear constructor
-     * Build a vector from three other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     */
-    public FieldVector3D(final T a1, final FieldVector3D<T> u1,
-                         final T a2, final FieldVector3D<T> u2,
-                         final T a3, final FieldVector3D<T> u3) {
-        final T prototype = a1;
-        this.x = prototype.linearCombination(a1, u1.getX(), a2, u2.getX(), a3, u3.getX());
-        this.y = prototype.linearCombination(a1, u1.getY(), a2, u2.getY(), a3, u3.getY());
-        this.z = prototype.linearCombination(a1, u1.getZ(), a2, u2.getZ(), a3, u3.getZ());
-    }
-
-    /** Linear constructor
-     * Build a vector from three other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     */
-    public FieldVector3D(final T a1, final Vector3D u1,
-                         final T a2, final Vector3D u2,
-                         final T a3, final Vector3D u3) {
-        final T prototype = a1;
-        this.x = prototype.linearCombination(u1.getX(), a1, u2.getX(), a2, u3.getX(), a3);
-        this.y = prototype.linearCombination(u1.getY(), a1, u2.getY(), a2, u3.getY(), a3);
-        this.z = prototype.linearCombination(u1.getZ(), a1, u2.getZ(), a2, u3.getZ(), a3);
-    }
-
-    /** Linear constructor
-     * Build a vector from three other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     */
-    public FieldVector3D(final double a1, final FieldVector3D<T> u1,
-                         final double a2, final FieldVector3D<T> u2,
-                         final double a3, final FieldVector3D<T> u3) {
-        final T prototype = u1.getX();
-        this.x = prototype.linearCombination(a1, u1.getX(), a2, u2.getX(), a3, u3.getX());
-        this.y = prototype.linearCombination(a1, u1.getY(), a2, u2.getY(), a3, u3.getY());
-        this.z = prototype.linearCombination(a1, u1.getZ(), a2, u2.getZ(), a3, u3.getZ());
-    }
-
-    /** Linear constructor
-     * Build a vector from four other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     * @param a4 fourth scale factor
-     * @param u4 fourth base (unscaled) vector
-     */
-    public FieldVector3D(final T a1, final FieldVector3D<T> u1,
-                         final T a2, final FieldVector3D<T> u2,
-                         final T a3, final FieldVector3D<T> u3,
-                         final T a4, final FieldVector3D<T> u4) {
-        final T prototype = a1;
-        this.x = prototype.linearCombination(a1, u1.getX(), a2, u2.getX(), a3, u3.getX(), a4, u4.getX());
-        this.y = prototype.linearCombination(a1, u1.getY(), a2, u2.getY(), a3, u3.getY(), a4, u4.getY());
-        this.z = prototype.linearCombination(a1, u1.getZ(), a2, u2.getZ(), a3, u3.getZ(), a4, u4.getZ());
-    }
-
-    /** Linear constructor
-     * Build a vector from four other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     * @param a4 fourth scale factor
-     * @param u4 fourth base (unscaled) vector
-     */
-    public FieldVector3D(final T a1, final Vector3D u1,
-                         final T a2, final Vector3D u2,
-                         final T a3, final Vector3D u3,
-                         final T a4, final Vector3D u4) {
-        final T prototype = a1;
-        this.x = prototype.linearCombination(u1.getX(), a1, u2.getX(), a2, u3.getX(), a3, u4.getX(), a4);
-        this.y = prototype.linearCombination(u1.getY(), a1, u2.getY(), a2, u3.getY(), a3, u4.getY(), a4);
-        this.z = prototype.linearCombination(u1.getZ(), a1, u2.getZ(), a2, u3.getZ(), a3, u4.getZ(), a4);
-    }
-
-    /** Linear constructor
-     * Build a vector from four other ones and corresponding scale factors.
-     * The vector built will be a1 * u1 + a2 * u2 + a3 * u3 + a4 * u4
-     * @param a1 first scale factor
-     * @param u1 first base (unscaled) vector
-     * @param a2 second scale factor
-     * @param u2 second base (unscaled) vector
-     * @param a3 third scale factor
-     * @param u3 third base (unscaled) vector
-     * @param a4 fourth scale factor
-     * @param u4 fourth base (unscaled) vector
-     */
-    public FieldVector3D(final double a1, final FieldVector3D<T> u1,
-                         final double a2, final FieldVector3D<T> u2,
-                         final double a3, final FieldVector3D<T> u3,
-                         final double a4, final FieldVector3D<T> u4) {
-        final T prototype = u1.getX();
-        this.x = prototype.linearCombination(a1, u1.getX(), a2, u2.getX(), a3, u3.getX(), a4, u4.getX());
-        this.y = prototype.linearCombination(a1, u1.getY(), a2, u2.getY(), a3, u3.getY(), a4, u4.getY());
-        this.z = prototype.linearCombination(a1, u1.getZ(), a2, u2.getZ(), a3, u3.getZ(), a4, u4.getZ());
-    }
-
-    /** Get the abscissa of the vector.
-     * @return abscissa of the vector
-     * @see #FieldVector3D(RealFieldElement, RealFieldElement, RealFieldElement)
-     */
-    public T getX() {
-        return x;
-    }
-
-    /** Get the ordinate of the vector.
-     * @return ordinate of the vector
-     * @see #FieldVector3D(RealFieldElement, RealFieldElement, RealFieldElement)
-     */
-    public T getY() {
-        return y;
-    }
-
-    /** Get the height of the vector.
-     * @return height of the vector
-     * @see #FieldVector3D(RealFieldElement, RealFieldElement, RealFieldElement)
-     */
-    public T getZ() {
-        return z;
-    }
-
-    /** Get the vector coordinates as a dimension 3 array.
-     * @return vector coordinates
-     * @see #FieldVector3D(RealFieldElement[])
-     */
-    public T[] toArray() {
-        final T[] array = MathArrays.buildArray(x.getField(), 3);
-        array[0] = x;
-        array[1] = y;
-        array[2] = z;
-        return array;
-    }
-
-    /** Convert to a constant vector without derivatives.
-     * @return a constant vector
-     */
-    public Vector3D toVector3D() {
-        return new Vector3D(x.getReal(), y.getReal(), z.getReal());
-    }
-
-    /** Get the L<sub>1</sub> norm for the vector.
-     * @return L<sub>1</sub> norm for the vector
-     */
-    public T getNorm1() {
-        return x.abs().add(y.abs()).add(z.abs());
-    }
-
-    /** Get the L<sub>2</sub> norm for the vector.
-     * @return Euclidean norm for the vector
-     */
-    public T getNorm() {
-        // there are no cancellation problems here, so we use the straightforward formula
-        return x.multiply(x).add(y.multiply(y)).add(z.multiply(z)).sqrt();
-    }
-
-    /** Get the square of the norm for the vector.
-     * @return square of the Euclidean norm for the vector
-     */
-    public T getNormSq() {
-        // there are no cancellation problems here, so we use the straightforward formula
-        return x.multiply(x).add(y.multiply(y)).add(z.multiply(z));
-    }
-
-    /** Get the L<sub>&infin;</sub> norm for the vector.
-     * @return L<sub>&infin;</sub> norm for the vector
-     */
-    public T getNormInf() {
-        final T xAbs = x.abs();
-        final T yAbs = y.abs();
-        final T zAbs = z.abs();
-        if (xAbs.getReal() <= yAbs.getReal()) {
-            if (yAbs.getReal() <= zAbs.getReal()) {
-                return zAbs;
-            } else {
-                return yAbs;
-            }
-        } else {
-            if (xAbs.getReal() <= zAbs.getReal()) {
-                return zAbs;
-            } else {
-                return xAbs;
-            }
-        }
-    }
-
-    /** Get the azimuth of the vector.
-     * @return azimuth (&alpha;) of the vector, between -&pi; and +&pi;
-     * @see #FieldVector3D(RealFieldElement, RealFieldElement)
-     */
-    public T getAlpha() {
-        return y.atan2(x);
-    }
-
-    /** Get the elevation of the vector.
-     * @return elevation (&delta;) of the vector, between -&pi;/2 and +&pi;/2
-     * @see #FieldVector3D(RealFieldElement, RealFieldElement)
-     */
-    public T getDelta() {
-        return z.divide(getNorm()).asin();
-    }
-
-    /** Add a vector to the instance.
-     * @param v vector to add
-     * @return a new vector
-     */
-    public FieldVector3D<T> add(final FieldVector3D<T> v) {
-        return new FieldVector3D<T>(x.add(v.x), y.add(v.y), z.add(v.z));
-    }
-
-    /** Add a vector to the instance.
-     * @param v vector to add
-     * @return a new vector
-     */
-    public FieldVector3D<T> add(final Vector3D v) {
-        return new FieldVector3D<T>(x.add(v.getX()), y.add(v.getY()), z.add(v.getZ()));
-    }
-
-    /** Add a scaled vector to the instance.
-     * @param factor scale factor to apply to v before adding it
-     * @param v vector to add
-     * @return a new vector
-     */
-    public FieldVector3D<T> add(final T factor, final FieldVector3D<T> v) {
-        return new FieldVector3D<T>(x.getField().getOne(), this, factor, v);
-    }
-
-    /** Add a scaled vector to the instance.
-     * @param factor scale factor to apply to v before adding it
-     * @param v vector to add
-     * @return a new vector
-     */
-    public FieldVector3D<T> add(final T factor, final Vector3D v) {
-        return new FieldVector3D<T>(x.add(factor.multiply(v.getX())),
-                                    y.add(factor.multiply(v.getY())),
-                                    z.add(factor.multiply(v.getZ())));
-    }
-
-    /** Add a scaled vector to the instance.
-     * @param factor scale factor to apply to v before adding it
-     * @param v vector to add
-     * @return a new vector
-     */
-    public FieldVector3D<T> add(final double factor, final FieldVector3D<T> v) {
-        return new FieldVector3D<T>(1.0, this, factor, v);
-    }
-
-    /** Add a scaled vector to the instance.
-     * @param factor scale factor to apply to v before adding it
-     * @param v vector to add
-     * @return a new vector
-     */
-    public FieldVector3D<T> add(final double factor, final Vector3D v) {
-        return new FieldVector3D<T>(x.add(factor * v.getX()),
-                                    y.add(factor * v.getY()),
-                                    z.add(factor * v.getZ()));
-    }
-
-    /** Subtract a vector from the instance.
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    public FieldVector3D<T> subtract(final FieldVector3D<T> v) {
-        return new FieldVector3D<T>(x.subtract(v.x), y.subtract(v.y), z.subtract(v.z));
-    }
-
-    /** Subtract a vector from the instance.
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    public FieldVector3D<T> subtract(final Vector3D v) {
-        return new FieldVector3D<T>(x.subtract(v.getX()), y.subtract(v.getY()), z.subtract(v.getZ()));
-    }
-
-    /** Subtract a scaled vector from the instance.
-     * @param factor scale factor to apply to v before subtracting it
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    public FieldVector3D<T> subtract(final T factor, final FieldVector3D<T> v) {
-        return new FieldVector3D<T>(x.getField().getOne(), this, factor.negate(), v);
-    }
-
-    /** Subtract a scaled vector from the instance.
-     * @param factor scale factor to apply to v before subtracting it
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    public FieldVector3D<T> subtract(final T factor, final Vector3D v) {
-        return new FieldVector3D<T>(x.subtract(factor.multiply(v.getX())),
-                                    y.subtract(factor.multiply(v.getY())),
-                                    z.subtract(factor.multiply(v.getZ())));
-    }
-
-    /** Subtract a scaled vector from the instance.
-     * @param factor scale factor to apply to v before subtracting it
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    public FieldVector3D<T> subtract(final double factor, final FieldVector3D<T> v) {
-        return new FieldVector3D<T>(1.0, this, -factor, v);
-    }
-
-    /** Subtract a scaled vector from the instance.
-     * @param factor scale factor to apply to v before subtracting it
-     * @param v vector to subtract
-     * @return a new vector
-     */
-    public FieldVector3D<T> subtract(final double factor, final Vector3D v) {
-        return new FieldVector3D<T>(x.subtract(factor * v.getX()),
-                                    y.subtract(factor * v.getY()),
-                                    z.subtract(factor * v.getZ()));
-    }
-
-    /** Get a normalized vector aligned with the instance.
-     * @return a new normalized vector
-     * @exception MathArithmeticException if the norm is zero
-     */
-    public FieldVector3D<T> normalize() throws MathArithmeticException {
-        final T s = getNorm();
-        if (s.getReal() == 0) {
-            throw new MathArithmeticException(LocalizedFormats.CANNOT_NORMALIZE_A_ZERO_NORM_VECTOR);
-        }
-        return scalarMultiply(s.reciprocal());
-    }
-
-    /** Get a vector orthogonal to the instance.
-     * <p>There are an infinite number of normalized vectors orthogonal
-     * to the instance. This method picks up one of them almost
-     * arbitrarily. It is useful when one needs to compute a reference
-     * frame with one of the axes in a predefined direction. The
-     * following example shows how to build a frame having the k axis
-     * aligned with the known vector u :
-     * <pre><code>
-     *   Vector3D k = u.normalize();
-     *   Vector3D i = k.orthogonal();
-     *   Vector3D j = Vector3D.crossProduct(k, i);
-     * </code></pre></p>
-     * @return a new normalized vector orthogonal to the instance
-     * @exception MathArithmeticException if the norm of the instance is null
-     */
-    public FieldVector3D<T> orthogonal() throws MathArithmeticException {
-
-        final double threshold = 0.6 * getNorm().getReal();
-        if (threshold == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-
-        if (FastMath.abs(x.getReal()) <= threshold) {
-            final T inverse  = y.multiply(y).add(z.multiply(z)).sqrt().reciprocal();
-            return new FieldVector3D<T>(inverse.getField().getZero(), inverse.multiply(z), inverse.multiply(y).negate());
-        } else if (FastMath.abs(y.getReal()) <= threshold) {
-            final T inverse  = x.multiply(x).add(z.multiply(z)).sqrt().reciprocal();
-            return new FieldVector3D<T>(inverse.multiply(z).negate(), inverse.getField().getZero(), inverse.multiply(x));
-        } else {
-            final T inverse  = x.multiply(x).add(y.multiply(y)).sqrt().reciprocal();
-            return new FieldVector3D<T>(inverse.multiply(y), inverse.multiply(x).negate(), inverse.getField().getZero());
-        }
-
-    }
-
-    /** Compute the angular separation between two vectors.
-     * <p>This method computes the angular separation between two
-     * vectors using the dot product for well separated vectors and the
-     * cross product for almost aligned vectors. This allows to have a
-     * good accuracy in all cases, even for vectors very close to each
-     * other.</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return angular separation between v1 and v2
-     * @exception MathArithmeticException if either vector has a null norm
-     */
-    public static <T extends RealFieldElement<T>> T angle(final FieldVector3D<T> v1, final FieldVector3D<T> v2)
-        throws MathArithmeticException {
-
-        final T normProduct = v1.getNorm().multiply(v2.getNorm());
-        if (normProduct.getReal() == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-
-        final T dot = dotProduct(v1, v2);
-        final double threshold = normProduct.getReal() * 0.9999;
-        if ((dot.getReal() < -threshold) || (dot.getReal() > threshold)) {
-            // the vectors are almost aligned, compute using the sine
-            FieldVector3D<T> v3 = crossProduct(v1, v2);
-            if (dot.getReal() >= 0) {
-                return v3.getNorm().divide(normProduct).asin();
-            }
-            return v3.getNorm().divide(normProduct).asin().subtract(FastMath.PI).negate();
-        }
-
-        // the vectors are sufficiently separated to use the cosine
-        return dot.divide(normProduct).acos();
-
-    }
-
-    /** Compute the angular separation between two vectors.
-     * <p>This method computes the angular separation between two
-     * vectors using the dot product for well separated vectors and the
-     * cross product for almost aligned vectors. This allows to have a
-     * good accuracy in all cases, even for vectors very close to each
-     * other.</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return angular separation between v1 and v2
-     * @exception MathArithmeticException if either vector has a null norm
-     */
-    public static <T extends RealFieldElement<T>> T angle(final FieldVector3D<T> v1, final Vector3D v2)
-        throws MathArithmeticException {
-
-        final T normProduct = v1.getNorm().multiply(v2.getNorm());
-        if (normProduct.getReal() == 0) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-
-        final T dot = dotProduct(v1, v2);
-        final double threshold = normProduct.getReal() * 0.9999;
-        if ((dot.getReal() < -threshold) || (dot.getReal() > threshold)) {
-            // the vectors are almost aligned, compute using the sine
-            FieldVector3D<T> v3 = crossProduct(v1, v2);
-            if (dot.getReal() >= 0) {
-                return v3.getNorm().divide(normProduct).asin();
-            }
-            return v3.getNorm().divide(normProduct).asin().subtract(FastMath.PI).negate();
-        }
-
-        // the vectors are sufficiently separated to use the cosine
-        return dot.divide(normProduct).acos();
-
-    }
-
-    /** Compute the angular separation between two vectors.
-     * <p>This method computes the angular separation between two
-     * vectors using the dot product for well separated vectors and the
-     * cross product for almost aligned vectors. This allows to have a
-     * good accuracy in all cases, even for vectors very close to each
-     * other.</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return angular separation between v1 and v2
-     * @exception MathArithmeticException if either vector has a null norm
-     */
-    public static <T extends RealFieldElement<T>> T angle(final Vector3D v1, final FieldVector3D<T> v2)
-        throws MathArithmeticException {
-        return angle(v2, v1);
-    }
-
-    /** Get the opposite of the instance.
-     * @return a new vector which is opposite to the instance
-     */
-    public FieldVector3D<T> negate() {
-        return new FieldVector3D<T>(x.negate(), y.negate(), z.negate());
-    }
-
-    /** Multiply the instance by a scalar.
-     * @param a scalar
-     * @return a new vector
-     */
-    public FieldVector3D<T> scalarMultiply(final T a) {
-        return new FieldVector3D<T>(x.multiply(a), y.multiply(a), z.multiply(a));
-    }
-
-    /** Multiply the instance by a scalar.
-     * @param a scalar
-     * @return a new vector
-     */
-    public FieldVector3D<T> scalarMultiply(final double a) {
-        return new FieldVector3D<T>(x.multiply(a), y.multiply(a), z.multiply(a));
-    }
-
-    /**
-     * Returns true if any coordinate of this vector is NaN; false otherwise
-     * @return  true if any coordinate of this vector is NaN; false otherwise
-     */
-    public boolean isNaN() {
-        return Double.isNaN(x.getReal()) || Double.isNaN(y.getReal()) || Double.isNaN(z.getReal());
-    }
-
-    /**
-     * Returns true if any coordinate of this vector is infinite and none are NaN;
-     * false otherwise
-     * @return  true if any coordinate of this vector is infinite and none are NaN;
-     * false otherwise
-     */
-    public boolean isInfinite() {
-        return !isNaN() && (Double.isInfinite(x.getReal()) || Double.isInfinite(y.getReal()) || Double.isInfinite(z.getReal()));
-    }
-
-    /**
-     * Test for the equality of two 3D vectors.
-     * <p>
-     * If all coordinates of two 3D vectors are exactly the same, and none of their
-     * {@link RealFieldElement#getReal() real part} are <code>NaN</code>, the
-     * two 3D vectors are considered to be equal.
-     * </p>
-     * <p>
-     * <code>NaN</code> coordinates are considered to affect globally the vector
-     * and be equals to each other - i.e, if either (or all) real part of the
-     * coordinates of the 3D vector are <code>NaN</code>, the 3D vector is <code>NaN</code>.
-     * </p>
-     *
-     * @param other Object to test for equality to this
-     * @return true if two 3D vector objects are equal, false if
-     *         object is null, not an instance of Vector3D, or
-     *         not equal to this Vector3D instance
-     *
-     */
-    @Override
-    public boolean equals(Object other) {
-
-        if (this == other) {
-            return true;
-        }
-
-        if (other instanceof FieldVector3D) {
-            @SuppressWarnings("unchecked")
-            final FieldVector3D<T> rhs = (FieldVector3D<T>) other;
-            if (rhs.isNaN()) {
-                return this.isNaN();
-            }
-
-            return x.equals(rhs.x) && y.equals(rhs.y) && z.equals(rhs.z);
-
-        }
-        return false;
-    }
-
-    /**
-     * Get a hashCode for the 3D vector.
-     * <p>
-     * All NaN values have the same hash code.</p>
-     *
-     * @return a hash code value for this object
-     */
-    @Override
-    public int hashCode() {
-        if (isNaN()) {
-            return 409;
-        }
-        return 311 * (107 * x.hashCode() + 83 * y.hashCode() +  z.hashCode());
-    }
-
-    /** Compute the dot-product of the instance and another vector.
-     * <p>
-     * The implementation uses specific multiplication and addition
-     * algorithms to preserve accuracy and reduce cancellation effects.
-     * It should be very accurate even for nearly orthogonal vectors.
-     * </p>
-     * @see MathArrays#linearCombination(double, double, double, double, double, double)
-     * @param v second vector
-     * @return the dot product this.v
-     */
-    public T dotProduct(final FieldVector3D<T> v) {
-        return x.linearCombination(x, v.x, y, v.y, z, v.z);
-    }
-
-    /** Compute the dot-product of the instance and another vector.
-     * <p>
-     * The implementation uses specific multiplication and addition
-     * algorithms to preserve accuracy and reduce cancellation effects.
-     * It should be very accurate even for nearly orthogonal vectors.
-     * </p>
-     * @see MathArrays#linearCombination(double, double, double, double, double, double)
-     * @param v second vector
-     * @return the dot product this.v
-     */
-    public T dotProduct(final Vector3D v) {
-        return x.linearCombination(v.getX(), x, v.getY(), y, v.getZ(), z);
-    }
-
-    /** Compute the cross-product of the instance with another vector.
-     * @param v other vector
-     * @return the cross product this ^ v as a new Vector3D
-     */
-    public FieldVector3D<T> crossProduct(final FieldVector3D<T> v) {
-        return new FieldVector3D<T>(x.linearCombination(y, v.z, z.negate(), v.y),
-                                    y.linearCombination(z, v.x, x.negate(), v.z),
-                                    z.linearCombination(x, v.y, y.negate(), v.x));
-    }
-
-    /** Compute the cross-product of the instance with another vector.
-     * @param v other vector
-     * @return the cross product this ^ v as a new Vector3D
-     */
-    public FieldVector3D<T> crossProduct(final Vector3D v) {
-        return new FieldVector3D<T>(x.linearCombination(v.getZ(), y, -v.getY(), z),
-                                    y.linearCombination(v.getX(), z, -v.getZ(), x),
-                                    z.linearCombination(v.getY(), x, -v.getX(), y));
-    }
-
-    /** Compute the distance between the instance and another vector according to the L<sub>1</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNorm1()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>1</sub> norm
-     */
-    public T distance1(final FieldVector3D<T> v) {
-        final T dx = v.x.subtract(x).abs();
-        final T dy = v.y.subtract(y).abs();
-        final T dz = v.z.subtract(z).abs();
-        return dx.add(dy).add(dz);
-    }
-
-    /** Compute the distance between the instance and another vector according to the L<sub>1</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNorm1()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>1</sub> norm
-     */
-    public T distance1(final Vector3D v) {
-        final T dx = x.subtract(v.getX()).abs();
-        final T dy = y.subtract(v.getY()).abs();
-        final T dz = z.subtract(v.getZ()).abs();
-        return dx.add(dy).add(dz);
-    }
-
-    /** Compute the distance between the instance and another vector according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>2</sub> norm
-     */
-    public T distance(final FieldVector3D<T> v) {
-        final T dx = v.x.subtract(x);
-        final T dy = v.y.subtract(y);
-        final T dz = v.z.subtract(z);
-        return dx.multiply(dx).add(dy.multiply(dy)).add(dz.multiply(dz)).sqrt();
-    }
-
-    /** Compute the distance between the instance and another vector according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>2</sub> norm
-     */
-    public T distance(final Vector3D v) {
-        final T dx = x.subtract(v.getX());
-        final T dy = y.subtract(v.getY());
-        final T dz = z.subtract(v.getZ());
-        return dx.multiply(dx).add(dy.multiply(dy)).add(dz.multiply(dz)).sqrt();
-    }
-
-    /** Compute the distance between the instance and another vector according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>&infin;</sub> norm
-     */
-    public T distanceInf(final FieldVector3D<T> v) {
-        final T dx = v.x.subtract(x).abs();
-        final T dy = v.y.subtract(y).abs();
-        final T dz = v.z.subtract(z).abs();
-        if (dx.getReal() <= dy.getReal()) {
-            if (dy.getReal() <= dz.getReal()) {
-                return dz;
-            } else {
-                return dy;
-            }
-        } else {
-            if (dx.getReal() <= dz.getReal()) {
-                return dz;
-            } else {
-                return dx;
-            }
-        }
-    }
-
-    /** Compute the distance between the instance and another vector according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the distance between the instance and p according to the L<sub>&infin;</sub> norm
-     */
-    public T distanceInf(final Vector3D v) {
-        final T dx = x.subtract(v.getX()).abs();
-        final T dy = y.subtract(v.getY()).abs();
-        final T dz = z.subtract(v.getZ()).abs();
-        if (dx.getReal() <= dy.getReal()) {
-            if (dy.getReal() <= dz.getReal()) {
-                return dz;
-            } else {
-                return dy;
-            }
-        } else {
-            if (dx.getReal() <= dz.getReal()) {
-                return dz;
-            } else {
-                return dx;
-            }
-        }
-    }
-
-    /** Compute the square of the distance between the instance and another vector.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the square of the distance between the instance and p
-     */
-    public T distanceSq(final FieldVector3D<T> v) {
-        final T dx = v.x.subtract(x);
-        final T dy = v.y.subtract(y);
-        final T dz = v.z.subtract(z);
-        return dx.multiply(dx).add(dy.multiply(dy)).add(dz.multiply(dz));
-    }
-
-    /** Compute the square of the distance between the instance and another vector.
-     * <p>Calling this method is equivalent to calling:
-     * <code>q.subtract(p).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param v second vector
-     * @return the square of the distance between the instance and p
-     */
-    public T distanceSq(final Vector3D v) {
-        final T dx = x.subtract(v.getX());
-        final T dy = y.subtract(v.getY());
-        final T dz = z.subtract(v.getZ());
-        return dx.multiply(dx).add(dy.multiply(dy)).add(dz.multiply(dz));
-    }
-
-    /** Compute the dot-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the dot product v1.v2
-     */
-    public static <T extends RealFieldElement<T>> T dotProduct(final FieldVector3D<T> v1,
-                                                                   final FieldVector3D<T> v2) {
-        return v1.dotProduct(v2);
-    }
-
-    /** Compute the dot-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the dot product v1.v2
-     */
-    public static <T extends RealFieldElement<T>> T dotProduct(final FieldVector3D<T> v1,
-                                                                   final Vector3D v2) {
-        return v1.dotProduct(v2);
-    }
-
-    /** Compute the dot-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the dot product v1.v2
-     */
-    public static <T extends RealFieldElement<T>> T dotProduct(final Vector3D v1,
-                                                                   final FieldVector3D<T> v2) {
-        return v2.dotProduct(v1);
-    }
-
-    /** Compute the cross-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the cross product v1 ^ v2 as a new Vector
-     */
-    public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(final FieldVector3D<T> v1,
-                                                                                    final FieldVector3D<T> v2) {
-        return v1.crossProduct(v2);
-    }
-
-    /** Compute the cross-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the cross product v1 ^ v2 as a new Vector
-     */
-    public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(final FieldVector3D<T> v1,
-                                                                                    final Vector3D v2) {
-        return v1.crossProduct(v2);
-    }
-
-    /** Compute the cross-product of two vectors.
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the cross product v1 ^ v2 as a new Vector
-     */
-    public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(final Vector3D v1,
-                                                                                    final FieldVector3D<T> v2) {
-        return new FieldVector3D<T>(v2.x.linearCombination(v1.getY(), v2.z, -v1.getZ(), v2.y),
-                                    v2.y.linearCombination(v1.getZ(), v2.x, -v1.getX(), v2.z),
-                                    v2.z.linearCombination(v1.getX(), v2.y, -v1.getY(), v2.x));
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>1</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm1()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>1</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distance1(final FieldVector3D<T> v1,
-                                                                  final FieldVector3D<T> v2) {
-        return v1.distance1(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>1</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm1()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>1</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distance1(final FieldVector3D<T> v1,
-                                                                  final Vector3D v2) {
-        return v1.distance1(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>1</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm1()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>1</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distance1(final Vector3D v1,
-                                                                  final FieldVector3D<T> v2) {
-        return v2.distance1(v1);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>2</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distance(final FieldVector3D<T> v1,
-                                                                 final FieldVector3D<T> v2) {
-        return v1.distance(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>2</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distance(final FieldVector3D<T> v1,
-                                                                 final Vector3D v2) {
-        return v1.distance(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>2</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNorm()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>2</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distance(final Vector3D v1,
-                                                                 final FieldVector3D<T> v2) {
-        return v2.distance(v1);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>&infin;</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distanceInf(final FieldVector3D<T> v1,
-                                                                    final FieldVector3D<T> v2) {
-        return v1.distanceInf(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>&infin;</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distanceInf(final FieldVector3D<T> v1,
-                                                                    final Vector3D v2) {
-        return v1.distanceInf(v2);
-    }
-
-    /** Compute the distance between two vectors according to the L<sub>&infin;</sub> norm.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormInf()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the distance between v1 and v2 according to the L<sub>&infin;</sub> norm
-     */
-    public static <T extends RealFieldElement<T>> T distanceInf(final Vector3D v1,
-                                                                    final FieldVector3D<T> v2) {
-        return v2.distanceInf(v1);
-    }
-
-    /** Compute the square of the distance between two vectors.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the square of the distance between v1 and v2
-     */
-    public static <T extends RealFieldElement<T>> T distanceSq(final FieldVector3D<T> v1,
-                                                                   final FieldVector3D<T> v2) {
-        return v1.distanceSq(v2);
-    }
-
-    /** Compute the square of the distance between two vectors.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the square of the distance between v1 and v2
-     */
-    public static <T extends RealFieldElement<T>> T distanceSq(final FieldVector3D<T> v1,
-                                                                   final Vector3D v2) {
-        return v1.distanceSq(v2);
-    }
-
-    /** Compute the square of the distance between two vectors.
-     * <p>Calling this method is equivalent to calling:
-     * <code>v1.subtract(v2).getNormSq()</code> except that no intermediate
-     * vector is built</p>
-     * @param v1 first vector
-     * @param v2 second vector
-     * @param <T> the type of the field elements
-     * @return the square of the distance between v1 and v2
-     */
-    public static <T extends RealFieldElement<T>> T distanceSq(final Vector3D v1,
-                                                                   final FieldVector3D<T> v2) {
-        return v2.distanceSq(v1);
-    }
-
-    /** Get a string representation of this vector.
-     * @return a string representation of this vector
-     */
-    @Override
-    public String toString() {
-        return Vector3DFormat.getInstance().format(toVector3D());
-    }
-
-    /** Get a string representation of this vector.
-     * @param format the custom format for components
-     * @return a string representation of this vector
-     */
-    public String toString(final NumberFormat format) {
-        return new Vector3DFormat(format).format(toVector3D());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java
deleted file mode 100644
index e234495..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Line.java
+++ /dev/null
@@ -1,275 +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.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.IntervalsSet;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-
-/** The class represent lines in a three dimensional space.
-
- * <p>Each oriented line is intrinsically associated with an abscissa
- * which is a coordinate on the line. The point at abscissa 0 is the
- * orthogonal projection of the origin on the line, another equivalent
- * way to express this is to say that it is the point of the line
- * which is closest to the origin. Abscissa increases in the line
- * direction.</p>
-
- * @since 3.0
- */
-public class Line implements Embedding<Euclidean3D, Euclidean1D> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Line direction. */
-    private Vector3D direction;
-
-    /** Line point closest to the origin. */
-    private Vector3D zero;
-
-    /** Tolerance below which points are considered identical. */
-    private final double tolerance;
-
-    /** Build a line from two points.
-     * @param p1 first point belonging to the line (this can be any point)
-     * @param p2 second point belonging to the line (this can be any point, different from p1)
-     * @param tolerance tolerance below which points are considered identical
-     * @exception MathIllegalArgumentException if the points are equal
-     * @since 3.3
-     */
-    public Line(final Vector3D p1, final Vector3D p2, final double tolerance)
-        throws MathIllegalArgumentException {
-        reset(p1, p2);
-        this.tolerance = tolerance;
-    }
-
-    /** Copy constructor.
-     * <p>The created instance is completely independent from the
-     * original instance, it is a deep copy.</p>
-     * @param line line to copy
-     */
-    public Line(final Line line) {
-        this.direction = line.direction;
-        this.zero      = line.zero;
-        this.tolerance = line.tolerance;
-    }
-
-    /** Build a line from two points.
-     * @param p1 first point belonging to the line (this can be any point)
-     * @param p2 second point belonging to the line (this can be any point, different from p1)
-     * @exception MathIllegalArgumentException if the points are equal
-     * @deprecated as of 3.3, replaced with {@link #Line(Vector3D, Vector3D, double)}
-     */
-    @Deprecated
-    public Line(final Vector3D p1, final Vector3D p2) throws MathIllegalArgumentException {
-        this(p1, p2, DEFAULT_TOLERANCE);
-    }
-
-    /** Reset the instance as if built from two points.
-     * @param p1 first point belonging to the line (this can be any point)
-     * @param p2 second point belonging to the line (this can be any point, different from p1)
-     * @exception MathIllegalArgumentException if the points are equal
-     */
-    public void reset(final Vector3D p1, final Vector3D p2) throws MathIllegalArgumentException {
-        final Vector3D delta = p2.subtract(p1);
-        final double norm2 = delta.getNormSq();
-        if (norm2 == 0.0) {
-            throw new MathIllegalArgumentException(LocalizedFormats.ZERO_NORM);
-        }
-        this.direction = new Vector3D(1.0 / FastMath.sqrt(norm2), delta);
-        zero = new Vector3D(1.0, p1, -p1.dotProduct(delta) / norm2, delta);
-    }
-
-    /** Get the tolerance below which points are considered identical.
-     * @return tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /** Get a line with reversed direction.
-     * @return a new instance, with reversed direction
-     */
-    public Line revert() {
-        final Line reverted = new Line(this);
-        reverted.direction = reverted.direction.negate();
-        return reverted;
-    }
-
-    /** Get the normalized direction vector.
-     * @return normalized direction vector
-     */
-    public Vector3D getDirection() {
-        return direction;
-    }
-
-    /** Get the line point closest to the origin.
-     * @return line point closest to the origin
-     */
-    public Vector3D getOrigin() {
-        return zero;
-    }
-
-    /** Get the abscissa of a point with respect to the line.
-     * <p>The abscissa is 0 if the projection of the point and the
-     * projection of the frame origin on the line are the same
-     * point.</p>
-     * @param point point to check
-     * @return abscissa of the point
-     */
-    public double getAbscissa(final Vector3D point) {
-        return point.subtract(zero).dotProduct(direction);
-    }
-
-    /** Get one point from the line.
-     * @param abscissa desired abscissa for the point
-     * @return one point belonging to the line, at specified abscissa
-     */
-    public Vector3D pointAt(final double abscissa) {
-        return new Vector3D(1.0, zero, abscissa, direction);
-    }
-
-    /** Transform a space point into a sub-space point.
-     * @param vector n-dimension point of the space
-     * @return (n-1)-dimension point of the sub-space corresponding to
-     * the specified space point
-     */
-    public Vector1D toSubSpace(Vector<Euclidean3D> vector) {
-        return toSubSpace((Point<Euclidean3D>) vector);
-    }
-
-    /** Transform a sub-space point into a space point.
-     * @param vector (n-1)-dimension point of the sub-space
-     * @return n-dimension point of the space corresponding to the
-     * specified sub-space point
-     */
-    public Vector3D toSpace(Vector<Euclidean1D> vector) {
-        return toSpace((Point<Euclidean1D>) vector);
-    }
-
-    /** {@inheritDoc}
-     * @see #getAbscissa(Vector3D)
-     */
-    public Vector1D toSubSpace(final Point<Euclidean3D> point) {
-        return new Vector1D(getAbscissa((Vector3D) point));
-    }
-
-    /** {@inheritDoc}
-     * @see #pointAt(double)
-     */
-    public Vector3D toSpace(final Point<Euclidean1D> point) {
-        return pointAt(((Vector1D) point).getX());
-    }
-
-    /** Check if the instance is similar to another line.
-     * <p>Lines are considered similar if they contain the same
-     * points. This does not mean they are equal since they can have
-     * opposite directions.</p>
-     * @param line line to which instance should be compared
-     * @return true if the lines are similar
-     */
-    public boolean isSimilarTo(final Line line) {
-        final double angle = Vector3D.angle(direction, line.direction);
-        return ((angle < tolerance) || (angle > (FastMath.PI - tolerance))) && contains(line.zero);
-    }
-
-    /** Check if the instance contains a point.
-     * @param p point to check
-     * @return true if p belongs to the line
-     */
-    public boolean contains(final Vector3D p) {
-        return distance(p) < tolerance;
-    }
-
-    /** Compute the distance between the instance and a point.
-     * @param p to check
-     * @return distance between the instance and the point
-     */
-    public double distance(final Vector3D p) {
-        final Vector3D d = p.subtract(zero);
-        final Vector3D n = new Vector3D(1.0, d, -d.dotProduct(direction), direction);
-        return n.getNorm();
-    }
-
-    /** Compute the shortest distance between the instance and another line.
-     * @param line line to check against the instance
-     * @return shortest distance between the instance and the line
-     */
-    public double distance(final Line line) {
-
-        final Vector3D normal = Vector3D.crossProduct(direction, line.direction);
-        final double n = normal.getNorm();
-        if (n < Precision.SAFE_MIN) {
-            // lines are parallel
-            return distance(line.zero);
-        }
-
-        // signed separation of the two parallel planes that contains the lines
-        final double offset = line.zero.subtract(zero).dotProduct(normal) / n;
-
-        return FastMath.abs(offset);
-
-    }
-
-    /** Compute the point of the instance closest to another line.
-     * @param line line to check against the instance
-     * @return point of the instance closest to another line
-     */
-    public Vector3D closestPoint(final Line line) {
-
-        final double cos = direction.dotProduct(line.direction);
-        final double n = 1 - cos * cos;
-        if (n < Precision.EPSILON) {
-            // the lines are parallel
-            return zero;
-        }
-
-        final Vector3D delta0 = line.zero.subtract(zero);
-        final double a        = delta0.dotProduct(direction);
-        final double b        = delta0.dotProduct(line.direction);
-
-        return new Vector3D(1, zero, (a - b * cos) / n, direction);
-
-    }
-
-    /** Get the intersection point of the instance and another line.
-     * @param line other line
-     * @return intersection point of the instance and the other line
-     * or null if there are no intersection points
-     */
-    public Vector3D intersection(final Line line) {
-        final Vector3D closest = closestPoint(line);
-        return line.contains(closest) ? closest : null;
-    }
-
-    /** Build a sub-line covering the whole line.
-     * @return a sub-line covering the whole line
-     */
-    public SubLine wholeLine() {
-        return new SubLine(this, new IntervalsSet(tolerance));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/NotARotationMatrixException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/NotARotationMatrixException.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/NotARotationMatrixException.java
deleted file mode 100644
index 3f1f3d3..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/NotARotationMatrixException.java
+++ /dev/null
@@ -1,47 +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.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.Localizable;
-
-/**
- * This class represents exceptions thrown while building rotations
- * from matrices.
- *
- * @since 1.2
- */
-
-public class NotARotationMatrixException
-  extends MathIllegalArgumentException {
-
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 5647178478658937642L;
-
-    /**
-     * Simple constructor.
-     * Build an exception by translating and formating a message
-     * @param specifier format specifier (to be translated)
-     * @param parts to insert in the format (no translation)
-     * @since 2.2
-     */
-    public NotARotationMatrixException(Localizable specifier, Object ... parts) {
-        super(specifier, parts);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/OutlineExtractor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/OutlineExtractor.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/OutlineExtractor.java
deleted file mode 100644
index 328018b..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/OutlineExtractor.java
+++ /dev/null
@@ -1,263 +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.geometry.euclidean.threed;
-
-import java.util.ArrayList;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.AbstractSubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.util.FastMath;
-
-/** Extractor for {@link PolygonsSet polyhedrons sets} outlines.
- * <p>This class extracts the 2D outlines from {{@link PolygonsSet
- * polyhedrons sets} in a specified projection plane.</p>
- * @since 3.0
- */
-public class OutlineExtractor {
-
-    /** Abscissa axis of the projection plane. */
-    private Vector3D u;
-
-    /** Ordinate axis of the projection plane. */
-    private Vector3D v;
-
-    /** Normal of the projection plane (viewing direction). */
-    private Vector3D w;
-
-    /** Build an extractor for a specific projection plane.
-     * @param u abscissa axis of the projection point
-     * @param v ordinate axis of the projection point
-     */
-    public OutlineExtractor(final Vector3D u, final Vector3D v) {
-        this.u = u;
-        this.v = v;
-        w = Vector3D.crossProduct(u, v);
-    }
-
-    /** Extract the outline of a polyhedrons set.
-     * @param polyhedronsSet polyhedrons set whose outline must be extracted
-     * @return an outline, as an array of loops.
-     */
-    public Vector2D[][] getOutline(final PolyhedronsSet polyhedronsSet) {
-
-        // project all boundary facets into one polygons set
-        final BoundaryProjector projector = new BoundaryProjector(polyhedronsSet.getTolerance());
-        polyhedronsSet.getTree(true).visit(projector);
-        final PolygonsSet projected = projector.getProjected();
-
-        // Remove the spurious intermediate vertices from the outline
-        final Vector2D[][] outline = projected.getVertices();
-        for (int i = 0; i < outline.length; ++i) {
-            final Vector2D[] rawLoop = outline[i];
-            int end = rawLoop.length;
-            int j = 0;
-            while (j < end) {
-                if (pointIsBetween(rawLoop, end, j)) {
-                    // the point should be removed
-                    for (int k = j; k < (end - 1); ++k) {
-                        rawLoop[k] = rawLoop[k + 1];
-                    }
-                    --end;
-                } else {
-                    // the point remains in the loop
-                    ++j;
-                }
-            }
-            if (end != rawLoop.length) {
-                // resize the array
-                outline[i] = new Vector2D[end];
-                System.arraycopy(rawLoop, 0, outline[i], 0, end);
-            }
-        }
-
-        return outline;
-
-    }
-
-    /** Check if a point is geometrically between its neighbor in an array.
-     * <p>The neighbors are computed considering the array is a loop
-     * (i.e. point at index (n-1) is before point at index 0)</p>
-     * @param loop points array
-     * @param n number of points to consider in the array
-     * @param i index of the point to check (must be between 0 and n-1)
-     * @return true if the point is exactly between its neighbors
-     */
-    private boolean pointIsBetween(final Vector2D[] loop, final int n, final int i) {
-        final Vector2D previous = loop[(i + n - 1) % n];
-        final Vector2D current  = loop[i];
-        final Vector2D next     = loop[(i + 1) % n];
-        final double dx1       = current.getX() - previous.getX();
-        final double dy1       = current.getY() - previous.getY();
-        final double dx2       = next.getX()    - current.getX();
-        final double dy2       = next.getY()    - current.getY();
-        final double cross     = dx1 * dy2 - dx2 * dy1;
-        final double dot       = dx1 * dx2 + dy1 * dy2;
-        final double d1d2      = FastMath.sqrt((dx1 * dx1 + dy1 * dy1) * (dx2 * dx2 + dy2 * dy2));
-        return (FastMath.abs(cross) <= (1.0e-6 * d1d2)) && (dot >= 0.0);
-    }
-
-    /** Visitor projecting the boundary facets on a plane. */
-    private class BoundaryProjector implements BSPTreeVisitor<Euclidean3D> {
-
-        /** Projection of the polyhedrons set on the plane. */
-        private PolygonsSet projected;
-
-        /** Tolerance below which points are considered identical. */
-        private final double tolerance;
-
-        /** Simple constructor.
-         * @param tolerance tolerance below which points are considered identical
-         */
-        public BoundaryProjector(final double tolerance) {
-            this.projected = new PolygonsSet(new BSPTree<Euclidean2D>(Boolean.FALSE), tolerance);
-            this.tolerance = tolerance;
-        }
-
-        /** {@inheritDoc} */
-        public Order visitOrder(final BSPTree<Euclidean3D> node) {
-            return Order.MINUS_SUB_PLUS;
-        }
-
-        /** {@inheritDoc} */
-        public void visitInternalNode(final BSPTree<Euclidean3D> node) {
-            @SuppressWarnings("unchecked")
-            final BoundaryAttribute<Euclidean3D> attribute =
-                (BoundaryAttribute<Euclidean3D>) node.getAttribute();
-            if (attribute.getPlusOutside() != null) {
-                addContribution(attribute.getPlusOutside(), false);
-            }
-            if (attribute.getPlusInside() != null) {
-                addContribution(attribute.getPlusInside(), true);
-            }
-        }
-
-        /** {@inheritDoc} */
-        public void visitLeafNode(final BSPTree<Euclidean3D> node) {
-        }
-
-        /** Add he contribution of a boundary facet.
-         * @param facet boundary facet
-         * @param reversed if true, the facet has the inside on its plus side
-         */
-        private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {
-
-            // extract the vertices of the facet
-            @SuppressWarnings("unchecked")
-            final AbstractSubHyperplane<Euclidean3D, Euclidean2D> absFacet =
-                (AbstractSubHyperplane<Euclidean3D, Euclidean2D>) facet;
-            final Plane plane    = (Plane) facet.getHyperplane();
-
-            final double scal = plane.getNormal().dotProduct(w);
-            if (FastMath.abs(scal) > 1.0e-3) {
-                Vector2D[][] vertices =
-                    ((PolygonsSet) absFacet.getRemainingRegion()).getVertices();
-
-                if ((scal < 0) ^ reversed) {
-                    // the facet is seen from the inside,
-                    // we need to invert its boundary orientation
-                    final Vector2D[][] newVertices = new Vector2D[vertices.length][];
-                    for (int i = 0; i < vertices.length; ++i) {
-                        final Vector2D[] loop = vertices[i];
-                        final Vector2D[] newLoop = new Vector2D[loop.length];
-                        if (loop[0] == null) {
-                            newLoop[0] = null;
-                            for (int j = 1; j < loop.length; ++j) {
-                                newLoop[j] = loop[loop.length - j];
-                            }
-                        } else {
-                            for (int j = 0; j < loop.length; ++j) {
-                                newLoop[j] = loop[loop.length - (j + 1)];
-                            }
-                        }
-                        newVertices[i] = newLoop;
-                    }
-
-                    // use the reverted vertices
-                    vertices = newVertices;
-
-                }
-
-                // compute the projection of the facet in the outline plane
-                final ArrayList<SubHyperplane<Euclidean2D>> edges = new ArrayList<SubHyperplane<Euclidean2D>>();
-                for (Vector2D[] loop : vertices) {
-                    final boolean closed = loop[0] != null;
-                    int previous         = closed ? (loop.length - 1) : 1;
-                    Vector3D previous3D  = plane.toSpace((Point<Euclidean2D>) loop[previous]);
-                    int current          = (previous + 1) % loop.length;
-                    Vector2D pPoint       = new Vector2D(previous3D.dotProduct(u),
-                                                         previous3D.dotProduct(v));
-                    while (current < loop.length) {
-
-                        final Vector3D current3D = plane.toSpace((Point<Euclidean2D>) loop[current]);
-                        final Vector2D  cPoint    = new Vector2D(current3D.dotProduct(u),
-                                                                 current3D.dotProduct(v));
-                        final org.apache.commons.math3.geometry.euclidean.twod.Line line =
-                            new org.apache.commons.math3.geometry.euclidean.twod.Line(pPoint, cPoint, tolerance);
-                        SubHyperplane<Euclidean2D> edge = line.wholeHyperplane();
-
-                        if (closed || (previous != 1)) {
-                            // the previous point is a real vertex
-                            // it defines one bounding point of the edge
-                            final double angle = line.getAngle() + 0.5 * FastMath.PI;
-                            final org.apache.commons.math3.geometry.euclidean.twod.Line l =
-                                new org.apache.commons.math3.geometry.euclidean.twod.Line(pPoint, angle, tolerance);
-                            edge = edge.split(l).getPlus();
-                        }
-
-                        if (closed || (current != (loop.length - 1))) {
-                            // the current point is a real vertex
-                            // it defines one bounding point of the edge
-                            final double angle = line.getAngle() + 0.5 * FastMath.PI;
-                            final org.apache.commons.math3.geometry.euclidean.twod.Line l =
-                                new org.apache.commons.math3.geometry.euclidean.twod.Line(cPoint, angle, tolerance);
-                            edge = edge.split(l).getMinus();
-                        }
-
-                        edges.add(edge);
-
-                        previous   = current++;
-                        previous3D = current3D;
-                        pPoint     = cPoint;
-
-                    }
-                }
-                final PolygonsSet projectedFacet = new PolygonsSet(edges, tolerance);
-
-                // add the contribution of the facet to the global outline
-                projected = (PolygonsSet) new RegionFactory<Euclidean2D>().union(projected, projectedFacet);
-
-            }
-        }
-
-        /** Get the projection of the polyhedrons set on the plane.
-         * @return projection of the polyhedrons set on the plane
-         */
-        public PolygonsSet getProjected() {
-            return projected;
-        }
-
-    }
-
-}


[45/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java b/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
deleted file mode 100644
index 51e3678..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/StepFunction.java
+++ /dev/null
@@ -1,100 +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.analysis.function;
-
-import java.util.Arrays;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.util.MathArrays;
-
-/**
- * <a href="http://en.wikipedia.org/wiki/Step_function">
- *  Step function</a>.
- *
- * @since 3.0
- */
-public class StepFunction implements UnivariateFunction {
-    /** Abscissae. */
-    private final double[] abscissa;
-    /** Ordinates. */
-    private final double[] ordinate;
-
-    /**
-     * Builds a step function from a list of arguments and the corresponding
-     * values. Specifically, returns the function h(x) defined by <pre><code>
-     * h(x) = y[0] for all x < x[1]
-     *        y[1] for x[1] <= x < x[2]
-     *        ...
-     *        y[y.length - 1] for x >= x[x.length - 1]
-     * </code></pre>
-     * The value of {@code x[0]} is ignored, but it must be strictly less than
-     * {@code x[1]}.
-     *
-     * @param x Domain values where the function changes value.
-     * @param y Values of the function.
-     * @throws NonMonotonicSequenceException
-     * if the {@code x} array is not sorted in strictly increasing order.
-     * @throws NullArgumentException if {@code x} or {@code y} are {@code null}.
-     * @throws NoDataException if {@code x} or {@code y} are zero-length.
-     * @throws DimensionMismatchException if {@code x} and {@code y} do not
-     * have the same length.
-     */
-    public StepFunction(double[] x,
-                        double[] y)
-        throws NullArgumentException, NoDataException,
-               DimensionMismatchException, NonMonotonicSequenceException {
-        if (x == null ||
-            y == null) {
-            throw new NullArgumentException();
-        }
-        if (x.length == 0 ||
-            y.length == 0) {
-            throw new NoDataException();
-        }
-        if (y.length != x.length) {
-            throw new DimensionMismatchException(y.length, x.length);
-        }
-        MathArrays.checkOrder(x);
-
-        abscissa = MathArrays.copyOf(x);
-        ordinate = MathArrays.copyOf(y);
-    }
-
-    /** {@inheritDoc} */
-    public double value(double x) {
-        int index = Arrays.binarySearch(abscissa, x);
-        double fx = 0;
-
-        if (index < -1) {
-            // "x" is between "abscissa[-index-2]" and "abscissa[-index-1]".
-            fx = ordinate[-index-2];
-        } else if (index >= 0) {
-            // "x" is exactly "abscissa[index]".
-            fx = ordinate[index];
-        } else {
-            // Otherwise, "x" is smaller than the first value in "abscissa"
-            // (hence the returned value should be "ordinate[0]").
-            fx = ordinate[0];
-        }
-
-        return fx;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java b/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java
deleted file mode 100644
index 7b87dd6..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Subtract.java
+++ /dev/null
@@ -1,32 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.BivariateFunction;
-
-/**
- * Subtract the second operand from the first.
- *
- * @since 3.0
- */
-public class Subtract implements BivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x, double y) {
-        return x - y;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Tan.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Tan.java b/src/main/java/org/apache/commons/math3/analysis/function/Tan.java
deleted file mode 100644
index 03304b4..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Tan.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Tangent function.
- *
- * @since 3.0
- */
-public class Tan implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.tan(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.tan();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java b/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java
deleted file mode 100644
index 6c7ef0d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Tanh.java
+++ /dev/null
@@ -1,53 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math3.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math3.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Hyperbolic tangent function.
- *
- * @since 3.0
- */
-public class Tanh implements UnivariateDifferentiableFunction, DifferentiableUnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.tanh(x);
-    }
-
-    /** {@inheritDoc}
-     * @deprecated as of 3.1, replaced by {@link #value(DerivativeStructure)}
-     */
-    @Deprecated
-    public UnivariateFunction derivative() {
-        return FunctionUtils.toDifferentiableUnivariateFunction(this).derivative();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.1
-     */
-    public DerivativeStructure value(final DerivativeStructure t) {
-        return t.tanh();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java b/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java
deleted file mode 100644
index d075a73..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/Ulp.java
+++ /dev/null
@@ -1,33 +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.analysis.function;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * {@code ulp} function.
- *
- * @since 3.0
- */
-public class Ulp implements UnivariateFunction {
-    /** {@inheritDoc} */
-    public double value(double x) {
-        return FastMath.ulp(x);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/function/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/function/package-info.java b/src/main/java/org/apache/commons/math3/analysis/function/package-info.java
deleted file mode 100644
index cb24544..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/function/package-info.java
+++ /dev/null
@@ -1,26 +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.
- */
-/**
- *
- *    <p>
- *      The {@code function} package contains function objects that wrap the
- *      methods contained in {@link java.lang.Math}, as well as common
- *      mathematical functions such as the gaussian and sinc functions.
- *    </p>
- *
- */
-package org.apache.commons.math3.analysis.function;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java
deleted file mode 100644
index 23c25b0..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/BaseAbstractUnivariateIntegrator.java
+++ /dev/null
@@ -1,280 +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.analysis.integration;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.Incrementor;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Provide a default implementation for several generic functions.
- *
- * @since 1.2
- */
-public abstract class BaseAbstractUnivariateIntegrator implements UnivariateIntegrator {
-
-    /** Default absolute accuracy. */
-    public static final double DEFAULT_ABSOLUTE_ACCURACY = 1.0e-15;
-
-    /** Default relative accuracy. */
-    public static final double DEFAULT_RELATIVE_ACCURACY = 1.0e-6;
-
-    /** Default minimal iteration count. */
-    public static final int DEFAULT_MIN_ITERATIONS_COUNT = 3;
-
-    /** Default maximal iteration count. */
-    public static final int DEFAULT_MAX_ITERATIONS_COUNT = Integer.MAX_VALUE;
-
-    /** The iteration count. */
-    protected final Incrementor iterations;
-
-    /** Maximum absolute error. */
-    private final double absoluteAccuracy;
-
-    /** Maximum relative error. */
-    private final double relativeAccuracy;
-
-    /** minimum number of iterations */
-    private final int minimalIterationCount;
-
-    /** The functions evaluation count. */
-    private final Incrementor evaluations;
-
-    /** Function to integrate. */
-    private UnivariateFunction function;
-
-    /** Lower bound for the interval. */
-    private double min;
-
-    /** Upper bound for the interval. */
-    private double max;
-
-    /**
-     * Construct an integrator with given accuracies and iteration counts.
-     * <p>
-     * The meanings of the various parameters are:
-     * <ul>
-     *   <li>relative accuracy:
-     *       this is used to stop iterations if the absolute accuracy can't be
-     *       achieved due to large values or short mantissa length. If this
-     *       should be the primary criterion for convergence rather then a
-     *       safety measure, set the absolute accuracy to a ridiculously small value,
-     *       like {@link org.apache.commons.math3.util.Precision#SAFE_MIN Precision.SAFE_MIN}.</li>
-     *   <li>absolute accuracy:
-     *       The default is usually chosen so that results in the interval
-     *       -10..-0.1 and +0.1..+10 can be found with a reasonable accuracy. If the
-     *       expected absolute value of your results is of much smaller magnitude, set
-     *       this to a smaller value.</li>
-     *   <li>minimum number of iterations:
-     *       minimal iteration is needed to avoid false early convergence, e.g.
-     *       the sample points happen to be zeroes of the function. Users can
-     *       use the default value or choose one that they see as appropriate.</li>
-     *   <li>maximum number of iterations:
-     *       usually a high iteration count indicates convergence problems. However,
-     *       the "reasonable value" varies widely for different algorithms. Users are
-     *       advised to use the default value supplied by the algorithm.</li>
-     * </ul>
-     * </p>
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy,
-                                               final double absoluteAccuracy,
-                                               final int minimalIterationCount,
-                                               final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-
-        // accuracy settings
-        this.relativeAccuracy      = relativeAccuracy;
-        this.absoluteAccuracy      = absoluteAccuracy;
-
-        // iterations count settings
-        if (minimalIterationCount <= 0) {
-            throw new NotStrictlyPositiveException(minimalIterationCount);
-        }
-        if (maximalIterationCount <= minimalIterationCount) {
-            throw new NumberIsTooSmallException(maximalIterationCount, minimalIterationCount, false);
-        }
-        this.minimalIterationCount = minimalIterationCount;
-        this.iterations            = new Incrementor();
-        iterations.setMaximalCount(maximalIterationCount);
-
-        // prepare evaluations counter, but do not set it yet
-        evaluations = new Incrementor();
-
-    }
-
-    /**
-     * Construct an integrator with given accuracies.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     */
-    protected BaseAbstractUnivariateIntegrator(final double relativeAccuracy,
-                                           final double absoluteAccuracy) {
-        this(relativeAccuracy, absoluteAccuracy,
-             DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Construct an integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    protected BaseAbstractUnivariateIntegrator(final int minimalIterationCount,
-                                           final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-        this(DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
-             minimalIterationCount, maximalIterationCount);
-    }
-
-    /** {@inheritDoc} */
-    public double getRelativeAccuracy() {
-        return relativeAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public double getAbsoluteAccuracy() {
-        return absoluteAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public int getMinimalIterationCount() {
-        return minimalIterationCount;
-    }
-
-    /** {@inheritDoc} */
-    public int getMaximalIterationCount() {
-        return iterations.getMaximalCount();
-    }
-
-    /** {@inheritDoc} */
-    public int getEvaluations() {
-        return evaluations.getCount();
-    }
-
-    /** {@inheritDoc} */
-    public int getIterations() {
-        return iterations.getCount();
-    }
-
-    /**
-     * @return the lower bound.
-     */
-    protected double getMin() {
-        return min;
-    }
-    /**
-     * @return the upper bound.
-     */
-    protected double getMax() {
-        return max;
-    }
-
-    /**
-     * Compute the objective function value.
-     *
-     * @param point Point at which the objective function must be evaluated.
-     * @return the objective function value at specified point.
-     * @throws TooManyEvaluationsException if the maximal number of function
-     * evaluations is exceeded.
-     */
-    protected double computeObjectiveValue(final double point)
-        throws TooManyEvaluationsException {
-        try {
-            evaluations.incrementCount();
-        } catch (MaxCountExceededException e) {
-            throw new TooManyEvaluationsException(e.getMax());
-        }
-        return function.value(point);
-    }
-
-    /**
-     * Prepare for computation.
-     * Subclasses must call this method if they override any of the
-     * {@code solve} methods.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f the integrand function
-     * @param lower the min bound for the interval
-     * @param upper the upper bound for the interval
-     * @throws NullArgumentException if {@code f} is {@code null}.
-     * @throws MathIllegalArgumentException if {@code min >= max}.
-     */
-    protected void setup(final int maxEval,
-                         final UnivariateFunction f,
-                         final double lower, final double upper)
-        throws NullArgumentException, MathIllegalArgumentException {
-
-        // Checks.
-        MathUtils.checkNotNull(f);
-        UnivariateSolverUtils.verifyInterval(lower, upper);
-
-        // Reset.
-        min = lower;
-        max = upper;
-        function = f;
-        evaluations.setMaximalCount(maxEval);
-        evaluations.resetCount();
-        iterations.resetCount();
-
-    }
-
-    /** {@inheritDoc} */
-    public double integrate(final int maxEval, final UnivariateFunction f,
-                            final double lower, final double upper)
-        throws TooManyEvaluationsException, MaxCountExceededException,
-               MathIllegalArgumentException, NullArgumentException {
-
-        // Initialization.
-        setup(maxEval, f, lower, upper);
-
-        // Perform computation.
-        return doIntegrate();
-
-    }
-
-    /**
-     * Method for implementing actual integration algorithms in derived
-     * classes.
-     *
-     * @return the root.
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     * @throws MaxCountExceededException if the maximum iteration count is exceeded
-     * or the integrator detects convergence problems otherwise
-     */
-    protected abstract double doIntegrate()
-        throws TooManyEvaluationsException, MaxCountExceededException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java
deleted file mode 100644
index b7c6b81..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/IterativeLegendreGaussIntegrator.java
+++ /dev/null
@@ -1,182 +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.analysis.integration;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.integration.gauss.GaussIntegratorFactory;
-import org.apache.commons.math3.analysis.integration.gauss.GaussIntegrator;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * This algorithm divides the integration interval into equally-sized
- * sub-interval and on each of them performs a
- * <a href="http://mathworld.wolfram.com/Legendre-GaussQuadrature.html">
- * Legendre-Gauss</a> quadrature.
- * Because of its <em>non-adaptive</em> nature, this algorithm can
- * converge to a wrong value for the integral (for example, if the
- * function is significantly different from zero toward the ends of the
- * integration interval).
- * In particular, a change of variables aimed at estimating integrals
- * over infinite intervals as proposed
- * <a href="http://en.wikipedia.org/w/index.php?title=Numerical_integration#Integrals_over_infinite_intervals">
- *  here</a> should be avoided when using this class.
- *
- * @since 3.1
- */
-
-public class IterativeLegendreGaussIntegrator
-    extends BaseAbstractUnivariateIntegrator {
-    /** Factory that computes the points and weights. */
-    private static final GaussIntegratorFactory FACTORY
-        = new GaussIntegratorFactory();
-    /** Number of integration points (per interval). */
-    private final int numberOfPoints;
-
-    /**
-     * Builds an integrator with given accuracies and iterations counts.
-     *
-     * @param n Number of integration points.
-     * @param relativeAccuracy Relative accuracy of the result.
-     * @param absoluteAccuracy Absolute accuracy of the result.
-     * @param minimalIterationCount Minimum number of iterations.
-     * @param maximalIterationCount Maximum number of iterations.
-     * @throws NotStrictlyPositiveException if minimal number of iterations
-     * or number of points are not strictly positive.
-     * @throws NumberIsTooSmallException if maximal number of iterations
-     * is smaller than or equal to the minimal number of iterations.
-     */
-    public IterativeLegendreGaussIntegrator(final int n,
-                                            final double relativeAccuracy,
-                                            final double absoluteAccuracy,
-                                            final int minimalIterationCount,
-                                            final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (n <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS, n);
-        }
-       numberOfPoints = n;
-    }
-
-    /**
-     * Builds an integrator with given accuracies.
-     *
-     * @param n Number of integration points.
-     * @param relativeAccuracy Relative accuracy of the result.
-     * @param absoluteAccuracy Absolute accuracy of the result.
-     * @throws NotStrictlyPositiveException if {@code n < 1}.
-     */
-    public IterativeLegendreGaussIntegrator(final int n,
-                                            final double relativeAccuracy,
-                                            final double absoluteAccuracy)
-        throws NotStrictlyPositiveException {
-        this(n, relativeAccuracy, absoluteAccuracy,
-             DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Builds an integrator with given iteration counts.
-     *
-     * @param n Number of integration points.
-     * @param minimalIterationCount Minimum number of iterations.
-     * @param maximalIterationCount Maximum number of iterations.
-     * @throws NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive.
-     * @throws NumberIsTooSmallException if maximal number of iterations
-     * is smaller than or equal to the minimal number of iterations.
-     * @throws NotStrictlyPositiveException if {@code n < 1}.
-     */
-    public IterativeLegendreGaussIntegrator(final int n,
-                                            final int minimalIterationCount,
-                                            final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException {
-        this(n, DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
-             minimalIterationCount, maximalIterationCount);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-        // Compute first estimate with a single step.
-        double oldt = stage(1);
-
-        int n = 2;
-        while (true) {
-            // Improve integral with a larger number of steps.
-            final double t = stage(n);
-
-            // Estimate the error.
-            final double delta = FastMath.abs(t - oldt);
-            final double limit =
-                FastMath.max(getAbsoluteAccuracy(),
-                             getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5);
-
-            // check convergence
-            if (iterations.getCount() + 1 >= getMinimalIterationCount() &&
-                delta <= limit) {
-                return t;
-            }
-
-            // Prepare next iteration.
-            final double ratio = FastMath.min(4, FastMath.pow(delta / limit, 0.5 / numberOfPoints));
-            n = FastMath.max((int) (ratio * n), n + 1);
-            oldt = t;
-            iterations.incrementCount();
-        }
-    }
-
-    /**
-     * Compute the n-th stage integral.
-     *
-     * @param n Number of steps.
-     * @return the value of n-th stage integral.
-     * @throws TooManyEvaluationsException if the maximum number of evaluations
-     * is exceeded.
-     */
-    private double stage(final int n)
-        throws TooManyEvaluationsException {
-        // Function to be integrated is stored in the base class.
-        final UnivariateFunction f = new UnivariateFunction() {
-                public double value(double x)
-                    throws MathIllegalArgumentException, TooManyEvaluationsException {
-                    return computeObjectiveValue(x);
-                }
-            };
-
-        final double min = getMin();
-        final double max = getMax();
-        final double step = (max - min) / n;
-
-        double sum = 0;
-        for (int i = 0; i < n; i++) {
-            // Integrate over each sub-interval [a, b].
-            final double a = min + i * step;
-            final double b = a + step;
-            final GaussIntegrator g = FACTORY.legendreHighPrecision(numberOfPoints, a, b);
-            sum += g.integrate(f);
-        }
-
-        return sum;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java
deleted file mode 100644
index 08f4794..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/LegendreGaussIntegrator.java
+++ /dev/null
@@ -1,265 +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.analysis.integration;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/Legendre-GaussQuadrature.html">
- * Legendre-Gauss</a> quadrature formula.
- * <p>
- * Legendre-Gauss integrators are efficient integrators that can
- * accurately integrate functions with few function evaluations. A
- * Legendre-Gauss integrator using an n-points quadrature formula can
- * integrate 2n-1 degree polynomials exactly.
- * </p>
- * <p>
- * These integrators evaluate the function on n carefully chosen
- * abscissas in each step interval (mapped to the canonical [-1,1] interval).
- * The evaluation abscissas are not evenly spaced and none of them are
- * at the interval endpoints. This implies the function integrated can be
- * undefined at integration interval endpoints.
- * </p>
- * <p>
- * The evaluation abscissas x<sub>i</sub> are the roots of the degree n
- * Legendre polynomial. The weights a<sub>i</sub> of the quadrature formula
- * integrals from -1 to +1 &int; Li<sup>2</sup> where Li (x) =
- * &prod; (x-x<sub>k</sub>)/(x<sub>i</sub>-x<sub>k</sub>) for k != i.
- * </p>
- * <p>
- * @since 1.2
- * @deprecated As of 3.1 (to be removed in 4.0). Please use
- * {@link IterativeLegendreGaussIntegrator} instead.
- */
-@Deprecated
-public class LegendreGaussIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Abscissas for the 2 points method. */
-    private static final double[] ABSCISSAS_2 = {
-        -1.0 / FastMath.sqrt(3.0),
-         1.0 / FastMath.sqrt(3.0)
-    };
-
-    /** Weights for the 2 points method. */
-    private static final double[] WEIGHTS_2 = {
-        1.0,
-        1.0
-    };
-
-    /** Abscissas for the 3 points method. */
-    private static final double[] ABSCISSAS_3 = {
-        -FastMath.sqrt(0.6),
-         0.0,
-         FastMath.sqrt(0.6)
-    };
-
-    /** Weights for the 3 points method. */
-    private static final double[] WEIGHTS_3 = {
-        5.0 / 9.0,
-        8.0 / 9.0,
-        5.0 / 9.0
-    };
-
-    /** Abscissas for the 4 points method. */
-    private static final double[] ABSCISSAS_4 = {
-        -FastMath.sqrt((15.0 + 2.0 * FastMath.sqrt(30.0)) / 35.0),
-        -FastMath.sqrt((15.0 - 2.0 * FastMath.sqrt(30.0)) / 35.0),
-         FastMath.sqrt((15.0 - 2.0 * FastMath.sqrt(30.0)) / 35.0),
-         FastMath.sqrt((15.0 + 2.0 * FastMath.sqrt(30.0)) / 35.0)
-    };
-
-    /** Weights for the 4 points method. */
-    private static final double[] WEIGHTS_4 = {
-        (90.0 - 5.0 * FastMath.sqrt(30.0)) / 180.0,
-        (90.0 + 5.0 * FastMath.sqrt(30.0)) / 180.0,
-        (90.0 + 5.0 * FastMath.sqrt(30.0)) / 180.0,
-        (90.0 - 5.0 * FastMath.sqrt(30.0)) / 180.0
-    };
-
-    /** Abscissas for the 5 points method. */
-    private static final double[] ABSCISSAS_5 = {
-        -FastMath.sqrt((35.0 + 2.0 * FastMath.sqrt(70.0)) / 63.0),
-        -FastMath.sqrt((35.0 - 2.0 * FastMath.sqrt(70.0)) / 63.0),
-         0.0,
-         FastMath.sqrt((35.0 - 2.0 * FastMath.sqrt(70.0)) / 63.0),
-         FastMath.sqrt((35.0 + 2.0 * FastMath.sqrt(70.0)) / 63.0)
-    };
-
-    /** Weights for the 5 points method. */
-    private static final double[] WEIGHTS_5 = {
-        (322.0 - 13.0 * FastMath.sqrt(70.0)) / 900.0,
-        (322.0 + 13.0 * FastMath.sqrt(70.0)) / 900.0,
-        128.0 / 225.0,
-        (322.0 + 13.0 * FastMath.sqrt(70.0)) / 900.0,
-        (322.0 - 13.0 * FastMath.sqrt(70.0)) / 900.0
-    };
-
-    /** Abscissas for the current method. */
-    private final double[] abscissas;
-
-    /** Weights for the current method. */
-    private final double[] weights;
-
-    /**
-     * Build a Legendre-Gauss integrator with given accuracies and iterations counts.
-     * @param n number of points desired (must be between 2 and 5 inclusive)
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception MathIllegalArgumentException if number of points is out of [2; 5]
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    public LegendreGaussIntegrator(final int n,
-                                   final double relativeAccuracy,
-                                   final double absoluteAccuracy,
-                                   final int minimalIterationCount,
-                                   final int maximalIterationCount)
-        throws MathIllegalArgumentException, NotStrictlyPositiveException, NumberIsTooSmallException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        switch(n) {
-        case 2 :
-            abscissas = ABSCISSAS_2;
-            weights   = WEIGHTS_2;
-            break;
-        case 3 :
-            abscissas = ABSCISSAS_3;
-            weights   = WEIGHTS_3;
-            break;
-        case 4 :
-            abscissas = ABSCISSAS_4;
-            weights   = WEIGHTS_4;
-            break;
-        case 5 :
-            abscissas = ABSCISSAS_5;
-            weights   = WEIGHTS_5;
-            break;
-        default :
-            throw new MathIllegalArgumentException(
-                    LocalizedFormats.N_POINTS_GAUSS_LEGENDRE_INTEGRATOR_NOT_SUPPORTED,
-                    n, 2, 5);
-        }
-
-    }
-
-    /**
-     * Build a Legendre-Gauss integrator with given accuracies.
-     * @param n number of points desired (must be between 2 and 5 inclusive)
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @exception MathIllegalArgumentException if number of points is out of [2; 5]
-     */
-    public LegendreGaussIntegrator(final int n,
-                                   final double relativeAccuracy,
-                                   final double absoluteAccuracy)
-        throws MathIllegalArgumentException {
-        this(n, relativeAccuracy, absoluteAccuracy,
-             DEFAULT_MIN_ITERATIONS_COUNT, DEFAULT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Build a Legendre-Gauss integrator with given iteration counts.
-     * @param n number of points desired (must be between 2 and 5 inclusive)
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * @exception MathIllegalArgumentException if number of points is out of [2; 5]
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     */
-    public LegendreGaussIntegrator(final int n,
-                                   final int minimalIterationCount,
-                                   final int maximalIterationCount)
-        throws MathIllegalArgumentException {
-        this(n, DEFAULT_RELATIVE_ACCURACY, DEFAULT_ABSOLUTE_ACCURACY,
-             minimalIterationCount, maximalIterationCount);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-
-        // compute first estimate with a single step
-        double oldt = stage(1);
-
-        int n = 2;
-        while (true) {
-
-            // improve integral with a larger number of steps
-            final double t = stage(n);
-
-            // estimate error
-            final double delta = FastMath.abs(t - oldt);
-            final double limit =
-                FastMath.max(getAbsoluteAccuracy(),
-                             getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5);
-
-            // check convergence
-            if ((iterations.getCount() + 1 >= getMinimalIterationCount()) && (delta <= limit)) {
-                return t;
-            }
-
-            // prepare next iteration
-            double ratio = FastMath.min(4, FastMath.pow(delta / limit, 0.5 / abscissas.length));
-            n = FastMath.max((int) (ratio * n), n + 1);
-            oldt = t;
-            iterations.incrementCount();
-
-        }
-
-    }
-
-    /**
-     * Compute the n-th stage integral.
-     * @param n number of steps
-     * @return the value of n-th stage integral
-     * @throws TooManyEvaluationsException if the maximum number of evaluations
-     * is exceeded.
-     */
-    private double stage(final int n)
-        throws TooManyEvaluationsException {
-
-        // set up the step for the current stage
-        final double step     = (getMax() - getMin()) / n;
-        final double halfStep = step / 2.0;
-
-        // integrate over all elementary steps
-        double midPoint = getMin() + halfStep;
-        double sum = 0.0;
-        for (int i = 0; i < n; ++i) {
-            for (int j = 0; j < abscissas.length; ++j) {
-                sum += weights[j] * computeObjectiveValue(midPoint + halfStep * abscissas[j]);
-            }
-            midPoint += step;
-        }
-
-        return halfStep * sum;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
deleted file mode 100644
index aaea286..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/MidPointIntegrator.java
+++ /dev/null
@@ -1,169 +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.analysis.integration;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://en.wikipedia.org/wiki/Midpoint_method">
- * Midpoint Rule</a> for integration of real univariate functions. For
- * reference, see <b>Numerical Mathematics</b>, ISBN 0387989595,
- * chapter 9.2.
- * <p>
- * The function should be integrable.</p>
- *
- * @since 3.3
- */
-public class MidPointIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximum number of iterations for midpoint. */
-    public static final int MIDPOINT_MAX_ITERATIONS_COUNT = 64;
-
-    /**
-     * Build a midpoint integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     */
-    public MidPointIntegrator(final double relativeAccuracy,
-                              final double absoluteAccuracy,
-                              final int minimalIterationCount,
-                              final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > MIDPOINT_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                MIDPOINT_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a midpoint integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #MIDPOINT_MAX_ITERATIONS_COUNT}
-     */
-    public MidPointIntegrator(final int minimalIterationCount,
-                              final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > MIDPOINT_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                MIDPOINT_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct a midpoint integrator with default settings.
-     * (max iteration count set to {@link #MIDPOINT_MAX_ITERATIONS_COUNT})
-     */
-    public MidPointIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, MIDPOINT_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Compute the n-th stage integral of midpoint rule.
-     * This function should only be called by API <code>integrate()</code> in the package.
-     * To save time it does not verify arguments - caller does.
-     * <p>
-     * The interval is divided equally into 2^n sections rather than an
-     * arbitrary m sections because this configuration can best utilize the
-     * already computed values.</p>
-     *
-     * @param n the stage of 1/2 refinement. Must be larger than 0.
-     * @param previousStageResult Result from the previous call to the
-     * {@code stage} method.
-     * @param min Lower bound of the integration interval.
-     * @param diffMaxMin Difference between the lower bound and upper bound
-     * of the integration interval.
-     * @return the value of n-th stage integral
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     */
-    private double stage(final int n,
-                         double previousStageResult,
-                         double min,
-                         double diffMaxMin)
-        throws TooManyEvaluationsException {
-
-        // number of new points in this stage
-        final long np = 1L << (n - 1);
-        double sum = 0;
-
-        // spacing between adjacent new points
-        final double spacing = diffMaxMin / np;
-
-        // the first new point
-        double x = min + 0.5 * spacing;
-        for (long i = 0; i < np; i++) {
-            sum += computeObjectiveValue(x);
-            x += spacing;
-        }
-        // add the new sum to previously calculated result
-        return 0.5 * (previousStageResult + sum * spacing);
-    }
-
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-
-        final double min = getMin();
-        final double diff = getMax() - min;
-        final double midPoint = min + 0.5 * diff;
-
-        double oldt = diff * computeObjectiveValue(midPoint);
-
-        while (true) {
-            iterations.incrementCount();
-            final int i = iterations.getCount();
-            final double t = stage(i, oldt, min, diff);
-            if (i >= getMinimalIterationCount()) {
-                final double delta = FastMath.abs(t - oldt);
-                final double rLimit =
-                        getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return t;
-                }
-            }
-            oldt = t;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java
deleted file mode 100644
index 430cd6e..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/RombergIntegrator.java
+++ /dev/null
@@ -1,142 +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.analysis.integration;
-
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/RombergIntegration.html">
- * Romberg Algorithm</a> for integration of real univariate functions. For
- * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X,
- * chapter 3.
- * <p>
- * Romberg integration employs k successive refinements of the trapezoid
- * rule to remove error terms less than order O(N^(-2k)). Simpson's rule
- * is a special case of k = 2.</p>
- *
- * @since 1.2
- */
-public class RombergIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximal number of iterations for Romberg. */
-    public static final int ROMBERG_MAX_ITERATIONS_COUNT = 32;
-
-    /**
-     * Build a Romberg integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #ROMBERG_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #ROMBERG_MAX_ITERATIONS_COUNT}
-     */
-    public RombergIntegrator(final double relativeAccuracy,
-                             final double absoluteAccuracy,
-                             final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > ROMBERG_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                ROMBERG_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a Romberg integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #ROMBERG_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #ROMBERG_MAX_ITERATIONS_COUNT}
-     */
-    public RombergIntegrator(final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > ROMBERG_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                ROMBERG_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct a Romberg integrator with default settings
-     * (max iteration count set to {@link #ROMBERG_MAX_ITERATIONS_COUNT})
-     */
-    public RombergIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, ROMBERG_MAX_ITERATIONS_COUNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws TooManyEvaluationsException, MaxCountExceededException {
-
-        final int m = iterations.getMaximalCount() + 1;
-        double previousRow[] = new double[m];
-        double currentRow[]  = new double[m];
-
-        TrapezoidIntegrator qtrap = new TrapezoidIntegrator();
-        currentRow[0] = qtrap.stage(this, 0);
-        iterations.incrementCount();
-        double olds = currentRow[0];
-        while (true) {
-
-            final int i = iterations.getCount();
-
-            // switch rows
-            final double[] tmpRow = previousRow;
-            previousRow = currentRow;
-            currentRow = tmpRow;
-
-            currentRow[0] = qtrap.stage(this, i);
-            iterations.incrementCount();
-            for (int j = 1; j <= i; j++) {
-                // Richardson extrapolation coefficient
-                final double r = (1L << (2 * j)) - 1;
-                final double tIJm1 = currentRow[j - 1];
-                currentRow[j] = tIJm1 + (tIJm1 - previousRow[j - 1]) / r;
-            }
-            final double s = currentRow[i];
-            if (i >= getMinimalIterationCount()) {
-                final double delta  = FastMath.abs(s - olds);
-                final double rLimit = getRelativeAccuracy() * (FastMath.abs(olds) + FastMath.abs(s)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return s;
-                }
-            }
-            olds = s;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java
deleted file mode 100644
index b13ff5f..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/SimpsonIntegrator.java
+++ /dev/null
@@ -1,129 +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.analysis.integration;
-
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements <a href="http://mathworld.wolfram.com/SimpsonsRule.html">
- * Simpson's Rule</a> for integration of real univariate functions. For
- * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X,
- * chapter 3.
- * <p>
- * This implementation employs the basic trapezoid rule to calculate Simpson's
- * rule.</p>
- *
- * @since 1.2
- */
-public class SimpsonIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximal number of iterations for Simpson. */
-    public static final int SIMPSON_MAX_ITERATIONS_COUNT = 64;
-
-    /**
-     * Build a Simpson integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #SIMPSON_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #SIMPSON_MAX_ITERATIONS_COUNT}
-     */
-    public SimpsonIntegrator(final double relativeAccuracy,
-                             final double absoluteAccuracy,
-                             final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > SIMPSON_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                SIMPSON_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a Simpson integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #SIMPSON_MAX_ITERATIONS_COUNT})
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #SIMPSON_MAX_ITERATIONS_COUNT}
-     */
-    public SimpsonIntegrator(final int minimalIterationCount,
-                             final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > SIMPSON_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                SIMPSON_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct an integrator with default settings.
-     * (max iteration count set to {@link #SIMPSON_MAX_ITERATIONS_COUNT})
-     */
-    public SimpsonIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, SIMPSON_MAX_ITERATIONS_COUNT);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws TooManyEvaluationsException, MaxCountExceededException {
-
-        TrapezoidIntegrator qtrap = new TrapezoidIntegrator();
-        if (getMinimalIterationCount() == 1) {
-            return (4 * qtrap.stage(this, 1) - qtrap.stage(this, 0)) / 3.0;
-        }
-
-        // Simpson's rule requires at least two trapezoid stages.
-        double olds = 0;
-        double oldt = qtrap.stage(this, 0);
-        while (true) {
-            final double t = qtrap.stage(this, iterations.getCount());
-            iterations.incrementCount();
-            final double s = (4 * t - oldt) / 3.0;
-            if (iterations.getCount() >= getMinimalIterationCount()) {
-                final double delta = FastMath.abs(s - olds);
-                final double rLimit =
-                    getRelativeAccuracy() * (FastMath.abs(olds) + FastMath.abs(s)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return s;
-                }
-            }
-            olds = s;
-            oldt = t;
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java
deleted file mode 100644
index d22d12d..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/TrapezoidIntegrator.java
+++ /dev/null
@@ -1,168 +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.analysis.integration;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the <a href="http://mathworld.wolfram.com/TrapezoidalRule.html">
- * Trapezoid Rule</a> for integration of real univariate functions. For
- * reference, see <b>Introduction to Numerical Analysis</b>, ISBN 038795452X,
- * chapter 3.
- * <p>
- * The function should be integrable.</p>
- *
- * @since 1.2
- */
-public class TrapezoidIntegrator extends BaseAbstractUnivariateIntegrator {
-
-    /** Maximum number of iterations for trapezoid. */
-    public static final int TRAPEZOID_MAX_ITERATIONS_COUNT = 64;
-
-    /** Intermediate result. */
-    private double s;
-
-    /**
-     * Build a trapezoid integrator with given accuracies and iterations counts.
-     * @param relativeAccuracy relative accuracy of the result
-     * @param absoluteAccuracy absolute accuracy of the result
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     */
-    public TrapezoidIntegrator(final double relativeAccuracy,
-                               final double absoluteAccuracy,
-                               final int minimalIterationCount,
-                               final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(relativeAccuracy, absoluteAccuracy, minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > TRAPEZOID_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                TRAPEZOID_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Build a trapezoid integrator with given iteration counts.
-     * @param minimalIterationCount minimum number of iterations
-     * @param maximalIterationCount maximum number of iterations
-     * (must be less than or equal to {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     * @exception NotStrictlyPositiveException if minimal number of iterations
-     * is not strictly positive
-     * @exception NumberIsTooSmallException if maximal number of iterations
-     * is lesser than or equal to the minimal number of iterations
-     * @exception NumberIsTooLargeException if maximal number of iterations
-     * is greater than {@link #TRAPEZOID_MAX_ITERATIONS_COUNT}
-     */
-    public TrapezoidIntegrator(final int minimalIterationCount,
-                               final int maximalIterationCount)
-        throws NotStrictlyPositiveException, NumberIsTooSmallException, NumberIsTooLargeException {
-        super(minimalIterationCount, maximalIterationCount);
-        if (maximalIterationCount > TRAPEZOID_MAX_ITERATIONS_COUNT) {
-            throw new NumberIsTooLargeException(maximalIterationCount,
-                                                TRAPEZOID_MAX_ITERATIONS_COUNT, false);
-        }
-    }
-
-    /**
-     * Construct a trapezoid integrator with default settings.
-     * (max iteration count set to {@link #TRAPEZOID_MAX_ITERATIONS_COUNT})
-     */
-    public TrapezoidIntegrator() {
-        super(DEFAULT_MIN_ITERATIONS_COUNT, TRAPEZOID_MAX_ITERATIONS_COUNT);
-    }
-
-    /**
-     * Compute the n-th stage integral of trapezoid rule. This function
-     * should only be called by API <code>integrate()</code> in the package.
-     * To save time it does not verify arguments - caller does.
-     * <p>
-     * The interval is divided equally into 2^n sections rather than an
-     * arbitrary m sections because this configuration can best utilize the
-     * already computed values.</p>
-     *
-     * @param baseIntegrator integrator holding integration parameters
-     * @param n the stage of 1/2 refinement, n = 0 is no refinement
-     * @return the value of n-th stage integral
-     * @throws TooManyEvaluationsException if the maximal number of evaluations
-     * is exceeded.
-     */
-    double stage(final BaseAbstractUnivariateIntegrator baseIntegrator, final int n)
-        throws TooManyEvaluationsException {
-
-        if (n == 0) {
-            final double max = baseIntegrator.getMax();
-            final double min = baseIntegrator.getMin();
-            s = 0.5 * (max - min) *
-                      (baseIntegrator.computeObjectiveValue(min) +
-                       baseIntegrator.computeObjectiveValue(max));
-            return s;
-        } else {
-            final long np = 1L << (n-1);           // number of new points in this stage
-            double sum = 0;
-            final double max = baseIntegrator.getMax();
-            final double min = baseIntegrator.getMin();
-            // spacing between adjacent new points
-            final double spacing = (max - min) / np;
-            double x = min + 0.5 * spacing;    // the first new point
-            for (long i = 0; i < np; i++) {
-                sum += baseIntegrator.computeObjectiveValue(x);
-                x += spacing;
-            }
-            // add the new sum to previously calculated result
-            s = 0.5 * (s + sum * spacing);
-            return s;
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double doIntegrate()
-        throws MathIllegalArgumentException, TooManyEvaluationsException, MaxCountExceededException {
-
-        double oldt = stage(this, 0);
-        iterations.incrementCount();
-        while (true) {
-            final int i = iterations.getCount();
-            final double t = stage(this, i);
-            if (i >= getMinimalIterationCount()) {
-                final double delta = FastMath.abs(t - oldt);
-                final double rLimit =
-                    getRelativeAccuracy() * (FastMath.abs(oldt) + FastMath.abs(t)) * 0.5;
-                if ((delta <= rLimit) || (delta <= getAbsoluteAccuracy())) {
-                    return t;
-                }
-            }
-            oldt = t;
-            iterations.incrementCount();
-        }
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java b/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java
deleted file mode 100644
index f5673fb..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/UnivariateIntegrator.java
+++ /dev/null
@@ -1,92 +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.analysis.integration;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.TooManyEvaluationsException;
-
-/**
- * Interface for univariate real integration algorithms.
- *
- * @since 1.2
- */
-public interface UnivariateIntegrator {
-
-    /**
-     * Get the actual relative accuracy.
-     * @return the accuracy
-     */
-    double getRelativeAccuracy();
-
-    /**
-     * Get the actual absolute accuracy.
-     *
-     * @return the accuracy
-     */
-    double getAbsoluteAccuracy();
-
-    /**
-     * Get the min limit for the number of iterations.
-     *
-     * @return the actual min limit
-     */
-    int getMinimalIterationCount();
-
-    /**
-     * Get the upper limit for the number of iterations.
-     *
-     * @return the actual upper limit
-     */
-    int getMaximalIterationCount();
-
-    /**
-     * Integrate the function in the given interval.
-     *
-     * @param maxEval Maximum number of evaluations.
-     * @param f the integrand function
-     * @param min the min bound for the interval
-     * @param max the upper bound for the interval
-     * @return the value of integral
-     * @throws TooManyEvaluationsException if the maximum number of function
-     * evaluations is exceeded.
-     * @throws MaxCountExceededException if the maximum iteration count is exceeded
-     * or the integrator detects convergence problems otherwise
-     * @throws MathIllegalArgumentException if min > max or the endpoints do not
-     * satisfy the requirements specified by the integrator
-     * @throws NullArgumentException if {@code f} is {@code null}.
-     */
-    double integrate(int maxEval, UnivariateFunction f, double min,
-                     double max)
-        throws TooManyEvaluationsException, MaxCountExceededException,
-               MathIllegalArgumentException, NullArgumentException;
-
-    /**
-     * Get the number of function evaluations of the last run of the integrator.
-     * @return number of function evaluations
-     */
-    int getEvaluations();
-
-    /**
-     * Get the number of iterations of the last run of the integrator.
-     * @return number of iterations
-     */
-    int getIterations();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java b/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
deleted file mode 100644
index 556fa0c..0000000
--- a/src/main/java/org/apache/commons/math3/analysis/integration/gauss/BaseRuleFactory.java
+++ /dev/null
@@ -1,153 +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.analysis.integration.gauss;
-
-import java.util.Map;
-import java.util.TreeMap;
-import org.apache.commons.math3.util.Pair;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Base class for rules that determines the integration nodes and their
- * weights.
- * Subclasses must implement the {@link #computeRule(int) computeRule} method.
- *
- * @param <T> Type of the number used to represent the points and weights of
- * the quadrature rules.
- *
- * @since 3.1
- */
-public abstract class BaseRuleFactory<T extends Number> {
-    /** List of points and weights, indexed by the order of the rule. */
-    private final Map<Integer, Pair<T[], T[]>> pointsAndWeights
-        = new TreeMap<Integer, Pair<T[], T[]>>();
-    /** Cache for double-precision rules. */
-    private final Map<Integer, Pair<double[], double[]>> pointsAndWeightsDouble
-        = new TreeMap<Integer, Pair<double[], double[]>>();
-
-    /**
-     * Gets a copy of the quadrature rule with the given number of integration
-     * points.
-     *
-     * @param numberOfPoints Number of integration points.
-     * @return a copy of the integration rule.
-     * @throws NotStrictlyPositiveException if {@code numberOfPoints < 1}.
-     * @throws DimensionMismatchException if the elements of the rule pair do not
-     * have the same length.
-     */
-    public Pair<double[], double[]> getRule(int numberOfPoints)
-        throws NotStrictlyPositiveException, DimensionMismatchException {
-
-        if (numberOfPoints <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_POINTS,
-                                                   numberOfPoints);
-        }
-
-        // Try to obtain the rule from the cache.
-        Pair<double[], double[]> cached = pointsAndWeightsDouble.get(numberOfPoints);
-
-        if (cached == null) {
-            // Rule not computed yet.
-
-            // Compute the rule.
-            final Pair<T[], T[]> rule = getRuleInternal(numberOfPoints);
-            cached = convertToDouble(rule);
-
-            // Cache it.
-            pointsAndWeightsDouble.put(numberOfPoints, cached);
-        }
-
-        // Return a copy.
-        return new Pair<double[], double[]>(cached.getFirst().clone(),
-                                            cached.getSecond().clone());
-    }
-
-    /**
-     * Gets a rule.
-     * Synchronization ensures that rules will be computed and added to the
-     * cache at most once.
-     * The returned rule is a reference into the cache.
-     *
-     * @param numberOfPoints Order of the rule to be retrieved.
-     * @return the points and weights corresponding to the given order.
-     * @throws DimensionMismatchException if the elements of the rule pair do not
-     * have the same length.
-     */
-    protected synchronized Pair<T[], T[]> getRuleInternal(int numberOfPoints)
-        throws DimensionMismatchException {
-        final Pair<T[], T[]> rule = pointsAndWeights.get(numberOfPoints);
-        if (rule == null) {
-            addRule(computeRule(numberOfPoints));
-            // The rule should be available now.
-            return getRuleInternal(numberOfPoints);
-        }
-        return rule;
-    }
-
-    /**
-     * Stores a rule.
-     *
-     * @param rule Rule to be stored.
-     * @throws DimensionMismatchException if the elements of the pair do not
-     * have the same length.
-     */
-    protected void addRule(Pair<T[], T[]> rule) throws DimensionMismatchException {
-        if (rule.getFirst().length != rule.getSecond().length) {
-            throw new DimensionMismatchException(rule.getFirst().length,
-                                                 rule.getSecond().length);
-        }
-
-        pointsAndWeights.put(rule.getFirst().length, rule);
-    }
-
-    /**
-     * Computes the rule for the given order.
-     *
-     * @param numberOfPoints Order of the rule to be computed.
-     * @return the computed rule.
-     * @throws DimensionMismatchException if the elements of the pair do not
-     * have the same length.
-     */
-    protected abstract Pair<T[], T[]> computeRule(int numberOfPoints)
-        throws DimensionMismatchException;
-
-    /**
-     * Converts the from the actual {@code Number} type to {@code double}
-     *
-     * @param <T> Type of the number used to represent the points and
-     * weights of the quadrature rules.
-     * @param rule Points and weights.
-     * @return points and weights as {@code double}s.
-     */
-    private static <T extends Number> Pair<double[], double[]> convertToDouble(Pair<T[], T[]> rule) {
-        final T[] pT = rule.getFirst();
-        final T[] wT = rule.getSecond();
-
-        final int len = pT.length;
-        final double[] pD = new double[len];
-        final double[] wD = new double[len];
-
-        for (int i = 0; i < len; i++) {
-            pD[i] = pT[i].doubleValue();
-            wD[i] = wT[i].doubleValue();
-        }
-
-        return new Pair<double[], double[]>(pD, wD);
-    }
-}


[67/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/RandomGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RandomGeneratorFactory.java b/src/main/java/org/apache/commons/math4/random/RandomGeneratorFactory.java
index d4fb58a..401397a 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomGeneratorFactory.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomGeneratorFactory.java
@@ -14,10 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Random;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 
 /**
  * Utilities for creating {@link RandomGenerator} instances.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/RandomVectorGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/RandomVectorGenerator.java b/src/main/java/org/apache/commons/math4/random/RandomVectorGenerator.java
index 26110c1..fc6ddec 100644
--- a/src/main/java/org/apache/commons/math4/random/RandomVectorGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/RandomVectorGenerator.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /** This interface represents a random generator for whole vectors.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/SobolSequenceGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/SobolSequenceGenerator.java b/src/main/java/org/apache/commons/math4/random/SobolSequenceGenerator.java
index de16a7c..5fd89fc 100644
--- a/src/main/java/org/apache/commons/math4/random/SobolSequenceGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/SobolSequenceGenerator.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.io.BufferedReader;
 import java.io.IOException;
@@ -25,12 +25,12 @@ import java.util.Arrays;
 import java.util.NoSuchElementException;
 import java.util.StringTokenizer;
 
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.MathParseException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.MathParseException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implementation of a Sobol sequence.
@@ -65,7 +65,7 @@ public class SobolSequenceGenerator implements RandomVectorGenerator {
     private static final int MAX_DIMENSION = 1000;
 
     /** The resource containing the direction numbers. */
-    private static final String RESOURCE_NAME = "/assets/org/apache/commons/math3/random/new-joe-kuo-6.1000";
+    private static final String RESOURCE_NAME = "/assets/org/apache/commons/math4/random/new-joe-kuo-6.1000";
 
     /** Character set for file input. */
     private static final String FILE_CHARSET = "US-ASCII";

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java
index 22a0da3..c8b0987 100644
--- a/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/StableRandomGenerator.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <p>This class provides a stable normalized random generator. It samples from a stable

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/SynchronizedRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/SynchronizedRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/SynchronizedRandomGenerator.java
index 4e79cb2..615f708 100644
--- a/src/main/java/org/apache/commons/math4/random/SynchronizedRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/SynchronizedRandomGenerator.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 /**
  * Any {@link RandomGenerator} implementation can be thread-safe if it

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGenerator.java b/src/main/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGenerator.java
index b573756..71bba9b 100644
--- a/src/main/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/UncorrelatedRandomVectorGenerator.java
@@ -15,11 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /**
  * A {@link RandomVectorGenerator} that generates vectors with uncorrelated

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java b/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java
index 6a72eaa..6a2eb92 100644
--- a/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/UniformRandomGenerator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This class implements a normalized uniform random generator.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java b/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java
index 12c7fad..9ac8ffe 100644
--- a/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java
+++ b/src/main/java/org/apache/commons/math4/random/UnitSphereRandomVectorGenerator.java
@@ -15,9 +15,9 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/ValueServer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/ValueServer.java b/src/main/java/org/apache/commons/math4/random/ValueServer.java
index 975d2d8..a610783 100644
--- a/src/main/java/org/apache/commons/math4/random/ValueServer.java
+++ b/src/main/java/org/apache/commons/math4/random/ValueServer.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.MalformedURLException;
 import java.net.URL;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.ZeroException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.ZeroException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Generates values for use in simulation applications.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 25420eb..6d96606 100644
--- a/src/main/java/org/apache/commons/math4/random/Well1024a.java
+++ b/src/main/java/org/apache/commons/math4/random/Well1024a.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /** This class implements the WELL1024a pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/Well19937a.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/Well19937a.java b/src/main/java/org/apache/commons/math4/random/Well19937a.java
index 0a24a18..d3abf95 100644
--- a/src/main/java/org/apache/commons/math4/random/Well19937a.java
+++ b/src/main/java/org/apache/commons/math4/random/Well19937a.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /** This class implements the WELL19937a pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/Well19937c.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/Well19937c.java b/src/main/java/org/apache/commons/math4/random/Well19937c.java
index ab52d4b..2adf075 100644
--- a/src/main/java/org/apache/commons/math4/random/Well19937c.java
+++ b/src/main/java/org/apache/commons/math4/random/Well19937c.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /** This class implements the WELL19937c pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/Well44497a.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/Well44497a.java b/src/main/java/org/apache/commons/math4/random/Well44497a.java
index 59543d2..52717e3 100644
--- a/src/main/java/org/apache/commons/math4/random/Well44497a.java
+++ b/src/main/java/org/apache/commons/math4/random/Well44497a.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /** This class implements the WELL44497a pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/Well44497b.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/Well44497b.java b/src/main/java/org/apache/commons/math4/random/Well44497b.java
index 4b50dbe..cc73f7f 100644
--- a/src/main/java/org/apache/commons/math4/random/Well44497b.java
+++ b/src/main/java/org/apache/commons/math4/random/Well44497b.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /** This class implements the WELL44497b pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/random/Well512a.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/random/Well512a.java b/src/main/java/org/apache/commons/math4/random/Well512a.java
index 1f15875..c68b9cd 100644
--- a/src/main/java/org/apache/commons/math4/random/Well512a.java
+++ b/src/main/java/org/apache/commons/math4/random/Well512a.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;
 
 
 /** This class implements the WELL512a pseudo-random number generator

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/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 06e5739..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
@@ -20,19 +20,19 @@
  *      <p>Commons-math provides a few pseudo random number generators. The top level interface is RandomGenerator.
  *      It is implemented by three classes:
  *      <ul>
- *        <li>{@link org.apache.commons.math3.random.JDKRandomGenerator JDKRandomGenerator}
+ *        <li>{@link org.apache.commons.math4.random.JDKRandomGenerator JDKRandomGenerator}
  *            that extends the JDK provided generator</li>
  *        <li>AbstractRandomGenerator as a helper for users generators</li>
  *        <li>BitStreamGenerator which is an abstract class for several generators and
  *            which in turn is extended by:
  *            <ul>
- *              <li>{@link org.apache.commons.math3.random.MersenneTwister MersenneTwister}</li>
- *              <li>{@link org.apache.commons.math3.random.Well512a Well512a}</li>
- *              <li>{@link org.apache.commons.math3.random.Well1024a Well1024a}</li>
- *              <li>{@link org.apache.commons.math3.random.Well19937a Well19937a}</li>
- *              <li>{@link org.apache.commons.math3.random.Well19937c Well19937c}</li>
- *              <li>{@link org.apache.commons.math3.random.Well44497a Well44497a}</li>
- *              <li>{@link org.apache.commons.math3.random.Well44497b Well44497b}</li>
+ *              <li>{@link org.apache.commons.math4.random.MersenneTwister MersenneTwister}</li>
+ *              <li>{@link org.apache.commons.math4.random.Well512a Well512a}</li>
+ *              <li>{@link org.apache.commons.math4.random.Well1024a Well1024a}</li>
+ *              <li>{@link org.apache.commons.math4.random.Well19937a Well19937a}</li>
+ *              <li>{@link org.apache.commons.math4.random.Well19937c Well19937c}</li>
+ *              <li>{@link org.apache.commons.math4.random.Well44497a Well44497a}</li>
+ *              <li>{@link org.apache.commons.math4.random.Well44497b Well44497b}</li>
  *            </ul>
  *          </li>
  *        </ul>
@@ -103,21 +103,21 @@
  *        <table border="1" align="center">
  *          <tr BGCOLOR="#CCCCFF"><td colspan="2"><font size="+2">Example of performances</font></td></tr>
  *          <tr BGCOLOR="#EEEEFF"><font size="+1"><td>Name</td><td>generation rate (relative to MersenneTwister)</td></font></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.MersenneTwister MersenneTwister}</td><td>1</td></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.JDKRandomGenerator JDKRandomGenerator}</td><td>between 0.96 and 1.16</td></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.Well512a Well512a}</td><td>between 0.85 and 0.88</td></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.Well1024a Well1024a}</td><td>between 0.63 and 0.73</td></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.Well19937a Well19937a}</td><td>between 0.70 and 0.71</td></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.Well19937c Well19937c}</td><td>between 0.57 and 0.71</td></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.Well44497a Well44497a}</td><td>between 0.69 and 0.71</td></tr>
- *          <tr><td>{@link org.apache.commons.math3.random.Well44497b Well44497b}</td><td>between 0.65 and 0.71</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.MersenneTwister MersenneTwister}</td><td>1</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.JDKRandomGenerator JDKRandomGenerator}</td><td>between 0.96 and 1.16</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.Well512a Well512a}</td><td>between 0.85 and 0.88</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.Well1024a Well1024a}</td><td>between 0.63 and 0.73</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.Well19937a Well19937a}</td><td>between 0.70 and 0.71</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.Well19937c Well19937c}</td><td>between 0.57 and 0.71</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.Well44497a Well44497a}</td><td>between 0.69 and 0.71</td></tr>
+ *          <tr><td>{@link org.apache.commons.math4.random.Well44497b Well44497b}</td><td>between 0.65 and 0.71</td></tr>
  *        </table>
  *      </p>
  *
  *      <p>
  *      So for most simulation problems, the better generators like {@link
- *      org.apache.commons.math3.random.Well19937c Well19937c} and {@link
- *      org.apache.commons.math3.random.Well44497b Well44497b} are probably very good choices.
+ *      org.apache.commons.math4.random.Well19937c Well19937c} and {@link
+ *      org.apache.commons.math4.random.Well44497b Well44497b} are probably very good choices.
  *      </p>
  *
  *      <p>
@@ -129,4 +129,4 @@
  *
  *
  */
-package org.apache.commons.math3.random;
+package org.apache.commons.math4.random;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/special/BesselJ.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/special/BesselJ.java b/src/main/java/org/apache/commons/math4/special/BesselJ.java
index a2897a5..ad5eddc 100644
--- a/src/main/java/org/apache/commons/math4/special/BesselJ.java
+++ b/src/main/java/org/apache/commons/math4/special/BesselJ.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.special;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+package org.apache.commons.math4.special;
+
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.special.Gamma;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * This class provides computation methods related to Bessel

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/special/Beta.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/special/Beta.java b/src/main/java/org/apache/commons/math4/special/Beta.java
index fc316e9..08a0d46 100644
--- a/src/main/java/org/apache/commons/math4/special/Beta.java
+++ b/src/main/java/org/apache/commons/math4/special/Beta.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.special;
+package org.apache.commons.math4.special;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.util.ContinuedFraction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.ContinuedFraction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <p>
@@ -109,7 +109,7 @@ public class Beta {
      * @param a Parameter {@code a}.
      * @param b Parameter {@code b}.
      * @return the regularized beta function I(x, a, b).
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if the algorithm fails to converge.
      */
     public static double regularizedBeta(double x, double a, double b) {
@@ -128,7 +128,7 @@ public class Beta {
      * series is less than epsilon the approximation ceases to calculate
      * further elements in the series.
      * @return the regularized beta function I(x, a, b)
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if the algorithm fails to converge.
      */
     public static double regularizedBeta(double x,
@@ -145,7 +145,7 @@ public class Beta {
      * @param b Parameter {@code b}.
      * @param maxIterations Maximum number of "iterations" to complete.
      * @return the regularized beta function I(x, a, b)
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if the algorithm fails to converge.
      */
     public static double regularizedBeta(double x,
@@ -175,7 +175,7 @@ public class Beta {
      * further elements in the series.
      * @param maxIterations Maximum number of "iterations" to complete.
      * @return the regularized beta function I(x, a, b)
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if the algorithm fails to converge.
      */
     public static double regularizedBeta(double x,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/special/Erf.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/special/Erf.java b/src/main/java/org/apache/commons/math4/special/Erf.java
index a42a907..9872230 100644
--- a/src/main/java/org/apache/commons/math4/special/Erf.java
+++ b/src/main/java/org/apache/commons/math4/special/Erf.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.special;
+package org.apache.commons.math4.special;
 
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * This is a utility class that provides computation methods related to the
@@ -58,7 +58,7 @@ public class Erf {
      *
      * @param x the value.
      * @return the error function erf(x)
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if the algorithm fails to converge.
      * @see Gamma#regularizedGammaP(double, double, double, int)
      */
@@ -88,7 +88,7 @@ public class Erf {
      *
      * @param x the value
      * @return the complementary error function erfc(x)
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if the algorithm fails to converge.
      * @see Gamma#regularizedGammaQ(double, double, double, int)
      * @since 2.2

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/special/Gamma.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/special/Gamma.java b/src/main/java/org/apache/commons/math4/special/Gamma.java
index fef30e6..eb3fb5b 100644
--- a/src/main/java/org/apache/commons/math4/special/Gamma.java
+++ b/src/main/java/org/apache/commons/math4/special/Gamma.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.special;
+package org.apache.commons.math4.special;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.util.ContinuedFraction;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.util.ContinuedFraction;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/special/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/special/package-info.java b/src/main/java/org/apache/commons/math4/special/package-info.java
index 6ebcbd5..f3289a9 100644
--- a/src/main/java/org/apache/commons/math4/special/package-info.java
+++ b/src/main/java/org/apache/commons/math4/special/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Implementations of special functions such as Beta and Gamma.
  */
-package org.apache.commons.math3.special;
+package org.apache.commons.math4.special;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/Frequency.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/Frequency.java b/src/main/java/org/apache/commons/math4/stat/Frequency.java
index c9bc100..213f248 100644
--- a/src/main/java/org/apache/commons/math4/stat/Frequency.java
+++ b/src/main/java/org/apache/commons/math4/stat/Frequency.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat;
+package org.apache.commons.math4.stat;
 
 import java.io.Serializable;
 import java.text.NumberFormat;
@@ -27,10 +27,10 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.TreeMap;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Maintains a frequency distribution.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/StatUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/StatUtils.java b/src/main/java/org/apache/commons/math4/stat/StatUtils.java
index d7f9e53..4ecd49c 100644
--- a/src/main/java/org/apache/commons/math4/stat/StatUtils.java
+++ b/src/main/java/org/apache/commons/math4/stat/StatUtils.java
@@ -14,29 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat;
+package org.apache.commons.math4.stat;
 
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.DescriptiveStatistics;
-import org.apache.commons.math3.stat.descriptive.UnivariateStatistic;
-import org.apache.commons.math3.stat.descriptive.moment.GeometricMean;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.stat.descriptive.rank.Max;
-import org.apache.commons.math3.stat.descriptive.rank.Min;
-import org.apache.commons.math3.stat.descriptive.rank.Percentile;
-import org.apache.commons.math3.stat.descriptive.summary.Product;
-import org.apache.commons.math3.stat.descriptive.summary.Sum;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfLogs;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfSquares;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.DescriptiveStatistics;
+import org.apache.commons.math4.stat.descriptive.UnivariateStatistic;
+import org.apache.commons.math4.stat.descriptive.moment.GeometricMean;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.stat.descriptive.rank.Max;
+import org.apache.commons.math4.stat.descriptive.rank.Min;
+import org.apache.commons.math4.stat.descriptive.rank.Percentile;
+import org.apache.commons.math4.stat.descriptive.summary.Product;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfLogs;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
 
 /**
  * StatUtils provides static methods for computing statistics based on data
@@ -191,7 +191,7 @@ public final class StatUtils {
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.summary.SumOfLogs}.
+     * See {@link org.apache.commons.math4.stat.descriptive.summary.SumOfLogs}.
      * </p>
      *
      * @param values the input array
@@ -211,7 +211,7 @@ public final class StatUtils {
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.summary.SumOfLogs}.
+     * See {@link org.apache.commons.math4.stat.descriptive.summary.SumOfLogs}.
      * </p>
      *
      * @param values the input array
@@ -233,7 +233,7 @@ public final class StatUtils {
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Mean} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Mean} for
      * details on the computing algorithm.</p>
      *
      * @param values the input array
@@ -252,7 +252,7 @@ public final class StatUtils {
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Mean} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Mean} for
      * details on the computing algorithm.</p>
      *
      * @param values the input array
@@ -273,7 +273,7 @@ public final class StatUtils {
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.GeometricMean}
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.GeometricMean}
      * for details on the computing algorithm.</p>
      *
      * @param values the input array
@@ -292,7 +292,7 @@ public final class StatUtils {
      * <p>
      * Throws <code>IllegalArgumentException</code> if the array is null.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.GeometricMean}
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.GeometricMean}
      * for details on the computing algorithm.</p>
      *
      * @param values the input array
@@ -316,7 +316,7 @@ public final class StatUtils {
      * the denominator).  Use {@link #populationVariance(double[])} for the non-bias-corrected
      * population variance.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the computing algorithm.</p>
      * <p>
      * Returns 0 for a single-value (i.e. length = 1) sample.</p>
@@ -340,7 +340,7 @@ public final class StatUtils {
      * the denominator).  Use {@link #populationVariance(double[], int, int)} for the non-bias-corrected
      * population variance.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the computing algorithm.</p>
      * <p>
      * Returns 0 for a single-value (i.e. length = 1) sample.</p>
@@ -369,7 +369,7 @@ public final class StatUtils {
      * the denominator).  Use {@link #populationVariance(double[], double, int, int)} for the non-bias-corrected
      * population variance.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the computing algorithm.</p>
      * <p>
      * The formula used assumes that the supplied mean value is the arithmetic
@@ -404,7 +404,7 @@ public final class StatUtils {
      * the denominator).  Use {@link #populationVariance(double[], double)} for the non-bias-corrected
      * population variance.</p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the computing algorithm.</p>
      * <p>
      * The formula used assumes that the supplied mean value is the arithmetic
@@ -431,7 +431,7 @@ public final class StatUtils {
      * population variance</a> of the entries in the input array, or
      * <code>Double.NaN</code> if the array is empty.
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the formula and computing algorithm.</p>
      * <p>
      * Returns 0 for a single-value (i.e. length = 1) sample.</p>
@@ -453,7 +453,7 @@ public final class StatUtils {
      * the input array, or <code>Double.NaN</code> if the designated subarray
      * is empty.
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the computing algorithm.</p>
      * <p>
      * Returns 0 for a single-value (i.e. length = 1) sample.</p>
@@ -479,7 +479,7 @@ public final class StatUtils {
      * the input array, using the precomputed mean value.  Returns
      * <code>Double.NaN</code> if the designated subarray is empty.
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the computing algorithm.</p>
      * <p>
      * The formula used assumes that the supplied mean value is the arithmetic
@@ -511,7 +511,7 @@ public final class StatUtils {
      * precomputed mean value.  Returns <code>Double.NaN</code> if the array
      * is empty.
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.moment.Variance} for
+     * See {@link org.apache.commons.math4.stat.descriptive.moment.Variance} for
      * details on the computing algorithm.</p>
      * <p>
      * The formula used assumes that the supplied mean value is the arithmetic
@@ -643,7 +643,7 @@ public final class StatUtils {
      * and less than or equal to 100)</li>
      * </ul></p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.rank.Percentile} for
+     * See {@link org.apache.commons.math4.stat.descriptive.rank.Percentile} for
      * a description of the percentile estimation algorithm used.</p>
      *
      * @param values input array of values
@@ -673,7 +673,7 @@ public final class StatUtils {
      * and less than or equal to 100)</li>
      * </ul></p>
      * <p>
-     * See {@link org.apache.commons.math3.stat.descriptive.rank.Percentile} for
+     * See {@link org.apache.commons.math4.stat.descriptive.rank.Percentile} for
      * a description of the percentile estimation algorithm used.</p>
      *
      * @param values array of input values

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/clustering/Cluster.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/clustering/Cluster.java b/src/main/java/org/apache/commons/math4/stat/clustering/Cluster.java
index 8d9483e..3fbc11b 100644
--- a/src/main/java/org/apache/commons/math4/stat/clustering/Cluster.java
+++ b/src/main/java/org/apache/commons/math4/stat/clustering/Cluster.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.io.Serializable;
 import java.util.ArrayList;
@@ -26,7 +26,7 @@ import java.util.List;
  * @param <T> the type of points that can be clustered
  * @since 2.0
  * @deprecated As of 3.2 (to be removed in 4.0),
- * use {@link org.apache.commons.math3.ml.clustering.Cluster} instead
+ * use {@link org.apache.commons.math4.ml.clustering.Cluster} instead
  */
 @Deprecated
 public class Cluster<T extends Clusterable<T>> implements Serializable {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/clustering/Clusterable.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/clustering/Clusterable.java b/src/main/java/org/apache/commons/math4/stat/clustering/Clusterable.java
index f9818f3..f9f75b4 100644
--- a/src/main/java/org/apache/commons/math4/stat/clustering/Clusterable.java
+++ b/src/main/java/org/apache/commons/math4/stat/clustering/Clusterable.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.util.Collection;
 
@@ -24,7 +24,7 @@ import java.util.Collection;
  * @param <T> the type of point that can be clustered
  * @since 2.0
  * @deprecated As of 3.2 (to be removed in 4.0),
- * use {@link org.apache.commons.math3.ml.clustering.Clusterable} instead
+ * use {@link org.apache.commons.math4.ml.clustering.Clusterable} instead
  */
 @Deprecated
 public interface Clusterable<T> {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/clustering/DBSCANClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/clustering/DBSCANClusterer.java b/src/main/java/org/apache/commons/math4/stat/clustering/DBSCANClusterer.java
index 13247eb..0122f48 100644
--- a/src/main/java/org/apache/commons/math4/stat/clustering/DBSCANClusterer.java
+++ b/src/main/java/org/apache/commons/math4/stat/clustering/DBSCANClusterer.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -24,9 +24,9 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * DBSCAN (density-based spatial clustering of applications with noise) algorithm.
@@ -57,7 +57,7 @@ import org.apache.commons.math3.util.MathUtils;
  * A Density-Based Algorithm for Discovering Clusters in Large Spatial Databases with Noise</a>
  * @since 3.1
  * @deprecated As of 3.2 (to be removed in 4.0),
- * use {@link org.apache.commons.math3.ml.clustering.DBSCANClusterer} instead
+ * use {@link org.apache.commons.math4.ml.clustering.DBSCANClusterer} instead
  */
 @Deprecated
 public class DBSCANClusterer<T extends Clusterable<T>> {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePoint.java b/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePoint.java
index 32c236c..912b01d 100644
--- a/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePoint.java
+++ b/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanDoublePoint.java
@@ -14,19 +14,19 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Arrays;
 
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * A simple implementation of {@link Clusterable} for points with double coordinates.
  * @since 3.1
  * @deprecated As of 3.2 (to be removed in 4.0),
- * use {@link org.apache.commons.math3.ml.clustering.DoublePoint} instead
+ * use {@link org.apache.commons.math4.ml.clustering.DoublePoint} instead
  */
 @Deprecated
 public class EuclideanDoublePoint implements Clusterable<EuclideanDoublePoint>, Serializable {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPoint.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPoint.java b/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPoint.java
index 508b0fa..bbc707e 100644
--- a/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPoint.java
+++ b/src/main/java/org/apache/commons/math4/stat/clustering/EuclideanIntegerPoint.java
@@ -15,19 +15,19 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Collection;
 
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * A simple implementation of {@link Clusterable} for points with integer coordinates.
  * @since 2.0
  * @deprecated As of 3.2 (to be removed in 4.0),
- * use {@link org.apache.commons.math3.ml.clustering.DoublePoint} instead
+ * use {@link org.apache.commons.math4.ml.clustering.DoublePoint} instead
  */
 @Deprecated
 public class EuclideanIntegerPoint implements Clusterable<EuclideanIntegerPoint>, Serializable {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClusterer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClusterer.java b/src/main/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClusterer.java
index ace584e..6c93ed5 100644
--- a/src/main/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClusterer.java
+++ b/src/main/java/org/apache/commons/math4/stat/clustering/KMeansPlusPlusClusterer.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -23,12 +23,12 @@ import java.util.Collections;
 import java.util.List;
 import java.util.Random;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Clustering algorithm based on David Arthur and Sergei Vassilvitski k-means++ algorithm.
@@ -36,7 +36,7 @@ import org.apache.commons.math3.util.MathUtils;
  * @see <a href="http://en.wikipedia.org/wiki/K-means%2B%2B">K-means++ (wikipedia)</a>
  * @since 2.0
  * @deprecated As of 3.2 (to be removed in 4.0),
- * use {@link org.apache.commons.math3.ml.clustering.KMeansPlusPlusClusterer} instead
+ * use {@link org.apache.commons.math4.ml.clustering.KMeansPlusPlusClusterer} instead
  */
 @Deprecated
 public class KMeansPlusPlusClusterer<T extends Clusterable<T>> {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/clustering/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/clustering/package-info.java b/src/main/java/org/apache/commons/math4/stat/clustering/package-info.java
index f6b8d3e..bf59709 100644
--- a/src/main/java/org/apache/commons/math4/stat/clustering/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/clustering/package-info.java
@@ -18,7 +18,7 @@
  * <h2>All classes and sub-packages of this package are deprecated.</h2>
  * <h3>Please use their replacements, to be found under
  *  <ul>
- *   <li>{@link org.apache.commons.math3.ml.clustering}</li>
+ *   <li>{@link org.apache.commons.math4.ml.clustering}</li>
  *  </ul>
  * </h3>
  *
@@ -26,4 +26,4 @@
  * Clustering algorithms.
  * </p>
  */
-package org.apache.commons.math3.stat.clustering;
+package org.apache.commons.math4.stat.clustering;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/correlation/Covariance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/Covariance.java b/src/main/java/org/apache/commons/math4/stat/correlation/Covariance.java
index c462401..a42d435 100644
--- a/src/main/java/org/apache/commons/math4/stat/correlation/Covariance.java
+++ b/src/main/java/org/apache/commons/math4/stat/correlation/Covariance.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
 
 /**
  * Computes covariances for pairs of arrays or columns of a matrix.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java b/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java
index 5d66c5e..f71390d 100644
--- a/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java
+++ b/src/main/java/org/apache/commons/math4/stat/correlation/KendallsCorrelation.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Pair;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Pair;
 
 import java.util.Arrays;
 import java.util.Comparator;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelation.java b/src/main/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelation.java
index 53d17ab..6059752 100644
--- a/src/main/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelation.java
+++ b/src/main/java/org/apache/commons/math4/stat/correlation/PearsonsCorrelation.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.distribution.TDistribution;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.stat.regression.SimpleRegression;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.regression.SimpleRegression;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Computes Pearson's product-moment correlation coefficients for pairs of arrays
@@ -187,7 +187,7 @@ public class PearsonsCorrelation {
      * matrix must have been used to create this instance.</p>
      *
      * @return matrix of p-values
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if an error occurs estimating probabilities
      * @throws NullPointerException if this instance was created with no data
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/correlation/SpearmansCorrelation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/SpearmansCorrelation.java b/src/main/java/org/apache/commons/math4/stat/correlation/SpearmansCorrelation.java
index fbc80de..1afc940 100644
--- a/src/main/java/org/apache/commons/math4/stat/correlation/SpearmansCorrelation.java
+++ b/src/main/java/org/apache/commons/math4/stat/correlation/SpearmansCorrelation.java
@@ -15,21 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.BlockRealMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.stat.ranking.NaNStrategy;
-import org.apache.commons.math3.stat.ranking.NaturalRanking;
-import org.apache.commons.math3.stat.ranking.RankingAlgorithm;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.BlockRealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.ranking.NaNStrategy;
+import org.apache.commons.math4.stat.ranking.NaturalRanking;
+import org.apache.commons.math4.stat.ranking.RankingAlgorithm;
 
 /**
  * Spearman's rank correlation. This implementation performs a rank

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/correlation/StorelessBivariateCovariance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/StorelessBivariateCovariance.java b/src/main/java/org/apache/commons/math4/stat/correlation/StorelessBivariateCovariance.java
index 20722a6..93f6ca3 100644
--- a/src/main/java/org/apache/commons/math4/stat/correlation/StorelessBivariateCovariance.java
+++ b/src/main/java/org/apache/commons/math4/stat/correlation/StorelessBivariateCovariance.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Bivariate Covariance implementation that does not require input data to be

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/correlation/StorelessCovariance.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/StorelessCovariance.java b/src/main/java/org/apache/commons/math4/stat/correlation/StorelessCovariance.java
index 7e927ca..0d3b501 100644
--- a/src/main/java/org/apache/commons/math4/stat/correlation/StorelessCovariance.java
+++ b/src/main/java/org/apache/commons/math4/stat/correlation/StorelessCovariance.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathUnsupportedOperationException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.linear.MatrixUtils;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathUnsupportedOperationException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.linear.MatrixUtils;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  * Covariance implementation that does not require input data to be

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/correlation/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/correlation/package-info.java b/src/main/java/org/apache/commons/math4/stat/correlation/package-info.java
index adf285e..2d5ee30 100644
--- a/src/main/java/org/apache/commons/math4/stat/correlation/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/correlation/package-info.java
@@ -19,4 +19,4 @@
  *        Correlations/Covariance computations.
  *
  */
-package org.apache.commons.math3.stat.correlation;
+package org.apache.commons.math4.stat.correlation;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
index 4249994..fe46039 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractStorelessUnivariateStatistic.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  *
@@ -53,7 +53,7 @@ public abstract class AbstractStorelessUnivariateStatistic
      * @param values input array
      * @return the value of the statistic applied to the input array
      * @throws MathIllegalArgumentException if values is null
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatistic#evaluate(double[])
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatistic#evaluate(double[])
      */
     @Override
     public double evaluate(final double[] values) throws MathIllegalArgumentException {
@@ -83,7 +83,7 @@ public abstract class AbstractStorelessUnivariateStatistic
      * @param length the number of elements to include
      * @return the value of the statistic applied to the included array entries
      * @throws MathIllegalArgumentException if the array is null or the indices are not valid
-     * @see org.apache.commons.math3.stat.descriptive.UnivariateStatistic#evaluate(double[], int, int)
+     * @see org.apache.commons.math4.stat.descriptive.UnivariateStatistic#evaluate(double[], int, int)
      */
     @Override
     public double evaluate(final double[] values, final int begin,
@@ -124,7 +124,7 @@ public abstract class AbstractStorelessUnivariateStatistic
      *
      * @param values values to add
      * @throws MathIllegalArgumentException if values is null
-     * @see org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic#incrementAll(double[])
+     * @see org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic#incrementAll(double[])
      */
     public void incrementAll(double[] values) throws MathIllegalArgumentException {
         if (values == null) {
@@ -143,7 +143,7 @@ public abstract class AbstractStorelessUnivariateStatistic
      * @param begin   index of the first array element to add
      * @param length  number of array elements to add
      * @throws MathIllegalArgumentException if values is null
-     * @see org.apache.commons.math3.stat.descriptive.StorelessUnivariateStatistic#incrementAll(double[], int, int)
+     * @see org.apache.commons.math4.stat.descriptive.StorelessUnivariateStatistic#incrementAll(double[], int, int)
      */
     public void incrementAll(double[] values, int begin, int length) throws MathIllegalArgumentException {
         if (test(values, begin, length)) {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java
index 9abe45a..c55d3f1 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/AbstractUnivariateStatistic.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Abstract base class for all implementations of the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java
index ebc3e33..3a7c345 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/AggregateSummaryStatistics.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Iterator;
 
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
 
 /**
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatistics.java
index 31acd24..b1aa6d5 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/DescriptiveStatistics.java
@@ -14,29 +14,29 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.io.Serializable;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.moment.GeometricMean;
-import org.apache.commons.math3.stat.descriptive.moment.Kurtosis;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.stat.descriptive.moment.Skewness;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.stat.descriptive.rank.Max;
-import org.apache.commons.math3.stat.descriptive.rank.Min;
-import org.apache.commons.math3.stat.descriptive.rank.Percentile;
-import org.apache.commons.math3.stat.descriptive.summary.Sum;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfSquares;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.ResizableDoubleArray;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.moment.GeometricMean;
+import org.apache.commons.math4.stat.descriptive.moment.Kurtosis;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.Skewness;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.stat.descriptive.rank.Max;
+import org.apache.commons.math4.stat.descriptive.rank.Min;
+import org.apache.commons.math4.stat.descriptive.rank.Percentile;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.ResizableDoubleArray;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
index 3ede26e..f1db607 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/MultivariateSummaryStatistics.java
@@ -14,27 +14,27 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.stat.descriptive.moment.GeometricMean;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.stat.descriptive.moment.VectorialCovariance;
-import org.apache.commons.math3.stat.descriptive.rank.Max;
-import org.apache.commons.math3.stat.descriptive.rank.Min;
-import org.apache.commons.math3.stat.descriptive.summary.Sum;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfLogs;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfSquares;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.stat.descriptive.moment.GeometricMean;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.VectorialCovariance;
+import org.apache.commons.math4.stat.descriptive.rank.Max;
+import org.apache.commons.math4.stat.descriptive.rank.Min;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfLogs;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * <p>Computes summary statistics for a stream of n-tuples added using the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalMultivariateSummary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalMultivariateSummary.java b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalMultivariateSummary.java
index bfe4deb..64fa55f 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalMultivariateSummary.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalMultivariateSummary.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  *  Reporting interface for basic multivariate statistics.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummary.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummary.java b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummary.java
index 2f310ac..e4b71ab 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummary.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummary.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 /**
  *  Reporting interface for basic univariate statistics.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
index e216e9b..b7071c3 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/StatisticalSummaryValues.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  *  Value object representing the results of a univariate statistical summary.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatistic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatistic.java b/src/main/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatistic.java
index e1c2464..4d72f38 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatistic.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/StorelessUnivariateStatistic.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Extends the definition of {@link UnivariateStatistic} with

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
index 62fee80..3f0c4d7 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/SummaryStatistics.java
@@ -14,25 +14,25 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.stat.descriptive.moment.GeometricMean;
-import org.apache.commons.math3.stat.descriptive.moment.Mean;
-import org.apache.commons.math3.stat.descriptive.moment.SecondMoment;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.stat.descriptive.rank.Max;
-import org.apache.commons.math3.stat.descriptive.rank.Min;
-import org.apache.commons.math3.stat.descriptive.summary.Sum;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfLogs;
-import org.apache.commons.math3.stat.descriptive.summary.SumOfSquares;
-import org.apache.commons.math3.util.MathUtils;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.stat.descriptive.moment.GeometricMean;
+import org.apache.commons.math4.stat.descriptive.moment.Mean;
+import org.apache.commons.math4.stat.descriptive.moment.SecondMoment;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.stat.descriptive.rank.Max;
+import org.apache.commons.math4.stat.descriptive.rank.Min;
+import org.apache.commons.math4.stat.descriptive.summary.Sum;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfLogs;
+import org.apache.commons.math4.stat.descriptive.summary.SumOfSquares;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathUtils;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatistics.java
index 270e4aa..9899f3a 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedDescriptiveStatistics.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implementation of
- * {@link org.apache.commons.math3.stat.descriptive.DescriptiveStatistics} that
+ * {@link org.apache.commons.math4.stat.descriptive.DescriptiveStatistics} that
  * is safe to use in a multithreaded environment.  Multiple threads can safely
  * operate on a single instance without causing runtime exceptions due to race
  * conditions.  In effect, this implementation makes modification and access

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java
index 889eb3a..05a92ce 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedMultivariateSummaryStatistics.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.linear.RealMatrix;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.linear.RealMatrix;
 
 /**
  * Implementation of
- * {@link org.apache.commons.math3.stat.descriptive.MultivariateSummaryStatistics} that
+ * {@link org.apache.commons.math4.stat.descriptive.MultivariateSummaryStatistics} that
  * is safe to use in a multithreaded environment.  Multiple threads can safely
  * operate on a single instance without causing runtime exceptions due to race
  * conditions.  In effect, this implementation makes modification and access

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatistics.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatistics.java b/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatistics.java
index 7eaf9ac..578d0c7 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatistics.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/SynchronizedSummaryStatistics.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.util.MathUtils;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.util.MathUtils;
 
 /**
  * Implementation of
- * {@link org.apache.commons.math3.stat.descriptive.SummaryStatistics} that
+ * {@link org.apache.commons.math4.stat.descriptive.SummaryStatistics} that
  * is safe to use in a multithreaded environment.  Multiple threads can safely
  * operate on a single instance without causing runtime exceptions due to race
  * conditions.  In effect, this implementation makes modification and access

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/UnivariateStatistic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/UnivariateStatistic.java b/src/main/java/org/apache/commons/math4/stat/descriptive/UnivariateStatistic.java
index 5d6c9fe..4b831d5 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/UnivariateStatistic.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/UnivariateStatistic.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.util.MathArrays;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/descriptive/WeightedEvaluation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/descriptive/WeightedEvaluation.java b/src/main/java/org/apache/commons/math4/stat/descriptive/WeightedEvaluation.java
index 01693dc..5bd512b 100644
--- a/src/main/java/org/apache/commons/math4/stat/descriptive/WeightedEvaluation.java
+++ b/src/main/java/org/apache/commons/math4/stat/descriptive/WeightedEvaluation.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.descriptive;
+package org.apache.commons.math4.stat.descriptive;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Weighted evaluation for statistics.


[23/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java b/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java
deleted file mode 100644
index a426bc2..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/ElitisticListPopulation.java
+++ /dev/null
@@ -1,117 +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.genetics;
-
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Population of chromosomes which uses elitism (certain percentage of the best
- * chromosomes is directly copied to the next generation).
- *
- * @since 2.0
- */
-public class ElitisticListPopulation extends ListPopulation {
-
-    /** percentage of chromosomes copied to the next generation */
-    private double elitismRate = 0.9;
-
-    /**
-     * Creates a new {@link ElitisticListPopulation} instance.
-     *
-     * @param chromosomes list of chromosomes in the population
-     * @param populationLimit maximal size of the population
-     * @param elitismRate how many best chromosomes will be directly transferred to the next generation [in %]
-     * @throws NullArgumentException if the list of chromosomes is {@code null}
-     * @throws NotPositiveException if the population limit is not a positive number (&lt; 1)
-     * @throws NumberIsTooLargeException if the list of chromosomes exceeds the population limit
-     * @throws OutOfRangeException if the elitism rate is outside the [0, 1] range
-     */
-    public ElitisticListPopulation(final List<Chromosome> chromosomes, final int populationLimit,
-                                   final double elitismRate)
-        throws NullArgumentException, NotPositiveException, NumberIsTooLargeException, OutOfRangeException {
-
-        super(chromosomes, populationLimit);
-        setElitismRate(elitismRate);
-    }
-
-    /**
-     * Creates a new {@link ElitisticListPopulation} instance and initializes its inner chromosome list.
-     *
-     * @param populationLimit maximal size of the population
-     * @param elitismRate how many best chromosomes will be directly transferred to the next generation [in %]
-     * @throws NotPositiveException if the population limit is not a positive number (&lt; 1)
-     * @throws OutOfRangeException if the elitism rate is outside the [0, 1] range
-     */
-    public ElitisticListPopulation(final int populationLimit, final double elitismRate)
-        throws NotPositiveException, OutOfRangeException {
-
-        super(populationLimit);
-        setElitismRate(elitismRate);
-    }
-
-    /**
-     * Start the population for the next generation. The <code>{@link #elitismRate}</code>
-     * percents of the best chromosomes are directly copied to the next generation.
-     *
-     * @return the beginnings of the next generation.
-     */
-    public Population nextGeneration() {
-        // initialize a new generation with the same parameters
-        ElitisticListPopulation nextGeneration =
-                new ElitisticListPopulation(getPopulationLimit(), getElitismRate());
-
-        final List<Chromosome> oldChromosomes = getChromosomeList();
-        Collections.sort(oldChromosomes);
-
-        // index of the last "not good enough" chromosome
-        int boundIndex = (int) FastMath.ceil((1.0 - getElitismRate()) * oldChromosomes.size());
-        for (int i = boundIndex; i < oldChromosomes.size(); i++) {
-            nextGeneration.addChromosome(oldChromosomes.get(i));
-        }
-        return nextGeneration;
-    }
-
-    /**
-     * Sets the elitism rate, i.e. how many best chromosomes will be directly transferred to the next generation [in %].
-     *
-     * @param elitismRate how many best chromosomes will be directly transferred to the next generation [in %]
-     * @throws OutOfRangeException if the elitism rate is outside the [0, 1] range
-     */
-    public void setElitismRate(final double elitismRate) throws OutOfRangeException {
-        if (elitismRate < 0 || elitismRate > 1) {
-            throw new OutOfRangeException(LocalizedFormats.ELITISM_RATE, elitismRate, 0, 1);
-        }
-        this.elitismRate = elitismRate;
-    }
-
-    /**
-     * Access the elitism rate.
-     * @return the elitism rate
-     */
-    public double getElitismRate() {
-        return this.elitismRate;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/Fitness.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/Fitness.java b/src/main/java/org/apache/commons/math3/genetics/Fitness.java
deleted file mode 100644
index 40d6192..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/Fitness.java
+++ /dev/null
@@ -1,32 +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.genetics;
-
-/**
- * Fitness of a chromosome.
- *
- * @since 2.0
- */
-public interface Fitness {
-
-    /**
-     * Compute the fitness. This is usually very time-consuming, so the value should be cached.
-     * @return fitness
-     */
-    double fitness();
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java b/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java
deleted file mode 100644
index 3879a8c..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/FixedElapsedTime.java
+++ /dev/null
@@ -1,77 +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.genetics;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-
-/**
- * Stops after a fixed amount of time has elapsed.
- * <p>
- * The first time {@link #isSatisfied(Population)} is invoked, the end time of the evolution is determined based on the
- * provided <code>maxTime</code> value. Once the elapsed time reaches the configured <code>maxTime</code> value,
- * {@link #isSatisfied(Population)} returns true.
- *
- * @since 3.1
- */
-public class FixedElapsedTime implements StoppingCondition {
-    /** Maximum allowed time period (in nanoseconds). */
-    private final long maxTimePeriod;
-
-    /** The predetermined termination time (stopping condition). */
-    private long endTime = -1;
-
-    /**
-     * Create a new {@link FixedElapsedTime} instance.
-     *
-     * @param maxTime maximum number of seconds generations are allowed to evolve
-     * @throws NumberIsTooSmallException if the provided time is &lt; 0
-     */
-    public FixedElapsedTime(final long maxTime) throws NumberIsTooSmallException {
-        this(maxTime, TimeUnit.SECONDS);
-    }
-
-    /**
-     * Create a new {@link FixedElapsedTime} instance.
-     *
-     * @param maxTime maximum time generations are allowed to evolve
-     * @param unit {@link TimeUnit} of the maxTime argument
-     * @throws NumberIsTooSmallException if the provided time is &lt; 0
-     */
-    public FixedElapsedTime(final long maxTime, final TimeUnit unit) throws NumberIsTooSmallException {
-        if (maxTime < 0) {
-            throw new NumberIsTooSmallException(maxTime, 0, true);
-        }
-        maxTimePeriod = unit.toNanos(maxTime);
-    }
-
-    /**
-     * Determine whether or not the maximum allowed time has passed.
-     * The termination time is determined after the first generation.
-     *
-     * @param population ignored (no impact on result)
-     * @return <code>true</code> IFF the maximum allowed time period has elapsed
-     */
-    public boolean isSatisfied(final Population population) {
-        if (endTime < 0) {
-            endTime = System.nanoTime() + maxTimePeriod;
-        }
-
-        return System.nanoTime() >= endTime;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java b/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java
deleted file mode 100644
index 64362fc..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/FixedGenerationCount.java
+++ /dev/null
@@ -1,71 +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.genetics;
-
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-
-/**
- * Stops after a fixed number of generations. Each time {@link #isSatisfied(Population)} is invoked, a generation
- * counter is incremented. Once the counter reaches the configured <code>maxGenerations</code> value,
- * {@link #isSatisfied(Population)} returns true.
- *
- * @since 2.0
- */
-public class FixedGenerationCount implements StoppingCondition {
-    /** Number of generations that have passed */
-    private int numGenerations = 0;
-
-    /** Maximum number of generations (stopping criteria) */
-    private final int maxGenerations;
-
-    /**
-     * Create a new FixedGenerationCount instance.
-     *
-     * @param maxGenerations number of generations to evolve
-     * @throws NumberIsTooSmallException if the number of generations is &lt; 1
-     */
-    public FixedGenerationCount(final int maxGenerations) throws NumberIsTooSmallException {
-        if (maxGenerations <= 0) {
-            throw new NumberIsTooSmallException(maxGenerations, 1, true);
-        }
-        this.maxGenerations = maxGenerations;
-    }
-
-    /**
-     * Determine whether or not the given number of generations have passed. Increments the number of generations
-     * counter if the maximum has not been reached.
-     *
-     * @param population ignored (no impact on result)
-     * @return <code>true</code> IFF the maximum number of generations has been exceeded
-     */
-    public boolean isSatisfied(final Population population) {
-        if (this.numGenerations < this.maxGenerations) {
-            numGenerations++;
-            return false;
-        }
-        return true;
-    }
-
-    /**
-     * Returns the number of generations that have already passed.
-     * @return the number of generations that have passed
-     */
-    public int getNumGenerations() {
-        return numGenerations;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java b/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java
deleted file mode 100644
index 2f3d684..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/GeneticAlgorithm.java
+++ /dev/null
@@ -1,233 +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.genetics;
-
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.JDKRandomGenerator;
-
-/**
- * Implementation of a genetic algorithm. All factors that govern the operation
- * of the algorithm can be configured for a specific problem.
- *
- * @since 2.0
- */
-public class GeneticAlgorithm {
-
-    /**
-     * Static random number generator shared by GA implementation classes. Set the randomGenerator seed to get
-     * reproducible results. Use {@link #setRandomGenerator(RandomGenerator)} to supply an alternative to the default
-     * JDK-provided PRNG.
-     */
-    //@GuardedBy("this")
-    private static RandomGenerator randomGenerator = new JDKRandomGenerator();
-
-    /** the crossover policy used by the algorithm. */
-    private final CrossoverPolicy crossoverPolicy;
-
-    /** the rate of crossover for the algorithm. */
-    private final double crossoverRate;
-
-    /** the mutation policy used by the algorithm. */
-    private final MutationPolicy mutationPolicy;
-
-    /** the rate of mutation for the algorithm. */
-    private final double mutationRate;
-
-    /** the selection policy used by the algorithm. */
-    private final SelectionPolicy selectionPolicy;
-
-    /** the number of generations evolved to reach {@link StoppingCondition} in the last run. */
-    private int generationsEvolved = 0;
-
-    /**
-     * Create a new genetic algorithm.
-     * @param crossoverPolicy The {@link CrossoverPolicy}
-     * @param crossoverRate The crossover rate as a percentage (0-1 inclusive)
-     * @param mutationPolicy The {@link MutationPolicy}
-     * @param mutationRate The mutation rate as a percentage (0-1 inclusive)
-     * @param selectionPolicy The {@link SelectionPolicy}
-     * @throws OutOfRangeException if the crossover or mutation rate is outside the [0, 1] range
-     */
-    public GeneticAlgorithm(final CrossoverPolicy crossoverPolicy,
-                            final double crossoverRate,
-                            final MutationPolicy mutationPolicy,
-                            final double mutationRate,
-                            final SelectionPolicy selectionPolicy) throws OutOfRangeException {
-
-        if (crossoverRate < 0 || crossoverRate > 1) {
-            throw new OutOfRangeException(LocalizedFormats.CROSSOVER_RATE,
-                                          crossoverRate, 0, 1);
-        }
-        if (mutationRate < 0 || mutationRate > 1) {
-            throw new OutOfRangeException(LocalizedFormats.MUTATION_RATE,
-                                          mutationRate, 0, 1);
-        }
-        this.crossoverPolicy = crossoverPolicy;
-        this.crossoverRate = crossoverRate;
-        this.mutationPolicy = mutationPolicy;
-        this.mutationRate = mutationRate;
-        this.selectionPolicy = selectionPolicy;
-    }
-
-    /**
-     * Set the (static) random generator.
-     *
-     * @param random random generator
-     */
-    public static synchronized void setRandomGenerator(final RandomGenerator random) {
-        randomGenerator = random;
-    }
-
-    /**
-     * Returns the (static) random generator.
-     *
-     * @return the static random generator shared by GA implementation classes
-     */
-    public static synchronized RandomGenerator getRandomGenerator() {
-        return randomGenerator;
-    }
-
-    /**
-     * Evolve the given population. Evolution stops when the stopping condition
-     * is satisfied. Updates the {@link #getGenerationsEvolved() generationsEvolved}
-     * property with the number of generations evolved before the StoppingCondition
-     * is satisfied.
-     *
-     * @param initial the initial, seed population.
-     * @param condition the stopping condition used to stop evolution.
-     * @return the population that satisfies the stopping condition.
-     */
-    public Population evolve(final Population initial, final StoppingCondition condition) {
-        Population current = initial;
-        generationsEvolved = 0;
-        while (!condition.isSatisfied(current)) {
-            current = nextGeneration(current);
-            generationsEvolved++;
-        }
-        return current;
-    }
-
-    /**
-     * Evolve the given population into the next generation.
-     * <p>
-     * <ol>
-     *  <li>Get nextGeneration population to fill from <code>current</code>
-     *      generation, using its nextGeneration method</li>
-     *  <li>Loop until new generation is filled:</li>
-     *  <ul><li>Apply configured SelectionPolicy to select a pair of parents
-     *          from <code>current</code></li>
-     *      <li>With probability = {@link #getCrossoverRate()}, apply
-     *          configured {@link CrossoverPolicy} to parents</li>
-     *      <li>With probability = {@link #getMutationRate()}, apply
-     *          configured {@link MutationPolicy} to each of the offspring</li>
-     *      <li>Add offspring individually to nextGeneration,
-     *          space permitting</li>
-     *  </ul>
-     *  <li>Return nextGeneration</li>
-     * </ol>
-     *
-     * @param current the current population.
-     * @return the population for the next generation.
-     */
-    public Population nextGeneration(final Population current) {
-        Population nextGeneration = current.nextGeneration();
-
-        RandomGenerator randGen = getRandomGenerator();
-
-        while (nextGeneration.getPopulationSize() < nextGeneration.getPopulationLimit()) {
-            // select parent chromosomes
-            ChromosomePair pair = getSelectionPolicy().select(current);
-
-            // crossover?
-            if (randGen.nextDouble() < getCrossoverRate()) {
-                // apply crossover policy to create two offspring
-                pair = getCrossoverPolicy().crossover(pair.getFirst(), pair.getSecond());
-            }
-
-            // mutation?
-            if (randGen.nextDouble() < getMutationRate()) {
-                // apply mutation policy to the chromosomes
-                pair = new ChromosomePair(
-                    getMutationPolicy().mutate(pair.getFirst()),
-                    getMutationPolicy().mutate(pair.getSecond()));
-            }
-
-            // add the first chromosome to the population
-            nextGeneration.addChromosome(pair.getFirst());
-            // is there still a place for the second chromosome?
-            if (nextGeneration.getPopulationSize() < nextGeneration.getPopulationLimit()) {
-                // add the second chromosome to the population
-                nextGeneration.addChromosome(pair.getSecond());
-            }
-        }
-
-        return nextGeneration;
-    }
-
-    /**
-     * Returns the crossover policy.
-     * @return crossover policy
-     */
-    public CrossoverPolicy getCrossoverPolicy() {
-        return crossoverPolicy;
-    }
-
-    /**
-     * Returns the crossover rate.
-     * @return crossover rate
-     */
-    public double getCrossoverRate() {
-        return crossoverRate;
-    }
-
-    /**
-     * Returns the mutation policy.
-     * @return mutation policy
-     */
-    public MutationPolicy getMutationPolicy() {
-        return mutationPolicy;
-    }
-
-    /**
-     * Returns the mutation rate.
-     * @return mutation rate
-     */
-    public double getMutationRate() {
-        return mutationRate;
-    }
-
-    /**
-     * Returns the selection policy.
-     * @return selection policy
-     */
-    public SelectionPolicy getSelectionPolicy() {
-        return selectionPolicy;
-    }
-
-    /**
-     * Returns the number of generations evolved to reach {@link StoppingCondition} in the last run.
-     *
-     * @return number of generations evolved
-     * @since 2.1
-     */
-    public int getGenerationsEvolved() {
-        return generationsEvolved;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/InvalidRepresentationException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/InvalidRepresentationException.java b/src/main/java/org/apache/commons/math3/genetics/InvalidRepresentationException.java
deleted file mode 100644
index 7ca3a9a..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/InvalidRepresentationException.java
+++ /dev/null
@@ -1,42 +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.genetics;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.Localizable;
-
-/**
- * Exception indicating that the representation of a chromosome is not valid.
- *
- * @since 2.0
- */
-public class InvalidRepresentationException extends MathIllegalArgumentException {
-
-    /** Serialization version id */
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * Construct an InvalidRepresentationException with a specialized message.
-     *
-     * @param pattern Message pattern.
-     * @param args Arguments.
-     */
-    public InvalidRepresentationException(Localizable pattern, Object ... args) {
-       super(pattern, args);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java b/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java
deleted file mode 100644
index ce45234..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/ListPopulation.java
+++ /dev/null
@@ -1,222 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-
-/**
- * Population of chromosomes represented by a {@link List}.
- *
- * @since 2.0
- */
-public abstract class ListPopulation implements Population {
-
-    /** List of chromosomes */
-    private List<Chromosome> chromosomes;
-
-    /** maximal size of the population */
-    private int populationLimit;
-
-    /**
-     * Creates a new ListPopulation instance and initializes its inner chromosome list.
-     *
-     * @param populationLimit maximal size of the population
-     * @throws NotPositiveException if the population limit is not a positive number (&lt; 1)
-     */
-    public ListPopulation(final int populationLimit) throws NotPositiveException {
-        this(Collections.<Chromosome> emptyList(), populationLimit);
-    }
-
-    /**
-     * Creates a new ListPopulation instance.
-     * <p>
-     * Note: the chromosomes of the specified list are added to the population.
-     *
-     * @param chromosomes list of chromosomes to be added to the population
-     * @param populationLimit maximal size of the population
-     * @throws NullArgumentException if the list of chromosomes is {@code null}
-     * @throws NotPositiveException if the population limit is not a positive number (&lt; 1)
-     * @throws NumberIsTooLargeException if the list of chromosomes exceeds the population limit
-     */
-    public ListPopulation(final List<Chromosome> chromosomes, final int populationLimit)
-        throws NullArgumentException, NotPositiveException, NumberIsTooLargeException {
-
-        if (chromosomes == null) {
-            throw new NullArgumentException();
-        }
-        if (populationLimit <= 0) {
-            throw new NotPositiveException(LocalizedFormats.POPULATION_LIMIT_NOT_POSITIVE, populationLimit);
-        }
-        if (chromosomes.size() > populationLimit) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
-                                                chromosomes.size(), populationLimit, false);
-        }
-        this.populationLimit = populationLimit;
-        this.chromosomes = new ArrayList<Chromosome>(populationLimit);
-        this.chromosomes.addAll(chromosomes);
-    }
-
-    /**
-     * Sets the list of chromosomes.
-     * <p>
-     * Note: this method removed all existing chromosomes in the population and adds all chromosomes
-     * of the specified list to the population.
-     *
-     * @param chromosomes the list of chromosomes
-     * @throws NullArgumentException if the list of chromosomes is {@code null}
-     * @throws NumberIsTooLargeException if the list of chromosomes exceeds the population limit
-     * @deprecated use {@link #addChromosomes(Collection)} instead
-     */
-    @Deprecated
-    public void setChromosomes(final List<Chromosome> chromosomes)
-        throws NullArgumentException, NumberIsTooLargeException {
-
-        if (chromosomes == null) {
-            throw new NullArgumentException();
-        }
-        if (chromosomes.size() > populationLimit) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
-                                                chromosomes.size(), populationLimit, false);
-        }
-        this.chromosomes.clear();
-        this.chromosomes.addAll(chromosomes);
-    }
-
-    /**
-     * Add a {@link Collection} of chromosomes to this {@link Population}.
-     * @param chromosomeColl a {@link Collection} of chromosomes
-     * @throws NumberIsTooLargeException if the population would exceed the population limit when
-     * adding this chromosome
-     * @since 3.1
-     */
-    public void addChromosomes(final Collection<Chromosome> chromosomeColl) throws NumberIsTooLargeException {
-        if (chromosomes.size() + chromosomeColl.size() > populationLimit) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
-                                                chromosomes.size(), populationLimit, false);
-        }
-        this.chromosomes.addAll(chromosomeColl);
-    }
-
-    /**
-     * Returns an unmodifiable list of the chromosomes in this population.
-     * @return the unmodifiable list of chromosomes
-     */
-    public List<Chromosome> getChromosomes() {
-        return Collections.unmodifiableList(chromosomes);
-    }
-
-    /**
-     * Access the list of chromosomes.
-     * @return the list of chromosomes
-     * @since 3.1
-     */
-    protected List<Chromosome> getChromosomeList() {
-        return chromosomes;
-    }
-
-    /**
-     * Add the given chromosome to the population.
-     *
-     * @param chromosome the chromosome to add.
-     * @throws NumberIsTooLargeException if the population would exceed the {@code populationLimit} after
-     *   adding this chromosome
-     */
-    public void addChromosome(final Chromosome chromosome) throws NumberIsTooLargeException {
-        if (chromosomes.size() >= populationLimit) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LIST_OF_CHROMOSOMES_BIGGER_THAN_POPULATION_SIZE,
-                                                chromosomes.size(), populationLimit, false);
-        }
-        this.chromosomes.add(chromosome);
-    }
-
-    /**
-     * Access the fittest chromosome in this population.
-     * @return the fittest chromosome.
-     */
-    public Chromosome getFittestChromosome() {
-        // best so far
-        Chromosome bestChromosome = this.chromosomes.get(0);
-        for (Chromosome chromosome : this.chromosomes) {
-            if (chromosome.compareTo(bestChromosome) > 0) {
-                // better chromosome found
-                bestChromosome = chromosome;
-            }
-        }
-        return bestChromosome;
-    }
-
-    /**
-     * Access the maximum population size.
-     * @return the maximum population size.
-     */
-    public int getPopulationLimit() {
-        return this.populationLimit;
-    }
-
-    /**
-     * Sets the maximal population size.
-     * @param populationLimit maximal population size.
-     * @throws NotPositiveException if the population limit is not a positive number (&lt; 1)
-     * @throws NumberIsTooSmallException if the new population size is smaller than the current number
-     *   of chromosomes in the population
-     */
-    public void setPopulationLimit(final int populationLimit) throws NotPositiveException, NumberIsTooSmallException {
-        if (populationLimit <= 0) {
-            throw new NotPositiveException(LocalizedFormats.POPULATION_LIMIT_NOT_POSITIVE, populationLimit);
-        }
-        if (populationLimit < chromosomes.size()) {
-            throw new NumberIsTooSmallException(populationLimit, chromosomes.size(), true);
-        }
-        this.populationLimit = populationLimit;
-    }
-
-    /**
-     * Access the current population size.
-     * @return the current population size.
-     */
-    public int getPopulationSize() {
-        return this.chromosomes.size();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public String toString() {
-        return this.chromosomes.toString();
-    }
-
-    /**
-     * Returns an iterator over the unmodifiable list of chromosomes.
-     * <p>Any call to {@link Iterator#remove()} will result in a {@link UnsupportedOperationException}.</p>
-     *
-     * @return chromosome iterator
-     */
-    public Iterator<Chromosome> iterator() {
-        return getChromosomes().iterator();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/MutationPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/MutationPolicy.java b/src/main/java/org/apache/commons/math3/genetics/MutationPolicy.java
deleted file mode 100644
index b981881..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/MutationPolicy.java
+++ /dev/null
@@ -1,35 +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.genetics;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-/**
- * Algorithm used to mutate a chromosome.
- *
- * @since 2.0
- */
-public interface MutationPolicy {
-
-    /**
-     * Mutate the given chromosome.
-     * @param original the original chromosome.
-     * @return the mutated chromosome.
-     * @throws MathIllegalArgumentException if the given chromosome is not compatible with this {@link MutationPolicy}
-     */
-    Chromosome mutate(Chromosome original) throws MathIllegalArgumentException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java b/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java
deleted file mode 100644
index a1a7d99..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/NPointCrossover.java
+++ /dev/null
@@ -1,178 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-
-/**
- * N-point crossover policy. For each iteration a random crossover point is
- * selected and the first part from each parent is copied to the corresponding
- * child, and the second parts are copied crosswise.
- *
- * Example (2-point crossover):
- * <pre>
- * -C- denotes a crossover point
- *           -C-       -C-                         -C-        -C-
- * p1 = (1 0  | 1 0 0 1 | 0 1 1)    X    p2 = (0 1  | 1 0 1 0  | 1 1 1)
- *      \----/ \-------/ \-----/              \----/ \--------/ \-----/
- *        ||      (*)       ||                  ||      (**)       ||
- *        VV      (**)      VV                  VV      (*)        VV
- *      /----\ /--------\ /-----\             /----\ /--------\ /-----\
- * c1 = (1 0  | 1 0 1 0  | 0 1 1)    X   c2 = (0 1  | 1 0 0 1  | 0 1 1)
- * </pre>
- *
- * This policy works only on {@link AbstractListChromosome}, and therefore it
- * is parameterized by T. Moreover, the chromosomes must have same lengths.
- *
- * @param <T> generic type of the {@link AbstractListChromosome}s for crossover
- * @since 3.1
- */
-public class NPointCrossover<T> implements CrossoverPolicy {
-
-    /** The number of crossover points. */
-    private final int crossoverPoints;
-
-    /**
-     * Creates a new {@link NPointCrossover} policy using the given number of points.
-     * <p>
-     * <b>Note</b>: the number of crossover points must be &lt; <code>chromosome length - 1</code>.
-     * This condition can only be checked at runtime, as the chromosome length is not known in advance.
-     *
-     * @param crossoverPoints the number of crossover points
-     * @throws NotStrictlyPositiveException if the number of {@code crossoverPoints} is not strictly positive
-     */
-    public NPointCrossover(final int crossoverPoints) throws NotStrictlyPositiveException {
-        if (crossoverPoints <= 0) {
-            throw new NotStrictlyPositiveException(crossoverPoints);
-        }
-        this.crossoverPoints = crossoverPoints;
-    }
-
-    /**
-     * Returns the number of crossover points used by this {@link CrossoverPolicy}.
-     *
-     * @return the number of crossover points
-     */
-    public int getCrossoverPoints() {
-        return crossoverPoints;
-    }
-
-    /**
-     * Performs a N-point crossover. N random crossover points are selected and are used
-     * to divide the parent chromosomes into segments. The segments are copied in alternate
-     * order from the two parents to the corresponding child chromosomes.
-     *
-     * Example (2-point crossover):
-     * <pre>
-     * -C- denotes a crossover point
-     *           -C-       -C-                         -C-        -C-
-     * p1 = (1 0  | 1 0 0 1 | 0 1 1)    X    p2 = (0 1  | 1 0 1 0  | 1 1 1)
-     *      \----/ \-------/ \-----/              \----/ \--------/ \-----/
-     *        ||      (*)       ||                  ||      (**)       ||
-     *        VV      (**)      VV                  VV      (*)        VV
-     *      /----\ /--------\ /-----\             /----\ /--------\ /-----\
-     * c1 = (1 0  | 1 0 1 0  | 0 1 1)    X   c2 = (0 1  | 1 0 0 1  | 0 1 1)
-     * </pre>
-     *
-     * @param first first parent (p1)
-     * @param second second parent (p2)
-     * @return pair of two children (c1,c2)
-     * @throws MathIllegalArgumentException iff one of the chromosomes is
-     *   not an instance of {@link AbstractListChromosome}
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    @SuppressWarnings("unchecked") // OK because of instanceof checks
-    public ChromosomePair crossover(final Chromosome first, final Chromosome second)
-        throws DimensionMismatchException, MathIllegalArgumentException {
-
-        if (!(first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
-        }
-        return mate((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
-    }
-
-    /**
-     * Helper for {@link #crossover(Chromosome, Chromosome)}. Performs the actual crossover.
-     *
-     * @param first the first chromosome
-     * @param second the second chromosome
-     * @return the pair of new chromosomes that resulted from the crossover
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     * @throws NumberIsTooLargeException if the number of crossoverPoints is too large for the actual chromosomes
-     */
-    private ChromosomePair mate(final AbstractListChromosome<T> first,
-                                final AbstractListChromosome<T> second)
-        throws DimensionMismatchException, NumberIsTooLargeException {
-
-        final int length = first.getLength();
-        if (length != second.getLength()) {
-            throw new DimensionMismatchException(second.getLength(), length);
-        }
-        if (crossoverPoints >= length) {
-            throw new NumberIsTooLargeException(crossoverPoints, length, false);
-        }
-
-        // array representations of the parents
-        final List<T> parent1Rep = first.getRepresentation();
-        final List<T> parent2Rep = second.getRepresentation();
-        // and of the children
-        final List<T> child1Rep = new ArrayList<T>(length);
-        final List<T> child2Rep = new ArrayList<T>(length);
-
-        final RandomGenerator random = GeneticAlgorithm.getRandomGenerator();
-
-        List<T> c1 = child1Rep;
-        List<T> c2 = child2Rep;
-
-        int remainingPoints = crossoverPoints;
-        int lastIndex = 0;
-        for (int i = 0; i < crossoverPoints; i++, remainingPoints--) {
-            // select the next crossover point at random
-            final int crossoverIndex = 1 + lastIndex + random.nextInt(length - lastIndex - remainingPoints);
-
-            // copy the current segment
-            for (int j = lastIndex; j < crossoverIndex; j++) {
-                c1.add(parent1Rep.get(j));
-                c2.add(parent2Rep.get(j));
-            }
-
-            // swap the children for the next segment
-            List<T> tmp = c1;
-            c1 = c2;
-            c2 = tmp;
-
-            lastIndex = crossoverIndex;
-        }
-
-        // copy the last segment
-        for (int j = lastIndex; j < length; j++) {
-            c1.add(parent1Rep.get(j));
-            c2.add(parent2Rep.get(j));
-        }
-
-        return new ChromosomePair(first.newFixedLengthChromosome(child1Rep),
-                                  second.newFixedLengthChromosome(child2Rep));
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java b/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java
deleted file mode 100644
index b1ea47b..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/OnePointCrossover.java
+++ /dev/null
@@ -1,128 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-
-/**
- * One point crossover policy. A random crossover point is selected and the
- * first part from each parent is copied to the corresponding child, and the
- * second parts are copied crosswise.
- *
- * Example:
- * <pre>
- * -C- denotes a crossover point
- *                   -C-                                 -C-
- * p1 = (1 0 1 0 0 1  | 0 1 1)    X    p2 = (0 1 1 0 1 0  | 1 1 1)
- *      \------------/ \-----/              \------------/ \-----/
- *            ||         (*)                       ||        (**)
- *            VV         (**)                      VV        (*)
- *      /------------\ /-----\              /------------\ /-----\
- * c1 = (1 0 1 0 0 1  | 1 1 1)    X    c2 = (0 1 1 0 1 0  | 0 1 1)
- * </pre>
- *
- * This policy works only on {@link AbstractListChromosome}, and therefore it
- * is parameterized by T. Moreover, the chromosomes must have same lengths.
- *
- * @param <T> generic type of the {@link AbstractListChromosome}s for crossover
- * @since 2.0
- *
- */
-public class OnePointCrossover<T> implements CrossoverPolicy {
-
-    /**
-     * Performs one point crossover. A random crossover point is selected and the
-     * first part from each parent is copied to the corresponding child, and the
-     * second parts are copied crosswise.
-     *
-     * Example:
-     * <pre>
-     * -C- denotes a crossover point
-     *                   -C-                                 -C-
-     * p1 = (1 0 1 0 0 1  | 0 1 1)    X    p2 = (0 1 1 0 1 0  | 1 1 1)
-     *      \------------/ \-----/              \------------/ \-----/
-     *            ||         (*)                       ||        (**)
-     *            VV         (**)                      VV        (*)
-     *      /------------\ /-----\              /------------\ /-----\
-     * c1 = (1 0 1 0 0 1  | 1 1 1)    X    c2 = (0 1 1 0 1 0  | 0 1 1)
-     * </pre>
-     *
-     * @param first first parent (p1)
-     * @param second second parent (p2)
-     * @return pair of two children (c1,c2)
-     * @throws MathIllegalArgumentException iff one of the chromosomes is
-     *   not an instance of {@link AbstractListChromosome}
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    @SuppressWarnings("unchecked") // OK because of instanceof checks
-    public ChromosomePair crossover(final Chromosome first, final Chromosome second)
-        throws DimensionMismatchException, MathIllegalArgumentException {
-
-        if (! (first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
-        }
-        return crossover((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
-    }
-
-
-    /**
-     * Helper for {@link #crossover(Chromosome, Chromosome)}. Performs the actual crossover.
-     *
-     * @param first the first chromosome.
-     * @param second the second chromosome.
-     * @return the pair of new chromosomes that resulted from the crossover.
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    private ChromosomePair crossover(final AbstractListChromosome<T> first,
-                                     final AbstractListChromosome<T> second) throws DimensionMismatchException {
-        final int length = first.getLength();
-        if (length != second.getLength()) {
-            throw new DimensionMismatchException(second.getLength(), length);
-        }
-
-        // array representations of the parents
-        final List<T> parent1Rep = first.getRepresentation();
-        final List<T> parent2Rep = second.getRepresentation();
-        // and of the children
-        final List<T> child1Rep = new ArrayList<T>(length);
-        final List<T> child2Rep = new ArrayList<T>(length);
-
-        // select a crossover point at random (0 and length makes no sense)
-        final int crossoverIndex = 1 + (GeneticAlgorithm.getRandomGenerator().nextInt(length-2));
-
-        // copy the first part
-        for (int i = 0; i < crossoverIndex; i++) {
-            child1Rep.add(parent1Rep.get(i));
-            child2Rep.add(parent2Rep.get(i));
-        }
-        // and switch the second part
-        for (int i = crossoverIndex; i < length; i++) {
-            child1Rep.add(parent2Rep.get(i));
-            child2Rep.add(parent1Rep.get(i));
-        }
-
-        return new ChromosomePair(first.newFixedLengthChromosome(child1Rep),
-                                  second.newFixedLengthChromosome(child2Rep));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java b/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java
deleted file mode 100644
index e796f53..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/OrderedCrossover.java
+++ /dev/null
@@ -1,150 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Order 1 Crossover [OX1] builds offspring from <b>ordered</b> chromosomes by copying a
- * consecutive slice from one parent, and filling up the remaining genes from the other
- * parent as they appear.
- * <p>
- * This policy works by applying the following rules:
- * <ol>
- *   <li>select a random slice of consecutive genes from parent 1</li>
- *   <li>copy the slice to child 1 and mark out the genes in parent 2</li>
- *   <li>starting from the right side of the slice, copy genes from parent 2 as they
- *       appear to child 1 if they are not yet marked out.</li>
- * </ol>
- * <p>
- * Example (random sublist from index 3 to 7, underlined):
- * <pre>
- * p1 = (8 4 7 3 6 2 5 1 9 0)   X   c1 = (0 4 7 3 6 2 5 1 8 9)
- *             ---------                        ---------
- * p2 = (0 1 2 3 4 5 6 7 8 9)   X   c2 = (8 1 2 3 4 5 6 7 9 0)
- * </pre>
- * <p>
- * This policy works only on {@link AbstractListChromosome}, and therefore it
- * is parameterized by T. Moreover, the chromosomes must have same lengths.
- *
- * @see <a href="http://www.rubicite.com/Tutorials/GeneticAlgorithms/CrossoverOperators/Order1CrossoverOperator.aspx">
- * Order 1 Crossover Operator</a>
- *
- * @param <T> generic type of the {@link AbstractListChromosome}s for crossover
- * @since 3.1
- */
-public class OrderedCrossover<T> implements CrossoverPolicy {
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws MathIllegalArgumentException iff one of the chromosomes is
-     *   not an instance of {@link AbstractListChromosome}
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    @SuppressWarnings("unchecked")
-    public ChromosomePair crossover(final Chromosome first, final Chromosome second)
-        throws DimensionMismatchException, MathIllegalArgumentException {
-
-        if (!(first instanceof AbstractListChromosome<?> && second instanceof AbstractListChromosome<?>)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.INVALID_FIXED_LENGTH_CHROMOSOME);
-        }
-        return mate((AbstractListChromosome<T>) first, (AbstractListChromosome<T>) second);
-    }
-
-    /**
-     * Helper for {@link #crossover(Chromosome, Chromosome)}. Performs the actual crossover.
-     *
-     * @param first the first chromosome
-     * @param second the second chromosome
-     * @return the pair of new chromosomes that resulted from the crossover
-     * @throws DimensionMismatchException if the length of the two chromosomes is different
-     */
-    protected ChromosomePair mate(final AbstractListChromosome<T> first, final AbstractListChromosome<T> second)
-        throws DimensionMismatchException {
-
-        final int length = first.getLength();
-        if (length != second.getLength()) {
-            throw new DimensionMismatchException(second.getLength(), length);
-        }
-
-        // array representations of the parents
-        final List<T> parent1Rep = first.getRepresentation();
-        final List<T> parent2Rep = second.getRepresentation();
-        // and of the children
-        final List<T> child1 = new ArrayList<T>(length);
-        final List<T> child2 = new ArrayList<T>(length);
-        // sets of already inserted items for quick access
-        final Set<T> child1Set = new HashSet<T>(length);
-        final Set<T> child2Set = new HashSet<T>(length);
-
-        final RandomGenerator random = GeneticAlgorithm.getRandomGenerator();
-        // choose random points, making sure that lb < ub.
-        int a = random.nextInt(length);
-        int b;
-        do {
-            b = random.nextInt(length);
-        } while (a == b);
-        // determine the lower and upper bounds
-        final int lb = FastMath.min(a, b);
-        final int ub = FastMath.max(a, b);
-
-        // add the subLists that are between lb and ub
-        child1.addAll(parent1Rep.subList(lb, ub + 1));
-        child1Set.addAll(child1);
-        child2.addAll(parent2Rep.subList(lb, ub + 1));
-        child2Set.addAll(child2);
-
-        // iterate over every item in the parents
-        for (int i = 1; i <= length; i++) {
-            final int idx = (ub + i) % length;
-
-            // retrieve the current item in each parent
-            final T item1 = parent1Rep.get(idx);
-            final T item2 = parent2Rep.get(idx);
-
-            // if the first child already contains the item in the second parent add it
-            if (!child1Set.contains(item2)) {
-                child1.add(item2);
-                child1Set.add(item2);
-            }
-
-            // if the second child already contains the item in the first parent add it
-            if (!child2Set.contains(item1)) {
-                child2.add(item1);
-                child2Set.add(item1);
-            }
-        }
-
-        // rotate so that the original slice is in the same place as in the parents.
-        Collections.rotate(child1, lb);
-        Collections.rotate(child2, lb);
-
-        return new ChromosomePair(first.newFixedLengthChromosome(child1),
-                                  second.newFixedLengthChromosome(child2));
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java b/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java
deleted file mode 100644
index d02cf2c..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/PermutationChromosome.java
+++ /dev/null
@@ -1,40 +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.genetics;
-
-import java.util.List;
-
-/**
- * Interface indicating that the chromosome represents a permutation of objects.
- *
- * @param <T> type of the permuted objects
- * @since 2.0
- */
-public interface PermutationChromosome<T> {
-
-    /**
-     * Permutes the <code>sequence</code> of objects of type T according to the
-     * permutation this chromosome represents. For example, if this chromosome
-     * represents a permutation (3,0,1,2), and the unpermuted sequence is
-     * (a,b,c,d), this yields (d,a,b,c).
-     *
-     * @param sequence the unpermuted (original) sequence of objects
-     * @return permutation of <code>sequence</code> represented by this permutation
-     */
-    List<T> decode(List<T> sequence);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/Population.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/Population.java b/src/main/java/org/apache/commons/math3/genetics/Population.java
deleted file mode 100644
index 8cc6d8b..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/Population.java
+++ /dev/null
@@ -1,59 +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.genetics;
-
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-
-
-/**
- * A collection of chromosomes that facilitates generational evolution.
- *
- * @since 2.0
- */
-public interface Population extends Iterable<Chromosome> {
-    /**
-     * Access the current population size.
-     * @return the current population size.
-     */
-    int getPopulationSize();
-
-    /**
-     * Access the maximum population size.
-     * @return the maximum population size.
-     */
-    int getPopulationLimit();
-
-    /**
-     * Start the population for the next generation.
-     * @return the beginnings of the next generation.
-     */
-    Population nextGeneration();
-
-    /**
-     * Add the given chromosome to the population.
-     * @param chromosome the chromosome to add.
-     * @throws NumberIsTooLargeException if the population would exceed the population limit when adding
-     *   this chromosome
-     */
-    void addChromosome(Chromosome chromosome) throws NumberIsTooLargeException;
-
-    /**
-     * Access the fittest chromosome in this population.
-     * @return the fittest chromosome.
-     */
-    Chromosome getFittestChromosome();
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/RandomKey.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/RandomKey.java b/src/main/java/org/apache/commons/math3/genetics/RandomKey.java
deleted file mode 100644
index 52db4a7..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/RandomKey.java
+++ /dev/null
@@ -1,298 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Random Key chromosome is used for permutation representation. It is a vector
- * of a fixed length of real numbers in [0,1] interval. The index of the i-th
- * smallest value in the vector represents an i-th member of the permutation.
- * <p>
- * For example, the random key [0.2, 0.3, 0.8, 0.1] corresponds to the
- * permutation of indices (3,0,1,2). If the original (unpermuted) sequence would
- * be (a,b,c,d), this would mean the sequence (d,a,b,c).
- * <p>
- * With this representation, common operators like n-point crossover can be
- * used, because any such chromosome represents a valid permutation.
- * <p>
- * Since the chromosome (and thus its arrayRepresentation) is immutable, the
- * array representation is sorted only once in the constructor.
- * <p>
- * For details, see:
- * <ul>
- *   <li>Bean, J.C.: Genetic algorithms and random keys for sequencing and
- *       optimization. ORSA Journal on Computing 6 (1994) 154-160</li>
- *   <li>Rothlauf, F.: Representations for Genetic and Evolutionary Algorithms.
- *       Volume 104 of Studies in Fuzziness and Soft Computing. Physica-Verlag,
- *       Heidelberg (2002)</li>
- * </ul>
- *
- * @param <T> type of the permuted objects
- * @since 2.0
- */
-public abstract class RandomKey<T> extends AbstractListChromosome<Double> implements PermutationChromosome<T> {
-
-    /** Cache of sorted representation (unmodifiable). */
-    private final List<Double> sortedRepresentation;
-
-    /**
-     * Base sequence [0,1,...,n-1], permuted according to the representation (unmodifiable).
-     */
-    private final List<Integer> baseSeqPermutation;
-
-    /**
-     * Constructor.
-     *
-     * @param representation list of [0,1] values representing the permutation
-     * @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
-     */
-    public RandomKey(final List<Double> representation) throws InvalidRepresentationException {
-        super(representation);
-        // store the sorted representation
-        List<Double> sortedRepr = new ArrayList<Double> (getRepresentation());
-        Collections.sort(sortedRepr);
-        sortedRepresentation = Collections.unmodifiableList(sortedRepr);
-        // store the permutation of [0,1,...,n-1] list for toString() and isSame() methods
-        baseSeqPermutation = Collections.unmodifiableList(
-            decodeGeneric(baseSequence(getLength()), getRepresentation(), sortedRepresentation)
-        );
-    }
-
-    /**
-     * Constructor.
-     *
-     * @param representation array of [0,1] values representing the permutation
-     * @throws InvalidRepresentationException iff the <code>representation</code> can not represent a valid chromosome
-     */
-    public RandomKey(final Double[] representation) throws InvalidRepresentationException {
-        this(Arrays.asList(representation));
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public List<T> decode(final List<T> sequence) {
-        return decodeGeneric(sequence, getRepresentation(), sortedRepresentation);
-    }
-
-    /**
-     * Decodes a permutation represented by <code>representation</code> and
-     * returns a (generic) list with the permuted values.
-     *
-     * @param <S> generic type of the sequence values
-     * @param sequence the unpermuted sequence
-     * @param representation representation of the permutation ([0,1] vector)
-     * @param sortedRepr sorted <code>representation</code>
-     * @return list with the sequence values permuted according to the representation
-     * @throws DimensionMismatchException iff the length of the <code>sequence</code>,
-     *   <code>representation</code> or <code>sortedRepr</code> lists are not equal
-     */
-    private static <S> List<S> decodeGeneric(final List<S> sequence, List<Double> representation,
-                                             final List<Double> sortedRepr)
-        throws DimensionMismatchException {
-
-        int l = sequence.size();
-
-        // the size of the three lists must be equal
-        if (representation.size() != l) {
-            throw new DimensionMismatchException(representation.size(), l);
-        }
-        if (sortedRepr.size() != l) {
-            throw new DimensionMismatchException(sortedRepr.size(), l);
-        }
-
-        // do not modify the original representation
-        List<Double> reprCopy = new ArrayList<Double> (representation);
-
-        // now find the indices in the original repr and use them for permuting
-        List<S> res = new ArrayList<S> (l);
-        for (int i=0; i<l; i++) {
-            int index = reprCopy.indexOf(sortedRepr.get(i));
-            res.add(sequence.get(index));
-            reprCopy.set(index, null);
-        }
-        return res;
-    }
-
-    /**
-     * Returns <code>true</code> iff <code>another</code> is a RandomKey and
-     * encodes the same permutation.
-     *
-     * @param another chromosome to compare
-     * @return true iff chromosomes encode the same permutation
-     */
-    @Override
-    protected boolean isSame(final Chromosome another) {
-        // type check
-        if (! (another instanceof RandomKey<?>)) {
-            return false;
-        }
-        RandomKey<?> anotherRk = (RandomKey<?>) another;
-        // size check
-        if (getLength() != anotherRk.getLength()) {
-            return false;
-        }
-
-        // two different representations can still encode the same permutation
-        // the ordering is what counts
-        List<Integer> thisPerm = this.baseSeqPermutation;
-        List<Integer> anotherPerm = anotherRk.baseSeqPermutation;
-
-        for (int i=0; i<getLength(); i++) {
-            if (thisPerm.get(i) != anotherPerm.get(i)) {
-                return false;
-            }
-        }
-        // the permutations are the same
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    protected void checkValidity(final List<Double> chromosomeRepresentation)
-        throws InvalidRepresentationException {
-
-        for (double val : chromosomeRepresentation) {
-            if (val < 0 || val > 1) {
-                throw new InvalidRepresentationException(LocalizedFormats.OUT_OF_RANGE_SIMPLE,
-                                                         val, 0, 1);
-            }
-        }
-    }
-
-
-    /**
-     * Generates a representation corresponding to a random permutation of
-     * length l which can be passed to the RandomKey constructor.
-     *
-     * @param l length of the permutation
-     * @return representation of a random permutation
-     */
-    public static final List<Double> randomPermutation(final int l) {
-        List<Double> repr = new ArrayList<Double>(l);
-        for (int i=0; i<l; i++) {
-            repr.add(GeneticAlgorithm.getRandomGenerator().nextDouble());
-        }
-        return repr;
-    }
-
-    /**
-     * Generates a representation corresponding to an identity permutation of
-     * length l which can be passed to the RandomKey constructor.
-     *
-     * @param l length of the permutation
-     * @return representation of an identity permutation
-     */
-    public static final List<Double> identityPermutation(final int l) {
-        List<Double> repr = new ArrayList<Double>(l);
-        for (int i=0; i<l; i++) {
-            repr.add((double)i/l);
-        }
-        return repr;
-    }
-
-    /**
-     * Generates a representation of a permutation corresponding to the
-     * <code>data</code> sorted by <code>comparator</code>. The
-     * <code>data</code> is not modified during the process.
-     *
-     * This is useful if you want to inject some permutations to the initial
-     * population.
-     *
-     * @param <S> type of the data
-     * @param data list of data determining the order
-     * @param comparator how the data will be compared
-     * @return list representation of the permutation corresponding to the parameters
-     */
-    public static <S> List<Double> comparatorPermutation(final List<S> data,
-                                                         final Comparator<S> comparator) {
-        List<S> sortedData = new ArrayList<S>(data);
-        Collections.sort(sortedData, comparator);
-
-        return inducedPermutation(data, sortedData);
-    }
-
-    /**
-     * Generates a representation of a permutation corresponding to a
-     * permutation which yields <code>permutedData</code> when applied to
-     * <code>originalData</code>.
-     *
-     * This method can be viewed as an inverse to {@link #decode(List)}.
-     *
-     * @param <S> type of the data
-     * @param originalData the original, unpermuted data
-     * @param permutedData the data, somehow permuted
-     * @return representation of a permutation corresponding to the permutation
-     *   <code>originalData -> permutedData</code>
-     * @throws DimensionMismatchException iff the length of <code>originalData</code>
-     *   and <code>permutedData</code> lists are not equal
-     * @throws MathIllegalArgumentException iff the <code>permutedData</code> and
-     *   <code>originalData</code> lists contain different data
-     */
-    public static <S> List<Double> inducedPermutation(final List<S> originalData,
-                                                      final List<S> permutedData)
-        throws DimensionMismatchException, MathIllegalArgumentException {
-
-        if (originalData.size() != permutedData.size()) {
-            throw new DimensionMismatchException(permutedData.size(), originalData.size());
-        }
-        int l = originalData.size();
-
-        List<S> origDataCopy = new ArrayList<S> (originalData);
-
-        Double[] res = new Double[l];
-        for (int i=0; i<l; i++) {
-            int index = origDataCopy.indexOf(permutedData.get(i));
-            if (index == -1) {
-                throw new MathIllegalArgumentException(LocalizedFormats.DIFFERENT_ORIG_AND_PERMUTED_DATA);
-            }
-            res[index] = (double) i / l;
-            origDataCopy.set(index, null);
-        }
-        return Arrays.asList(res);
-    }
-
-    @Override
-    public String toString() {
-        return String.format("(f=%s pi=(%s))", getFitness(), baseSeqPermutation);
-    }
-
-    /**
-     * Helper for constructor. Generates a list of natural numbers (0,1,...,l-1).
-     *
-     * @param l length of list to generate
-     * @return list of integers from 0 to l-1
-     */
-    private static List<Integer> baseSequence(final int l) {
-        List<Integer> baseSequence = new ArrayList<Integer> (l);
-        for (int i=0; i<l; i++) {
-            baseSequence.add(i);
-        }
-        return baseSequence;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java b/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java
deleted file mode 100644
index 9fb16fb..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/RandomKeyMutation.java
+++ /dev/null
@@ -1,54 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Mutation operator for {@link RandomKey}s. Changes a randomly chosen element
- * of the array representation to a random value uniformly distributed in [0,1].
- *
- * @since 2.0
- */
-public class RandomKeyMutation implements MutationPolicy {
-
-    /**
-     * {@inheritDoc}
-     *
-     * @throws MathIllegalArgumentException if <code>original</code> is not a {@link RandomKey} instance
-     */
-    public Chromosome mutate(final Chromosome original) throws MathIllegalArgumentException {
-        if (!(original instanceof RandomKey<?>)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.RANDOMKEY_MUTATION_WRONG_CLASS,
-                                                   original.getClass().getSimpleName());
-        }
-
-        RandomKey<?> originalRk = (RandomKey<?>) original;
-        List<Double> repr = originalRk.getRepresentation();
-        int rInd = GeneticAlgorithm.getRandomGenerator().nextInt(repr.size());
-
-        List<Double> newRepr = new ArrayList<Double> (repr);
-        newRepr.set(rInd, GeneticAlgorithm.getRandomGenerator().nextDouble());
-
-        return originalRk.newFixedLengthChromosome(newRepr);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/SelectionPolicy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/SelectionPolicy.java b/src/main/java/org/apache/commons/math3/genetics/SelectionPolicy.java
deleted file mode 100644
index 5240f75..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/SelectionPolicy.java
+++ /dev/null
@@ -1,34 +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.genetics;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-
-/**
- * Algorithm used to select a chromosome pair from a population.
- *
- * @since 2.0
- */
-public interface SelectionPolicy {
-    /**
-     * Select two chromosomes from the population.
-     * @param population the population from which the chromosomes are choosen.
-     * @return the selected chromosomes.
-     * @throws MathIllegalArgumentException if the population is not compatible with this {@link SelectionPolicy}
-     */
-    ChromosomePair select(Population population) throws MathIllegalArgumentException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java b/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java
deleted file mode 100644
index 0e21628..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/StoppingCondition.java
+++ /dev/null
@@ -1,33 +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.genetics;
-
-/**
- * Algorithm used to determine when to stop evolution.
- *
- * @since 2.0
- */
-public interface StoppingCondition {
-    /**
-     * Determine whether or not the given population satisfies the stopping condition.
-     *
-     * @param population the population to test.
-     * @return <code>true</code> if this stopping condition is met by the given population,
-     *   <code>false</code> otherwise.
-     */
-    boolean isSatisfied(Population population);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java b/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java
deleted file mode 100644
index 95051ee..0000000
--- a/src/main/java/org/apache/commons/math3/genetics/TournamentSelection.java
+++ /dev/null
@@ -1,114 +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.genetics;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-
-/**
- * Tournament selection scheme. Each of the two selected chromosomes is selected
- * based on n-ary tournament -- this is done by drawing {@link #arity} random
- * chromosomes without replacement from the population, and then selecting the
- * fittest chromosome among them.
- *
- * @since 2.0
- */
-public class TournamentSelection implements SelectionPolicy {
-
-    /** number of chromosomes included in the tournament selections */
-    private int arity;
-
-    /**
-     * Creates a new TournamentSelection instance.
-     *
-     * @param arity how many chromosomes will be drawn to the tournament
-     */
-    public TournamentSelection(final int arity) {
-        this.arity = arity;
-    }
-
-    /**
-     * Select two chromosomes from the population. Each of the two selected
-     * chromosomes is selected based on n-ary tournament -- this is done by
-     * drawing {@link #arity} random chromosomes without replacement from the
-     * population, and then selecting the fittest chromosome among them.
-     *
-     * @param population the population from which the chromosomes are chosen.
-     * @return the selected chromosomes.
-     * @throws MathIllegalArgumentException if the tournament arity is bigger than the population size
-     */
-    public ChromosomePair select(final Population population) throws MathIllegalArgumentException {
-        return new ChromosomePair(tournament((ListPopulation) population),
-                                  tournament((ListPopulation) population));
-    }
-
-    /**
-     * Helper for {@link #select(Population)}. Draw {@link #arity} random chromosomes without replacement from the
-     * population, and then select the fittest chromosome among them.
-     *
-     * @param population the population from which the chromosomes are chosen.
-     * @return the selected chromosome.
-     * @throws MathIllegalArgumentException if the tournament arity is bigger than the population size
-     */
-    private Chromosome tournament(final ListPopulation population) throws MathIllegalArgumentException {
-        if (population.getPopulationSize() < this.arity) {
-            throw new MathIllegalArgumentException(LocalizedFormats.TOO_LARGE_TOURNAMENT_ARITY,
-                                                   arity, population.getPopulationSize());
-        }
-        // auxiliary population
-        ListPopulation tournamentPopulation = new ListPopulation(this.arity) {
-            public Population nextGeneration() {
-                // not useful here
-                return null;
-            }
-        };
-
-        // create a copy of the chromosome list
-        List<Chromosome> chromosomes = new ArrayList<Chromosome> (population.getChromosomes());
-        for (int i=0; i<this.arity; i++) {
-            // select a random individual and add it to the tournament
-            int rind = GeneticAlgorithm.getRandomGenerator().nextInt(chromosomes.size());
-            tournamentPopulation.addChromosome(chromosomes.get(rind));
-            // do not select it again
-            chromosomes.remove(rind);
-        }
-        // the winner takes it all
-        return tournamentPopulation.getFittestChromosome();
-    }
-
-    /**
-     * Gets the arity (number of chromosomes drawn to the tournament).
-     *
-     * @return arity of the tournament
-     */
-    public int getArity() {
-        return arity;
-    }
-
-    /**
-     * Sets the arity (number of chromosomes drawn to the tournament).
-     *
-     * @param arity arity of the tournament
-     */
-    public void setArity(final int arity) {
-        this.arity = arity;
-    }
-
-}


[18/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java
deleted file mode 100644
index a63e806..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/Plane.java
+++ /dev/null
@@ -1,527 +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.geometry.euclidean.threed;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Vector;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.oned.Vector1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.PolygonsSet;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.Embedding;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.util.FastMath;
-
-/** The class represent planes in a three dimensional space.
- * @since 3.0
- */
-public class Plane implements Hyperplane<Euclidean3D>, Embedding<Euclidean3D, Euclidean2D> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Offset of the origin with respect to the plane. */
-    private double originOffset;
-
-    /** Origin of the plane frame. */
-    private Vector3D origin;
-
-    /** First vector of the plane frame (in plane). */
-    private Vector3D u;
-
-    /** Second vector of the plane frame (in plane). */
-    private Vector3D v;
-
-    /** Third vector of the plane frame (plane normal). */
-    private Vector3D w;
-
-    /** Tolerance below which points are considered identical. */
-    private final double tolerance;
-
-    /** Build a plane normal to a given direction and containing the origin.
-     * @param normal normal direction to the plane
-     * @param tolerance tolerance below which points are considered identical
-     * @exception MathArithmeticException if the normal norm is too small
-     * @since 3.3
-     */
-    public Plane(final Vector3D normal, final double tolerance)
-        throws MathArithmeticException {
-        setNormal(normal);
-        this.tolerance = tolerance;
-        originOffset = 0;
-        setFrame();
-    }
-
-    /** Build a plane from a point and a normal.
-     * @param p point belonging to the plane
-     * @param normal normal direction to the plane
-     * @param tolerance tolerance below which points are considered identical
-     * @exception MathArithmeticException if the normal norm is too small
-     * @since 3.3
-     */
-    public Plane(final Vector3D p, final Vector3D normal, final double tolerance)
-        throws MathArithmeticException {
-        setNormal(normal);
-        this.tolerance = tolerance;
-        originOffset = -p.dotProduct(w);
-        setFrame();
-    }
-
-    /** Build a plane from three points.
-     * <p>The plane is oriented in the direction of
-     * {@code (p2-p1) ^ (p3-p1)}</p>
-     * @param p1 first point belonging to the plane
-     * @param p2 second point belonging to the plane
-     * @param p3 third point belonging to the plane
-     * @param tolerance tolerance below which points are considered identical
-     * @exception MathArithmeticException if the points do not constitute a plane
-     * @since 3.3
-     */
-    public Plane(final Vector3D p1, final Vector3D p2, final Vector3D p3, final double tolerance)
-        throws MathArithmeticException {
-        this(p1, p2.subtract(p1).crossProduct(p3.subtract(p1)), tolerance);
-    }
-
-    /** Build a plane normal to a given direction and containing the origin.
-     * @param normal normal direction to the plane
-     * @exception MathArithmeticException if the normal norm is too small
-     * @deprecated as of 3.3, replaced with {@link #Plane(Vector3D, double)}
-     */
-    @Deprecated
-    public Plane(final Vector3D normal) throws MathArithmeticException {
-        this(normal, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a plane from a point and a normal.
-     * @param p point belonging to the plane
-     * @param normal normal direction to the plane
-     * @exception MathArithmeticException if the normal norm is too small
-     * @deprecated as of 3.3, replaced with {@link #Plane(Vector3D, Vector3D, double)}
-     */
-    @Deprecated
-    public Plane(final Vector3D p, final Vector3D normal) throws MathArithmeticException {
-        this(p, normal, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a plane from three points.
-     * <p>The plane is oriented in the direction of
-     * {@code (p2-p1) ^ (p3-p1)}</p>
-     * @param p1 first point belonging to the plane
-     * @param p2 second point belonging to the plane
-     * @param p3 third point belonging to the plane
-     * @exception MathArithmeticException if the points do not constitute a plane
-     * @deprecated as of 3.3, replaced with {@link #Plane(Vector3D, Vector3D, Vector3D, double)}
-     */
-    @Deprecated
-    public Plane(final Vector3D p1, final Vector3D p2, final Vector3D p3)
-        throws MathArithmeticException {
-        this(p1, p2, p3, DEFAULT_TOLERANCE);
-    }
-
-    /** Copy constructor.
-     * <p>The instance created is completely independant of the original
-     * one. A deep copy is used, none of the underlying object are
-     * shared.</p>
-     * @param plane plane to copy
-     */
-    public Plane(final Plane plane) {
-        originOffset = plane.originOffset;
-        origin       = plane.origin;
-        u            = plane.u;
-        v            = plane.v;
-        w            = plane.w;
-        tolerance    = plane.tolerance;
-    }
-
-    /** Copy the instance.
-     * <p>The instance created is completely independant of the original
-     * one. A deep copy is used, none of the underlying objects are
-     * shared (except for immutable objects).</p>
-     * @return a new hyperplane, copy of the instance
-     */
-    public Plane copySelf() {
-        return new Plane(this);
-    }
-
-    /** Reset the instance as if built from a point and a normal.
-     * @param p point belonging to the plane
-     * @param normal normal direction to the plane
-     * @exception MathArithmeticException if the normal norm is too small
-     */
-    public void reset(final Vector3D p, final Vector3D normal) throws MathArithmeticException {
-        setNormal(normal);
-        originOffset = -p.dotProduct(w);
-        setFrame();
-    }
-
-    /** Reset the instance from another one.
-     * <p>The updated instance is completely independant of the original
-     * one. A deep reset is used none of the underlying object is
-     * shared.</p>
-     * @param original plane to reset from
-     */
-    public void reset(final Plane original) {
-        originOffset = original.originOffset;
-        origin       = original.origin;
-        u            = original.u;
-        v            = original.v;
-        w            = original.w;
-    }
-
-    /** Set the normal vactor.
-     * @param normal normal direction to the plane (will be copied)
-     * @exception MathArithmeticException if the normal norm is too small
-     */
-    private void setNormal(final Vector3D normal) throws MathArithmeticException {
-        final double norm = normal.getNorm();
-        if (norm < 1.0e-10) {
-            throw new MathArithmeticException(LocalizedFormats.ZERO_NORM);
-        }
-        w = new Vector3D(1.0 / norm, normal);
-    }
-
-    /** Reset the plane frame.
-     */
-    private void setFrame() {
-        origin = new Vector3D(-originOffset, w);
-        u = w.orthogonal();
-        v = Vector3D.crossProduct(w, u);
-    }
-
-    /** Get the origin point of the plane frame.
-     * <p>The point returned is the orthogonal projection of the
-     * 3D-space origin in the plane.</p>
-     * @return the origin point of the plane frame (point closest to the
-     * 3D-space origin)
-     */
-    public Vector3D getOrigin() {
-        return origin;
-    }
-
-    /** Get the normalized normal vector.
-     * <p>The frame defined by ({@link #getU getU}, {@link #getV getV},
-     * {@link #getNormal getNormal}) is a rigth-handed orthonormalized
-     * frame).</p>
-     * @return normalized normal vector
-     * @see #getU
-     * @see #getV
-     */
-    public Vector3D getNormal() {
-        return w;
-    }
-
-    /** Get the plane first canonical vector.
-     * <p>The frame defined by ({@link #getU getU}, {@link #getV getV},
-     * {@link #getNormal getNormal}) is a rigth-handed orthonormalized
-     * frame).</p>
-     * @return normalized first canonical vector
-     * @see #getV
-     * @see #getNormal
-     */
-    public Vector3D getU() {
-        return u;
-    }
-
-    /** Get the plane second canonical vector.
-     * <p>The frame defined by ({@link #getU getU}, {@link #getV getV},
-     * {@link #getNormal getNormal}) is a rigth-handed orthonormalized
-     * frame).</p>
-     * @return normalized second canonical vector
-     * @see #getU
-     * @see #getNormal
-     */
-    public Vector3D getV() {
-        return v;
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    public Point<Euclidean3D> project(Point<Euclidean3D> point) {
-        return toSpace(toSubSpace(point));
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /** Revert the plane.
-     * <p>Replace the instance by a similar plane with opposite orientation.</p>
-     * <p>The new plane frame is chosen in such a way that a 3D point that had
-     * {@code (x, y)} in-plane coordinates and {@code z} offset with
-     * respect to the plane and is unaffected by the change will have
-     * {@code (y, x)} in-plane coordinates and {@code -z} offset with
-     * respect to the new plane. This means that the {@code u} and {@code v}
-     * vectors returned by the {@link #getU} and {@link #getV} methods are exchanged,
-     * and the {@code w} vector returned by the {@link #getNormal} method is
-     * reversed.</p>
-     */
-    public void revertSelf() {
-        final Vector3D tmp = u;
-        u = v;
-        v = tmp;
-        w = w.negate();
-        originOffset = -originOffset;
-    }
-
-    /** Transform a space point into a sub-space point.
-     * @param vector n-dimension point of the space
-     * @return (n-1)-dimension point of the sub-space corresponding to
-     * the specified space point
-     */
-    public Vector2D toSubSpace(Vector<Euclidean3D> vector) {
-        return toSubSpace((Point<Euclidean3D>) vector);
-    }
-
-    /** Transform a sub-space point into a space point.
-     * @param vector (n-1)-dimension point of the sub-space
-     * @return n-dimension point of the space corresponding to the
-     * specified sub-space point
-     */
-    public Vector3D toSpace(Vector<Euclidean2D> vector) {
-        return toSpace((Point<Euclidean2D>) vector);
-    }
-
-    /** Transform a 3D space point into an in-plane point.
-     * @param point point of the space (must be a {@link Vector3D
-     * Vector3D} instance)
-     * @return in-plane point (really a {@link
-     * org.apache.commons.math3.geometry.euclidean.twod.Vector2D Vector2D} instance)
-     * @see #toSpace
-     */
-    public Vector2D toSubSpace(final Point<Euclidean3D> point) {
-        final Vector3D p3D = (Vector3D) point;
-        return new Vector2D(p3D.dotProduct(u), p3D.dotProduct(v));
-    }
-
-    /** Transform an in-plane point into a 3D space point.
-     * @param point in-plane point (must be a {@link
-     * org.apache.commons.math3.geometry.euclidean.twod.Vector2D Vector2D} instance)
-     * @return 3D space point (really a {@link Vector3D Vector3D} instance)
-     * @see #toSubSpace
-     */
-    public Vector3D toSpace(final Point<Euclidean2D> point) {
-        final Vector2D p2D = (Vector2D) point;
-        return new Vector3D(p2D.getX(), u, p2D.getY(), v, -originOffset, w);
-    }
-
-    /** Get one point from the 3D-space.
-     * @param inPlane desired in-plane coordinates for the point in the
-     * plane
-     * @param offset desired offset for the point
-     * @return one point in the 3D-space, with given coordinates and offset
-     * relative to the plane
-     */
-    public Vector3D getPointAt(final Vector2D inPlane, final double offset) {
-        return new Vector3D(inPlane.getX(), u, inPlane.getY(), v, offset - originOffset, w);
-    }
-
-    /** Check if the instance is similar to another plane.
-     * <p>Planes are considered similar if they contain the same
-     * points. This does not mean they are equal since they can have
-     * opposite normals.</p>
-     * @param plane plane to which the instance is compared
-     * @return true if the planes are similar
-     */
-    public boolean isSimilarTo(final Plane plane) {
-        final double angle = Vector3D.angle(w, plane.w);
-        return ((angle < 1.0e-10) && (FastMath.abs(originOffset - plane.originOffset) < 1.0e-10)) ||
-               ((angle > (FastMath.PI - 1.0e-10)) && (FastMath.abs(originOffset + plane.originOffset) < 1.0e-10));
-    }
-
-    /** Rotate the plane around the specified point.
-     * <p>The instance is not modified, a new instance is created.</p>
-     * @param center rotation center
-     * @param rotation vectorial rotation operator
-     * @return a new plane
-     */
-    public Plane rotate(final Vector3D center, final Rotation rotation) {
-
-        final Vector3D delta = origin.subtract(center);
-        final Plane plane = new Plane(center.add(rotation.applyTo(delta)),
-                                      rotation.applyTo(w), tolerance);
-
-        // make sure the frame is transformed as desired
-        plane.u = rotation.applyTo(u);
-        plane.v = rotation.applyTo(v);
-
-        return plane;
-
-    }
-
-    /** Translate the plane by the specified amount.
-     * <p>The instance is not modified, a new instance is created.</p>
-     * @param translation translation to apply
-     * @return a new plane
-     */
-    public Plane translate(final Vector3D translation) {
-
-        final Plane plane = new Plane(origin.add(translation), w, tolerance);
-
-        // make sure the frame is transformed as desired
-        plane.u = u;
-        plane.v = v;
-
-        return plane;
-
-    }
-
-    /** Get the intersection of a line with the instance.
-     * @param line line intersecting the instance
-     * @return intersection point between between the line and the
-     * instance (null if the line is parallel to the instance)
-     */
-    public Vector3D intersection(final Line line) {
-        final Vector3D direction = line.getDirection();
-        final double   dot       = w.dotProduct(direction);
-        if (FastMath.abs(dot) < 1.0e-10) {
-            return null;
-        }
-        final Vector3D point = line.toSpace((Point<Euclidean1D>) Vector1D.ZERO);
-        final double   k     = -(originOffset + w.dotProduct(point)) / dot;
-        return new Vector3D(1.0, point, k, direction);
-    }
-
-    /** Build the line shared by the instance and another plane.
-     * @param other other plane
-     * @return line at the intersection of the instance and the
-     * other plane (really a {@link Line Line} instance)
-     */
-    public Line intersection(final Plane other) {
-        final Vector3D direction = Vector3D.crossProduct(w, other.w);
-        if (direction.getNorm() < 1.0e-10) {
-            return null;
-        }
-        final Vector3D point = intersection(this, other, new Plane(direction, tolerance));
-        return new Line(point, point.add(direction), tolerance);
-    }
-
-    /** Get the intersection point of three planes.
-     * @param plane1 first plane1
-     * @param plane2 second plane2
-     * @param plane3 third plane2
-     * @return intersection point of three planes, null if some planes are parallel
-     */
-    public static Vector3D intersection(final Plane plane1, final Plane plane2, final Plane plane3) {
-
-        // coefficients of the three planes linear equations
-        final double a1 = plane1.w.getX();
-        final double b1 = plane1.w.getY();
-        final double c1 = plane1.w.getZ();
-        final double d1 = plane1.originOffset;
-
-        final double a2 = plane2.w.getX();
-        final double b2 = plane2.w.getY();
-        final double c2 = plane2.w.getZ();
-        final double d2 = plane2.originOffset;
-
-        final double a3 = plane3.w.getX();
-        final double b3 = plane3.w.getY();
-        final double c3 = plane3.w.getZ();
-        final double d3 = plane3.originOffset;
-
-        // direct Cramer resolution of the linear system
-        // (this is still feasible for a 3x3 system)
-        final double a23         = b2 * c3 - b3 * c2;
-        final double b23         = c2 * a3 - c3 * a2;
-        final double c23         = a2 * b3 - a3 * b2;
-        final double determinant = a1 * a23 + b1 * b23 + c1 * c23;
-        if (FastMath.abs(determinant) < 1.0e-10) {
-            return null;
-        }
-
-        final double r = 1.0 / determinant;
-        return new Vector3D(
-                            (-a23 * d1 - (c1 * b3 - c3 * b1) * d2 - (c2 * b1 - c1 * b2) * d3) * r,
-                            (-b23 * d1 - (c3 * a1 - c1 * a3) * d2 - (c1 * a2 - c2 * a1) * d3) * r,
-                            (-c23 * d1 - (b1 * a3 - b3 * a1) * d2 - (b2 * a1 - b1 * a2) * d3) * r);
-
-    }
-
-    /** Build a region covering the whole hyperplane.
-     * @return a region covering the whole hyperplane
-     */
-    public SubPlane wholeHyperplane() {
-        return new SubPlane(this, new PolygonsSet(tolerance));
-    }
-
-    /** Build a region covering the whole space.
-     * @return a region containing the instance (really a {@link
-     * PolyhedronsSet PolyhedronsSet} instance)
-     */
-    public PolyhedronsSet wholeSpace() {
-        return new PolyhedronsSet(tolerance);
-    }
-
-    /** Check if the instance contains a point.
-     * @param p point to check
-     * @return true if p belongs to the plane
-     */
-    public boolean contains(final Vector3D p) {
-        return FastMath.abs(getOffset(p)) < 1.0e-10;
-    }
-
-    /** Get the offset (oriented distance) of a parallel plane.
-     * <p>This method should be called only for parallel planes otherwise
-     * the result is not meaningful.</p>
-     * <p>The offset is 0 if both planes are the same, it is
-     * positive if the plane is on the plus side of the instance and
-     * negative if it is on the minus side, according to its natural
-     * orientation.</p>
-     * @param plane plane to check
-     * @return offset of the plane
-     */
-    public double getOffset(final Plane plane) {
-        return originOffset + (sameOrientationAs(plane) ? -plane.originOffset : plane.originOffset);
-    }
-
-    /** Get the offset (oriented distance) of a vector.
-     * @param vector vector to check
-     * @return offset of the vector
-     */
-    public double getOffset(Vector<Euclidean3D> vector) {
-        return getOffset((Point<Euclidean3D>) vector);
-    }
-
-    /** Get the offset (oriented distance) of a point.
-     * <p>The offset is 0 if the point is on the underlying hyperplane,
-     * it is positive if the point is on one particular side of the
-     * hyperplane, and it is negative if the point is on the other side,
-     * according to the hyperplane natural orientation.</p>
-     * @param point point to check
-     * @return offset of the point
-     */
-    public double getOffset(final Point<Euclidean3D> point) {
-        return ((Vector3D) point).dotProduct(w) + originOffset;
-    }
-
-    /** Check if the instance has the same orientation as another hyperplane.
-     * @param other other hyperplane to check against the instance
-     * @return true if the instance and the other hyperplane have
-     * the same orientation
-     */
-    public boolean sameOrientationAs(final Hyperplane<Euclidean3D> other) {
-        return (((Plane) other).w).dotProduct(w) > 0.0;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java
deleted file mode 100644
index d41d133..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/PolyhedronsSet.java
+++ /dev/null
@@ -1,539 +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.geometry.euclidean.threed;
-
-import java.awt.geom.AffineTransform;
-import java.util.Collection;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.euclidean.oned.Euclidean1D;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.SubLine;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.partitioning.AbstractRegion;
-import org.apache.commons.math3.geometry.partitioning.BSPTree;
-import org.apache.commons.math3.geometry.partitioning.BSPTreeVisitor;
-import org.apache.commons.math3.geometry.partitioning.BoundaryAttribute;
-import org.apache.commons.math3.geometry.partitioning.Hyperplane;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.geometry.partitioning.SubHyperplane;
-import org.apache.commons.math3.geometry.partitioning.Transform;
-import org.apache.commons.math3.util.FastMath;
-
-/** This class represents a 3D region: a set of polyhedrons.
- * @since 3.0
- */
-public class PolyhedronsSet extends AbstractRegion<Euclidean3D, Euclidean2D> {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1.0e-10;
-
-    /** Build a polyhedrons set representing the whole real line.
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolyhedronsSet(final double tolerance) {
-        super(tolerance);
-    }
-
-    /** Build a polyhedrons set from a BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * <p>
-     * This constructor is aimed at expert use, as building the tree may
-     * be a difficult task. It is not intended for general use and for
-     * performances reasons does not check thoroughly its input, as this would
-     * require walking the full tree each time. Failing to provide a tree with
-     * the proper attributes, <em>will</em> therefore generate problems like
-     * {@link NullPointerException} or {@link ClassCastException} only later on.
-     * This limitation is known and explains why this constructor is for expert
-     * use only. The caller does have the responsibility to provided correct arguments.
-     * </p>
-     * @param tree inside/outside BSP tree representing the region
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolyhedronsSet(final BSPTree<Euclidean3D> tree, final double tolerance) {
-        super(tree, tolerance);
-    }
-
-    /** Build a polyhedrons set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polyhedrons with holes
-     * or a set of disjoint polyhedrons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link Region#checkPoint(Point) checkPoint} method will
-     * not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements, as a
-     * collection of {@link SubHyperplane SubHyperplane} objects
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolyhedronsSet(final Collection<SubHyperplane<Euclidean3D>> boundary,
-                          final double tolerance) {
-        super(boundary, tolerance);
-    }
-
-    /** Build a parallellepipedic box.
-     * @param xMin low bound along the x direction
-     * @param xMax high bound along the x direction
-     * @param yMin low bound along the y direction
-     * @param yMax high bound along the y direction
-     * @param zMin low bound along the z direction
-     * @param zMax high bound along the z direction
-     * @param tolerance tolerance below which points are considered identical
-     * @since 3.3
-     */
-    public PolyhedronsSet(final double xMin, final double xMax,
-                          final double yMin, final double yMax,
-                          final double zMin, final double zMax,
-                          final double tolerance) {
-        super(buildBoundary(xMin, xMax, yMin, yMax, zMin, zMax, tolerance), tolerance);
-    }
-
-    /** Build a polyhedrons set representing the whole real line.
-     * @deprecated as of 3.3, replaced with {@link #PolyhedronsSet(double)}
-     */
-    @Deprecated
-    public PolyhedronsSet() {
-        this(DEFAULT_TOLERANCE);
-    }
-
-    /** Build a polyhedrons set from a BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p>
-     * @param tree inside/outside BSP tree representing the region
-     * @deprecated as of 3.3, replaced with {@link #PolyhedronsSet(BSPTree, double)}
-     */
-    @Deprecated
-    public PolyhedronsSet(final BSPTree<Euclidean3D> tree) {
-        this(tree, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a polyhedrons set from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polyhedrons with holes
-     * or a set of disjoint polyhedrons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link Region#checkPoint(Point) checkPoint} method will
-     * not be meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements, as a
-     * collection of {@link SubHyperplane SubHyperplane} objects
-     * @deprecated as of 3.3, replaced with {@link #PolyhedronsSet(Collection, double)}
-     */
-    @Deprecated
-    public PolyhedronsSet(final Collection<SubHyperplane<Euclidean3D>> boundary) {
-        this(boundary, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a parallellepipedic box.
-     * @param xMin low bound along the x direction
-     * @param xMax high bound along the x direction
-     * @param yMin low bound along the y direction
-     * @param yMax high bound along the y direction
-     * @param zMin low bound along the z direction
-     * @param zMax high bound along the z direction
-     * @deprecated as of 3.3, replaced with {@link #PolyhedronsSet(double, double,
-     * double, double, double, double, double)}
-     */
-    @Deprecated
-    public PolyhedronsSet(final double xMin, final double xMax,
-                          final double yMin, final double yMax,
-                          final double zMin, final double zMax) {
-        this(xMin, xMax, yMin, yMax, zMin, zMax, DEFAULT_TOLERANCE);
-    }
-
-    /** Build a parallellepipedic box boundary.
-     * @param xMin low bound along the x direction
-     * @param xMax high bound along the x direction
-     * @param yMin low bound along the y direction
-     * @param yMax high bound along the y direction
-     * @param zMin low bound along the z direction
-     * @param zMax high bound along the z direction
-     * @param tolerance tolerance below which points are considered identical
-     * @return boundary tree
-     * @since 3.3
-     */
-    private static BSPTree<Euclidean3D> buildBoundary(final double xMin, final double xMax,
-                                                      final double yMin, final double yMax,
-                                                      final double zMin, final double zMax,
-                                                      final double tolerance) {
-        if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance) || (zMin >= zMax - tolerance)) {
-            // too thin box, build an empty polygons set
-            return new BSPTree<Euclidean3D>(Boolean.FALSE);
-        }
-        final Plane pxMin = new Plane(new Vector3D(xMin, 0,    0),   Vector3D.MINUS_I, tolerance);
-        final Plane pxMax = new Plane(new Vector3D(xMax, 0,    0),   Vector3D.PLUS_I,  tolerance);
-        final Plane pyMin = new Plane(new Vector3D(0,    yMin, 0),   Vector3D.MINUS_J, tolerance);
-        final Plane pyMax = new Plane(new Vector3D(0,    yMax, 0),   Vector3D.PLUS_J,  tolerance);
-        final Plane pzMin = new Plane(new Vector3D(0,    0,   zMin), Vector3D.MINUS_K, tolerance);
-        final Plane pzMax = new Plane(new Vector3D(0,    0,   zMax), Vector3D.PLUS_K,  tolerance);
-        @SuppressWarnings("unchecked")
-        final Region<Euclidean3D> boundary =
-        new RegionFactory<Euclidean3D>().buildConvex(pxMin, pxMax, pyMin, pyMax, pzMin, pzMax);
-        return boundary.getTree(false);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public PolyhedronsSet buildNew(final BSPTree<Euclidean3D> tree) {
-        return new PolyhedronsSet(tree, getTolerance());
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected void computeGeometricalProperties() {
-
-        // compute the contribution of all boundary facets
-        getTree(true).visit(new FacetsContributionVisitor());
-
-        if (getSize() < 0) {
-            // the polyhedrons set as a finite outside
-            // surrounded by an infinite inside
-            setSize(Double.POSITIVE_INFINITY);
-            setBarycenter((Point<Euclidean3D>) Vector3D.NaN);
-        } else {
-            // the polyhedrons set is finite, apply the remaining scaling factors
-            setSize(getSize() / 3.0);
-            setBarycenter((Point<Euclidean3D>) new Vector3D(1.0 / (4 * getSize()), (Vector3D) getBarycenter()));
-        }
-
-    }
-
-    /** Visitor computing geometrical properties. */
-    private class FacetsContributionVisitor implements BSPTreeVisitor<Euclidean3D> {
-
-        /** Simple constructor. */
-        public FacetsContributionVisitor() {
-            setSize(0);
-            setBarycenter((Point<Euclidean3D>) new Vector3D(0, 0, 0));
-        }
-
-        /** {@inheritDoc} */
-        public Order visitOrder(final BSPTree<Euclidean3D> node) {
-            return Order.MINUS_SUB_PLUS;
-        }
-
-        /** {@inheritDoc} */
-        public void visitInternalNode(final BSPTree<Euclidean3D> node) {
-            @SuppressWarnings("unchecked")
-            final BoundaryAttribute<Euclidean3D> attribute =
-                (BoundaryAttribute<Euclidean3D>) node.getAttribute();
-            if (attribute.getPlusOutside() != null) {
-                addContribution(attribute.getPlusOutside(), false);
-            }
-            if (attribute.getPlusInside() != null) {
-                addContribution(attribute.getPlusInside(), true);
-            }
-        }
-
-        /** {@inheritDoc} */
-        public void visitLeafNode(final BSPTree<Euclidean3D> node) {
-        }
-
-        /** Add he contribution of a boundary facet.
-         * @param facet boundary facet
-         * @param reversed if true, the facet has the inside on its plus side
-         */
-        private void addContribution(final SubHyperplane<Euclidean3D> facet, final boolean reversed) {
-
-            final Region<Euclidean2D> polygon = ((SubPlane) facet).getRemainingRegion();
-            final double area    = polygon.getSize();
-
-            if (Double.isInfinite(area)) {
-                setSize(Double.POSITIVE_INFINITY);
-                setBarycenter((Point<Euclidean3D>) Vector3D.NaN);
-            } else {
-
-                final Plane    plane  = (Plane) facet.getHyperplane();
-                final Vector3D facetB = plane.toSpace(polygon.getBarycenter());
-                double   scaled = area * facetB.dotProduct(plane.getNormal());
-                if (reversed) {
-                    scaled = -scaled;
-                }
-
-                setSize(getSize() + scaled);
-                setBarycenter((Point<Euclidean3D>) new Vector3D(1.0, (Vector3D) getBarycenter(), scaled, facetB));
-
-            }
-
-        }
-
-    }
-
-    /** Get the first sub-hyperplane crossed by a semi-infinite line.
-     * @param point start point of the part of the line considered
-     * @param line line to consider (contains point)
-     * @return the first sub-hyperplaned crossed by the line after the
-     * given point, or null if the line does not intersect any
-     * sub-hyperplaned
-     */
-    public SubHyperplane<Euclidean3D> firstIntersection(final Vector3D point, final Line line) {
-        return recurseFirstIntersection(getTree(true), point, line);
-    }
-
-    /** Get the first sub-hyperplane crossed by a semi-infinite line.
-     * @param node current node
-     * @param point start point of the part of the line considered
-     * @param line line to consider (contains point)
-     * @return the first sub-hyperplaned crossed by the line after the
-     * given point, or null if the line does not intersect any
-     * sub-hyperplaned
-     */
-    private SubHyperplane<Euclidean3D> recurseFirstIntersection(final BSPTree<Euclidean3D> node,
-                                                                final Vector3D point,
-                                                                final Line line) {
-
-        final SubHyperplane<Euclidean3D> cut = node.getCut();
-        if (cut == null) {
-            return null;
-        }
-        final BSPTree<Euclidean3D> minus = node.getMinus();
-        final BSPTree<Euclidean3D> plus  = node.getPlus();
-        final Plane               plane = (Plane) cut.getHyperplane();
-
-        // establish search order
-        final double offset = plane.getOffset((Point<Euclidean3D>) point);
-        final boolean in    = FastMath.abs(offset) < 1.0e-10;
-        final BSPTree<Euclidean3D> near;
-        final BSPTree<Euclidean3D> far;
-        if (offset < 0) {
-            near = minus;
-            far  = plus;
-        } else {
-            near = plus;
-            far  = minus;
-        }
-
-        if (in) {
-            // search in the cut hyperplane
-            final SubHyperplane<Euclidean3D> facet = boundaryFacet(point, node);
-            if (facet != null) {
-                return facet;
-            }
-        }
-
-        // search in the near branch
-        final SubHyperplane<Euclidean3D> crossed = recurseFirstIntersection(near, point, line);
-        if (crossed != null) {
-            return crossed;
-        }
-
-        if (!in) {
-            // search in the cut hyperplane
-            final Vector3D hit3D = plane.intersection(line);
-            if (hit3D != null) {
-                final SubHyperplane<Euclidean3D> facet = boundaryFacet(hit3D, node);
-                if (facet != null) {
-                    return facet;
-                }
-            }
-        }
-
-        // search in the far branch
-        return recurseFirstIntersection(far, point, line);
-
-    }
-
-    /** Check if a point belongs to the boundary part of a node.
-     * @param point point to check
-     * @param node node containing the boundary facet to check
-     * @return the boundary facet this points belongs to (or null if it
-     * does not belong to any boundary facet)
-     */
-    private SubHyperplane<Euclidean3D> boundaryFacet(final Vector3D point,
-                                                     final BSPTree<Euclidean3D> node) {
-        final Vector2D point2D = ((Plane) node.getCut().getHyperplane()).toSubSpace((Point<Euclidean3D>) point);
-        @SuppressWarnings("unchecked")
-        final BoundaryAttribute<Euclidean3D> attribute =
-            (BoundaryAttribute<Euclidean3D>) node.getAttribute();
-        if ((attribute.getPlusOutside() != null) &&
-            (((SubPlane) attribute.getPlusOutside()).getRemainingRegion().checkPoint(point2D) == Location.INSIDE)) {
-            return attribute.getPlusOutside();
-        }
-        if ((attribute.getPlusInside() != null) &&
-            (((SubPlane) attribute.getPlusInside()).getRemainingRegion().checkPoint(point2D) == Location.INSIDE)) {
-            return attribute.getPlusInside();
-        }
-        return null;
-    }
-
-    /** Rotate the region around the specified point.
-     * <p>The instance is not modified, a new instance is created.</p>
-     * @param center rotation center
-     * @param rotation vectorial rotation operator
-     * @return a new instance representing the rotated region
-     */
-    public PolyhedronsSet rotate(final Vector3D center, final Rotation rotation) {
-        return (PolyhedronsSet) applyTransform(new RotationTransform(center, rotation));
-    }
-
-    /** 3D rotation as a Transform. */
-    private static class RotationTransform implements Transform<Euclidean3D, Euclidean2D> {
-
-        /** Center point of the rotation. */
-        private Vector3D   center;
-
-        /** Vectorial rotation. */
-        private Rotation   rotation;
-
-        /** Cached original hyperplane. */
-        private Plane cachedOriginal;
-
-        /** Cached 2D transform valid inside the cached original hyperplane. */
-        private Transform<Euclidean2D, Euclidean1D>  cachedTransform;
-
-        /** Build a rotation transform.
-         * @param center center point of the rotation
-         * @param rotation vectorial rotation
-         */
-        public RotationTransform(final Vector3D center, final Rotation rotation) {
-            this.center   = center;
-            this.rotation = rotation;
-        }
-
-        /** {@inheritDoc} */
-        public Vector3D apply(final Point<Euclidean3D> point) {
-            final Vector3D delta = ((Vector3D) point).subtract(center);
-            return new Vector3D(1.0, center, 1.0, rotation.applyTo(delta));
-        }
-
-        /** {@inheritDoc} */
-        public Plane apply(final Hyperplane<Euclidean3D> hyperplane) {
-            return ((Plane) hyperplane).rotate(center, rotation);
-        }
-
-        /** {@inheritDoc} */
-        public SubHyperplane<Euclidean2D> apply(final SubHyperplane<Euclidean2D> sub,
-                                                final Hyperplane<Euclidean3D> original,
-                                                final Hyperplane<Euclidean3D> transformed) {
-            if (original != cachedOriginal) {
-                // we have changed hyperplane, reset the in-hyperplane transform
-
-                final Plane    oPlane = (Plane) original;
-                final Plane    tPlane = (Plane) transformed;
-                final Vector3D p00    = oPlane.getOrigin();
-                final Vector3D p10    = oPlane.toSpace((Point<Euclidean2D>) new Vector2D(1.0, 0.0));
-                final Vector3D p01    = oPlane.toSpace((Point<Euclidean2D>) new Vector2D(0.0, 1.0));
-                final Vector2D tP00   = tPlane.toSubSpace((Point<Euclidean3D>) apply(p00));
-                final Vector2D tP10   = tPlane.toSubSpace((Point<Euclidean3D>) apply(p10));
-                final Vector2D tP01   = tPlane.toSubSpace((Point<Euclidean3D>) apply(p01));
-                final AffineTransform at =
-                    new AffineTransform(tP10.getX() - tP00.getX(), tP10.getY() - tP00.getY(),
-                                        tP01.getX() - tP00.getX(), tP01.getY() - tP00.getY(),
-                                        tP00.getX(), tP00.getY());
-
-                cachedOriginal  = (Plane) original;
-                cachedTransform = org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
-
-            }
-            return ((SubLine) sub).applyTransform(cachedTransform);
-        }
-
-    }
-
-    /** Translate the region by the specified amount.
-     * <p>The instance is not modified, a new instance is created.</p>
-     * @param translation translation to apply
-     * @return a new instance representing the translated region
-     */
-    public PolyhedronsSet translate(final Vector3D translation) {
-        return (PolyhedronsSet) applyTransform(new TranslationTransform(translation));
-    }
-
-    /** 3D translation as a transform. */
-    private static class TranslationTransform implements Transform<Euclidean3D, Euclidean2D> {
-
-        /** Translation vector. */
-        private Vector3D   translation;
-
-        /** Cached original hyperplane. */
-        private Plane cachedOriginal;
-
-        /** Cached 2D transform valid inside the cached original hyperplane. */
-        private Transform<Euclidean2D, Euclidean1D>  cachedTransform;
-
-        /** Build a translation transform.
-         * @param translation translation vector
-         */
-        public TranslationTransform(final Vector3D translation) {
-            this.translation = translation;
-        }
-
-        /** {@inheritDoc} */
-        public Vector3D apply(final Point<Euclidean3D> point) {
-            return new Vector3D(1.0, (Vector3D) point, 1.0, translation);
-        }
-
-        /** {@inheritDoc} */
-        public Plane apply(final Hyperplane<Euclidean3D> hyperplane) {
-            return ((Plane) hyperplane).translate(translation);
-        }
-
-        /** {@inheritDoc} */
-        public SubHyperplane<Euclidean2D> apply(final SubHyperplane<Euclidean2D> sub,
-                                                final Hyperplane<Euclidean3D> original,
-                                                final Hyperplane<Euclidean3D> transformed) {
-            if (original != cachedOriginal) {
-                // we have changed hyperplane, reset the in-hyperplane transform
-
-                final Plane   oPlane = (Plane) original;
-                final Plane   tPlane = (Plane) transformed;
-                final Vector2D shift  = tPlane.toSubSpace((Point<Euclidean3D>) apply(oPlane.getOrigin()));
-                final AffineTransform at =
-                    AffineTransform.getTranslateInstance(shift.getX(), shift.getY());
-
-                cachedOriginal  = (Plane) original;
-                cachedTransform =
-                        org.apache.commons.math3.geometry.euclidean.twod.Line.getTransform(at);
-
-            }
-
-            return ((SubLine) sub).applyTransform(cachedTransform);
-
-        }
-
-    }
-
-}


[65/82] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java
index b71c718..6685e64 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/AgrestiCoullInterval.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the Agresti-Coull method for creating a binomial proportion confidence interval.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/BinomialConfidenceInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/BinomialConfidenceInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/BinomialConfidenceInterval.java
index 532679a..8639929 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/BinomialConfidenceInterval.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/BinomialConfidenceInterval.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Interface to generate confidence intervals for a binomial proportion.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
index 34a0d57..ea713d8 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.distribution.FDistribution;
+import org.apache.commons.math4.distribution.FDistribution;
 
 /**
  * Implements the Clopper-Pearson method for creating a binomial proportion confidence interval.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/ConfidenceInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/ConfidenceInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/ConfidenceInterval.java
index 0147c8c..4cadd1f 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/ConfidenceInterval.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/ConfidenceInterval.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Represents an interval estimate of a population parameter.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/IntervalUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/IntervalUtils.java b/src/main/java/org/apache/commons/math4/stat/interval/IntervalUtils.java
index 0613c99..86a7949 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/IntervalUtils.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/IntervalUtils.java
@@ -14,13 +14,13 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Factory methods to generate confidence intervals for a binomial proportion.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java
index 25a213a..a81e58d 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/NormalApproximationInterval.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the normal approximation method for creating a binomial proportion confidence interval.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java
index 9932835..0c91f62 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/WilsonScoreInterval.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;
 
-import org.apache.commons.math3.distribution.NormalDistribution;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.distribution.NormalDistribution;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the Wilson score method for creating a binomial proportion confidence interval.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/interval/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/package-info.java b/src/main/java/org/apache/commons/math4/stat/interval/package-info.java
index 34f43d9..0e1fa28 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/package-info.java
@@ -19,4 +19,4 @@
  *      Classes providing binomial proportion confidence interval construction.
  *
  */
-package org.apache.commons.math3.stat.interval;
+package org.apache.commons.math4.stat.interval;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/package-info.java b/src/main/java/org/apache/commons/math4/stat/package-info.java
index 0df9424..4919e19 100644
--- a/src/main/java/org/apache/commons/math4/stat/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Data storage, manipulation and summary routines.
  */
-package org.apache.commons.math3.stat;
+package org.apache.commons.math4.stat;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/ranking/NaNStrategy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/ranking/NaNStrategy.java b/src/main/java/org/apache/commons/math4/stat/ranking/NaNStrategy.java
index 1a916ef..7752103 100644
--- a/src/main/java/org/apache/commons/math4/stat/ranking/NaNStrategy.java
+++ b/src/main/java/org/apache/commons/math4/stat/ranking/NaNStrategy.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.ranking;
+package org.apache.commons.math4.stat.ranking;
 
 /**
  * Strategies for handling NaN values in rank transformations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java b/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java
index feaa510..6e29cb6 100644
--- a/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java
+++ b/src/main/java/org/apache/commons/math4/stat/ranking/NaturalRanking.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.ranking;
+package org.apache.commons.math4.stat.ranking;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
 
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NotANumberException;
-import org.apache.commons.math3.random.RandomDataGenerator;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.random.RandomDataGenerator;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.util.FastMath;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/ranking/RankingAlgorithm.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/ranking/RankingAlgorithm.java b/src/main/java/org/apache/commons/math4/stat/ranking/RankingAlgorithm.java
index 188bc99..69837f7 100644
--- a/src/main/java/org/apache/commons/math4/stat/ranking/RankingAlgorithm.java
+++ b/src/main/java/org/apache/commons/math4/stat/ranking/RankingAlgorithm.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.ranking;
+package org.apache.commons.math4.stat.ranking;
 
 /**
  * Interface representing a rank transformation.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/ranking/TiesStrategy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/ranking/TiesStrategy.java b/src/main/java/org/apache/commons/math4/stat/ranking/TiesStrategy.java
index 08ab99a..2ae3352 100644
--- a/src/main/java/org/apache/commons/math4/stat/ranking/TiesStrategy.java
+++ b/src/main/java/org/apache/commons/math4/stat/ranking/TiesStrategy.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.ranking;
+package org.apache.commons.math4.stat.ranking;
 
 /**
  * Strategies for handling tied values in rank transformations.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/ranking/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/ranking/package-info.java b/src/main/java/org/apache/commons/math4/stat/ranking/package-info.java
index b86575b..e37d851 100644
--- a/src/main/java/org/apache/commons/math4/stat/ranking/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/ranking/package-info.java
@@ -19,4 +19,4 @@
  *      Classes providing rank transformations.
  *
  */
-package org.apache.commons.math3.stat.ranking;
+package org.apache.commons.math4.stat.ranking;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java
index 9b7c40a..0b9751a 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/AbstractMultipleLinearRegression.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.linear.NonSquareMatrixException;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.linear.ArrayRealVector;
-import org.apache.commons.math3.stat.descriptive.moment.Variance;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.InsufficientDataException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.ArrayRealVector;
+import org.apache.commons.math4.linear.NonSquareMatrixException;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.stat.descriptive.moment.Variance;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Abstract base class for implementations of MultipleLinearRegression.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.java
index 1644e6d..f5981d4 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/GLSMultipleLinearRegression.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
-import org.apache.commons.math3.linear.LUDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.RealVector;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
 
 /**
  * The GLS implementation of multiple linear regression.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
index 3fe3c03..c7a1003 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/MillerUpdatingRegression.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
 import java.util.Arrays;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-import org.apache.commons.math3.util.MathArrays;
+
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * This class is a concrete implementation of the {@link UpdatingMultipleLinearRegression} interface.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/ModelSpecificationException.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/ModelSpecificationException.java b/src/main/java/org/apache/commons/math4/stat/regression/ModelSpecificationException.java
index f3804db..248234d 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/ModelSpecificationException.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/ModelSpecificationException.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.Localizable;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.Localizable;
 
 /**
  * Exception thrown when a regression model is not correctly specified.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/MultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/MultipleLinearRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/MultipleLinearRegression.java
index 866214f..7a0c09e 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/MultipleLinearRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/MultipleLinearRegression.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
 /**
  * The multiple linear regression can be represented in matrix-notation.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.java
index 7fff940..38b38c1 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/OLSMultipleLinearRegression.java
@@ -14,16 +14,16 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.LUDecomposition;
-import org.apache.commons.math3.linear.QRDecomposition;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.linear.RealVector;
-import org.apache.commons.math3.stat.StatUtils;
-import org.apache.commons.math3.stat.descriptive.moment.SecondMoment;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.linear.Array2DRowRealMatrix;
+import org.apache.commons.math4.linear.LUDecomposition;
+import org.apache.commons.math4.linear.QRDecomposition;
+import org.apache.commons.math4.linear.RealMatrix;
+import org.apache.commons.math4.linear.RealVector;
+import org.apache.commons.math4.stat.StatUtils;
+import org.apache.commons.math4.stat.descriptive.moment.SecondMoment;
 
 /**
  * <p>Implements ordinary least squares (OLS) to estimate the parameters of a
@@ -173,7 +173,7 @@ public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegressio
      *
      * @return residual sum of squares
      * @since 2.2
-     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular
+     * @throws org.apache.commons.math4.linear.SingularMatrixException if the design matrix is singular
      * @throws NullPointerException if the data for the model have not been loaded
      */
     public double calculateResidualSumOfSquares() {
@@ -193,7 +193,7 @@ public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegressio
      *
      * @return R-square statistic
      * @throws NullPointerException if the sample has not been set
-     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular
+     * @throws org.apache.commons.math4.linear.SingularMatrixException if the design matrix is singular
      * @since 2.2
      */
     public double calculateRSquared() {
@@ -216,7 +216,7 @@ public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegressio
      *
      * @return adjusted R-Squared statistic
      * @throws NullPointerException if the sample has not been set
-     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular
+     * @throws org.apache.commons.math4.linear.SingularMatrixException if the design matrix is singular
      * @see #isNoIntercept()
      * @since 2.2
      */
@@ -249,7 +249,7 @@ public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegressio
      * a {@code NullPointerException} will be thrown.</p>
      *
      * @return beta
-     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular
+     * @throws org.apache.commons.math4.linear.SingularMatrixException if the design matrix is singular
      * @throws NullPointerException if the data for the model have not been loaded
      */
     @Override
@@ -271,7 +271,7 @@ public class OLSMultipleLinearRegression extends AbstractMultipleLinearRegressio
      * a {@code NullPointerException} will be thrown.</p>
      *
      * @return The beta variance-covariance matrix
-     * @throws org.apache.commons.math3.linear.SingularMatrixException if the design matrix is singular
+     * @throws org.apache.commons.math4.linear.SingularMatrixException if the design matrix is singular
      * @throws NullPointerException if the data for the model have not been loaded
      */
     @Override

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/RegressionResults.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/RegressionResults.java b/src/main/java/org/apache/commons/math4/stat/regression/RegressionResults.java
index 70faeac..bc8f3c1 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/RegressionResults.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/RegressionResults.java
@@ -14,13 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
 import java.io.Serializable;
 import java.util.Arrays;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.exception.OutOfRangeException;
+
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Results of a Multiple Linear Regression model fit.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
index 02bf8f4..38f2e63 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/SimpleRegression.java
@@ -15,16 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 import java.io.Serializable;
 
-import org.apache.commons.math3.distribution.TDistribution;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
+import org.apache.commons.math4.distribution.TDistribution;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.OutOfRangeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.Precision;
 
 /**
  * Estimates an ordinary least squares regression model
@@ -716,7 +716,7 @@ public class SimpleRegression implements Serializable, UpdatingMultipleLinearReg
      * <code>Double.NaN</code>.</p>
      *
      * @return significance level for slope/correlation
-     * @throws org.apache.commons.math3.exception.MaxCountExceededException
+     * @throws org.apache.commons.math4.exception.MaxCountExceededException
      * if the significance level can not be computed.
      */
     public double getSignificance() {

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/UpdatingMultipleLinearRegression.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/UpdatingMultipleLinearRegression.java b/src/main/java/org/apache/commons/math4/stat/regression/UpdatingMultipleLinearRegression.java
index ebefc31..60a0534 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/UpdatingMultipleLinearRegression.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/UpdatingMultipleLinearRegression.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NoDataException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NoDataException;
 
 /**
  * An interface for regression models allowing for dynamic updating of the data.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/stat/regression/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/regression/package-info.java b/src/main/java/org/apache/commons/math4/stat/regression/package-info.java
index fbc0e12..ad05581 100644
--- a/src/main/java/org/apache/commons/math4/stat/regression/package-info.java
+++ b/src/main/java/org/apache/commons/math4/stat/regression/package-info.java
@@ -19,4 +19,4 @@
  *      Statistical routines involving multivariate data.
  *
  */
-package org.apache.commons.math3.stat.regression;
+package org.apache.commons.math4.stat.regression;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/DctNormalization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/DctNormalization.java b/src/main/java/org/apache/commons/math4/transform/DctNormalization.java
index b355013..b1221af 100644
--- a/src/main/java/org/apache/commons/math4/transform/DctNormalization.java
+++ b/src/main/java/org/apache/commons/math4/transform/DctNormalization.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 /**
  * This enumeration defines the various types of normalizations that can be

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/DftNormalization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/DftNormalization.java b/src/main/java/org/apache/commons/math4/transform/DftNormalization.java
index 8bc1888..928d1b2 100644
--- a/src/main/java/org/apache/commons/math4/transform/DftNormalization.java
+++ b/src/main/java/org/apache/commons/math4/transform/DftNormalization.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 /**
  * This enumeration defines the various types of normalizations that can be

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/DstNormalization.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/DstNormalization.java b/src/main/java/org/apache/commons/math4/transform/DstNormalization.java
index a65eca3..3957bb7 100644
--- a/src/main/java/org/apache/commons/math4/transform/DstNormalization.java
+++ b/src/main/java/org/apache/commons/math4/transform/DstNormalization.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 /**
  * This enumeration defines the various types of normalizations that can be

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/FastCosineTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/FastCosineTransformer.java b/src/main/java/org/apache/commons/math4/transform/FastCosineTransformer.java
index c83a215..0884701 100644
--- a/src/main/java/org/apache/commons/math4/transform/FastCosineTransformer.java
+++ b/src/main/java/org/apache/commons/math4/transform/FastCosineTransformer.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the Fast Cosine Transform for transformation of one-dimensional
@@ -109,9 +109,9 @@ public class FastCosineTransformer implements RealTransformer, Serializable {
     /**
      * {@inheritDoc}
      *
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
+     * @throws org.apache.commons.math4.exception.NonMonotonicSequenceException
      * if the lower bound is greater than, or equal to the upper bound
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      * if the number of sample points is negative
      * @throws MathIllegalArgumentException if the number of sample points is
      * not a power of two plus one

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/FastFourierTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/FastFourierTransformer.java b/src/main/java/org/apache/commons/math4/transform/FastFourierTransformer.java
index ca62c19..b829367 100644
--- a/src/main/java/org/apache/commons/math4/transform/FastFourierTransformer.java
+++ b/src/main/java/org/apache/commons/math4/transform/FastFourierTransformer.java
@@ -14,21 +14,21 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.io.Serializable;
 import java.lang.reflect.Array;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathArrays;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.FastMath;
+import org.apache.commons.math4.util.MathArrays;
 
 /**
  * Implements the Fast Fourier Transform for transformation of one-dimensional
@@ -386,9 +386,9 @@ public class FastFourierTransformer implements Serializable {
      * @param n the number of sample points
      * @param type the type of transform (forward, inverse) to be performed
      * @return the complex transformed array
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException
      *   if the lower bound is greater than, or equal to the upper bound
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      *   if the number of sample points {@code n} is negative
      * @throws MathIllegalArgumentException if the number of sample points
      *   {@code n} is not a power of two

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/FastHadamardTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/FastHadamardTransformer.java b/src/main/java/org/apache/commons/math4/transform/FastHadamardTransformer.java
index f0777c7..d6b3ad9 100644
--- a/src/main/java/org/apache/commons/math4/transform/FastHadamardTransformer.java
+++ b/src/main/java/org/apache/commons/math4/transform/FastHadamardTransformer.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.ArithmeticUtils;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.ArithmeticUtils;
 
 /**
  * Implements the <a href="http://www.archive.chipcenter.com/dsp/DSP000517F1.html">Fast Hadamard Transform</a> (FHT).
@@ -57,9 +57,9 @@ public class FastHadamardTransformer implements RealTransformer, Serializable {
     /**
      * {@inheritDoc}
      *
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
+     * @throws org.apache.commons.math4.exception.NonMonotonicSequenceException
      *   if the lower bound is greater than, or equal to the upper bound
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      *   if the number of sample points is negative
      * @throws MathIllegalArgumentException if the number of sample points is not a power of two
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/FastSineTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/FastSineTransformer.java b/src/main/java/org/apache/commons/math4/transform/FastSineTransformer.java
index 28e8b47..34a94ef 100644
--- a/src/main/java/org/apache/commons/math4/transform/FastSineTransformer.java
+++ b/src/main/java/org/apache/commons/math4/transform/FastSineTransformer.java
@@ -14,17 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.analysis.FunctionUtils;
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.util.ArithmeticUtils;
-import org.apache.commons.math3.util.FastMath;
+import org.apache.commons.math4.analysis.FunctionUtils;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.util.ArithmeticUtils;
+import org.apache.commons.math4.util.FastMath;
 
 /**
  * Implements the Fast Sine Transform for transformation of one-dimensional real
@@ -109,9 +109,9 @@ public class FastSineTransformer implements RealTransformer, Serializable {
      *
      * This implementation enforces {@code f(x) = 0.0} at {@code x = 0.0}.
      *
-     * @throws org.apache.commons.math3.exception.NonMonotonicSequenceException
+     * @throws org.apache.commons.math4.exception.NonMonotonicSequenceException
      *   if the lower bound is greater than, or equal to the upper bound
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
+     * @throws org.apache.commons.math4.exception.NotStrictlyPositiveException
      *   if the number of sample points is negative
      * @throws MathIllegalArgumentException if the number of sample points is not a power of two
      */

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/RealTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/RealTransformer.java b/src/main/java/org/apache/commons/math4/transform/RealTransformer.java
index 672a1cb..a53dfad 100644
--- a/src/main/java/org/apache/commons/math4/transform/RealTransformer.java
+++ b/src/main/java/org/apache/commons/math4/transform/RealTransformer.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.analysis.UnivariateFunction;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
 
 /**
  * Interface for one-dimensional data sets transformations producing real results.
@@ -28,7 +28,7 @@ import org.apache.commons.math3.exception.NotStrictlyPositiveException;
  * {@link FastCosineTransformer cosine transform} or {@link
  * FastHadamardTransformer Hadamard transform}. {@link FastFourierTransformer
  * Fourier transform} is of a different kind and does not implement this
- * interface since it produces {@link org.apache.commons.math3.complex.Complex}
+ * interface since it produces {@link org.apache.commons.math4.complex.Complex}
  * results instead of real ones.
  *
  * @since 2.0

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/TransformType.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/TransformType.java b/src/main/java/org/apache/commons/math4/transform/TransformType.java
index ae1a6c5..b4d84cf 100644
--- a/src/main/java/org/apache/commons/math4/transform/TransformType.java
+++ b/src/main/java/org/apache/commons/math4/transform/TransformType.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 /**
  * This enumeration defines the type of transform which is to be computed.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/TransformUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/TransformUtils.java b/src/main/java/org/apache/commons/math4/transform/TransformUtils.java
index 17cbb00..27915b2 100644
--- a/src/main/java/org/apache/commons/math4/transform/TransformUtils.java
+++ b/src/main/java/org/apache/commons/math4/transform/TransformUtils.java
@@ -14,14 +14,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.complex.Complex;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.complex.Complex;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Useful functions for the implementation of various transforms.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/transform/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/transform/package-info.java b/src/main/java/org/apache/commons/math4/transform/package-info.java
index 6d6cfc6..bc64c9c 100644
--- a/src/main/java/org/apache/commons/math4/transform/package-info.java
+++ b/src/main/java/org/apache/commons/math4/transform/package-info.java
@@ -19,4 +19,4 @@
  *     Implementations of transform methods, including Fast Fourier transforms.
  *
  */
-package org.apache.commons.math3.transform;
+package org.apache.commons.math4.transform;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java b/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
index ed51142..027fa29 100644
--- a/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
+++ b/src/main/java/org/apache/commons/math4/util/ArithmeticUtils.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.math.BigInteger;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Some useful, arithmetics related, additions to the built-in functions in

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/BigReal.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/BigReal.java b/src/main/java/org/apache/commons/math4/util/BigReal.java
index 678eabd..cd3a7d4 100644
--- a/src/main/java/org/apache/commons/math4/util/BigReal.java
+++ b/src/main/java/org/apache/commons/math4/util/BigReal.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 
 import java.io.Serializable;
@@ -23,10 +23,10 @@ import java.math.BigInteger;
 import java.math.MathContext;
 import java.math.RoundingMode;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Arbitrary precision decimal number.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/BigRealField.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/BigRealField.java b/src/main/java/org/apache/commons/math4/util/BigRealField.java
index c748087..ce8ff5b 100644
--- a/src/main/java/org/apache/commons/math4/util/BigRealField.java
+++ b/src/main/java/org/apache/commons/math4/util/BigRealField.java
@@ -15,12 +15,12 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Representation of real numbers with arbitrary precision field.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/CentralPivotingStrategy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/CentralPivotingStrategy.java b/src/main/java/org/apache/commons/math4/util/CentralPivotingStrategy.java
index eacbf21..8d19b6d 100644
--- a/src/main/java/org/apache/commons/math4/util/CentralPivotingStrategy.java
+++ b/src/main/java/org/apache/commons/math4/util/CentralPivotingStrategy.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/Combinations.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/Combinations.java b/src/main/java/org/apache/commons/math4/util/Combinations.java
index f0a0fc3..8079ba5 100644
--- a/src/main/java/org/apache/commons/math4/util/Combinations.java
+++ b/src/main/java/org/apache/commons/math4/util/Combinations.java
@@ -14,16 +14,17 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.Iterator;
 import java.util.Comparator;
 import java.util.Arrays;
 import java.util.NoSuchElementException;
 import java.io.Serializable;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Utility to create <a href="http://en.wikipedia.org/wiki/Combination">
@@ -68,8 +69,8 @@ public class Combinations implements Iterable<int[]> {
      *
      * @param n Size of the set from which subsets are selected.
      * @param k Size of the subsets to be enumerated.
-     * @throws org.apache.commons.math3.exception.NotPositiveException if {@code n < 0}.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException if {@code k > n}.
+     * @throws org.apache.commons.math4.exception.NotPositiveException if {@code n < 0}.
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException if {@code k > n}.
      */
     public Combinations(int n,
                         int k) {
@@ -97,8 +98,8 @@ public class Combinations implements Iterable<int[]> {
      * @param n Size of the set from which subsets are selected.
      * @param k Size of the subsets to be enumerated.
      * @param iterationOrder Specifies the {@link #iterator() iteration order}.
-     * @throws org.apache.commons.math3.exception.NotPositiveException if {@code n < 0}.
-     * @throws org.apache.commons.math3.exception.NumberIsTooLargeException if {@code k > n}.
+     * @throws org.apache.commons.math4.exception.NotPositiveException if {@code n < 0}.
+     * @throws org.apache.commons.math4.exception.NumberIsTooLargeException if {@code k > n}.
      */
     private Combinations(int n,
                          int k,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java b/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java
index e43d549..0ca2e75 100644
--- a/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java
+++ b/src/main/java/org/apache/commons/math4/util/CombinatoricsUtils.java
@@ -14,15 +14,15 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.Iterator;
 import java.util.concurrent.atomic.AtomicReference;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Combinatorial utilities.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/CompositeFormat.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/CompositeFormat.java b/src/main/java/org/apache/commons/math4/util/CompositeFormat.java
index 043b66e..40809ba 100644
--- a/src/main/java/org/apache/commons/math4/util/CompositeFormat.java
+++ b/src/main/java/org/apache/commons/math4/util/CompositeFormat.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.text.FieldPosition;
 import java.text.NumberFormat;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java b/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
index e4bac0b..56b7267 100644
--- a/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
+++ b/src/main/java/org/apache/commons/math4/util/ContinuedFraction.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.ConvergenceException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Provides a generic means to evaluate continued fractions.  Subclasses simply

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/Decimal64.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/Decimal64.java b/src/main/java/org/apache/commons/math4/util/Decimal64.java
index e5c9607..15c174d 100644
--- a/src/main/java/org/apache/commons/math4/util/Decimal64.java
+++ b/src/main/java/org/apache/commons/math4/util/Decimal64.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.RealFieldElement;
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.RealFieldElement;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /**
  * This class wraps a {@code double} value in an object. It is similar to the

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/Decimal64Field.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/Decimal64Field.java b/src/main/java/org/apache/commons/math4/util/Decimal64Field.java
index 2b07826..67117f2 100644
--- a/src/main/java/org/apache/commons/math4/util/Decimal64Field.java
+++ b/src/main/java/org/apache/commons/math4/util/Decimal64Field.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * The field of double precision floating-point numbers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/DefaultTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/DefaultTransformer.java b/src/main/java/org/apache/commons/math4/util/DefaultTransformer.java
index 6128a88..b0d2078 100644
--- a/src/main/java/org/apache/commons/math4/util/DefaultTransformer.java
+++ b/src/main/java/org/apache/commons/math4/util/DefaultTransformer.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * A Default NumberTransformer for java.lang.Numbers and Numeric Strings. This

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/DoubleArray.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/DoubleArray.java b/src/main/java/org/apache/commons/math4/util/DoubleArray.java
index f7d9d25..371bd84 100644
--- a/src/main/java/org/apache/commons/math4/util/DoubleArray.java
+++ b/src/main/java/org/apache/commons/math4/util/DoubleArray.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/FastMath.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/FastMath.java b/src/main/java/org/apache/commons/math4/util/FastMath.java
index b1e3c0a..b88183c 100644
--- a/src/main/java/org/apache/commons/math4/util/FastMath.java
+++ b/src/main/java/org/apache/commons/math4/util/FastMath.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.PrintStream;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Faster, more accurate, portable alternative to {@link Math} and

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/FastMathCalc.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/FastMathCalc.java b/src/main/java/org/apache/commons/math4/util/FastMathCalc.java
index be2a2fb..7beba2a 100644
--- a/src/main/java/org/apache/commons/math4/util/FastMathCalc.java
+++ b/src/main/java/org/apache/commons/math4/util/FastMathCalc.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.PrintStream;
 
-import org.apache.commons.math3.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.DimensionMismatchException;
 
 /** Class used to compute the classical functions tables.
  * @since 3.0

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/FastMathLiteralArrays.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/FastMathLiteralArrays.java b/src/main/java/org/apache/commons/math4/util/FastMathLiteralArrays.java
index d7b00e3..90bbf67 100644
--- a/src/main/java/org/apache/commons/math4/util/FastMathLiteralArrays.java
+++ b/src/main/java/org/apache/commons/math4/util/FastMathLiteralArrays.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 /**
  * Utility class for loading tabulated data used by {@link FastMath}.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/Incrementor.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/Incrementor.java b/src/main/java/org/apache/commons/math4/util/Incrementor.java
index a351dc8..c63081d 100644
--- a/src/main/java/org/apache/commons/math4/util/Incrementor.java
+++ b/src/main/java/org/apache/commons/math4/util/Incrementor.java
@@ -14,10 +14,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.NullArgumentException;
 
 /**
  * Utility that increments a counter until a maximum is reached, at

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/IterationEvent.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/IterationEvent.java b/src/main/java/org/apache/commons/math4/util/IterationEvent.java
index 29194ca..5e58b17 100644
--- a/src/main/java/org/apache/commons/math4/util/IterationEvent.java
+++ b/src/main/java/org/apache/commons/math4/util/IterationEvent.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.EventObject;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/IterationListener.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/IterationListener.java b/src/main/java/org/apache/commons/math4/util/IterationListener.java
index f9d7cd8..b6c1157 100644
--- a/src/main/java/org/apache/commons/math4/util/IterationListener.java
+++ b/src/main/java/org/apache/commons/math4/util/IterationListener.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.EventListener;
 

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/IterationManager.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/IterationManager.java b/src/main/java/org/apache/commons/math4/util/IterationManager.java
index 1a80d3a..4437a8f 100644
--- a/src/main/java/org/apache/commons/math4/util/IterationManager.java
+++ b/src/main/java/org/apache/commons/math4/util/IterationManager.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.Collection;
 import java.util.concurrent.CopyOnWriteArrayList;
 
-import org.apache.commons.math3.exception.MaxCountExceededException;
+import org.apache.commons.math4.exception.MaxCountExceededException;
 
 /**
  * This abstract class provides a general framework for managing iterative
@@ -52,7 +52,7 @@ public class IterationManager {
      * @param maxIterations the maximum number of iterations
      * @param callBack the function to be called when the maximum number of
      * iterations has been reached
-     * @throws org.apache.commons.math3.exception.NullArgumentException if {@code callBack} is {@code null}
+     * @throws org.apache.commons.math4.exception.NullArgumentException if {@code callBack} is {@code null}
      * @since 3.1
      */
     public IterationManager(final int maxIterations,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/KthSelector.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/KthSelector.java b/src/main/java/org/apache/commons/math4/util/KthSelector.java
index 391c548..9a71a2f 100644
--- a/src/main/java/org/apache/commons/math4/util/KthSelector.java
+++ b/src/main/java/org/apache/commons/math4/util/KthSelector.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NullArgumentException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/MathArrays.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/MathArrays.java b/src/main/java/org/apache/commons/math4/util/MathArrays.java
index a9e11b9..d7f7928 100644
--- a/src/main/java/org/apache/commons/math4/util/MathArrays.java
+++ b/src/main/java/org/apache/commons/math4/util/MathArrays.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.lang.reflect.Array;
 import java.util.ArrayList;
@@ -24,22 +24,22 @@ import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.distribution.UniformIntegerDistribution;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NoDataException;
-import org.apache.commons.math3.exception.NonMonotonicSequenceException;
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.NotANumberException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.distribution.UniformIntegerDistribution;
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NoDataException;
+import org.apache.commons.math4.exception.NonMonotonicSequenceException;
+import org.apache.commons.math4.exception.NotANumberException;
+import org.apache.commons.math4.exception.NotPositiveException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooLargeException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
+import org.apache.commons.math4.random.RandomGenerator;
+import org.apache.commons.math4.random.Well19937c;
 
 /**
  * Arrays utilities.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/MathUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/MathUtils.java b/src/main/java/org/apache/commons/math4/util/MathUtils.java
index 0b5fc56..8e11026 100644
--- a/src/main/java/org/apache/commons/math4/util/MathUtils.java
+++ b/src/main/java/org/apache/commons/math4/util/MathUtils.java
@@ -15,15 +15,15 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotFiniteNumberException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.Localizable;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.NotFiniteNumberException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.util.Localizable;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Miscellaneous utility functions.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/MedianOf3PivotingStrategy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/MedianOf3PivotingStrategy.java b/src/main/java/org/apache/commons/math4/util/MedianOf3PivotingStrategy.java
index b167d9e..0eaa6a2 100644
--- a/src/main/java/org/apache/commons/math4/util/MedianOf3PivotingStrategy.java
+++ b/src/main/java/org/apache/commons/math4/util/MedianOf3PivotingStrategy.java
@@ -14,11 +14,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/MultidimensionalCounter.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/MultidimensionalCounter.java b/src/main/java/org/apache/commons/math4/util/MultidimensionalCounter.java
index 57573d8..58b8445 100644
--- a/src/main/java/org/apache/commons/math4/util/MultidimensionalCounter.java
+++ b/src/main/java/org/apache/commons/math4/util/MultidimensionalCounter.java
@@ -15,12 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.util.NoSuchElementException;
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
+
+import org.apache.commons.math4.exception.DimensionMismatchException;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.OutOfRangeException;
 
 /**
  * Converter between unidimensional storage structure and multidimensional

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/NumberTransformer.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/NumberTransformer.java b/src/main/java/org/apache/commons/math4/util/NumberTransformer.java
index 79a6414..8c411ab 100644
--- a/src/main/java/org/apache/commons/math4/util/NumberTransformer.java
+++ b/src/main/java/org/apache/commons/math4/util/NumberTransformer.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * Subclasses implementing this interface can transform Objects to doubles.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/OpenIntToDoubleHashMap.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/OpenIntToDoubleHashMap.java b/src/main/java/org/apache/commons/math4/util/OpenIntToDoubleHashMap.java
index 9fb3e0a..b03ca95 100644
--- a/src/main/java/org/apache/commons/math4/util/OpenIntToDoubleHashMap.java
+++ b/src/main/java/org/apache/commons/math4/util/OpenIntToDoubleHashMap.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/OpenIntToFieldHashMap.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/OpenIntToFieldHashMap.java b/src/main/java/org/apache/commons/math4/util/OpenIntToFieldHashMap.java
index df628a5..1fb034a 100644
--- a/src/main/java/org/apache/commons/math4/util/OpenIntToFieldHashMap.java
+++ b/src/main/java/org/apache/commons/math4/util/OpenIntToFieldHashMap.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.IOException;
 import java.io.ObjectInputStream;
@@ -23,8 +23,8 @@ import java.lang.reflect.Array;
 import java.util.ConcurrentModificationException;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math3.Field;
-import org.apache.commons.math3.FieldElement;
+import org.apache.commons.math4.Field;
+import org.apache.commons.math4.FieldElement;
 
 /**
  * Open addressed map from int to FieldElement.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/Pair.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/Pair.java b/src/main/java/org/apache/commons/math4/util/Pair.java
index ecdca37..6bdecdf 100644
--- a/src/main/java/org/apache/commons/math4/util/Pair.java
+++ b/src/main/java/org/apache/commons/math4/util/Pair.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 /**
  * Generic pair.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/PivotingStrategyInterface.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/PivotingStrategyInterface.java b/src/main/java/org/apache/commons/math4/util/PivotingStrategyInterface.java
index 1914d31..36a3bcb 100644
--- a/src/main/java/org/apache/commons/math4/util/PivotingStrategyInterface.java
+++ b/src/main/java/org/apache/commons/math4/util/PivotingStrategyInterface.java
@@ -14,9 +14,9 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/Precision.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/Precision.java b/src/main/java/org/apache/commons/math4/util/Precision.java
index 49fd15c..e2d0cc9 100644
--- a/src/main/java/org/apache/commons/math4/util/Precision.java
+++ b/src/main/java/org/apache/commons/math4/util/Precision.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.math.BigDecimal;
 
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathArithmeticException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * Utilities for comparing numbers.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java b/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
index b9819bf..fa0374f 100644
--- a/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
+++ b/src/main/java/org/apache/commons/math4/util/RandomPivotingStrategy.java
@@ -14,12 +14,12 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.random.RandomGenerator;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.random.RandomGenerator;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/ResizableDoubleArray.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/ResizableDoubleArray.java b/src/main/java/org/apache/commons/math4/util/ResizableDoubleArray.java
index 468ed74..3fd29f3 100644
--- a/src/main/java/org/apache/commons/math4/util/ResizableDoubleArray.java
+++ b/src/main/java/org/apache/commons/math4/util/ResizableDoubleArray.java
@@ -14,18 +14,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 import java.util.Arrays;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.MathIllegalStateException;
-import org.apache.commons.math3.exception.MathInternalError;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalStateException;
+import org.apache.commons.math4.exception.MathInternalError;
+import org.apache.commons.math4.exception.NotStrictlyPositiveException;
+import org.apache.commons.math4.exception.NullArgumentException;
+import org.apache.commons.math4.exception.NumberIsTooSmallException;
+import org.apache.commons.math4.exception.util.LocalizedFormats;
 
 /**
  * <p>

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/TransformerMap.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/TransformerMap.java b/src/main/java/org/apache/commons/math4/util/TransformerMap.java
index de09669..c5b9ce0 100644
--- a/src/main/java/org/apache/commons/math4/util/TransformerMap.java
+++ b/src/main/java/org/apache/commons/math4/util/TransformerMap.java
@@ -14,7 +14,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;
 
 import java.io.Serializable;
 import java.util.Collection;
@@ -22,7 +22,7 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
 
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
+import org.apache.commons.math4.exception.MathIllegalArgumentException;
 
 /**
  * This TansformerMap automates the transformation of mixed object types.
@@ -135,7 +135,7 @@ public class TransformerMap implements NumberTransformer, Serializable {
      * @return the double value of the Object.
      * @throws MathIllegalArgumentException if the Object can not be
      * transformed into a Double.
-     * @see org.apache.commons.math3.util.NumberTransformer#transform(java.lang.Object)
+     * @see org.apache.commons.math4.util.NumberTransformer#transform(java.lang.Object)
      */
     public double transform(Object o) throws MathIllegalArgumentException {
         double value = Double.NaN;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/e4e1ac23/src/main/java/org/apache/commons/math4/util/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/util/package-info.java b/src/main/java/org/apache/commons/math4/util/package-info.java
index 5d75341..80f385b 100644
--- a/src/main/java/org/apache/commons/math4/util/package-info.java
+++ b/src/main/java/org/apache/commons/math4/util/package-info.java
@@ -17,4 +17,4 @@
 /**
  * Convenience routines and common data structures used throughout the commons-math library.
  */
-package org.apache.commons.math3.util;
+package org.apache.commons.math4.util;


[34/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/AbstractRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/AbstractRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/AbstractRealDistribution.java
deleted file mode 100644
index e3b1fac..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/AbstractRealDistribution.java
+++ /dev/null
@@ -1,307 +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.distribution;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.analysis.UnivariateFunction;
-import org.apache.commons.math3.analysis.solvers.UnivariateSolverUtils;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.RandomDataImpl;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Base class for probability distributions on the reals.
- * Default implementations are provided for some of the methods
- * that do not vary from distribution to distribution.
- *
- * @since 3.0
- */
-public abstract class AbstractRealDistribution
-implements RealDistribution, Serializable {
-    /** Default accuracy. */
-    public static final double SOLVER_DEFAULT_ABSOLUTE_ACCURACY = 1e-6;
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -38038050983108802L;
-     /**
-      * RandomData instance used to generate samples from the distribution.
-      * @deprecated As of 3.1, to be removed in 4.0. Please use the
-      * {@link #random} instance variable instead.
-      */
-    @Deprecated
-    protected RandomDataImpl randomData = new RandomDataImpl();
-
-    /**
-     * RNG instance used to generate samples from the distribution.
-     * @since 3.1
-     */
-    protected final RandomGenerator random;
-
-    /** Solver absolute accuracy for inverse cumulative computation */
-    private double solverAbsoluteAccuracy = SOLVER_DEFAULT_ABSOLUTE_ACCURACY;
-
-    /**
-     * @deprecated As of 3.1, to be removed in 4.0. Please use
-     * {@link #AbstractRealDistribution(RandomGenerator)} instead.
-     */
-    @Deprecated
-    protected AbstractRealDistribution() {
-        // Legacy users are only allowed to access the deprecated "randomData".
-        // New users are forbidden to use this constructor.
-        random = null;
-    }
-    /**
-     * @param rng Random number generator.
-     * @since 3.1
-     */
-    protected AbstractRealDistribution(RandomGenerator rng) {
-        random = rng;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation uses the identity
-     * <p>{@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}</p>
-     *
-     * @deprecated As of 3.1 (to be removed in 4.0). Please use
-     * {@link #probability(double,double)} instead.
-     */
-    @Deprecated
-    public double cumulativeProbability(double x0, double x1) throws NumberIsTooLargeException {
-        return probability(x0, x1);
-    }
-
-    /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(x0 < X <= x1)}.
-     *
-     * @param x0 Lower bound (excluded).
-     * @param x1 Upper bound (included).
-     * @return the probability that a random variable with this distribution
-     * takes a value between {@code x0} and {@code x1}, excluding the lower
-     * and including the upper endpoint.
-     * @throws NumberIsTooLargeException if {@code x0 > x1}.
-     *
-     * The default implementation uses the identity
-     * {@code P(x0 < X <= x1) = P(X <= x1) - P(X <= x0)}
-     *
-     * @since 3.1
-     */
-    public double probability(double x0,
-                              double x1) {
-        if (x0 > x1) {
-            throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
-                                                x0, x1, true);
-        }
-        return cumulativeProbability(x1) - cumulativeProbability(x0);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation returns
-     * <ul>
-     * <li>{@link #getSupportLowerBound()} for {@code p = 0},</li>
-     * <li>{@link #getSupportUpperBound()} for {@code p = 1}.</li>
-     * </ul>
-     */
-    public double inverseCumulativeProbability(final double p) throws OutOfRangeException {
-        /*
-         * IMPLEMENTATION NOTES
-         * --------------------
-         * Where applicable, use is made of the one-sided Chebyshev inequality
-         * to bracket the root. This inequality states that
-         * P(X - mu >= k * sig) <= 1 / (1 + k^2),
-         * mu: mean, sig: standard deviation. Equivalently
-         * 1 - P(X < mu + k * sig) <= 1 / (1 + k^2),
-         * F(mu + k * sig) >= k^2 / (1 + k^2).
-         *
-         * For k = sqrt(p / (1 - p)), we find
-         * F(mu + k * sig) >= p,
-         * and (mu + k * sig) is an upper-bound for the root.
-         *
-         * Then, introducing Y = -X, mean(Y) = -mu, sd(Y) = sig, and
-         * P(Y >= -mu + k * sig) <= 1 / (1 + k^2),
-         * P(-X >= -mu + k * sig) <= 1 / (1 + k^2),
-         * P(X <= mu - k * sig) <= 1 / (1 + k^2),
-         * F(mu - k * sig) <= 1 / (1 + k^2).
-         *
-         * For k = sqrt((1 - p) / p), we find
-         * F(mu - k * sig) <= p,
-         * and (mu - k * sig) is a lower-bound for the root.
-         *
-         * In cases where the Chebyshev inequality does not apply, geometric
-         * progressions 1, 2, 4, ... and -1, -2, -4, ... are used to bracket
-         * the root.
-         */
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-
-        double lowerBound = getSupportLowerBound();
-        if (p == 0.0) {
-            return lowerBound;
-        }
-
-        double upperBound = getSupportUpperBound();
-        if (p == 1.0) {
-            return upperBound;
-        }
-
-        final double mu = getNumericalMean();
-        final double sig = FastMath.sqrt(getNumericalVariance());
-        final boolean chebyshevApplies;
-        chebyshevApplies = !(Double.isInfinite(mu) || Double.isNaN(mu) ||
-                             Double.isInfinite(sig) || Double.isNaN(sig));
-
-        if (lowerBound == Double.NEGATIVE_INFINITY) {
-            if (chebyshevApplies) {
-                lowerBound = mu - sig * FastMath.sqrt((1. - p) / p);
-            } else {
-                lowerBound = -1.0;
-                while (cumulativeProbability(lowerBound) >= p) {
-                    lowerBound *= 2.0;
-                }
-            }
-        }
-
-        if (upperBound == Double.POSITIVE_INFINITY) {
-            if (chebyshevApplies) {
-                upperBound = mu + sig * FastMath.sqrt(p / (1. - p));
-            } else {
-                upperBound = 1.0;
-                while (cumulativeProbability(upperBound) < p) {
-                    upperBound *= 2.0;
-                }
-            }
-        }
-
-        final UnivariateFunction toSolve = new UnivariateFunction() {
-
-            public double value(final double x) {
-                return cumulativeProbability(x) - p;
-            }
-        };
-
-        double x = UnivariateSolverUtils.solve(toSolve,
-                                                   lowerBound,
-                                                   upperBound,
-                                                   getSolverAbsoluteAccuracy());
-
-        if (!isSupportConnected()) {
-            /* Test for plateau. */
-            final double dx = getSolverAbsoluteAccuracy();
-            if (x - dx >= getSupportLowerBound()) {
-                double px = cumulativeProbability(x);
-                if (cumulativeProbability(x - dx) == px) {
-                    upperBound = x;
-                    while (upperBound - lowerBound > dx) {
-                        final double midPoint = 0.5 * (lowerBound + upperBound);
-                        if (cumulativeProbability(midPoint) < px) {
-                            lowerBound = midPoint;
-                        } else {
-                            upperBound = midPoint;
-                        }
-                    }
-                    return upperBound;
-                }
-            }
-        }
-        return x;
-    }
-
-    /**
-     * Returns the solver absolute accuracy for inverse cumulative computation.
-     * You can override this method in order to use a Brent solver with an
-     * absolute accuracy different from the default.
-     *
-     * @return the maximum absolute error in inverse cumulative probability estimates
-     */
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public void reseedRandomGenerator(long seed) {
-        random.setSeed(seed);
-        randomData.reSeed(seed);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation uses the
-     * <a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling">
-     * inversion method.
-     * </a>
-     */
-    public double sample() {
-        return inverseCumulativeProbability(random.nextDouble());
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The default implementation generates the sample by calling
-     * {@link #sample()} in a loop.
-     */
-    public double[] sample(int sampleSize) {
-        if (sampleSize <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
-                    sampleSize);
-        }
-        double[] out = new double[sampleSize];
-        for (int i = 0; i < sampleSize; i++) {
-            out[i] = sample();
-        }
-        return out;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return zero.
-     * @since 3.1
-     */
-    public double probability(double x) {
-        return 0d;
-    }
-
-    /**
-     * Returns the natural logarithm of the probability density function (PDF) of this distribution
-     * evaluated at the specified point {@code x}. In general, the PDF is the derivative of the
-     * {@link #cumulativeProbability(double) CDF}. If the derivative does not exist at {@code x},
-     * then an appropriate replacement should be returned, e.g. {@code Double.POSITIVE_INFINITY},
-     * {@code Double.NaN}, or the limit inferior or limit superior of the difference quotient. Note
-     * that due to the floating point precision and under/overflow issues, this method will for some
-     * distributions be more precise and faster than computing the logarithm of
-     * {@link #density(double)}. The default implementation simply computes the logarithm of
-     * {@code density(x)}.
-     *
-     * @param x the point at which the PDF is evaluated
-     * @return the logarithm of the value of the probability density function at point {@code x}
-     */
-    public double logDensity(double x) {
-        return FastMath.log(density(x));
-    }
-}
-

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java b/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
deleted file mode 100644
index 3f62f64..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
+++ /dev/null
@@ -1,269 +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.distribution;
-
-import org.apache.commons.math3.exception.NumberIsTooSmallException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implements the Beta distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Beta_distribution">Beta distribution</a>
- * @since 2.0 (changed to concrete class in 3.0)
- */
-public class BetaDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -1221965979403477668L;
-    /** First shape parameter. */
-    private final double alpha;
-    /** Second shape parameter. */
-    private final double beta;
-    /** Normalizing factor used in density computations.
-     * updated whenever alpha or beta are changed.
-     */
-    private double z;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param alpha First shape parameter (must be positive).
-     * @param beta Second shape parameter (must be positive).
-     */
-    public BetaDistribution(double alpha, double beta) {
-        this(alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param alpha First shape parameter (must be positive).
-     * @param beta Second shape parameter (must be positive).
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @since 2.1
-     */
-    public BetaDistribution(double alpha, double beta, double inverseCumAccuracy) {
-        this(new Well19937c(), alpha, beta, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a &beta; distribution.
-     *
-     * @param rng Random number generator.
-     * @param alpha First shape parameter (must be positive).
-     * @param beta Second shape parameter (must be positive).
-     * @since 3.3
-     */
-    public BetaDistribution(RandomGenerator rng, double alpha, double beta) {
-        this(rng, alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a &beta; distribution.
-     *
-     * @param rng Random number generator.
-     * @param alpha First shape parameter (must be positive).
-     * @param beta Second shape parameter (must be positive).
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @since 3.1
-     */
-    public BetaDistribution(RandomGenerator rng,
-                            double alpha,
-                            double beta,
-                            double inverseCumAccuracy) {
-        super(rng);
-
-        this.alpha = alpha;
-        this.beta = beta;
-        z = Double.NaN;
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * Access the first shape parameter, {@code alpha}.
-     *
-     * @return the first shape parameter.
-     */
-    public double getAlpha() {
-        return alpha;
-    }
-
-    /**
-     * Access the second shape parameter, {@code beta}.
-     *
-     * @return the second shape parameter.
-     */
-    public double getBeta() {
-        return beta;
-    }
-
-    /** Recompute the normalization factor. */
-    private void recomputeZ() {
-        if (Double.isNaN(z)) {
-            z = Gamma.logGamma(alpha) + Gamma.logGamma(beta) - Gamma.logGamma(alpha + beta);
-        }
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        final double logDensity = logDensity(x);
-        return logDensity == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logDensity);
-    }
-
-    /** {@inheritDoc} **/
-    @Override
-    public double logDensity(double x) {
-        recomputeZ();
-        if (x < 0 || x > 1) {
-            return Double.NEGATIVE_INFINITY;
-        } else if (x == 0) {
-            if (alpha < 1) {
-                throw new NumberIsTooSmallException(LocalizedFormats.CANNOT_COMPUTE_BETA_DENSITY_AT_0_FOR_SOME_ALPHA, alpha, 1, false);
-            }
-            return Double.NEGATIVE_INFINITY;
-        } else if (x == 1) {
-            if (beta < 1) {
-                throw new NumberIsTooSmallException(LocalizedFormats.CANNOT_COMPUTE_BETA_DENSITY_AT_1_FOR_SOME_BETA, beta, 1, false);
-            }
-            return Double.NEGATIVE_INFINITY;
-        } else {
-            double logX = FastMath.log(x);
-            double log1mX = FastMath.log1p(-x);
-            return (alpha - 1) * logX + (beta - 1) * log1mX - z;
-        }
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x)  {
-        if (x <= 0) {
-            return 0;
-        } else if (x >= 1) {
-            return 1;
-        } else {
-            return Beta.regularizedBeta(x, alpha, beta);
-        }
-    }
-
-    /**
-     * Return the absolute accuracy setting of the solver used to estimate
-     * inverse cumulative probabilities.
-     *
-     * @return the solver absolute accuracy.
-     * @since 2.1
-     */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For first shape parameter {@code alpha} and second shape parameter
-     * {@code beta}, the mean is {@code alpha / (alpha + beta)}.
-     */
-    public double getNumericalMean() {
-        final double a = getAlpha();
-        return a / (a + getBeta());
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For first shape parameter {@code alpha} and second shape parameter
-     * {@code beta}, the variance is
-     * {@code (alpha * beta) / [(alpha + beta)^2 * (alpha + beta + 1)]}.
-     */
-    public double getNumericalVariance() {
-        final double a = getAlpha();
-        final double b = getBeta();
-        final double alphabetasum = a + b;
-        return (a * b) / ((alphabetasum * alphabetasum) * (alphabetasum + 1));
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the parameters.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always 1 no matter the parameters.
-     *
-     * @return upper bound of the support (always 1)
-     */
-    public double getSupportUpperBound() {
-        return 1;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/BinomialDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/BinomialDistribution.java b/src/main/java/org/apache/commons/math3/distribution/BinomialDistribution.java
deleted file mode 100644
index f8cea26..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/BinomialDistribution.java
+++ /dev/null
@@ -1,198 +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.distribution;
-
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the binomial distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Binomial_distribution">Binomial distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/BinomialDistribution.html">Binomial Distribution (MathWorld)</a>
- */
-public class BinomialDistribution extends AbstractIntegerDistribution {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 6751309484392813623L;
-    /** The number of trials. */
-    private final int numberOfTrials;
-    /** The probability of success. */
-    private final double probabilityOfSuccess;
-
-    /**
-     * Create a binomial distribution with the given number of trials and
-     * probability of success.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param trials Number of trials.
-     * @param p Probability of success.
-     * @throws NotPositiveException if {@code trials < 0}.
-     * @throws OutOfRangeException if {@code p < 0} or {@code p > 1}.
-     */
-    public BinomialDistribution(int trials, double p) {
-        this(new Well19937c(), trials, p);
-    }
-
-    /**
-     * Creates a binomial distribution.
-     *
-     * @param rng Random number generator.
-     * @param trials Number of trials.
-     * @param p Probability of success.
-     * @throws NotPositiveException if {@code trials < 0}.
-     * @throws OutOfRangeException if {@code p < 0} or {@code p > 1}.
-     * @since 3.1
-     */
-    public BinomialDistribution(RandomGenerator rng,
-                                int trials,
-                                double p) {
-        super(rng);
-
-        if (trials < 0) {
-            throw new NotPositiveException(LocalizedFormats.NUMBER_OF_TRIALS,
-                                           trials);
-        }
-        if (p < 0 || p > 1) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-
-        probabilityOfSuccess = p;
-        numberOfTrials = trials;
-    }
-
-    /**
-     * Access the number of trials for this distribution.
-     *
-     * @return the number of trials.
-     */
-    public int getNumberOfTrials() {
-        return numberOfTrials;
-    }
-
-    /**
-     * Access the probability of success for this distribution.
-     *
-     * @return the probability of success.
-     */
-    public double getProbabilityOfSuccess() {
-        return probabilityOfSuccess;
-    }
-
-    /** {@inheritDoc} */
-    public double probability(int x) {
-        final double logProbability = logProbability(x);
-        return logProbability == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logProbability);
-    }
-
-    /** {@inheritDoc} **/
-    @Override
-    public double logProbability(int x) {
-        if (numberOfTrials == 0) {
-            return (x == 0) ? 0. : Double.NEGATIVE_INFINITY;
-        }
-        double ret;
-        if (x < 0 || x > numberOfTrials) {
-            ret = Double.NEGATIVE_INFINITY;
-        } else {
-            ret = SaddlePointExpansion.logBinomialProbability(x,
-                    numberOfTrials, probabilityOfSuccess,
-                    1.0 - probabilityOfSuccess);
-        }
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(int x) {
-        double ret;
-        if (x < 0) {
-            ret = 0.0;
-        } else if (x >= numberOfTrials) {
-            ret = 1.0;
-        } else {
-            ret = 1.0 - Beta.regularizedBeta(probabilityOfSuccess,
-                    x + 1.0, numberOfTrials - x);
-        }
-        return ret;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For {@code n} trials and probability parameter {@code p}, the mean is
-     * {@code n * p}.
-     */
-    public double getNumericalMean() {
-        return numberOfTrials * probabilityOfSuccess;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For {@code n} trials and probability parameter {@code p}, the variance is
-     * {@code n * p * (1 - p)}.
-     */
-    public double getNumericalVariance() {
-        final double p = probabilityOfSuccess;
-        return numberOfTrials * p * (1 - p);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 except for the probability
-     * parameter {@code p = 1}.
-     *
-     * @return lower bound of the support (0 or the number of trials)
-     */
-    public int getSupportLowerBound() {
-        return probabilityOfSuccess < 1.0 ? 0 : numberOfTrials;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is the number of trials except for the
-     * probability parameter {@code p = 0}.
-     *
-     * @return upper bound of the support (number of trials or 0)
-     */
-    public int getSupportUpperBound() {
-        return probabilityOfSuccess > 0.0 ? numberOfTrials : 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java b/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java
deleted file mode 100644
index af3d33a..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java
+++ /dev/null
@@ -1,256 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the Cauchy distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Cauchy_distribution">Cauchy distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/CauchyDistribution.html">Cauchy Distribution (MathWorld)</a>
- * @since 1.1 (changed to concrete class in 3.0)
- */
-public class CauchyDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 8589540077390120676L;
-    /** The median of this distribution. */
-    private final double median;
-    /** The scale of this distribution. */
-    private final double scale;
-    /** Inverse cumulative probability accuracy */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Creates a Cauchy distribution with the median equal to zero and scale
-     * equal to one.
-     */
-    public CauchyDistribution() {
-        this(0, 1);
-    }
-
-    /**
-     * Creates a Cauchy distribution using the given median and scale.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param median Median for this distribution.
-     * @param scale Scale parameter for this distribution.
-     */
-    public CauchyDistribution(double median, double scale) {
-        this(median, scale, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a Cauchy distribution using the given median and scale.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param median Median for this distribution.
-     * @param scale Scale parameter for this distribution.
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates
-     * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code scale <= 0}.
-     * @since 2.1
-     */
-    public CauchyDistribution(double median, double scale,
-                              double inverseCumAccuracy) {
-        this(new Well19937c(), median, scale, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a Cauchy distribution.
-     *
-     * @param rng Random number generator.
-     * @param median Median for this distribution.
-     * @param scale Scale parameter for this distribution.
-     * @throws NotStrictlyPositiveException if {@code scale <= 0}.
-     * @since 3.3
-     */
-    public CauchyDistribution(RandomGenerator rng, double median, double scale) {
-        this(rng, median, scale, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a Cauchy distribution.
-     *
-     * @param rng Random number generator.
-     * @param median Median for this distribution.
-     * @param scale Scale parameter for this distribution.
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates
-     * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code scale <= 0}.
-     * @since 3.1
-     */
-    public CauchyDistribution(RandomGenerator rng,
-                              double median,
-                              double scale,
-                              double inverseCumAccuracy) {
-        super(rng);
-        if (scale <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SCALE, scale);
-        }
-        this.scale = scale;
-        this.median = median;
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x) {
-        return 0.5 + (FastMath.atan((x - median) / scale) / FastMath.PI);
-    }
-
-    /**
-     * Access the median.
-     *
-     * @return the median for this distribution.
-     */
-    public double getMedian() {
-        return median;
-    }
-
-    /**
-     * Access the scale parameter.
-     *
-     * @return the scale parameter for this distribution.
-     */
-    public double getScale() {
-        return scale;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        final double dev = x - median;
-        return (1 / FastMath.PI) * (scale / (dev * dev + scale * scale));
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns {@code Double.NEGATIVE_INFINITY} when {@code p == 0}
-     * and {@code Double.POSITIVE_INFINITY} when {@code p == 1}.
-     */
-    @Override
-    public double inverseCumulativeProbability(double p) throws OutOfRangeException {
-        double ret;
-        if (p < 0 || p > 1) {
-            throw new OutOfRangeException(p, 0, 1);
-        } else if (p == 0) {
-            ret = Double.NEGATIVE_INFINITY;
-        } else  if (p == 1) {
-            ret = Double.POSITIVE_INFINITY;
-        } else {
-            ret = median + scale * FastMath.tan(FastMath.PI * (p - .5));
-        }
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The mean is always undefined no matter the parameters.
-     *
-     * @return mean (always Double.NaN)
-     */
-    public double getNumericalMean() {
-        return Double.NaN;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The variance is always undefined no matter the parameters.
-     *
-     * @return variance (always Double.NaN)
-     */
-    public double getNumericalVariance() {
-        return Double.NaN;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always negative infinity no matter
-     * the parameters.
-     *
-     * @return lower bound of the support (always Double.NEGATIVE_INFINITY)
-     */
-    public double getSupportLowerBound() {
-        return Double.NEGATIVE_INFINITY;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity no matter
-     * the parameters.
-     *
-     * @return upper bound of the support (always Double.POSITIVE_INFINITY)
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java
deleted file mode 100644
index 393d352..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java
+++ /dev/null
@@ -1,196 +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.distribution;
-
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-
-/**
- * Implementation of the chi-squared distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Chi-squared_distribution">Chi-squared distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html">Chi-squared Distribution (MathWorld)</a>
- */
-public class ChiSquaredDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier */
-    private static final long serialVersionUID = -8352658048349159782L;
-    /** Internal Gamma distribution. */
-    private final GammaDistribution gamma;
-    /** Inverse cumulative probability accuracy */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Create a Chi-Squared distribution with the given degrees of freedom.
-     *
-     * @param degreesOfFreedom Degrees of freedom.
-     */
-    public ChiSquaredDistribution(double degreesOfFreedom) {
-        this(degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create a Chi-Squared distribution with the given degrees of freedom and
-     * inverse cumulative probability accuracy.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param degreesOfFreedom Degrees of freedom.
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @since 2.1
-     */
-    public ChiSquaredDistribution(double degreesOfFreedom,
-                                  double inverseCumAccuracy) {
-        this(new Well19937c(), degreesOfFreedom, inverseCumAccuracy);
-    }
-
-    /**
-     * Create a Chi-Squared distribution with the given degrees of freedom.
-     *
-     * @param rng Random number generator.
-     * @param degreesOfFreedom Degrees of freedom.
-     * @since 3.3
-     */
-    public ChiSquaredDistribution(RandomGenerator rng, double degreesOfFreedom) {
-        this(rng, degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create a Chi-Squared distribution with the given degrees of freedom and
-     * inverse cumulative probability accuracy.
-     *
-     * @param rng Random number generator.
-     * @param degreesOfFreedom Degrees of freedom.
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @since 3.1
-     */
-    public ChiSquaredDistribution(RandomGenerator rng,
-                                  double degreesOfFreedom,
-                                  double inverseCumAccuracy) {
-        super(rng);
-
-        gamma = new GammaDistribution(degreesOfFreedom / 2, 2);
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * Access the number of degrees of freedom.
-     *
-     * @return the degrees of freedom.
-     */
-    public double getDegreesOfFreedom() {
-        return gamma.getShape() * 2.0;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        return gamma.density(x);
-    }
-
-    /** {@inheritDoc} **/
-    @Override
-    public double logDensity(double x) {
-        return gamma.logDensity(x);
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x)  {
-        return gamma.cumulativeProbability(x);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For {@code k} degrees of freedom, the mean is {@code k}.
-     */
-    public double getNumericalMean() {
-        return getDegreesOfFreedom();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return {@code 2 * k}, where {@code k} is the number of degrees of freedom.
-     */
-    public double getNumericalVariance() {
-        return 2 * getDegreesOfFreedom();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the
-     * degrees of freedom.
-     *
-     * @return zero.
-     */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity no matter the
-     * degrees of freedom.
-     *
-     * @return {@code Double.POSITIVE_INFINITY}.
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/ConstantRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/ConstantRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ConstantRealDistribution.java
deleted file mode 100644
index 0dbb6aa..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/ConstantRealDistribution.java
+++ /dev/null
@@ -1,121 +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.distribution;
-
-import org.apache.commons.math3.exception.OutOfRangeException;
-
-/**
- * Implementation of the constant real distribution.
- *
- * @since 3.4
- */
-public class ConstantRealDistribution extends AbstractRealDistribution {
-
-    /** Serialization ID */
-    private static final long serialVersionUID = -4157745166772046273L;
-
-    /** Constant value of the distribution */
-    private final double value;
-
-    /**
-     * Create a constant real distribution with the given value.
-     *
-     * @param value the constant value of this distribution
-     */
-    public ConstantRealDistribution(double value) {
-        super(null);  // Avoid creating RandomGenerator
-        this.value = value;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        return x == value ? 1 : 0;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x)  {
-        return x < value ? 0 : 1;
-    }
-
-    @Override
-    public double inverseCumulativeProbability(final double p)
-            throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-        return value;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double getNumericalMean() {
-        return value;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double getNumericalVariance() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double getSupportLowerBound() {
-        return value;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double getSupportUpperBound() {
-        return value;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double sample()  {
-        return value;
-    }
-
-    /**
-     * Override with no-op (there is no generator).
-     * @param seed (ignored)
-     */
-    @Override
-    public void reseedRandomGenerator(long seed) {}
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/EnumeratedDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/EnumeratedDistribution.java b/src/main/java/org/apache/commons/math3/distribution/EnumeratedDistribution.java
deleted file mode 100644
index 4cb23c1..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/EnumeratedDistribution.java
+++ /dev/null
@@ -1,291 +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.distribution;
-
-import java.io.Serializable;
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * <p>A generic implementation of a
- * <a href="http://en.wikipedia.org/wiki/Probability_distribution#Discrete_probability_distribution">
- * discrete probability distribution (Wikipedia)</a> over a finite sample space,
- * based on an enumerated list of &lt;value, probability&gt; pairs.  Input probabilities must all be non-negative,
- * but zero values are allowed and their sum does not have to equal one. Constructors will normalize input
- * probabilities to make them sum to one.</p>
- *
- * <p>The list of <value, probability> pairs does not, strictly speaking, have to be a function and it can
- * contain null values.  The pmf created by the constructor will combine probabilities of equal values and
- * will treat null values as equal.  For example, if the list of pairs &lt;"dog", 0.2&gt;, &lt;null, 0.1&gt;,
- * &lt;"pig", 0.2&gt;, &lt;"dog", 0.1&gt;, &lt;null, 0.4&gt; is provided to the constructor, the resulting
- * pmf will assign mass of 0.5 to null, 0.3 to "dog" and 0.2 to null.</p>
- *
- * @param <T> type of the elements in the sample space.
- * @since 3.2
- */
-public class EnumeratedDistribution<T> implements Serializable {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20123308L;
-
-    /**
-     * RNG instance used to generate samples from the distribution.
-     */
-    protected final RandomGenerator random;
-
-    /**
-     * List of random variable values.
-     */
-    private final List<T> singletons;
-
-    /**
-     * Probabilities of respective random variable values. For i = 0, ..., singletons.size() - 1,
-     * probability[i] is the probability that a random variable following this distribution takes
-     * the value singletons[i].
-     */
-    private final double[] probabilities;
-
-    /**
-     * Cumulative probabilities, cached to speed up sampling.
-     */
-    private final double[] cumulativeProbabilities;
-
-    /**
-     * Create an enumerated distribution using the given probability mass function
-     * enumeration.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param pmf probability mass function enumerated as a list of <T, probability>
-     * pairs.
-     * @throws NotPositiveException if any of the probabilities are negative.
-     * @throws NotFiniteNumberException if any of the probabilities are infinite.
-     * @throws NotANumberException if any of the probabilities are NaN.
-     * @throws MathArithmeticException all of the probabilities are 0.
-     */
-    public EnumeratedDistribution(final List<Pair<T, Double>> pmf)
-        throws NotPositiveException, MathArithmeticException, NotFiniteNumberException, NotANumberException {
-        this(new Well19937c(), pmf);
-    }
-
-    /**
-     * Create an enumerated distribution using the given random number generator
-     * and probability mass function enumeration.
-     *
-     * @param rng random number generator.
-     * @param pmf probability mass function enumerated as a list of <T, probability>
-     * pairs.
-     * @throws NotPositiveException if any of the probabilities are negative.
-     * @throws NotFiniteNumberException if any of the probabilities are infinite.
-     * @throws NotANumberException if any of the probabilities are NaN.
-     * @throws MathArithmeticException all of the probabilities are 0.
-     */
-    public EnumeratedDistribution(final RandomGenerator rng, final List<Pair<T, Double>> pmf)
-        throws NotPositiveException, MathArithmeticException, NotFiniteNumberException, NotANumberException {
-        random = rng;
-
-        singletons = new ArrayList<T>(pmf.size());
-        final double[] probs = new double[pmf.size()];
-
-        for (int i = 0; i < pmf.size(); i++) {
-            final Pair<T, Double> sample = pmf.get(i);
-            singletons.add(sample.getKey());
-            final double p = sample.getValue();
-            if (p < 0) {
-                throw new NotPositiveException(sample.getValue());
-            }
-            if (Double.isInfinite(p)) {
-                throw new NotFiniteNumberException(p);
-            }
-            if (Double.isNaN(p)) {
-                throw new NotANumberException();
-            }
-            probs[i] = p;
-        }
-
-        probabilities = MathArrays.normalizeArray(probs, 1.0);
-
-        cumulativeProbabilities = new double[probabilities.length];
-        double sum = 0;
-        for (int i = 0; i < probabilities.length; i++) {
-            sum += probabilities[i];
-            cumulativeProbabilities[i] = sum;
-        }
-    }
-
-    /**
-     * Reseed the random generator used to generate samples.
-     *
-     * @param seed the new seed
-     */
-    public void reseedRandomGenerator(long seed) {
-        random.setSeed(seed);
-    }
-
-    /**
-     * <p>For a random variable {@code X} whose values are distributed according to
-     * this distribution, this method returns {@code P(X = x)}. In other words,
-     * this method represents the probability mass function (PMF) for the
-     * distribution.</p>
-     *
-     * <p>Note that if {@code x1} and {@code x2} satisfy {@code x1.equals(x2)},
-     * or both are null, then {@code probability(x1) = probability(x2)}.</p>
-     *
-     * @param x the point at which the PMF is evaluated
-     * @return the value of the probability mass function at {@code x}
-     */
-    double probability(final T x) {
-        double probability = 0;
-
-        for (int i = 0; i < probabilities.length; i++) {
-            if ((x == null && singletons.get(i) == null) ||
-                (x != null && x.equals(singletons.get(i)))) {
-                probability += probabilities[i];
-            }
-        }
-
-        return probability;
-    }
-
-    /**
-     * <p>Return the probability mass function as a list of <value, probability> pairs.</p>
-     *
-     * <p>Note that if duplicate and / or null values were provided to the constructor
-     * when creating this EnumeratedDistribution, the returned list will contain these
-     * values.  If duplicates values exist, what is returned will not represent
-     * a pmf (i.e., it is up to the caller to consolidate duplicate mass points).</p>
-     *
-     * @return the probability mass function.
-     */
-    public List<Pair<T, Double>> getPmf() {
-        final List<Pair<T, Double>> samples = new ArrayList<Pair<T, Double>>(probabilities.length);
-
-        for (int i = 0; i < probabilities.length; i++) {
-            samples.add(new Pair<T, Double>(singletons.get(i), probabilities[i]));
-        }
-
-        return samples;
-    }
-
-    /**
-     * Generate a random value sampled from this distribution.
-     *
-     * @return a random value.
-     */
-    public T sample() {
-        final double randomValue = random.nextDouble();
-
-        int index = Arrays.binarySearch(cumulativeProbabilities, randomValue);
-        if (index < 0) {
-            index = -index-1;
-        }
-
-        if (index >= 0 && index < probabilities.length) {
-            if (randomValue < cumulativeProbabilities[index]) {
-                return singletons.get(index);
-            }
-        }
-
-        /* This should never happen, but it ensures we will return a correct
-         * object in case there is some floating point inequality problem
-         * wrt the cumulative probabilities. */
-        return singletons.get(singletons.size() - 1);
-    }
-
-    /**
-     * Generate a random sample from the distribution.
-     *
-     * @param sampleSize the number of random values to generate.
-     * @return an array representing the random sample.
-     * @throws NotStrictlyPositiveException if {@code sampleSize} is not
-     * positive.
-     */
-    public Object[] sample(int sampleSize) throws NotStrictlyPositiveException {
-        if (sampleSize <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
-                    sampleSize);
-        }
-
-        final Object[] out = new Object[sampleSize];
-
-        for (int i = 0; i < sampleSize; i++) {
-            out[i] = sample();
-        }
-
-        return out;
-
-    }
-
-    /**
-     * Generate a random sample from the distribution.
-     * <p>
-     * If the requested samples fit in the specified array, it is returned
-     * therein. Otherwise, a new array is allocated with the runtime type of
-     * the specified array and the size of this collection.
-     *
-     * @param sampleSize the number of random values to generate.
-     * @param array the array to populate.
-     * @return an array representing the random sample.
-     * @throws NotStrictlyPositiveException if {@code sampleSize} is not positive.
-     * @throws NullArgumentException if {@code array} is null
-     */
-    public T[] sample(int sampleSize, final T[] array) throws NotStrictlyPositiveException {
-        if (sampleSize <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES, sampleSize);
-        }
-
-        if (array == null) {
-            throw new NullArgumentException(LocalizedFormats.INPUT_ARRAY);
-        }
-
-        T[] out;
-        if (array.length < sampleSize) {
-            @SuppressWarnings("unchecked") // safe as both are of type T
-            final T[] unchecked = (T[]) Array.newInstance(array.getClass().getComponentType(), sampleSize);
-            out = unchecked;
-        } else {
-            out = array;
-        }
-
-        for (int i = 0; i < sampleSize; i++) {
-            out[i] = sample();
-        }
-
-        return out;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistribution.java b/src/main/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistribution.java
deleted file mode 100644
index 9a07787..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/EnumeratedIntegerDistribution.java
+++ /dev/null
@@ -1,218 +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.distribution;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * <p>Implementation of an integer-valued {@link EnumeratedDistribution}.</p>
- *
- * <p>Values with zero-probability are allowed but they do not extend the
- * support.<br/>
- * Duplicate values are allowed. Probabilities of duplicate values are combined
- * when computing cumulative probabilities and statistics.</p>
- *
- * @since 3.2
- */
-public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20130308L;
-
-    /**
-     * {@link EnumeratedDistribution} instance (using the {@link Integer} wrapper)
-     * used to generate the pmf.
-     */
-    protected final EnumeratedDistribution<Integer> innerDistribution;
-
-    /**
-     * Create a discrete distribution using the given probability mass function
-     * definition.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param singletons array of random variable values.
-     * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if any of the probabilities are negative.
-     * @throws NotFiniteNumberException if any of the probabilities are infinite.
-     * @throws NotANumberException if any of the probabilities are NaN.
-     * @throws MathArithmeticException all of the probabilities are 0.
-     */
-    public EnumeratedIntegerDistribution(final int[] singletons, final double[] probabilities)
-    throws DimensionMismatchException, NotPositiveException, MathArithmeticException,
-           NotFiniteNumberException, NotANumberException{
-        this(new Well19937c(), singletons, probabilities);
-    }
-
-    /**
-     * Create a discrete distribution using the given random number generator
-     * and probability mass function definition.
-     *
-     * @param rng random number generator.
-     * @param singletons array of random variable values.
-     * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if any of the probabilities are negative.
-     * @throws NotFiniteNumberException if any of the probabilities are infinite.
-     * @throws NotANumberException if any of the probabilities are NaN.
-     * @throws MathArithmeticException all of the probabilities are 0.
-     */
-    public EnumeratedIntegerDistribution(final RandomGenerator rng,
-                                       final int[] singletons, final double[] probabilities)
-        throws DimensionMismatchException, NotPositiveException, MathArithmeticException,
-                NotFiniteNumberException, NotANumberException {
-        super(rng);
-        if (singletons.length != probabilities.length) {
-            throw new DimensionMismatchException(probabilities.length, singletons.length);
-        }
-
-        final List<Pair<Integer, Double>> samples = new ArrayList<Pair<Integer, Double>>(singletons.length);
-
-        for (int i = 0; i < singletons.length; i++) {
-            samples.add(new Pair<Integer, Double>(singletons[i], probabilities[i]));
-        }
-
-        innerDistribution = new EnumeratedDistribution<Integer>(rng, samples);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double probability(final int x) {
-        return innerDistribution.probability(x);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double cumulativeProbability(final int x) {
-        double probability = 0;
-
-        for (final Pair<Integer, Double> sample : innerDistribution.getPmf()) {
-            if (sample.getKey() <= x) {
-                probability += sample.getValue();
-            }
-        }
-
-        return probability;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return {@code sum(singletons[i] * probabilities[i])}
-     */
-    public double getNumericalMean() {
-        double mean = 0;
-
-        for (final Pair<Integer, Double> sample : innerDistribution.getPmf()) {
-            mean += sample.getValue() * sample.getKey();
-        }
-
-        return mean;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return {@code sum((singletons[i] - mean) ^ 2 * probabilities[i])}
-     */
-    public double getNumericalVariance() {
-        double mean = 0;
-        double meanOfSquares = 0;
-
-        for (final Pair<Integer, Double> sample : innerDistribution.getPmf()) {
-            mean += sample.getValue() * sample.getKey();
-            meanOfSquares += sample.getValue() * sample.getKey() * sample.getKey();
-        }
-
-        return meanOfSquares - mean * mean;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns the lowest value with non-zero probability.
-     *
-     * @return the lowest value with non-zero probability.
-     */
-    public int getSupportLowerBound() {
-        int min = Integer.MAX_VALUE;
-        for (final Pair<Integer, Double> sample : innerDistribution.getPmf()) {
-            if (sample.getKey() < min && sample.getValue() > 0) {
-                min = sample.getKey();
-            }
-        }
-
-        return min;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns the highest value with non-zero probability.
-     *
-     * @return the highest value with non-zero probability.
-     */
-    public int getSupportUpperBound() {
-        int max = Integer.MIN_VALUE;
-        for (final Pair<Integer, Double> sample : innerDistribution.getPmf()) {
-            if (sample.getKey() > max && sample.getValue() > 0) {
-                max = sample.getKey();
-            }
-        }
-
-        return max;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public int sample() {
-        return innerDistribution.sample();
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/EnumeratedRealDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/EnumeratedRealDistribution.java b/src/main/java/org/apache/commons/math3/distribution/EnumeratedRealDistribution.java
deleted file mode 100644
index 07b96bc..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/EnumeratedRealDistribution.java
+++ /dev/null
@@ -1,282 +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.distribution;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.math3.exception.DimensionMismatchException;
-import org.apache.commons.math3.exception.MathArithmeticException;
-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.exception.OutOfRangeException;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.Pair;
-
-/**
- * <p>Implementation of a real-valued {@link EnumeratedDistribution}.
- *
- * <p>Values with zero-probability are allowed but they do not extend the
- * support.<br/>
- * Duplicate values are allowed. Probabilities of duplicate values are combined
- * when computing cumulative probabilities and statistics.</p>
- *
- * @since 3.2
- */
-public class EnumeratedRealDistribution extends AbstractRealDistribution {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20130308L;
-
-    /**
-     * {@link EnumeratedDistribution} (using the {@link Double} wrapper)
-     * used to generate the pmf.
-     */
-    protected final EnumeratedDistribution<Double> innerDistribution;
-
-    /**
-     * Create a discrete distribution using the given probability mass function
-     * enumeration.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param singletons array of random variable values.
-     * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if any of the probabilities are negative.
-     * @throws NotFiniteNumberException if any of the probabilities are infinite.
-     * @throws NotANumberException if any of the probabilities are NaN.
-     * @throws MathArithmeticException all of the probabilities are 0.
-     */
-    public EnumeratedRealDistribution(final double[] singletons, final double[] probabilities)
-    throws DimensionMismatchException, NotPositiveException, MathArithmeticException,
-           NotFiniteNumberException, NotANumberException {
-        this(new Well19937c(), singletons, probabilities);
-    }
-
-    /**
-     * Create a discrete distribution using the given random number generator
-     * and probability mass function enumeration.
-     *
-     * @param rng random number generator.
-     * @param singletons array of random variable values.
-     * @param probabilities array of probabilities.
-     * @throws DimensionMismatchException if
-     * {@code singletons.length != probabilities.length}
-     * @throws NotPositiveException if any of the probabilities are negative.
-     * @throws NotFiniteNumberException if any of the probabilities are infinite.
-     * @throws NotANumberException if any of the probabilities are NaN.
-     * @throws MathArithmeticException all of the probabilities are 0.
-     */
-    public EnumeratedRealDistribution(final RandomGenerator rng,
-                                    final double[] singletons, final double[] probabilities)
-        throws DimensionMismatchException, NotPositiveException, MathArithmeticException,
-               NotFiniteNumberException, NotANumberException {
-        super(rng);
-        if (singletons.length != probabilities.length) {
-            throw new DimensionMismatchException(probabilities.length, singletons.length);
-        }
-
-        List<Pair<Double, Double>> samples = new ArrayList<Pair<Double, Double>>(singletons.length);
-
-        for (int i = 0; i < singletons.length; i++) {
-            samples.add(new Pair<Double, Double>(singletons[i], probabilities[i]));
-        }
-
-        innerDistribution = new EnumeratedDistribution<Double>(rng, samples);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public double probability(final double x) {
-        return innerDistribution.probability(x);
-    }
-
-    /**
-     * For a random variable {@code X} whose values are distributed according to
-     * this distribution, this method returns {@code P(X = x)}. In other words,
-     * this method represents the probability mass function (PMF) for the
-     * distribution.
-     *
-     * @param x the point at which the PMF is evaluated
-     * @return the value of the probability mass function at point {@code x}
-     */
-    public double density(final double x) {
-        return probability(x);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public double cumulativeProbability(final double x) {
-        double probability = 0;
-
-        for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
-            if (sample.getKey() <= x) {
-                probability += sample.getValue();
-            }
-        }
-
-        return probability;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public double inverseCumulativeProbability(final double p) throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0, 1);
-        }
-
-        double probability = 0;
-        double x = getSupportLowerBound();
-        for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
-            if (sample.getValue() == 0.0) {
-                continue;
-            }
-
-            probability += sample.getValue();
-            x = sample.getKey();
-
-            if (probability >= p) {
-                break;
-            }
-        }
-
-        return x;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return {@code sum(singletons[i] * probabilities[i])}
-     */
-    public double getNumericalMean() {
-        double mean = 0;
-
-        for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
-            mean += sample.getValue() * sample.getKey();
-        }
-
-        return mean;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @return {@code sum((singletons[i] - mean) ^ 2 * probabilities[i])}
-     */
-    public double getNumericalVariance() {
-        double mean = 0;
-        double meanOfSquares = 0;
-
-        for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
-            mean += sample.getValue() * sample.getKey();
-            meanOfSquares += sample.getValue() * sample.getKey() * sample.getKey();
-        }
-
-        return meanOfSquares - mean * mean;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns the lowest value with non-zero probability.
-     *
-     * @return the lowest value with non-zero probability.
-     */
-    public double getSupportLowerBound() {
-        double min = Double.POSITIVE_INFINITY;
-        for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
-            if (sample.getKey() < min && sample.getValue() > 0) {
-                min = sample.getKey();
-            }
-        }
-
-        return min;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns the highest value with non-zero probability.
-     *
-     * @return the highest value with non-zero probability.
-     */
-    public double getSupportUpperBound() {
-        double max = Double.NEGATIVE_INFINITY;
-        for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
-            if (sample.getKey() > max && sample.getValue() > 0) {
-                max = sample.getKey();
-            }
-        }
-
-        return max;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution includes the lower bound.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution includes the upper bound.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportUpperBoundInclusive() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    @Override
-    public double sample() {
-        return innerDistribution.sample();
-    }
-}


[14/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
deleted file mode 100644
index b234ad5..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AbstractConvexHullGenerator2D.java
+++ /dev/null
@@ -1,116 +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.geometry.euclidean.twod.hull;
-
-import java.util.Collection;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * Abstract base class for convex hull generators in the two-dimensional euclidean space.
- *
- * @since 3.3
- */
-abstract class AbstractConvexHullGenerator2D implements ConvexHullGenerator2D {
-
-    /** Default value for tolerance. */
-    private static final double DEFAULT_TOLERANCE = 1e-10;
-
-    /** Tolerance below which points are considered identical. */
-    private final double tolerance;
-
-    /**
-     * Indicates if collinear points on the hull shall be present in the output.
-     * If {@code false}, only the extreme points are added to the hull.
-     */
-    private final boolean includeCollinearPoints;
-
-    /**
-     * Simple constructor.
-     * <p>
-     * The default tolerance (1e-10) will be used to determine identical points.
-     *
-     * @param includeCollinearPoints indicates if collinear points on the hull shall be
-     * added as hull vertices
-     */
-    protected AbstractConvexHullGenerator2D(final boolean includeCollinearPoints) {
-        this(includeCollinearPoints, DEFAULT_TOLERANCE);
-    }
-
-    /**
-     * Simple constructor.
-     *
-     * @param includeCollinearPoints indicates if collinear points on the hull shall be
-     * added as hull vertices
-     * @param tolerance tolerance below which points are considered identical
-     */
-    protected AbstractConvexHullGenerator2D(final boolean includeCollinearPoints, final double tolerance) {
-        this.includeCollinearPoints = includeCollinearPoints;
-        this.tolerance = tolerance;
-    }
-
-    /**
-     * Get the tolerance below which points are considered identical.
-     * @return the tolerance below which points are considered identical
-     */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /**
-     * Returns if collinear points on the hull will be added as hull vertices.
-     * @return {@code true} if collinear points are added as hull vertices, or {@code false}
-     * if only extreme points are present.
-     */
-    public boolean isIncludeCollinearPoints() {
-        return includeCollinearPoints;
-    }
-
-    /** {@inheritDoc} */
-    public ConvexHull2D generate(final Collection<Vector2D> points)
-            throws NullArgumentException, ConvergenceException {
-        // check for null points
-        MathUtils.checkNotNull(points);
-
-        Collection<Vector2D> hullVertices = null;
-        if (points.size() < 2) {
-            hullVertices = points;
-        } else {
-            hullVertices = findHullVertices(points);
-        }
-
-        try {
-            return new ConvexHull2D(hullVertices.toArray(new Vector2D[hullVertices.size()]),
-                                    tolerance);
-        } catch (MathIllegalArgumentException e) {
-            // the hull vertices may not form a convex hull if the tolerance value is to large
-            throw new ConvergenceException();
-        }
-    }
-
-    /**
-     * Find the convex hull vertices from the set of input points.
-     * @param points the set of input points
-     * @return the convex hull vertices in CCW winding
-     */
-    protected abstract Collection<Vector2D> findHullVertices(Collection<Vector2D> points);
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AklToussaintHeuristic.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AklToussaintHeuristic.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AklToussaintHeuristic.java
deleted file mode 100644
index f5d1b84..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/AklToussaintHeuristic.java
+++ /dev/null
@@ -1,153 +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.geometry.euclidean.twod.hull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-
-/**
- * A simple heuristic to improve the performance of convex hull algorithms.
- * <p>
- * The heuristic is based on the idea of a convex quadrilateral, which is formed by
- * four points with the lowest and highest x / y coordinates. Any point that lies inside
- * this quadrilateral can not be part of the convex hull and can thus be safely discarded
- * before generating the convex hull itself.
- * <p>
- * The complexity of the operation is O(n), and may greatly improve the time it takes to
- * construct the convex hull afterwards, depending on the point distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Convex_hull_algorithms#Akl-Toussaint_heuristic">
- * Akl-Toussaint heuristic (Wikipedia)</a>
- * @since 3.3
- */
-public final class AklToussaintHeuristic {
-
-    /** Hide utility constructor. */
-    private AklToussaintHeuristic() {
-    }
-
-    /**
-     * Returns a point set that is reduced by all points for which it is safe to assume
-     * that they are not part of the convex hull.
-     *
-     * @param points the original point set
-     * @return a reduced point set, useful as input for convex hull algorithms
-     */
-    public static Collection<Vector2D> reducePoints(final Collection<Vector2D> points) {
-
-        // find the leftmost point
-        int size = 0;
-        Vector2D minX = null;
-        Vector2D maxX = null;
-        Vector2D minY = null;
-        Vector2D maxY = null;
-        for (Vector2D p : points) {
-            if (minX == null || p.getX() < minX.getX()) {
-                minX = p;
-            }
-            if (maxX == null || p.getX() > maxX.getX()) {
-                maxX = p;
-            }
-            if (minY == null || p.getY() < minY.getY()) {
-                minY = p;
-            }
-            if (maxY == null || p.getY() > maxY.getY()) {
-                maxY = p;
-            }
-            size++;
-        }
-
-        if (size < 4) {
-            return points;
-        }
-
-        final List<Vector2D> quadrilateral = buildQuadrilateral(minY, maxX, maxY, minX);
-        // if the quadrilateral is not well formed, e.g. only 2 points, do not attempt to reduce
-        if (quadrilateral.size() < 3) {
-            return points;
-        }
-
-        final List<Vector2D> reducedPoints = new ArrayList<Vector2D>(quadrilateral);
-        for (final Vector2D p : points) {
-            // check all points if they are within the quadrilateral
-            // in which case they can not be part of the convex hull
-            if (!insideQuadrilateral(p, quadrilateral)) {
-                reducedPoints.add(p);
-            }
-        }
-
-        return reducedPoints;
-    }
-
-    /**
-     * Build the convex quadrilateral with the found corner points (with min/max x/y coordinates).
-     *
-     * @param points the respective points with min/max x/y coordinate
-     * @return the quadrilateral
-     */
-    private static List<Vector2D> buildQuadrilateral(final Vector2D... points) {
-        List<Vector2D> quadrilateral = new ArrayList<Vector2D>();
-        for (Vector2D p : points) {
-            if (!quadrilateral.contains(p)) {
-                quadrilateral.add(p);
-            }
-        }
-        return quadrilateral;
-    }
-
-    /**
-     * Checks if the given point is located within the convex quadrilateral.
-     * @param point the point to check
-     * @param quadrilateralPoints the convex quadrilateral, represented by 4 points
-     * @return {@code true} if the point is inside the quadrilateral, {@code false} otherwise
-     */
-    private static boolean insideQuadrilateral(final Vector2D point,
-                                               final List<Vector2D> quadrilateralPoints) {
-
-        Vector2D p1 = quadrilateralPoints.get(0);
-        Vector2D p2 = quadrilateralPoints.get(1);
-
-        if (point.equals(p1) || point.equals(p2)) {
-            return true;
-        }
-
-        // get the location of the point relative to the first two vertices
-        final double last = point.crossProduct(p1, p2);
-        final int size = quadrilateralPoints.size();
-        // loop through the rest of the vertices
-        for (int i = 1; i < size; i++) {
-            p1 = p2;
-            p2 = quadrilateralPoints.get((i + 1) == size ? 0 : i + 1);
-
-            if (point.equals(p1) || point.equals(p2)) {
-                return true;
-            }
-
-            // do side of line test: multiply the last location with this location
-            // if they are the same sign then the operation will yield a positive result
-            // -x * -y = +xy, x * y = +xy, -x * y = -xy, x * -y = -xy
-            if (last * point.crossProduct(p1, p2) < 0) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHull2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHull2D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHull2D.java
deleted file mode 100644
index 5d9734b..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHull2D.java
+++ /dev/null
@@ -1,172 +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.geometry.euclidean.twod.hull;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.exception.MathIllegalArgumentException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Line;
-import org.apache.commons.math3.geometry.euclidean.twod.Segment;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.hull.ConvexHull;
-import org.apache.commons.math3.geometry.partitioning.Region;
-import org.apache.commons.math3.geometry.partitioning.RegionFactory;
-import org.apache.commons.math3.util.MathArrays;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * This class represents a convex hull in an two-dimensional euclidean space.
- *
- * @since 3.3
- */
-public class ConvexHull2D implements ConvexHull<Euclidean2D, Vector2D>, Serializable {
-
-    /** Serializable UID. */
-    private static final long serialVersionUID = 20140129L;
-
-    /** Vertices of the hull. */
-    private final Vector2D[] vertices;
-
-    /** Tolerance threshold used during creation of the hull vertices. */
-    private final double tolerance;
-
-    /**
-     * Line segments of the hull.
-     * The array is not serialized and will be created from the vertices on first access.
-     */
-    private transient Segment[] lineSegments;
-
-    /**
-     * Simple constructor.
-     * @param vertices the vertices of the convex hull, must be ordered
-     * @param tolerance tolerance below which points are considered identical
-     * @throws MathIllegalArgumentException if the vertices do not form a convex hull
-     */
-    public ConvexHull2D(final Vector2D[] vertices, final double tolerance)
-        throws MathIllegalArgumentException {
-
-        // assign tolerance as it will be used by the isConvex method
-        this.tolerance = tolerance;
-
-        if (!isConvex(vertices)) {
-            throw new MathIllegalArgumentException(LocalizedFormats.NOT_CONVEX);
-        }
-
-        this.vertices = vertices.clone();
-    }
-
-    /**
-     * Checks whether the given hull vertices form a convex hull.
-     * @param hullVertices the hull vertices
-     * @return {@code true} if the vertices form a convex hull, {@code false} otherwise
-     */
-    private boolean isConvex(final Vector2D[] hullVertices) {
-        if (hullVertices.length < 3) {
-            return true;
-        }
-
-        int sign = 0;
-        for (int i = 0; i < hullVertices.length; i++) {
-            final Vector2D p1 = hullVertices[i == 0 ? hullVertices.length - 1 : i - 1];
-            final Vector2D p2 = hullVertices[i];
-            final Vector2D p3 = hullVertices[i == hullVertices.length - 1 ? 0 : i + 1];
-
-            final Vector2D d1 = p2.subtract(p1);
-            final Vector2D d2 = p3.subtract(p2);
-
-            final double crossProduct = MathArrays.linearCombination(d1.getX(), d2.getY(), -d1.getY(), d2.getX());
-            final int cmp = Precision.compareTo(crossProduct, 0.0, tolerance);
-            // in case of collinear points the cross product will be zero
-            if (cmp != 0.0) {
-                if (sign != 0.0 && cmp != sign) {
-                    return false;
-                }
-                sign = cmp;
-            }
-        }
-
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public Vector2D[] getVertices() {
-        return vertices.clone();
-    }
-
-    /**
-     * Get the line segments of the convex hull, ordered.
-     * @return the line segments of the convex hull
-     */
-    public Segment[] getLineSegments() {
-        return retrieveLineSegments().clone();
-    }
-
-    /**
-     * Retrieve the line segments from the cached array or create them if needed.
-     *
-     * @return the array of line segments
-     */
-    private Segment[] retrieveLineSegments() {
-        if (lineSegments == null) {
-            // construct the line segments - handle special cases of 1 or 2 points
-            final int size = vertices.length;
-            if (size <= 1) {
-                this.lineSegments = new Segment[0];
-            } else if (size == 2) {
-                this.lineSegments = new Segment[1];
-                final Vector2D p1 = vertices[0];
-                final Vector2D p2 = vertices[1];
-                this.lineSegments[0] = new Segment(p1, p2, new Line(p1, p2, tolerance));
-            } else {
-                this.lineSegments = new Segment[size];
-                Vector2D firstPoint = null;
-                Vector2D lastPoint = null;
-                int index = 0;
-                for (Vector2D point : vertices) {
-                    if (lastPoint == null) {
-                        firstPoint = point;
-                        lastPoint = point;
-                    } else {
-                        this.lineSegments[index++] =
-                                new Segment(lastPoint, point, new Line(lastPoint, point, tolerance));
-                        lastPoint = point;
-                    }
-                }
-                this.lineSegments[index] =
-                        new Segment(lastPoint, firstPoint, new Line(lastPoint, firstPoint, tolerance));
-            }
-        }
-        return lineSegments;
-    }
-
-    /** {@inheritDoc} */
-    public Region<Euclidean2D> createRegion() throws InsufficientDataException {
-        if (vertices.length < 3) {
-            throw new InsufficientDataException();
-        }
-        final RegionFactory<Euclidean2D> factory = new RegionFactory<Euclidean2D>();
-        final Segment[] segments = retrieveLineSegments();
-        final Line[] lineArray = new Line[segments.length];
-        for (int i = 0; i < segments.length; i++) {
-            lineArray[i] = segments[i].getLine();
-        }
-        return factory.buildConvex(lineArray);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
deleted file mode 100644
index 3e13e1a..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/ConvexHullGenerator2D.java
+++ /dev/null
@@ -1,37 +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.geometry.euclidean.twod.hull;
-
-import java.util.Collection;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.geometry.euclidean.twod.Euclidean2D;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.geometry.hull.ConvexHullGenerator;
-
-/**
- * Interface for convex hull generators in the two-dimensional euclidean space.
- *
- * @since 3.3
- */
-public interface ConvexHullGenerator2D extends ConvexHullGenerator<Euclidean2D, Vector2D> {
-
-    /** {@inheritDoc} */
-    ConvexHull2D generate(Collection<Vector2D> points) throws NullArgumentException, ConvergenceException;
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/MonotoneChain.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/MonotoneChain.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/MonotoneChain.java
deleted file mode 100644
index a811dda..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/MonotoneChain.java
+++ /dev/null
@@ -1,179 +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.geometry.euclidean.twod.hull;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-
-import org.apache.commons.math3.geometry.euclidean.twod.Line;
-import org.apache.commons.math3.geometry.euclidean.twod.Vector2D;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.Precision;
-
-/**
- * Implements Andrew's monotone chain method to generate the convex hull of a finite set of
- * points in the two-dimensional euclidean space.
- * <p>
- * The runtime complexity is O(n log n), with n being the number of input points. If the
- * point set is already sorted (by x-coordinate), the runtime complexity is O(n).
- * <p>
- * The implementation is not sensitive to collinear points on the hull. The parameter
- * {@code includeCollinearPoints} allows to control the behavior with regard to collinear points.
- * If {@code true}, all points on the boundary of the hull will be added to the hull vertices,
- * otherwise only the extreme points will be present. By default, collinear points are not added
- * as hull vertices.
- * <p>
- * The {@code tolerance} parameter (default: 1e-10) is used as epsilon criteria to determine
- * identical and collinear points.
- *
- * @see <a href="http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain">
- * Andrew's monotone chain algorithm (Wikibooks)</a>
- * @since 3.3
- */
-public class MonotoneChain extends AbstractConvexHullGenerator2D {
-
-    /**
-     * Create a new MonotoneChain instance.
-     */
-    public MonotoneChain() {
-        this(false);
-    }
-
-    /**
-     * Create a new MonotoneChain instance.
-     * @param includeCollinearPoints whether collinear points shall be added as hull vertices
-     */
-    public MonotoneChain(final boolean includeCollinearPoints) {
-        super(includeCollinearPoints);
-    }
-
-    /**
-     * Create a new MonotoneChain instance.
-     * @param includeCollinearPoints whether collinear points shall be added as hull vertices
-     * @param tolerance tolerance below which points are considered identical
-     */
-    public MonotoneChain(final boolean includeCollinearPoints, final double tolerance) {
-        super(includeCollinearPoints, tolerance);
-    }
-
-    @Override
-    public Collection<Vector2D> findHullVertices(final Collection<Vector2D> points) {
-
-        final List<Vector2D> pointsSortedByXAxis = new ArrayList<Vector2D>(points);
-
-        // sort the points in increasing order on the x-axis
-        Collections.sort(pointsSortedByXAxis, new Comparator<Vector2D>() {
-            public int compare(final Vector2D o1, final Vector2D o2) {
-                final double tolerance = getTolerance();
-                // need to take the tolerance value into account, otherwise collinear points
-                // will not be handled correctly when building the upper/lower hull
-                final int diff = Precision.compareTo(o1.getX(), o2.getX(), tolerance);
-                if (diff == 0) {
-                    return Precision.compareTo(o1.getY(), o2.getY(), tolerance);
-                } else {
-                    return diff;
-                }
-            }
-        });
-
-        // build lower hull
-        final List<Vector2D> lowerHull = new ArrayList<Vector2D>();
-        for (Vector2D p : pointsSortedByXAxis) {
-            updateHull(p, lowerHull);
-        }
-
-        // build upper hull
-        final List<Vector2D> upperHull = new ArrayList<Vector2D>();
-        for (int idx = pointsSortedByXAxis.size() - 1; idx >= 0; idx--) {
-            final Vector2D p = pointsSortedByXAxis.get(idx);
-            updateHull(p, upperHull);
-        }
-
-        // concatenate the lower and upper hulls
-        // the last point of each list is omitted as it is repeated at the beginning of the other list
-        final List<Vector2D> hullVertices = new ArrayList<Vector2D>(lowerHull.size() + upperHull.size() - 2);
-        for (int idx = 0; idx < lowerHull.size() - 1; idx++) {
-            hullVertices.add(lowerHull.get(idx));
-        }
-        for (int idx = 0; idx < upperHull.size() - 1; idx++) {
-            hullVertices.add(upperHull.get(idx));
-        }
-
-        // special case: if the lower and upper hull may contain only 1 point if all are identical
-        if (hullVertices.isEmpty() && ! lowerHull.isEmpty()) {
-            hullVertices.add(lowerHull.get(0));
-        }
-
-        return hullVertices;
-    }
-
-    /**
-     * Update the partial hull with the current point.
-     *
-     * @param point the current point
-     * @param hull the partial hull
-     */
-    private void updateHull(final Vector2D point, final List<Vector2D> hull) {
-        final double tolerance = getTolerance();
-
-        if (hull.size() == 1) {
-            // ensure that we do not add an identical point
-            final Vector2D p1 = hull.get(0);
-            if (p1.distance(point) < tolerance) {
-                return;
-            }
-        }
-
-        while (hull.size() >= 2) {
-            final int size = hull.size();
-            final Vector2D p1 = hull.get(size - 2);
-            final Vector2D p2 = hull.get(size - 1);
-
-            final double offset = new Line(p1, p2, tolerance).getOffset(point);
-            if (FastMath.abs(offset) < tolerance) {
-                // the point is collinear to the line (p1, p2)
-
-                final double distanceToCurrent = p1.distance(point);
-                if (distanceToCurrent < tolerance || p2.distance(point) < tolerance) {
-                    // the point is assumed to be identical to either p1 or p2
-                    return;
-                }
-
-                final double distanceToLast = p1.distance(p2);
-                if (isIncludeCollinearPoints()) {
-                    final int index = distanceToCurrent < distanceToLast ? size - 1 : size;
-                    hull.add(index, point);
-                } else {
-                    if (distanceToCurrent > distanceToLast) {
-                        hull.remove(size - 1);
-                        hull.add(point);
-                    }
-                }
-                return;
-            } else if (offset > 0) {
-                hull.remove(size - 1);
-            } else {
-                break;
-            }
-        }
-        hull.add(point);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/package-info.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/package-info.java
deleted file mode 100644
index d0469a4..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/hull/package-info.java
+++ /dev/null
@@ -1,25 +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.
- */
-/**
- *
- * <p>
- * This package provides algorithms to generate the convex hull
- * for a set of points in an two-dimensional euclidean space.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.euclidean.twod.hull;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/package-info.java b/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/package-info.java
deleted file mode 100644
index feb43b1..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- *
- * <p>
- * This package provides basic 2D geometry components.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.euclidean.twod;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHull.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHull.java b/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHull.java
deleted file mode 100644
index 8dfa3f3..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHull.java
+++ /dev/null
@@ -1,48 +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.geometry.hull;
-
-import java.io.Serializable;
-
-import org.apache.commons.math3.exception.InsufficientDataException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.partitioning.Region;
-
-/**
- * This class represents a convex hull.
- *
- * @param <S> Space type.
- * @param <P> Point type.
- * @since 3.3
- */
-public interface ConvexHull<S extends Space, P extends Point<S>> extends Serializable {
-
-    /**
-     * Get the vertices of the convex hull.
-     * @return vertices of the convex hull
-     */
-    P[] getVertices();
-
-    /**
-     * Returns a new region that is enclosed by the convex hull.
-     * @return the region enclosed by the convex hull
-     * @throws InsufficientDataException if the number of vertices is not enough to
-     * build a region in the respective space
-     */
-    Region<S> createRegion() throws InsufficientDataException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHullGenerator.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHullGenerator.java b/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHullGenerator.java
deleted file mode 100644
index 8f601d2..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/hull/ConvexHullGenerator.java
+++ /dev/null
@@ -1,49 +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.geometry.hull;
-
-import java.util.Collection;
-
-import org.apache.commons.math3.exception.ConvergenceException;
-import org.apache.commons.math3.exception.NullArgumentException;
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-
-/**
- * Interface for convex hull generators.
- *
- * @param <S> Type of the {@link Space}
- * @param <P> Type of the {@link Point}
- *
- * @see <a href="http://en.wikipedia.org/wiki/Convex_hull">Convex Hull (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/ConvexHull.html">Convex Hull (MathWorld)</a>
- *
- * @since 3.3
- */
-public interface ConvexHullGenerator<S extends Space, P extends Point<S>> {
-
-    /**
-     * Builds the convex hull from the set of input points.
-     *
-     * @param points the set of input points
-     * @return the convex hull
-     * @throws NullArgumentException if the input collection is {@code null}
-     * @throws ConvergenceException if generator fails to generate a convex hull for
-     * the given set of input points
-     */
-    ConvexHull<S, P> generate(Collection<P> points) throws NullArgumentException, ConvergenceException;
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/hull/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/hull/package-info.java b/src/main/java/org/apache/commons/math3/geometry/hull/package-info.java
deleted file mode 100644
index 2246682..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/hull/package-info.java
+++ /dev/null
@@ -1,24 +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.
- */
-/**
- *
- * <p>
- * This package provides interfaces and classes related to the convex hull problem.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry.hull;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/package-info.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/package-info.java b/src/main/java/org/apache/commons/math3/geometry/package-info.java
deleted file mode 100644
index 31929e2..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/package-info.java
+++ /dev/null
@@ -1,25 +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.
- */
-/**
- *
- * <p>
- * This package is the top level package for geometry. It provides only a few interfaces
- * related to vectorial/affine spaces that are implemented in sub-packages.
- * </p>
- *
- */
-package org.apache.commons.math3.geometry;

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractRegion.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractRegion.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractRegion.java
deleted file mode 100644
index 6928331..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractRegion.java
+++ /dev/null
@@ -1,533 +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.geometry.partitioning;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.TreeSet;
-
-import org.apache.commons.math3.geometry.Point;
-import org.apache.commons.math3.geometry.Space;
-import org.apache.commons.math3.geometry.Vector;
-
-/** Abstract class for all regions, independently of geometry type or dimension.
-
- * @param <S> Type of the space.
- * @param <T> Type of the sub-space.
-
- * @since 3.0
- */
-public abstract class AbstractRegion<S extends Space, T extends Space> implements Region<S> {
-
-    /** Inside/Outside BSP tree. */
-    private BSPTree<S> tree;
-
-    /** Tolerance below which points are considered to belong to hyperplanes. */
-    private final double tolerance;
-
-    /** Size of the instance. */
-    private double size;
-
-    /** Barycenter. */
-    private Point<S> barycenter;
-
-    /** Build a region representing the whole space.
-     * @param tolerance tolerance below which points are considered identical.
-     */
-    protected AbstractRegion(final double tolerance) {
-        this.tree      = new BSPTree<S>(Boolean.TRUE);
-        this.tolerance = tolerance;
-    }
-
-    /** Build a region from an inside/outside BSP tree.
-     * <p>The leaf nodes of the BSP tree <em>must</em> have a
-     * {@code Boolean} attribute representing the inside status of
-     * the corresponding cell (true for inside cells, false for outside
-     * cells). In order to avoid building too many small objects, it is
-     * recommended to use the predefined constants
-     * {@code Boolean.TRUE} and {@code Boolean.FALSE}. The
-     * tree also <em>must</em> have either null internal nodes or
-     * internal nodes representing the boundary as specified in the
-     * {@link #getTree getTree} method).</p>
-     * @param tree inside/outside BSP tree representing the region
-     * @param tolerance tolerance below which points are considered identical.
-     */
-    protected AbstractRegion(final BSPTree<S> tree, final double tolerance) {
-        this.tree      = tree;
-        this.tolerance = tolerance;
-    }
-
-    /** Build a Region from a Boundary REPresentation (B-rep).
-     * <p>The boundary is provided as a collection of {@link
-     * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the
-     * interior part of the region on its minus side and the exterior on
-     * its plus side.</p>
-     * <p>The boundary elements can be in any order, and can form
-     * several non-connected sets (like for example polygons with holes
-     * or a set of disjoints polyhedrons considered as a whole). In
-     * fact, the elements do not even need to be connected together
-     * (their topological connections are not used here). However, if the
-     * boundary does not really separate an inside open from an outside
-     * open (open having here its topological meaning), then subsequent
-     * calls to the {@link #checkPoint(Point) checkPoint} method will not be
-     * meaningful anymore.</p>
-     * <p>If the boundary is empty, the region will represent the whole
-     * space.</p>
-     * @param boundary collection of boundary elements, as a
-     * collection of {@link SubHyperplane SubHyperplane} objects
-     * @param tolerance tolerance below which points are considered identical.
-     */
-    protected AbstractRegion(final Collection<SubHyperplane<S>> boundary, final double tolerance) {
-
-        this.tolerance = tolerance;
-
-        if (boundary.size() == 0) {
-
-            // the tree represents the whole space
-            tree = new BSPTree<S>(Boolean.TRUE);
-
-        } else {
-
-            // sort the boundary elements in decreasing size order
-            // (we don't want equal size elements to be removed, so
-            // we use a trick to fool the TreeSet)
-            final TreeSet<SubHyperplane<S>> ordered = new TreeSet<SubHyperplane<S>>(new Comparator<SubHyperplane<S>>() {
-                public int compare(final SubHyperplane<S> o1, final SubHyperplane<S> o2) {
-                    final double size1 = o1.getSize();
-                    final double size2 = o2.getSize();
-                    return (size2 < size1) ? -1 : ((o1 == o2) ? 0 : +1);
-                }
-            });
-            ordered.addAll(boundary);
-
-            // build the tree top-down
-            tree = new BSPTree<S>();
-            insertCuts(tree, ordered);
-
-            // set up the inside/outside flags
-            tree.visit(new BSPTreeVisitor<S>() {
-
-                /** {@inheritDoc} */
-                public Order visitOrder(final BSPTree<S> node) {
-                    return Order.PLUS_SUB_MINUS;
-                }
-
-                /** {@inheritDoc} */
-                public void visitInternalNode(final BSPTree<S> node) {
-                }
-
-                /** {@inheritDoc} */
-                public void visitLeafNode(final BSPTree<S> node) {
-                    if (node.getParent() == null || node == node.getParent().getMinus()) {
-                        node.setAttribute(Boolean.TRUE);
-                    } else {
-                        node.setAttribute(Boolean.FALSE);
-                    }
-                }
-            });
-
-        }
-
-    }
-
-    /** Build a convex region from an array of bounding hyperplanes.
-     * @param hyperplanes array of bounding hyperplanes (if null, an
-     * empty region will be built)
-     * @param tolerance tolerance below which points are considered identical.
-     */
-    public AbstractRegion(final Hyperplane<S>[] hyperplanes, final double tolerance) {
-        this.tolerance = tolerance;
-        if ((hyperplanes == null) || (hyperplanes.length == 0)) {
-            tree = new BSPTree<S>(Boolean.FALSE);
-        } else {
-
-            // use the first hyperplane to build the right class
-            tree = hyperplanes[0].wholeSpace().getTree(false);
-
-            // chop off parts of the space
-            BSPTree<S> node = tree;
-            node.setAttribute(Boolean.TRUE);
-            for (final Hyperplane<S> hyperplane : hyperplanes) {
-                if (node.insertCut(hyperplane)) {
-                    node.setAttribute(null);
-                    node.getPlus().setAttribute(Boolean.FALSE);
-                    node = node.getMinus();
-                    node.setAttribute(Boolean.TRUE);
-                }
-            }
-
-        }
-
-    }
-
-    /** {@inheritDoc} */
-    public abstract AbstractRegion<S, T> buildNew(BSPTree<S> newTree);
-
-    /** Get the tolerance below which points are considered to belong to hyperplanes.
-     * @return tolerance below which points are considered to belong to hyperplanes
-     */
-    public double getTolerance() {
-        return tolerance;
-    }
-
-    /** Recursively build a tree by inserting cut sub-hyperplanes.
-     * @param node current tree node (it is a leaf node at the beginning
-     * of the call)
-     * @param boundary collection of edges belonging to the cell defined
-     * by the node
-     */
-    private void insertCuts(final BSPTree<S> node, final Collection<SubHyperplane<S>> boundary) {
-
-        final Iterator<SubHyperplane<S>> iterator = boundary.iterator();
-
-        // build the current level
-        Hyperplane<S> inserted = null;
-        while ((inserted == null) && iterator.hasNext()) {
-            inserted = iterator.next().getHyperplane();
-            if (!node.insertCut(inserted.copySelf())) {
-                inserted = null;
-            }
-        }
-
-        if (!iterator.hasNext()) {
-            return;
-        }
-
-        // distribute the remaining edges in the two sub-trees
-        final ArrayList<SubHyperplane<S>> plusList  = new ArrayList<SubHyperplane<S>>();
-        final ArrayList<SubHyperplane<S>> minusList = new ArrayList<SubHyperplane<S>>();
-        while (iterator.hasNext()) {
-            final SubHyperplane<S> other = iterator.next();
-            switch (other.side(inserted)) {
-            case PLUS:
-                plusList.add(other);
-                break;
-            case MINUS:
-                minusList.add(other);
-                break;
-            case BOTH:
-                final SubHyperplane.SplitSubHyperplane<S> split = other.split(inserted);
-                plusList.add(split.getPlus());
-                minusList.add(split.getMinus());
-                break;
-            default:
-                // ignore the sub-hyperplanes belonging to the cut hyperplane
-            }
-        }
-
-        // recurse through lower levels
-        insertCuts(node.getPlus(),  plusList);
-        insertCuts(node.getMinus(), minusList);
-
-    }
-
-    /** {@inheritDoc} */
-    public AbstractRegion<S, T> copySelf() {
-        return buildNew(tree.copySelf());
-    }
-
-    /** {@inheritDoc} */
-    public boolean isEmpty() {
-        return isEmpty(tree);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isEmpty(final BSPTree<S> node) {
-
-        // we use a recursive function rather than the BSPTreeVisitor
-        // interface because we can stop visiting the tree as soon as we
-        // have found an inside cell
-
-        if (node.getCut() == null) {
-            // if we find an inside node, the region is not empty
-            return !((Boolean) node.getAttribute());
-        }
-
-        // check both sides of the sub-tree
-        return isEmpty(node.getMinus()) && isEmpty(node.getPlus());
-
-    }
-
-    /** {@inheritDoc} */
-    public boolean isFull() {
-        return isFull(tree);
-    }
-
-    /** {@inheritDoc} */
-    public boolean isFull(final BSPTree<S> node) {
-
-        // we use a recursive function rather than the BSPTreeVisitor
-        // interface because we can stop visiting the tree as soon as we
-        // have found an outside cell
-
-        if (node.getCut() == null) {
-            // if we find an outside node, the region does not cover full space
-            return (Boolean) node.getAttribute();
-        }
-
-        // check both sides of the sub-tree
-        return isFull(node.getMinus()) && isFull(node.getPlus());
-
-    }
-
-    /** {@inheritDoc} */
-    public boolean contains(final Region<S> region) {
-        return new RegionFactory<S>().difference(region, this).isEmpty();
-    }
-
-    /** {@inheritDoc}
-     * @since 3.3
-     */
-    public BoundaryProjection<S> projectToBoundary(final Point<S> point) {
-        final BoundaryProjector<S, T> projector = new BoundaryProjector<S, T>(point);
-        getTree(true).visit(projector);
-        return projector.getProjection();
-    }
-
-    /** Check a point with respect to the region.
-     * @param point point to check
-     * @return a code representing the point status: either {@link
-     * Region.Location#INSIDE}, {@link Region.Location#OUTSIDE} or
-     * {@link Region.Location#BOUNDARY}
-     */
-    public Location checkPoint(final Vector<S> point) {
-        return checkPoint((Point<S>) point);
-    }
-
-    /** {@inheritDoc} */
-    public Location checkPoint(final Point<S> point) {
-        return checkPoint(tree, point);
-    }
-
-    /** Check a point with respect to the region starting at a given node.
-     * @param node root node of the region
-     * @param point point to check
-     * @return a code representing the point status: either {@link
-     * Region.Location#INSIDE INSIDE}, {@link Region.Location#OUTSIDE
-     * OUTSIDE} or {@link Region.Location#BOUNDARY BOUNDARY}
-     */
-    protected Location checkPoint(final BSPTree<S> node, final Vector<S> point) {
-        return checkPoint(node, (Point<S>) point);
-    }
-
-    /** Check a point with respect to the region starting at a given node.
-     * @param node root node of the region
-     * @param point point to check
-     * @return a code representing the point status: either {@link
-     * Region.Location#INSIDE INSIDE}, {@link Region.Location#OUTSIDE
-     * OUTSIDE} or {@link Region.Location#BOUNDARY BOUNDARY}
-     */
-    protected Location checkPoint(final BSPTree<S> node, final Point<S> point) {
-        final BSPTree<S> cell = node.getCell(point, tolerance);
-        if (cell.getCut() == null) {
-            // the point is in the interior of a cell, just check the attribute
-            return ((Boolean) cell.getAttribute()) ? Location.INSIDE : Location.OUTSIDE;
-        }
-
-        // the point is on a cut-sub-hyperplane, is it on a boundary ?
-        final Location minusCode = checkPoint(cell.getMinus(), point);
-        final Location plusCode  = checkPoint(cell.getPlus(),  point);
-        return (minusCode == plusCode) ? minusCode : Location.BOUNDARY;
-
-    }
-
-    /** {@inheritDoc} */
-    public BSPTree<S> getTree(final boolean includeBoundaryAttributes) {
-        if (includeBoundaryAttributes && (tree.getCut() != null) && (tree.getAttribute() == null)) {
-            // compute the boundary attributes
-            tree.visit(new BoundaryBuilder<S>());
-        }
-        return tree;
-    }
-
-    /** {@inheritDoc} */
-    public double getBoundarySize() {
-        final BoundarySizeVisitor<S> visitor = new BoundarySizeVisitor<S>();
-        getTree(true).visit(visitor);
-        return visitor.getSize();
-    }
-
-    /** {@inheritDoc} */
-    public double getSize() {
-        if (barycenter == null) {
-            computeGeometricalProperties();
-        }
-        return size;
-    }
-
-    /** Set the size of the instance.
-     * @param size size of the instance
-     */
-    protected void setSize(final double size) {
-        this.size = size;
-    }
-
-    /** {@inheritDoc} */
-    public Point<S> getBarycenter() {
-        if (barycenter == null) {
-            computeGeometricalProperties();
-        }
-        return barycenter;
-    }
-
-    /** Set the barycenter of the instance.
-     * @param barycenter barycenter of the instance
-     */
-    protected void setBarycenter(final Vector<S> barycenter) {
-        setBarycenter((Point<S>) barycenter);
-    }
-
-    /** Set the barycenter of the instance.
-     * @param barycenter barycenter of the instance
-     */
-    protected void setBarycenter(final Point<S> barycenter) {
-        this.barycenter = barycenter;
-    }
-
-    /** Compute some geometrical properties.
-     * <p>The properties to compute are the barycenter and the size.</p>
-     */
-    protected abstract void computeGeometricalProperties();
-
-    /** {@inheritDoc} */
-    public Side side(final Hyperplane<S> hyperplane) {
-        final InsideFinder<S> finder = new InsideFinder<S>(this);
-        finder.recurseSides(tree, hyperplane.wholeHyperplane());
-        return finder.plusFound() ?
-              (finder.minusFound() ? Side.BOTH  : Side.PLUS) :
-              (finder.minusFound() ? Side.MINUS : Side.HYPER);
-    }
-
-    /** {@inheritDoc} */
-    public SubHyperplane<S> intersection(final SubHyperplane<S> sub) {
-        return recurseIntersection(tree, sub);
-    }
-
-    /** Recursively compute the parts of a sub-hyperplane that are
-     * contained in the region.
-     * @param node current BSP tree node
-     * @param sub sub-hyperplane traversing the region
-     * @return filtered sub-hyperplane
-     */
-    private SubHyperplane<S> recurseIntersection(final BSPTree<S> node, final SubHyperplane<S> sub) {
-
-        if (node.getCut() == null) {
-            return (Boolean) node.getAttribute() ? sub.copySelf() : null;
-        }
-
-        final Hyperplane<S> hyperplane = node.getCut().getHyperplane();
-        switch (sub.side(hyperplane)) {
-        case PLUS :
-            return recurseIntersection(node.getPlus(), sub);
-        case MINUS :
-            return recurseIntersection(node.getMinus(), sub);
-        case BOTH :
-            final SubHyperplane.SplitSubHyperplane<S> split = sub.split(hyperplane);
-            final SubHyperplane<S> plus  = recurseIntersection(node.getPlus(),  split.getPlus());
-            final SubHyperplane<S> minus = recurseIntersection(node.getMinus(), split.getMinus());
-            if (plus == null) {
-                return minus;
-            } else if (minus == null) {
-                return plus;
-            } else {
-                return plus.reunite(minus);
-            }
-        default :
-            return recurseIntersection(node.getPlus(),
-                                       recurseIntersection(node.getMinus(), sub));
-        }
-
-    }
-
-    /** Transform a region.
-     * <p>Applying a transform to a region consist in applying the
-     * transform to all the hyperplanes of the underlying BSP tree and
-     * of the boundary (and also to the sub-hyperplanes embedded in
-     * these hyperplanes) and to the barycenter. The instance is not
-     * modified, a new instance is built.</p>
-     * @param transform transform to apply
-     * @return a new region, resulting from the application of the
-     * transform to the instance
-     */
-    public AbstractRegion<S, T> applyTransform(final Transform<S, T> transform) {
-
-        // transform the tree, except for boundary attribute splitters
-        final Map<BSPTree<S>, BSPTree<S>> map = new HashMap<BSPTree<S>, BSPTree<S>>();
-        final BSPTree<S> transformedTree = recurseTransform(getTree(false), transform, map);
-
-        // set up the boundary attributes splitters
-        for (final Map.Entry<BSPTree<S>, BSPTree<S>> entry : map.entrySet()) {
-            if (entry.getKey().getCut() != null) {
-                @SuppressWarnings("unchecked")
-                BoundaryAttribute<S> original = (BoundaryAttribute<S>) entry.getKey().getAttribute();
-                if (original != null) {
-                    @SuppressWarnings("unchecked")
-                    BoundaryAttribute<S> transformed = (BoundaryAttribute<S>) entry.getValue().getAttribute();
-                    for (final BSPTree<S> splitter : original.getSplitters()) {
-                        transformed.getSplitters().add(map.get(splitter));
-                    }
-                }
-            }
-        }
-
-        return buildNew(transformedTree);
-
-    }
-
-    /** Recursively transform an inside/outside BSP-tree.
-     * @param node current BSP tree node
-     * @param transform transform to apply
-     * @param map transformed nodes map
-     * @return a new tree
-     */
-    @SuppressWarnings("unchecked")
-    private BSPTree<S> recurseTransform(final BSPTree<S> node, final Transform<S, T> transform,
-                                        final Map<BSPTree<S>, BSPTree<S>> map) {
-
-        final BSPTree<S> transformedNode;
-        if (node.getCut() == null) {
-            transformedNode = new BSPTree<S>(node.getAttribute());
-        } else {
-
-            final SubHyperplane<S>  sub = node.getCut();
-            final SubHyperplane<S> tSub = ((AbstractSubHyperplane<S, T>) sub).applyTransform(transform);
-            BoundaryAttribute<S> attribute = (BoundaryAttribute<S>) node.getAttribute();
-            if (attribute != null) {
-                final SubHyperplane<S> tPO = (attribute.getPlusOutside() == null) ?
-                    null : ((AbstractSubHyperplane<S, T>) attribute.getPlusOutside()).applyTransform(transform);
-                final SubHyperplane<S> tPI = (attribute.getPlusInside()  == null) ?
-                    null  : ((AbstractSubHyperplane<S, T>) attribute.getPlusInside()).applyTransform(transform);
-                // we start with an empty list of splitters, it will be filled in out of recursion
-                attribute = new BoundaryAttribute<S>(tPO, tPI, new NodesSet<S>());
-            }
-
-            transformedNode = new BSPTree<S>(tSub,
-                                             recurseTransform(node.getPlus(),  transform, map),
-                                             recurseTransform(node.getMinus(), transform, map),
-                                             attribute);
-        }
-
-        map.put(node, transformedNode);
-        return transformedNode;
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractSubHyperplane.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractSubHyperplane.java b/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractSubHyperplane.java
deleted file mode 100644
index 3fd6b54..0000000
--- a/src/main/java/org/apache/commons/math3/geometry/partitioning/AbstractSubHyperplane.java
+++ /dev/null
@@ -1,188 +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.geometry.partitioning;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.commons.math3.geometry.Space;
-
-/** This class implements the dimension-independent parts of {@link SubHyperplane}.
-
- * <p>sub-hyperplanes are obtained when parts of an {@link
- * Hyperplane hyperplane} are chopped off by other hyperplanes that
- * intersect it. The remaining part is a convex region. Such objects
- * appear in {@link BSPTree BSP trees} as the intersection of a cut
- * hyperplane with the convex region which it splits, the chopping
- * hyperplanes are the cut hyperplanes closer to the tree root.</p>
-
- * @param <S> Type of the embedding space.
- * @param <T> Type of the embedded sub-space.
-
- * @since 3.0
- */
-public abstract class AbstractSubHyperplane<S extends Space, T extends Space>
-    implements SubHyperplane<S> {
-
-    /** Underlying hyperplane. */
-    private final Hyperplane<S> hyperplane;
-
-    /** Remaining region of the hyperplane. */
-    private final Region<T> remainingRegion;
-
-    /** Build a sub-hyperplane from an hyperplane and a region.
-     * @param hyperplane underlying hyperplane
-     * @param remainingRegion remaining region of the hyperplane
-     */
-    protected AbstractSubHyperplane(final Hyperplane<S> hyperplane,
-                                    final Region<T> remainingRegion) {
-        this.hyperplane      = hyperplane;
-        this.remainingRegion = remainingRegion;
-    }
-
-    /** Build a sub-hyperplane from an hyperplane and a region.
-     * @param hyper underlying hyperplane
-     * @param remaining remaining region of the hyperplane
-     * @return a new sub-hyperplane
-     */
-    protected abstract AbstractSubHyperplane<S, T> buildNew(final Hyperplane<S> hyper,
-                                                            final Region<T> remaining);
-
-    /** {@inheritDoc} */
-    public AbstractSubHyperplane<S, T> copySelf() {
-        return buildNew(hyperplane.copySelf(), remainingRegion);
-    }
-
-    /** Get the underlying hyperplane.
-     * @return underlying hyperplane
-     */
-    public Hyperplane<S> getHyperplane() {
-        return hyperplane;
-    }
-
-    /** Get the remaining region of the hyperplane.
-     * <p>The returned region is expressed in the canonical hyperplane
-     * frame and has the hyperplane dimension. For example a chopped
-     * hyperplane in the 3D euclidean is a 2D plane and the
-     * corresponding region is a convex 2D polygon.</p>
-     * @return remaining region of the hyperplane
-     */
-    public Region<T> getRemainingRegion() {
-        return remainingRegion;
-    }
-
-    /** {@inheritDoc} */
-    public double getSize() {
-        return remainingRegion.getSize();
-    }
-
-    /** {@inheritDoc} */
-    public AbstractSubHyperplane<S, T> reunite(final SubHyperplane<S> other) {
-        @SuppressWarnings("unchecked")
-        AbstractSubHyperplane<S, T> o = (AbstractSubHyperplane<S, T>) other;
-        return buildNew(hyperplane,
-                        new RegionFactory<T>().union(remainingRegion, o.remainingRegion));
-    }
-
-    /** Apply a transform to the instance.
-     * <p>The instance must be a (D-1)-dimension sub-hyperplane with
-     * respect to the transform <em>not</em> a (D-2)-dimension
-     * sub-hyperplane the transform knows how to transform by
-     * itself. The transform will consist in transforming first the
-     * hyperplane and then the all region using the various methods
-     * provided by the transform.</p>
-     * @param transform D-dimension transform to apply
-     * @return the transformed instance
-     */
-    public AbstractSubHyperplane<S, T> applyTransform(final Transform<S, T> transform) {
-        final Hyperplane<S> tHyperplane = transform.apply(hyperplane);
-
-        // transform the tree, except for boundary attribute splitters
-        final Map<BSPTree<T>, BSPTree<T>> map = new HashMap<BSPTree<T>, BSPTree<T>>();
-        final BSPTree<T> tTree =
-            recurseTransform(remainingRegion.getTree(false), tHyperplane, transform, map);
-
-        // set up the boundary attributes splitters
-        for (final Map.Entry<BSPTree<T>, BSPTree<T>> entry : map.entrySet()) {
-            if (entry.getKey().getCut() != null) {
-                @SuppressWarnings("unchecked")
-                BoundaryAttribute<T> original = (BoundaryAttribute<T>) entry.getKey().getAttribute();
-                if (original != null) {
-                    @SuppressWarnings("unchecked")
-                    BoundaryAttribute<T> transformed = (BoundaryAttribute<T>) entry.getValue().getAttribute();
-                    for (final BSPTree<T> splitter : original.getSplitters()) {
-                        transformed.getSplitters().add(map.get(splitter));
-                    }
-                }
-            }
-        }
-
-        return buildNew(tHyperplane, remainingRegion.buildNew(tTree));
-
-    }
-
-    /** Recursively transform a BSP-tree from a sub-hyperplane.
-     * @param node current BSP tree node
-     * @param transformed image of the instance hyperplane by the transform
-     * @param transform transform to apply
-     * @param map transformed nodes map
-     * @return a new tree
-     */
-    private BSPTree<T> recurseTransform(final BSPTree<T> node,
-                                        final Hyperplane<S> transformed,
-                                        final Transform<S, T> transform,
-                                        final Map<BSPTree<T>, BSPTree<T>> map) {
-
-        final BSPTree<T> transformedNode;
-        if (node.getCut() == null) {
-            transformedNode = new BSPTree<T>(node.getAttribute());
-        } else {
-
-            @SuppressWarnings("unchecked")
-            BoundaryAttribute<T> attribute = (BoundaryAttribute<T>) node.getAttribute();
-            if (attribute != null) {
-                final SubHyperplane<T> tPO = (attribute.getPlusOutside() == null) ?
-                    null : transform.apply(attribute.getPlusOutside(), hyperplane, transformed);
-                final SubHyperplane<T> tPI = (attribute.getPlusInside() == null) ?
-                    null : transform.apply(attribute.getPlusInside(), hyperplane, transformed);
-                // we start with an empty list of splitters, it will be filled in out of recursion
-                attribute = new BoundaryAttribute<T>(tPO, tPI, new NodesSet<T>());
-            }
-
-            transformedNode = new BSPTree<T>(transform.apply(node.getCut(), hyperplane, transformed),
-                    recurseTransform(node.getPlus(),  transformed, transform, map),
-                    recurseTransform(node.getMinus(), transformed, transform, map),
-                    attribute);
-        }
-
-        map.put(node, transformedNode);
-        return transformedNode;
-
-    }
-
-    /** {@inheritDoc} */
-    public abstract Side side(Hyperplane<S> hyper);
-
-    /** {@inheritDoc} */
-    public abstract SplitSubHyperplane<S> split(Hyperplane<S> hyper);
-
-    /** {@inheritDoc} */
-    public boolean isEmpty() {
-        return remainingRegion.isEmpty();
-    }
-
-}


[33/82] [partial] [math] Update for next development iteration: commons-math4

Posted by tn...@apache.org.
http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java
deleted file mode 100644
index 411f1a2..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java
+++ /dev/null
@@ -1,351 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.CombinatoricsUtils;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.ResizableDoubleArray;
-
-/**
- * Implementation of the exponential distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Exponential_distribution">Exponential distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/ExponentialDistribution.html">Exponential distribution (MathWorld)</a>
- */
-public class ExponentialDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier */
-    private static final long serialVersionUID = 2401296428283614780L;
-    /**
-     * Used when generating Exponential samples.
-     * Table containing the constants
-     * q_i = sum_{j=1}^i (ln 2)^j/j! = ln 2 + (ln 2)^2/2 + ... + (ln 2)^i/i!
-     * until the largest representable fraction below 1 is exceeded.
-     *
-     * Note that
-     * 1 = 2 - 1 = exp(ln 2) - 1 = sum_{n=1}^infty (ln 2)^n / n!
-     * thus q_i -> 1 as i -> +inf,
-     * so the higher i, the closer to one we get (the series is not alternating).
-     *
-     * By trying, n = 16 in Java is enough to reach 1.0.
-     */
-    private static final double[] EXPONENTIAL_SA_QI;
-    /** The mean of this distribution. */
-    private final double mean;
-    /** The logarithm of the mean, stored to reduce computing time. **/
-    private final double logMean;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Initialize tables.
-     */
-    static {
-        /**
-         * Filling EXPONENTIAL_SA_QI table.
-         * Note that we don't want qi = 0 in the table.
-         */
-        final double LN2 = FastMath.log(2);
-        double qi = 0;
-        int i = 1;
-
-        /**
-         * ArithmeticUtils provides factorials up to 20, so let's use that
-         * limit together with Precision.EPSILON to generate the following
-         * code (a priori, we know that there will be 16 elements, but it is
-         * better to not hardcode it).
-         */
-        final ResizableDoubleArray ra = new ResizableDoubleArray(20);
-
-        while (qi < 1) {
-            qi += FastMath.pow(LN2, i) / CombinatoricsUtils.factorial(i);
-            ra.addElement(qi);
-            ++i;
-        }
-
-        EXPONENTIAL_SA_QI = ra.getElements();
-    }
-
-    /**
-     * Create an exponential distribution with the given mean.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mean mean of this distribution.
-     */
-    public ExponentialDistribution(double mean) {
-        this(mean, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Create an exponential distribution with the given mean.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mean Mean of this distribution.
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code mean <= 0}.
-     * @since 2.1
-     */
-    public ExponentialDistribution(double mean, double inverseCumAccuracy) {
-        this(new Well19937c(), mean, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates an exponential distribution.
-     *
-     * @param rng Random number generator.
-     * @param mean Mean of this distribution.
-     * @throws NotStrictlyPositiveException if {@code mean <= 0}.
-     * @since 3.3
-     */
-    public ExponentialDistribution(RandomGenerator rng, double mean)
-        throws NotStrictlyPositiveException {
-        this(rng, mean, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates an exponential distribution.
-     *
-     * @param rng Random number generator.
-     * @param mean Mean of this distribution.
-     * @param inverseCumAccuracy Maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code mean <= 0}.
-     * @since 3.1
-     */
-    public ExponentialDistribution(RandomGenerator rng,
-                                   double mean,
-                                   double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (mean <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.MEAN, mean);
-        }
-        this.mean = mean;
-        logMean = FastMath.log(mean);
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * Access the mean.
-     *
-     * @return the mean.
-     */
-    public double getMean() {
-        return mean;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        final double logDensity = logDensity(x);
-        return logDensity == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logDensity);
-    }
-
-    /** {@inheritDoc} **/
-    @Override
-    public double logDensity(double x) {
-        if (x < 0) {
-            return Double.NEGATIVE_INFINITY;
-        }
-        return -x / mean - logMean;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The implementation of this method is based on:
-     * <ul>
-     * <li>
-     * <a href="http://mathworld.wolfram.com/ExponentialDistribution.html">
-     * Exponential Distribution</a>, equation (1).</li>
-     * </ul>
-     */
-    public double cumulativeProbability(double x)  {
-        double ret;
-        if (x <= 0.0) {
-            ret = 0.0;
-        } else {
-            ret = 1.0 - FastMath.exp(-x / mean);
-        }
-        return ret;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * Returns {@code 0} when {@code p= = 0} and
-     * {@code Double.POSITIVE_INFINITY} when {@code p == 1}.
-     */
-    @Override
-    public double inverseCumulativeProbability(double p) throws OutOfRangeException {
-        double ret;
-
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0.0, 1.0);
-        } else if (p == 1.0) {
-            ret = Double.POSITIVE_INFINITY;
-        } else {
-            ret = -mean * FastMath.log(1.0 - p);
-        }
-
-        return ret;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * <p><strong>Algorithm Description</strong>: this implementation uses the
-     * <a href="http://www.jesus.ox.ac.uk/~clifford/a5/chap1/node5.html">
-     * Inversion Method</a> to generate exponentially distributed random values
-     * from uniform deviates.</p>
-     *
-     * @return a random value.
-     * @since 2.2
-     */
-    @Override
-    public double sample() {
-        // Step 1:
-        double a = 0;
-        double u = random.nextDouble();
-
-        // Step 2 and 3:
-        while (u < 0.5) {
-            a += EXPONENTIAL_SA_QI[0];
-            u *= 2;
-        }
-
-        // Step 4 (now u >= 0.5):
-        u += u - 1;
-
-        // Step 5:
-        if (u <= EXPONENTIAL_SA_QI[0]) {
-            return mean * (a + u);
-        }
-
-        // Step 6:
-        int i = 0; // Should be 1, be we iterate before it in while using 0
-        double u2 = random.nextDouble();
-        double umin = u2;
-
-        // Step 7 and 8:
-        do {
-            ++i;
-            u2 = random.nextDouble();
-
-            if (u2 < umin) {
-                umin = u2;
-            }
-
-            // Step 8:
-        } while (u > EXPONENTIAL_SA_QI[i]); // Ensured to exit since EXPONENTIAL_SA_QI[MAX] = 1
-
-        return mean * (a + umin * EXPONENTIAL_SA_QI[0]);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For mean parameter {@code k}, the mean is {@code k}.
-     */
-    public double getNumericalMean() {
-        return getMean();
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For mean parameter {@code k}, the variance is {@code k^2}.
-     */
-    public double getNumericalVariance() {
-        final double m = getMean();
-        return m * m;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the mean parameter.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity
-     * no matter the mean parameter.
-     *
-     * @return upper bound of the support (always Double.POSITIVE_INFINITY)
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/FDistribution.java b/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
deleted file mode 100644
index bd98c37..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
+++ /dev/null
@@ -1,328 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Beta;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the F-distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/F-distribution">F-distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/F-Distribution.html">F-distribution (MathWorld)</a>
- */
-public class FDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -8516354193418641566L;
-    /** The numerator degrees of freedom. */
-    private final double numeratorDegreesOfFreedom;
-    /** The numerator degrees of freedom. */
-    private final double denominatorDegreesOfFreedom;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-    /** Cached numerical variance */
-    private double numericalVariance = Double.NaN;
-    /** Whether or not the numerical variance has been calculated */
-    private boolean numericalVarianceIsCalculated = false;
-
-    /**
-     * Creates an F distribution using the given degrees of freedom.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
-     * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
-     * @throws NotStrictlyPositiveException if
-     * {@code numeratorDegreesOfFreedom <= 0} or
-     * {@code denominatorDegreesOfFreedom <= 0}.
-     */
-    public FDistribution(double numeratorDegreesOfFreedom,
-                         double denominatorDegreesOfFreedom)
-        throws NotStrictlyPositiveException {
-        this(numeratorDegreesOfFreedom, denominatorDegreesOfFreedom,
-             DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates an F distribution using the given degrees of freedom
-     * and inverse cumulative probability accuracy.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
-     * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates.
-     * @throws NotStrictlyPositiveException if
-     * {@code numeratorDegreesOfFreedom <= 0} or
-     * {@code denominatorDegreesOfFreedom <= 0}.
-     * @since 2.1
-     */
-    public FDistribution(double numeratorDegreesOfFreedom,
-                         double denominatorDegreesOfFreedom,
-                         double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        this(new Well19937c(), numeratorDegreesOfFreedom,
-             denominatorDegreesOfFreedom, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates an F distribution.
-     *
-     * @param rng Random number generator.
-     * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
-     * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
-     * @throws NotStrictlyPositiveException if {@code numeratorDegreesOfFreedom <= 0} or
-     * {@code denominatorDegreesOfFreedom <= 0}.
-     * @since 3.3
-     */
-    public FDistribution(RandomGenerator rng,
-                         double numeratorDegreesOfFreedom,
-                         double denominatorDegreesOfFreedom)
-        throws NotStrictlyPositiveException {
-        this(rng, numeratorDegreesOfFreedom, denominatorDegreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates an F distribution.
-     *
-     * @param rng Random number generator.
-     * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
-     * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates.
-     * @throws NotStrictlyPositiveException if {@code numeratorDegreesOfFreedom <= 0} or
-     * {@code denominatorDegreesOfFreedom <= 0}.
-     * @since 3.1
-     */
-    public FDistribution(RandomGenerator rng,
-                         double numeratorDegreesOfFreedom,
-                         double denominatorDegreesOfFreedom,
-                         double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (numeratorDegreesOfFreedom <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
-                                                   numeratorDegreesOfFreedom);
-        }
-        if (denominatorDegreesOfFreedom <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.DEGREES_OF_FREEDOM,
-                                                   denominatorDegreesOfFreedom);
-        }
-        this.numeratorDegreesOfFreedom = numeratorDegreesOfFreedom;
-        this.denominatorDegreesOfFreedom = denominatorDegreesOfFreedom;
-        solverAbsoluteAccuracy = inverseCumAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @since 2.1
-     */
-    public double density(double x) {
-        return FastMath.exp(logDensity(x));
-    }
-
-    /** {@inheritDoc} **/
-    @Override
-    public double logDensity(double x) {
-        final double nhalf = numeratorDegreesOfFreedom / 2;
-        final double mhalf = denominatorDegreesOfFreedom / 2;
-        final double logx = FastMath.log(x);
-        final double logn = FastMath.log(numeratorDegreesOfFreedom);
-        final double logm = FastMath.log(denominatorDegreesOfFreedom);
-        final double lognxm = FastMath.log(numeratorDegreesOfFreedom * x +
-                denominatorDegreesOfFreedom);
-        return nhalf * logn + nhalf * logx - logx +
-               mhalf * logm - nhalf * lognxm - mhalf * lognxm -
-               Beta.logBeta(nhalf, mhalf);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The implementation of this method is based on
-     * <ul>
-     *  <li>
-     *   <a href="http://mathworld.wolfram.com/F-Distribution.html">
-     *   F-Distribution</a>, equation (4).
-     *  </li>
-     * </ul>
-     */
-    public double cumulativeProbability(double x)  {
-        double ret;
-        if (x <= 0) {
-            ret = 0;
-        } else {
-            double n = numeratorDegreesOfFreedom;
-            double m = denominatorDegreesOfFreedom;
-
-            ret = Beta.regularizedBeta((n * x) / (m + n * x),
-                0.5 * n,
-                0.5 * m);
-        }
-        return ret;
-    }
-
-    /**
-     * Access the numerator degrees of freedom.
-     *
-     * @return the numerator degrees of freedom.
-     */
-    public double getNumeratorDegreesOfFreedom() {
-        return numeratorDegreesOfFreedom;
-    }
-
-    /**
-     * Access the denominator degrees of freedom.
-     *
-     * @return the denominator degrees of freedom.
-     */
-    public double getDenominatorDegreesOfFreedom() {
-        return denominatorDegreesOfFreedom;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For denominator degrees of freedom parameter {@code b}, the mean is
-     * <ul>
-     *  <li>if {@code b > 2} then {@code b / (b - 2)},</li>
-     *  <li>else undefined ({@code Double.NaN}).
-     * </ul>
-     */
-    public double getNumericalMean() {
-        final double denominatorDF = getDenominatorDegreesOfFreedom();
-
-        if (denominatorDF > 2) {
-            return denominatorDF / (denominatorDF - 2);
-        }
-
-        return Double.NaN;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For numerator degrees of freedom parameter {@code a} and denominator
-     * degrees of freedom parameter {@code b}, the variance is
-     * <ul>
-     *  <li>
-     *    if {@code b > 4} then
-     *    {@code [2 * b^2 * (a + b - 2)] / [a * (b - 2)^2 * (b - 4)]},
-     *  </li>
-     *  <li>else undefined ({@code Double.NaN}).
-     * </ul>
-     */
-    public double getNumericalVariance() {
-        if (!numericalVarianceIsCalculated) {
-            numericalVariance = calculateNumericalVariance();
-            numericalVarianceIsCalculated = true;
-        }
-        return numericalVariance;
-    }
-
-    /**
-     * used by {@link #getNumericalVariance()}
-     *
-     * @return the variance of this distribution
-     */
-    protected double calculateNumericalVariance() {
-        final double denominatorDF = getDenominatorDegreesOfFreedom();
-
-        if (denominatorDF > 4) {
-            final double numeratorDF = getNumeratorDegreesOfFreedom();
-            final double denomDFMinusTwo = denominatorDF - 2;
-
-            return ( 2 * (denominatorDF * denominatorDF) * (numeratorDF + denominatorDF - 2) ) /
-                   ( (numeratorDF * (denomDFMinusTwo * denomDFMinusTwo) * (denominatorDF - 4)) );
-        }
-
-        return Double.NaN;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the parameters.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity
-     * no matter the parameters.
-     *
-     * @return upper bound of the support (always Double.POSITIVE_INFINITY)
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java b/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
deleted file mode 100644
index 4f60fa9..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
+++ /dev/null
@@ -1,513 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.special.Gamma;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the Gamma distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Gamma_distribution">Gamma distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/GammaDistribution.html">Gamma distribution (MathWorld)</a>
- */
-public class GammaDistribution extends AbstractRealDistribution {
-    /**
-     * Default inverse cumulative probability accuracy.
-     * @since 2.1
-     */
-    public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20120524L;
-    /** The shape parameter. */
-    private final double shape;
-    /** The scale parameter. */
-    private final double scale;
-    /**
-     * The constant value of {@code shape + g + 0.5}, where {@code g} is the
-     * Lanczos constant {@link Gamma#LANCZOS_G}.
-     */
-    private final double shiftedShape;
-    /**
-     * The constant value of
-     * {@code shape / scale * sqrt(e / (2 * pi * (shape + g + 0.5))) / L(shape)},
-     * where {@code L(shape)} is the Lanczos approximation returned by
-     * {@link Gamma#lanczos(double)}. This prefactor is used in
-     * {@link #density(double)}, when no overflow occurs with the natural
-     * calculation.
-     */
-    private final double densityPrefactor1;
-    /**
-     * The constant value of
-     * {@code log(shape / scale * sqrt(e / (2 * pi * (shape + g + 0.5))) / L(shape))},
-     * where {@code L(shape)} is the Lanczos approximation returned by
-     * {@link Gamma#lanczos(double)}. This prefactor is used in
-     * {@link #logDensity(double)}, when no overflow occurs with the natural
-     * calculation.
-     */
-    private final double logDensityPrefactor1;
-    /**
-     * The constant value of
-     * {@code shape * sqrt(e / (2 * pi * (shape + g + 0.5))) / L(shape)},
-     * where {@code L(shape)} is the Lanczos approximation returned by
-     * {@link Gamma#lanczos(double)}. This prefactor is used in
-     * {@link #density(double)}, when overflow occurs with the natural
-     * calculation.
-     */
-    private final double densityPrefactor2;
-    /**
-     * The constant value of
-     * {@code log(shape * sqrt(e / (2 * pi * (shape + g + 0.5))) / L(shape))},
-     * where {@code L(shape)} is the Lanczos approximation returned by
-     * {@link Gamma#lanczos(double)}. This prefactor is used in
-     * {@link #logDensity(double)}, when overflow occurs with the natural
-     * calculation.
-     */
-    private final double logDensityPrefactor2;
-    /**
-     * Lower bound on {@code y = x / scale} for the selection of the computation
-     * method in {@link #density(double)}. For {@code y <= minY}, the natural
-     * calculation overflows.
-     */
-    private final double minY;
-    /**
-     * Upper bound on {@code log(y)} ({@code y = x / scale}) for the selection
-     * of the computation method in {@link #density(double)}. For
-     * {@code log(y) >= maxLogY}, the natural calculation overflows.
-     */
-    private final double maxLogY;
-    /** Inverse cumulative probability accuracy. */
-    private final double solverAbsoluteAccuracy;
-
-    /**
-     * Creates a new gamma distribution with specified values of the shape and
-     * scale parameters.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param shape the shape parameter
-     * @param scale the scale parameter
-     * @throws NotStrictlyPositiveException if {@code shape <= 0} or
-     * {@code scale <= 0}.
-     */
-    public GammaDistribution(double shape, double scale) throws NotStrictlyPositiveException {
-        this(shape, scale, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a new gamma distribution with specified values of the shape and
-     * scale parameters.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param shape the shape parameter
-     * @param scale the scale parameter
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code shape <= 0} or
-     * {@code scale <= 0}.
-     * @since 2.1
-     */
-    public GammaDistribution(double shape, double scale, double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        this(new Well19937c(), shape, scale, inverseCumAccuracy);
-    }
-
-    /**
-     * Creates a Gamma distribution.
-     *
-     * @param rng Random number generator.
-     * @param shape the shape parameter
-     * @param scale the scale parameter
-     * @throws NotStrictlyPositiveException if {@code shape <= 0} or
-     * {@code scale <= 0}.
-     * @since 3.3
-     */
-    public GammaDistribution(RandomGenerator rng, double shape, double scale)
-        throws NotStrictlyPositiveException {
-        this(rng, shape, scale, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
-    }
-
-    /**
-     * Creates a Gamma distribution.
-     *
-     * @param rng Random number generator.
-     * @param shape the shape parameter
-     * @param scale the scale parameter
-     * @param inverseCumAccuracy the maximum absolute error in inverse
-     * cumulative probability estimates (defaults to
-     * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code shape <= 0} or
-     * {@code scale <= 0}.
-     * @since 3.1
-     */
-    public GammaDistribution(RandomGenerator rng,
-                             double shape,
-                             double scale,
-                             double inverseCumAccuracy)
-        throws NotStrictlyPositiveException {
-        super(rng);
-
-        if (shape <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SHAPE, shape);
-        }
-        if (scale <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SCALE, scale);
-        }
-
-        this.shape = shape;
-        this.scale = scale;
-        this.solverAbsoluteAccuracy = inverseCumAccuracy;
-        this.shiftedShape = shape + Gamma.LANCZOS_G + 0.5;
-        final double aux = FastMath.E / (2.0 * FastMath.PI * shiftedShape);
-        this.densityPrefactor2 = shape * FastMath.sqrt(aux) / Gamma.lanczos(shape);
-        this.logDensityPrefactor2 = FastMath.log(shape) + 0.5 * FastMath.log(aux) -
-                                    FastMath.log(Gamma.lanczos(shape));
-        this.densityPrefactor1 = this.densityPrefactor2 / scale *
-                FastMath.pow(shiftedShape, -shape) *
-                FastMath.exp(shape + Gamma.LANCZOS_G);
-        this.logDensityPrefactor1 = this.logDensityPrefactor2 - FastMath.log(scale) -
-                FastMath.log(shiftedShape) * shape +
-                shape + Gamma.LANCZOS_G;
-        this.minY = shape + Gamma.LANCZOS_G - FastMath.log(Double.MAX_VALUE);
-        this.maxLogY = FastMath.log(Double.MAX_VALUE) / (shape - 1.0);
-    }
-
-    /**
-     * Returns the shape parameter of {@code this} distribution.
-     *
-     * @return the shape parameter
-     * @deprecated as of version 3.1, {@link #getShape()} should be preferred.
-     * This method will be removed in version 4.0.
-     */
-    @Deprecated
-    public double getAlpha() {
-        return shape;
-    }
-
-    /**
-     * Returns the shape parameter of {@code this} distribution.
-     *
-     * @return the shape parameter
-     * @since 3.1
-     */
-    public double getShape() {
-        return shape;
-    }
-
-    /**
-     * Returns the scale parameter of {@code this} distribution.
-     *
-     * @return the scale parameter
-     * @deprecated as of version 3.1, {@link #getScale()} should be preferred.
-     * This method will be removed in version 4.0.
-     */
-    @Deprecated
-    public double getBeta() {
-        return scale;
-    }
-
-    /**
-     * Returns the scale parameter of {@code this} distribution.
-     *
-     * @return the scale parameter
-     * @since 3.1
-     */
-    public double getScale() {
-        return scale;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-       /* The present method must return the value of
-        *
-        *     1       x a     - x
-        * ---------- (-)  exp(---)
-        * x Gamma(a)  b        b
-        *
-        * where a is the shape parameter, and b the scale parameter.
-        * Substituting the Lanczos approximation of Gamma(a) leads to the
-        * following expression of the density
-        *
-        * a              e            1         y      a
-        * - sqrt(------------------) ---- (-----------)  exp(a - y + g),
-        * x      2 pi (a + g + 0.5)  L(a)  a + g + 0.5
-        *
-        * where y = x / b. The above formula is the "natural" computation, which
-        * is implemented when no overflow is likely to occur. If overflow occurs
-        * with the natural computation, the following identity is used. It is
-        * based on the BOOST library
-        * http://www.boost.org/doc/libs/1_35_0/libs/math/doc/sf_and_dist/html/math_toolkit/special/sf_gamma/igamma.html
-        * Formula (15) needs adaptations, which are detailed below.
-        *
-        *       y      a
-        * (-----------)  exp(a - y + g)
-        *  a + g + 0.5
-        *                              y - a - g - 0.5    y (g + 0.5)
-        *               = exp(a log1pm(---------------) - ----------- + g),
-        *                                a + g + 0.5      a + g + 0.5
-        *
-        *  where log1pm(z) = log(1 + z) - z. Therefore, the value to be
-        *  returned is
-        *
-        * a              e            1
-        * - sqrt(------------------) ----
-        * x      2 pi (a + g + 0.5)  L(a)
-        *                              y - a - g - 0.5    y (g + 0.5)
-        *               * exp(a log1pm(---------------) - ----------- + g).
-        *                                a + g + 0.5      a + g + 0.5
-        */
-        if (x < 0) {
-            return 0;
-        }
-        final double y = x / scale;
-        if ((y <= minY) || (FastMath.log(y) >= maxLogY)) {
-            /*
-             * Overflow.
-             */
-            final double aux1 = (y - shiftedShape) / shiftedShape;
-            final double aux2 = shape * (FastMath.log1p(aux1) - aux1);
-            final double aux3 = -y * (Gamma.LANCZOS_G + 0.5) / shiftedShape +
-                    Gamma.LANCZOS_G + aux2;
-            return densityPrefactor2 / x * FastMath.exp(aux3);
-        }
-        /*
-         * Natural calculation.
-         */
-        return densityPrefactor1 * FastMath.exp(-y) * FastMath.pow(y, shape - 1);
-    }
-
-    /** {@inheritDoc} **/
-    @Override
-    public double logDensity(double x) {
-        /*
-         * see the comment in {@link #density(double)} for computation details
-         */
-        if (x < 0) {
-            return Double.NEGATIVE_INFINITY;
-        }
-        final double y = x / scale;
-        if ((y <= minY) || (FastMath.log(y) >= maxLogY)) {
-            /*
-             * Overflow.
-             */
-            final double aux1 = (y - shiftedShape) / shiftedShape;
-            final double aux2 = shape * (FastMath.log1p(aux1) - aux1);
-            final double aux3 = -y * (Gamma.LANCZOS_G + 0.5) / shiftedShape +
-                    Gamma.LANCZOS_G + aux2;
-            return logDensityPrefactor2 - FastMath.log(x) + aux3;
-        }
-        /*
-         * Natural calculation.
-         */
-        return logDensityPrefactor1 - y + FastMath.log(y) * (shape - 1);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The implementation of this method is based on:
-     * <ul>
-     *  <li>
-     *   <a href="http://mathworld.wolfram.com/Chi-SquaredDistribution.html">
-     *    Chi-Squared Distribution</a>, equation (9).
-     *  </li>
-     *  <li>Casella, G., & Berger, R. (1990). <i>Statistical Inference</i>.
-     *    Belmont, CA: Duxbury Press.
-     *  </li>
-     * </ul>
-     */
-    public double cumulativeProbability(double x) {
-        double ret;
-
-        if (x <= 0) {
-            ret = 0;
-        } else {
-            ret = Gamma.regularizedGammaP(shape, x / scale);
-        }
-
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    protected double getSolverAbsoluteAccuracy() {
-        return solverAbsoluteAccuracy;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For shape parameter {@code alpha} and scale parameter {@code beta}, the
-     * mean is {@code alpha * beta}.
-     */
-    public double getNumericalMean() {
-        return shape * scale;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For shape parameter {@code alpha} and scale parameter {@code beta}, the
-     * variance is {@code alpha * beta^2}.
-     *
-     * @return {@inheritDoc}
-     */
-    public double getNumericalVariance() {
-        return shape * scale * scale;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0 no matter the parameters.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public double getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is always positive infinity
-     * no matter the parameters.
-     *
-     * @return upper bound of the support (always Double.POSITIVE_INFINITY)
-     */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return true;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-    /**
-     * <p>This implementation uses the following algorithms: </p>
-     *
-     * <p>For 0 < shape < 1: <br/>
-     * Ahrens, J. H. and Dieter, U., <i>Computer methods for
-     * sampling from gamma, beta, Poisson and binomial distributions.</i>
-     * Computing, 12, 223-246, 1974.</p>
-     *
-     * <p>For shape >= 1: <br/>
-     * Marsaglia and Tsang, <i>A Simple Method for Generating
-     * Gamma Variables.</i> ACM Transactions on Mathematical Software,
-     * Volume 26 Issue 3, September, 2000.</p>
-     *
-     * @return random value sampled from the Gamma(shape, scale) distribution
-     */
-    @Override
-    public double sample()  {
-        if (shape < 1) {
-            // [1]: p. 228, Algorithm GS
-
-            while (true) {
-                // Step 1:
-                final double u = random.nextDouble();
-                final double bGS = 1 + shape / FastMath.E;
-                final double p = bGS * u;
-
-                if (p <= 1) {
-                    // Step 2:
-
-                    final double x = FastMath.pow(p, 1 / shape);
-                    final double u2 = random.nextDouble();
-
-                    if (u2 > FastMath.exp(-x)) {
-                        // Reject
-                        continue;
-                    } else {
-                        return scale * x;
-                    }
-                } else {
-                    // Step 3:
-
-                    final double x = -1 * FastMath.log((bGS - p) / shape);
-                    final double u2 = random.nextDouble();
-
-                    if (u2 > FastMath.pow(x, shape - 1)) {
-                        // Reject
-                        continue;
-                    } else {
-                        return scale * x;
-                    }
-                }
-            }
-        }
-
-        // Now shape >= 1
-
-        final double d = shape - 0.333333333333333333;
-        final double c = 1 / (3 * FastMath.sqrt(d));
-
-        while (true) {
-            final double x = random.nextGaussian();
-            final double v = (1 + c * x) * (1 + c * x) * (1 + c * x);
-
-            if (v <= 0) {
-                continue;
-            }
-
-            final double x2 = x * x;
-            final double u = random.nextDouble();
-
-            // Squeeze
-            if (u < 1 - 0.0331 * x2 * x2) {
-                return scale * d * v;
-            }
-
-            if (FastMath.log(u) < 0.5 * x2 + d * (1 - v + FastMath.log(v))) {
-                return scale * d * v;
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/GeometricDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/GeometricDistribution.java b/src/main/java/org/apache/commons/math3/distribution/GeometricDistribution.java
deleted file mode 100644
index f82a3ec..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/GeometricDistribution.java
+++ /dev/null
@@ -1,173 +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.distribution;
-
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the geometric distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Geometric_distribution">Geometric distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/GeometricDistribution.html">Geometric Distribution (MathWorld)</a>
- * @since 3.3
- */
-public class GeometricDistribution extends AbstractIntegerDistribution {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20130507L;
-    /** The probability of success. */
-    private final double probabilityOfSuccess;
-
-    /**
-     * Create a geometric distribution with the given probability of success.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param p probability of success.
-     * @throws OutOfRangeException if {@code p <= 0} or {@code p > 1}.
-     */
-    public GeometricDistribution(double p) {
-        this(new Well19937c(), p);
-    }
-
-    /**
-     * Creates a geometric distribution.
-     *
-     * @param rng Random number generator.
-     * @param p Probability of success.
-     * @throws OutOfRangeException if {@code p <= 0} or {@code p > 1}.
-     */
-    public GeometricDistribution(RandomGenerator rng, double p) {
-        super(rng);
-
-        if (p <= 0 || p > 1) {
-            throw new OutOfRangeException(LocalizedFormats.OUT_OF_RANGE_LEFT, p, 0, 1);
-        }
-
-        probabilityOfSuccess = p;
-    }
-
-    /**
-     * Access the probability of success for this distribution.
-     *
-     * @return the probability of success.
-     */
-    public double getProbabilityOfSuccess() {
-        return probabilityOfSuccess;
-    }
-
-    /** {@inheritDoc} */
-    public double probability(int x) {
-        double ret;
-        if (x < 0) {
-            ret = 0.0;
-        } else {
-            final double p = probabilityOfSuccess;
-            ret = FastMath.pow(1 - p, x) * p;
-        }
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logProbability(int x) {
-        double ret;
-        if (x < 0) {
-            ret = Double.NEGATIVE_INFINITY;
-        } else {
-            final double p = probabilityOfSuccess;
-            ret = x * FastMath.log1p(-p) + FastMath.log(p);
-        }
-        return ret;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(int x) {
-        double ret;
-        if (x < 0) {
-            ret = 0.0;
-        } else {
-            final double p = probabilityOfSuccess;
-            ret = 1.0 - FastMath.pow(1 - p, x + 1);
-        }
-        return ret;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For probability parameter {@code p}, the mean is {@code (1 - p) / p}.
-     */
-    public double getNumericalMean() {
-        final double p = probabilityOfSuccess;
-        return (1 - p) / p;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For probability parameter {@code p}, the variance is
-     * {@code (1 - p) / (p * p)}.
-     */
-    public double getNumericalVariance() {
-        final double p = probabilityOfSuccess;
-        return (1 - p) / (p * p);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The lower bound of the support is always 0.
-     *
-     * @return lower bound of the support (always 0)
-     */
-    public int getSupportLowerBound() {
-        return 0;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The upper bound of the support is infinite (which we approximate as
-     * {@code Integer.MAX_VALUE}).
-     *
-     * @return upper bound of the support (always Integer.MAX_VALUE)
-     */
-    public int getSupportUpperBound() {
-        return Integer.MAX_VALUE;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java b/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java
deleted file mode 100644
index 85dbedd..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/GumbelDistribution.java
+++ /dev/null
@@ -1,166 +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.distribution;
-
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-import org.apache.commons.math3.util.MathUtils;
-
-/**
- * This class implements the Gumbel distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Gumbel_distribution">Gumbel Distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/GumbelDistribution.html">Gumbel Distribution (Mathworld)</a>
- *
- * @since 3.4
- */
-public class GumbelDistribution extends AbstractRealDistribution {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = 20141003;
-
-    /**
-     * Approximation of Euler's constant
-     * see http://mathworld.wolfram.com/Euler-MascheroniConstantApproximations.html
-     */
-    private static final double EULER = FastMath.PI / (2 * FastMath.E);
-
-    /** The location parameter. */
-    private final double mu;
-    /** The scale parameter. */
-    private final double beta;
-
-    /**
-     * Build a new instance.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param mu location parameter
-     * @param beta scale parameter (must be positive)
-     * @throws NotStrictlyPositiveException if {@code beta <= 0}
-     */
-    public GumbelDistribution(double mu, double beta) {
-        this(new Well19937c(), mu, beta);
-    }
-
-    /**
-     * Build a new instance.
-     *
-     * @param rng Random number generator
-     * @param mu location parameter
-     * @param beta scale parameter (must be positive)
-     * @throws NotStrictlyPositiveException if {@code beta <= 0}
-     */
-    public GumbelDistribution(RandomGenerator rng, double mu, double beta) {
-        super(rng);
-
-        if (beta <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.SCALE, beta);
-        }
-
-        this.beta = beta;
-        this.mu = mu;
-    }
-
-    /**
-     * Access the location parameter, {@code mu}.
-     *
-     * @return the location parameter.
-     */
-    public double getLocation() {
-        return mu;
-    }
-
-    /**
-     * Access the scale parameter, {@code beta}.
-     *
-     * @return the scale parameter.
-     */
-    public double getScale() {
-        return beta;
-    }
-
-    /** {@inheritDoc} */
-    public double density(double x) {
-        final double z = (x - mu) / beta;
-        final double t = FastMath.exp(-z);
-        return FastMath.exp(-z - t) / beta;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(double x) {
-        final double z = (x - mu) / beta;
-        return FastMath.exp(-FastMath.exp(-z));
-    }
-
-    @Override
-    public double inverseCumulativeProbability(double p) throws OutOfRangeException {
-        if (p < 0.0 || p > 1.0) {
-            throw new OutOfRangeException(p, 0.0, 1.0);
-        } else if (p == 0) {
-            return Double.NEGATIVE_INFINITY;
-        } else if (p == 1) {
-            return Double.POSITIVE_INFINITY;
-        }
-        return mu - FastMath.log(-FastMath.log(p)) * beta;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalMean() {
-        return mu + EULER * beta;
-    }
-
-    /** {@inheritDoc} */
-    public double getNumericalVariance() {
-        return (MathUtils.PI_SQUARED) / 6.0 * (beta * beta);
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportLowerBound() {
-        return Double.NEGATIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public double getSupportUpperBound() {
-        return Double.POSITIVE_INFINITY;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportLowerBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportUpperBoundInclusive() {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    public boolean isSupportConnected() {
-        return true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/HypergeometricDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/HypergeometricDistribution.java b/src/main/java/org/apache/commons/math3/distribution/HypergeometricDistribution.java
deleted file mode 100644
index 7a1436a..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/HypergeometricDistribution.java
+++ /dev/null
@@ -1,347 +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.distribution;
-
-import org.apache.commons.math3.exception.NotPositiveException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.random.RandomGenerator;
-import org.apache.commons.math3.random.Well19937c;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the hypergeometric distribution.
- *
- * @see <a href="http://en.wikipedia.org/wiki/Hypergeometric_distribution">Hypergeometric distribution (Wikipedia)</a>
- * @see <a href="http://mathworld.wolfram.com/HypergeometricDistribution.html">Hypergeometric distribution (MathWorld)</a>
- */
-public class HypergeometricDistribution extends AbstractIntegerDistribution {
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -436928820673516179L;
-    /** The number of successes in the population. */
-    private final int numberOfSuccesses;
-    /** The population size. */
-    private final int populationSize;
-    /** The sample size. */
-    private final int sampleSize;
-    /** Cached numerical variance */
-    private double numericalVariance = Double.NaN;
-    /** Whether or not the numerical variance has been calculated */
-    private boolean numericalVarianceIsCalculated = false;
-
-    /**
-     * Construct a new hypergeometric distribution with the specified population
-     * size, number of successes in the population, and sample size.
-     * <p>
-     * <b>Note:</b> this constructor will implicitly create an instance of
-     * {@link Well19937c} as random generator to be used for sampling only (see
-     * {@link #sample()} and {@link #sample(int)}). In case no sampling is
-     * needed for the created distribution, it is advised to pass {@code null}
-     * as random generator via the appropriate constructors to avoid the
-     * additional initialisation overhead.
-     *
-     * @param populationSize Population size.
-     * @param numberOfSuccesses Number of successes in the population.
-     * @param sampleSize Sample size.
-     * @throws NotPositiveException if {@code numberOfSuccesses < 0}.
-     * @throws NotStrictlyPositiveException if {@code populationSize <= 0}.
-     * @throws NumberIsTooLargeException if {@code numberOfSuccesses > populationSize},
-     * or {@code sampleSize > populationSize}.
-     */
-    public HypergeometricDistribution(int populationSize, int numberOfSuccesses, int sampleSize)
-    throws NotPositiveException, NotStrictlyPositiveException, NumberIsTooLargeException {
-        this(new Well19937c(), populationSize, numberOfSuccesses, sampleSize);
-    }
-
-    /**
-     * Creates a new hypergeometric distribution.
-     *
-     * @param rng Random number generator.
-     * @param populationSize Population size.
-     * @param numberOfSuccesses Number of successes in the population.
-     * @param sampleSize Sample size.
-     * @throws NotPositiveException if {@code numberOfSuccesses < 0}.
-     * @throws NotStrictlyPositiveException if {@code populationSize <= 0}.
-     * @throws NumberIsTooLargeException if {@code numberOfSuccesses > populationSize},
-     * or {@code sampleSize > populationSize}.
-     * @since 3.1
-     */
-    public HypergeometricDistribution(RandomGenerator rng,
-                                      int populationSize,
-                                      int numberOfSuccesses,
-                                      int sampleSize)
-    throws NotPositiveException, NotStrictlyPositiveException, NumberIsTooLargeException {
-        super(rng);
-
-        if (populationSize <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.POPULATION_SIZE,
-                                                   populationSize);
-        }
-        if (numberOfSuccesses < 0) {
-            throw new NotPositiveException(LocalizedFormats.NUMBER_OF_SUCCESSES,
-                                           numberOfSuccesses);
-        }
-        if (sampleSize < 0) {
-            throw new NotPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
-                                           sampleSize);
-        }
-
-        if (numberOfSuccesses > populationSize) {
-            throw new NumberIsTooLargeException(LocalizedFormats.NUMBER_OF_SUCCESS_LARGER_THAN_POPULATION_SIZE,
-                                                numberOfSuccesses, populationSize, true);
-        }
-        if (sampleSize > populationSize) {
-            throw new NumberIsTooLargeException(LocalizedFormats.SAMPLE_SIZE_LARGER_THAN_POPULATION_SIZE,
-                                                sampleSize, populationSize, true);
-        }
-
-        this.numberOfSuccesses = numberOfSuccesses;
-        this.populationSize = populationSize;
-        this.sampleSize = sampleSize;
-    }
-
-    /** {@inheritDoc} */
-    public double cumulativeProbability(int x) {
-        double ret;
-
-        int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize);
-        if (x < domain[0]) {
-            ret = 0.0;
-        } else if (x >= domain[1]) {
-            ret = 1.0;
-        } else {
-            ret = innerCumulativeProbability(domain[0], x, 1);
-        }
-
-        return ret;
-    }
-
-    /**
-     * Return the domain for the given hypergeometric distribution parameters.
-     *
-     * @param n Population size.
-     * @param m Number of successes in the population.
-     * @param k Sample size.
-     * @return a two element array containing the lower and upper bounds of the
-     * hypergeometric distribution.
-     */
-    private int[] getDomain(int n, int m, int k) {
-        return new int[] { getLowerDomain(n, m, k), getUpperDomain(m, k) };
-    }
-
-    /**
-     * Return the lowest domain value for the given hypergeometric distribution
-     * parameters.
-     *
-     * @param n Population size.
-     * @param m Number of successes in the population.
-     * @param k Sample size.
-     * @return the lowest domain value of the hypergeometric distribution.
-     */
-    private int getLowerDomain(int n, int m, int k) {
-        return FastMath.max(0, m - (n - k));
-    }
-
-    /**
-     * Access the number of successes.
-     *
-     * @return the number of successes.
-     */
-    public int getNumberOfSuccesses() {
-        return numberOfSuccesses;
-    }
-
-    /**
-     * Access the population size.
-     *
-     * @return the population size.
-     */
-    public int getPopulationSize() {
-        return populationSize;
-    }
-
-    /**
-     * Access the sample size.
-     *
-     * @return the sample size.
-     */
-    public int getSampleSize() {
-        return sampleSize;
-    }
-
-    /**
-     * Return the highest domain value for the given hypergeometric distribution
-     * parameters.
-     *
-     * @param m Number of successes in the population.
-     * @param k Sample size.
-     * @return the highest domain value of the hypergeometric distribution.
-     */
-    private int getUpperDomain(int m, int k) {
-        return FastMath.min(k, m);
-    }
-
-    /** {@inheritDoc} */
-    public double probability(int x) {
-        final double logProbability = logProbability(x);
-        return logProbability == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logProbability);
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public double logProbability(int x) {
-        double ret;
-
-        int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize);
-        if (x < domain[0] || x > domain[1]) {
-            ret = Double.NEGATIVE_INFINITY;
-        } else {
-            double p = (double) sampleSize / (double) populationSize;
-            double q = (double) (populationSize - sampleSize) / (double) populationSize;
-            double p1 = SaddlePointExpansion.logBinomialProbability(x,
-                    numberOfSuccesses, p, q);
-            double p2 =
-                    SaddlePointExpansion.logBinomialProbability(sampleSize - x,
-                            populationSize - numberOfSuccesses, p, q);
-            double p3 =
-                    SaddlePointExpansion.logBinomialProbability(sampleSize, populationSize, p, q);
-            ret = p1 + p2 - p3;
-        }
-
-        return ret;
-    }
-
-    /**
-     * For this distribution, {@code X}, this method returns {@code P(X >= x)}.
-     *
-     * @param x Value at which the CDF is evaluated.
-     * @return the upper tail CDF for this distribution.
-     * @since 1.1
-     */
-    public double upperCumulativeProbability(int x) {
-        double ret;
-
-        final int[] domain = getDomain(populationSize, numberOfSuccesses, sampleSize);
-        if (x <= domain[0]) {
-            ret = 1.0;
-        } else if (x > domain[1]) {
-            ret = 0.0;
-        } else {
-            ret = innerCumulativeProbability(domain[1], x, -1);
-        }
-
-        return ret;
-    }
-
-    /**
-     * For this distribution, {@code X}, this method returns
-     * {@code P(x0 <= X <= x1)}.
-     * This probability is computed by summing the point probabilities for the
-     * values {@code x0, x0 + 1, x0 + 2, ..., x1}, in the order directed by
-     * {@code dx}.
-     *
-     * @param x0 Inclusive lower bound.
-     * @param x1 Inclusive upper bound.
-     * @param dx Direction of summation (1 indicates summing from x0 to x1, and
-     * 0 indicates summing from x1 to x0).
-     * @return {@code P(x0 <= X <= x1)}.
-     */
-    private double innerCumulativeProbability(int x0, int x1, int dx) {
-        double ret = probability(x0);
-        while (x0 != x1) {
-            x0 += dx;
-            ret += probability(x0);
-        }
-        return ret;
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For population size {@code N}, number of successes {@code m}, and sample
-     * size {@code n}, the mean is {@code n * m / N}.
-     */
-    public double getNumericalMean() {
-        return getSampleSize() * (getNumberOfSuccesses() / (double) getPopulationSize());
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For population size {@code N}, number of successes {@code m}, and sample
-     * size {@code n}, the variance is
-     * {@code [n * m * (N - n) * (N - m)] / [N^2 * (N - 1)]}.
-     */
-    public double getNumericalVariance() {
-        if (!numericalVarianceIsCalculated) {
-            numericalVariance = calculateNumericalVariance();
-            numericalVarianceIsCalculated = true;
-        }
-        return numericalVariance;
-    }
-
-    /**
-     * Used by {@link #getNumericalVariance()}.
-     *
-     * @return the variance of this distribution
-     */
-    protected double calculateNumericalVariance() {
-        final double N = getPopulationSize();
-        final double m = getNumberOfSuccesses();
-        final double n = getSampleSize();
-        return (n * m * (N - n) * (N - m)) / (N * N * (N - 1));
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For population size {@code N}, number of successes {@code m}, and sample
-     * size {@code n}, the lower bound of the support is
-     * {@code max(0, n + m - N)}.
-     *
-     * @return lower bound of the support
-     */
-    public int getSupportLowerBound() {
-        return FastMath.max(0,
-                            getSampleSize() + getNumberOfSuccesses() - getPopulationSize());
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * For number of successes {@code m} and sample size {@code n}, the upper
-     * bound of the support is {@code min(m, n)}.
-     *
-     * @return upper bound of the support
-     */
-    public int getSupportUpperBound() {
-        return FastMath.min(getNumberOfSuccesses(), getSampleSize());
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * The support of this distribution is connected.
-     *
-     * @return {@code true}
-     */
-    public boolean isSupportConnected() {
-        return true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/IntegerDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/IntegerDistribution.java b/src/main/java/org/apache/commons/math3/distribution/IntegerDistribution.java
deleted file mode 100644
index 9ab4a04..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/IntegerDistribution.java
+++ /dev/null
@@ -1,155 +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.distribution;
-
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.OutOfRangeException;
-
-/**
- * Interface for distributions on the integers.
- *
- */
-public interface IntegerDistribution {
-    /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(X = x)}. In other
-     * words, this method represents the probability mass function (PMF)
-     * for the distribution.
-     *
-     * @param x the point at which the PMF is evaluated
-     * @return the value of the probability mass function at {@code x}
-     */
-    double probability(int x);
-
-    /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(X <= x)}.  In other
-     * words, this method represents the (cumulative) distribution function
-     * (CDF) for this distribution.
-     *
-     * @param x the point at which the CDF is evaluated
-     * @return the probability that a random variable with this
-     * distribution takes a value less than or equal to {@code x}
-     */
-    double cumulativeProbability(int x);
-
-    /**
-     * For a random variable {@code X} whose values are distributed according
-     * to this distribution, this method returns {@code P(x0 < X <= x1)}.
-     *
-     * @param x0 the exclusive lower bound
-     * @param x1 the inclusive upper bound
-     * @return the probability that a random variable with this distribution
-     * will take a value between {@code x0} and {@code x1},
-     * excluding the lower and including the upper endpoint
-     * @throws NumberIsTooLargeException if {@code x0 > x1}
-     */
-    double cumulativeProbability(int x0, int x1) throws NumberIsTooLargeException;
-
-    /**
-     * Computes the quantile function of this distribution.
-     * For a random variable {@code X} distributed according to this distribution,
-     * the returned value is
-     * <ul>
-     * <li><code>inf{x in Z | P(X<=x) >= p}</code> for {@code 0 < p <= 1},</li>
-     * <li><code>inf{x in Z | P(X<=x) > 0}</code> for {@code p = 0}.</li>
-     * </ul>
-     * If the result exceeds the range of the data type {@code int},
-     * then {@code Integer.MIN_VALUE} or {@code Integer.MAX_VALUE} is returned.
-     *
-     * @param p the cumulative probability
-     * @return the smallest {@code p}-quantile of this distribution
-     * (largest 0-quantile for {@code p = 0})
-     * @throws OutOfRangeException if {@code p < 0} or {@code p > 1}
-     */
-    int inverseCumulativeProbability(double p) throws OutOfRangeException;
-
-    /**
-     * Use this method to get the numerical value of the mean of this
-     * distribution.
-     *
-     * @return the mean or {@code Double.NaN} if it is not defined
-     */
-    double getNumericalMean();
-
-    /**
-     * Use this method to get the numerical value of the variance of this
-     * distribution.
-     *
-     * @return the variance (possibly {@code Double.POSITIVE_INFINITY} or
-     * {@code Double.NaN} if it is not defined)
-     */
-    double getNumericalVariance();
-
-    /**
-     * Access the lower bound of the support. This method must return the same
-     * value as {@code inverseCumulativeProbability(0)}. In other words, this
-     * method must return
-     * <p><code>inf {x in Z | P(X <= x) > 0}</code>.</p>
-     *
-     * @return lower bound of the support ({@code Integer.MIN_VALUE}
-     * for negative infinity)
-     */
-    int getSupportLowerBound();
-
-    /**
-     * Access the upper bound of the support. This method must return the same
-     * value as {@code inverseCumulativeProbability(1)}. In other words, this
-     * method must return
-     * <p><code>inf {x in R | P(X <= x) = 1}</code>.</p>
-     *
-     * @return upper bound of the support ({@code Integer.MAX_VALUE}
-     * for positive infinity)
-     */
-    int getSupportUpperBound();
-
-    /**
-     * Use this method to get information about whether the support is
-     * connected, i.e. whether all integers between the lower and upper bound of
-     * the support are included in the support.
-     *
-     * @return whether the support is connected or not
-     */
-    boolean isSupportConnected();
-
-    /**
-     * Reseed the random generator used to generate samples.
-     *
-     * @param seed the new seed
-     * @since 3.0
-     */
-    void reseedRandomGenerator(long seed);
-
-    /**
-     * Generate a random value sampled from this distribution.
-     *
-     * @return a random value
-     * @since 3.0
-     */
-    int sample();
-
-    /**
-     * Generate a random sample from the distribution.
-     *
-     * @param sampleSize the number of random values to generate
-     * @return an array representing the random sample
-     * @throws org.apache.commons.math3.exception.NotStrictlyPositiveException
-     * if {@code sampleSize} is not positive
-     * @since 3.0
-     */
-    int[] sample(int sampleSize);
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/a7b4803f/src/main/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistribution.java b/src/main/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistribution.java
deleted file mode 100644
index 7af514d..0000000
--- a/src/main/java/org/apache/commons/math3/distribution/KolmogorovSmirnovDistribution.java
+++ /dev/null
@@ -1,357 +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.distribution;
-
-import java.io.Serializable;
-import java.math.BigDecimal;
-
-import org.apache.commons.math3.exception.MathArithmeticException;
-import org.apache.commons.math3.exception.NotStrictlyPositiveException;
-import org.apache.commons.math3.exception.NumberIsTooLargeException;
-import org.apache.commons.math3.exception.util.LocalizedFormats;
-import org.apache.commons.math3.fraction.BigFraction;
-import org.apache.commons.math3.fraction.BigFractionField;
-import org.apache.commons.math3.fraction.FractionConversionException;
-import org.apache.commons.math3.linear.Array2DRowFieldMatrix;
-import org.apache.commons.math3.linear.Array2DRowRealMatrix;
-import org.apache.commons.math3.linear.FieldMatrix;
-import org.apache.commons.math3.linear.RealMatrix;
-import org.apache.commons.math3.util.FastMath;
-
-/**
- * Implementation of the Kolmogorov-Smirnov distribution.
- *
- * <p>
- * Treats the distribution of the two-sided {@code P(D_n < d)} where
- * {@code D_n = sup_x |G(x) - G_n (x)|} for the theoretical cdf {@code G} and
- * the empirical cdf {@code G_n}.
- * </p>
- * <p>
- * This implementation is based on [1] with certain quick decisions for extreme
- * values given in [2].
- * </p>
- * <p>
- * In short, when wanting to evaluate {@code P(D_n < d)}, the method in [1] is
- * to write {@code d = (k - h) / n} for positive integer {@code k} and
- * {@code 0 <= h < 1}. Then {@code P(D_n < d) = (n! / n^n) * t_kk}, where
- * {@code t_kk} is the {@code (k, k)}'th entry in the special matrix
- * {@code H^n}, i.e. {@code H} to the {@code n}'th power.
- * </p>
- * <p>
- * References:
- * <ul>
- * <li>[1] <a href="http://www.jstatsoft.org/v08/i18/">
- * Evaluating Kolmogorov's Distribution</a> by George Marsaglia, Wai
- * Wan Tsang, and Jingbo Wang</li>
- * <li>[2] <a href="http://www.jstatsoft.org/v39/i11/">
- * Computing the Two-Sided Kolmogorov-Smirnov Distribution</a> by Richard Simard
- * and Pierre L'Ecuyer</li>
- * </ul>
- * Note that [1] contains an error in computing h, refer to
- * <a href="https://issues.apache.org/jira/browse/MATH-437">MATH-437</a> for details.
- * </p>
- *
- * @see <a href="http://en.wikipedia.org/wiki/Kolmogorov-Smirnov_test">
- * Kolmogorov-Smirnov test (Wikipedia)</a>
- * @deprecated to be removed in version 4.0 -
- *  use {@link org.apache.commons.math3.stat.inference.KolmogorovSmirnovTest}
- */
-public class KolmogorovSmirnovDistribution implements Serializable {
-
-    /** Serializable version identifier. */
-    private static final long serialVersionUID = -4670676796862967187L;
-
-    /** Number of observations. */
-    private int n;
-
-    /**
-     * @param n Number of observations
-     * @throws NotStrictlyPositiveException if {@code n <= 0}
-     */
-    public KolmogorovSmirnovDistribution(int n)
-        throws NotStrictlyPositiveException {
-        if (n <= 0) {
-            throw new NotStrictlyPositiveException(LocalizedFormats.NOT_POSITIVE_NUMBER_OF_SAMPLES, n);
-        }
-
-        this.n = n;
-    }
-
-    /**
-     * Calculates {@code P(D_n < d)} using method described in [1] with quick
-     * decisions for extreme values given in [2] (see above). The result is not
-     * exact as with
-     * {@link KolmogorovSmirnovDistribution#cdfExact(double)} because
-     * calculations are based on {@code double} rather than
-     * {@link org.apache.commons.math3.fraction.BigFraction}.
-     *
-     * @param d statistic
-     * @return the two-sided probability of {@code P(D_n < d)}
-     * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
-     * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
-     * {@code 0 <= h < 1}.
-     */
-    public double cdf(double d) throws MathArithmeticException {
-        return this.cdf(d, false);
-    }
-
-    /**
-     * Calculates {@code P(D_n < d)} using method described in [1] with quick
-     * decisions for extreme values given in [2] (see above). The result is
-     * exact in the sense that BigFraction/BigReal is used everywhere at the
-     * expense of very slow execution time. Almost never choose this in real
-     * applications unless you are very sure; this is almost solely for
-     * verification purposes. Normally, you would choose
-     * {@link KolmogorovSmirnovDistribution#cdf(double)}
-     *
-     * @param d statistic
-     * @return the two-sided probability of {@code P(D_n < d)}
-     * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
-     * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
-     * {@code 0 <= h < 1}.
-     */
-    public double cdfExact(double d) throws MathArithmeticException {
-        return this.cdf(d, true);
-    }
-
-    /**
-     * Calculates {@code P(D_n < d)} using method described in [1] with quick
-     * decisions for extreme values given in [2] (see above).
-     *
-     * @param d statistic
-     * @param exact whether the probability should be calculated exact using
-     * {@link org.apache.commons.math3.fraction.BigFraction} everywhere at the
-     * expense of very slow execution time, or if {@code double} should be used
-     * convenient places to gain speed. Almost never choose {@code true} in real
-     * applications unless you are very sure; {@code true} is almost solely for
-     * verification purposes.
-     * @return the two-sided probability of {@code P(D_n < d)}
-     * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
-     * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
-     * {@code 0 <= h < 1}.
-     */
-    public double cdf(double d, boolean exact) throws MathArithmeticException {
-
-        final double ninv = 1 / ((double) n);
-        final double ninvhalf = 0.5 * ninv;
-
-        if (d <= ninvhalf) {
-
-            return 0;
-
-        } else if (ninvhalf < d && d <= ninv) {
-
-            double res = 1;
-            double f = 2 * d - ninv;
-
-            // n! f^n = n*f * (n-1)*f * ... * 1*x
-            for (int i = 1; i <= n; ++i) {
-                res *= i * f;
-            }
-
-            return res;
-
-        } else if (1 - ninv <= d && d < 1) {
-
-            return 1 - 2 * FastMath.pow(1 - d, n);
-
-        } else if (1 <= d) {
-
-            return 1;
-        }
-
-        return exact ? exactK(d) : roundedK(d);
-    }
-
-    /**
-     * Calculates the exact value of {@code P(D_n < d)} using method described
-     * in [1] and {@link org.apache.commons.math3.fraction.BigFraction} (see
-     * above).
-     *
-     * @param d statistic
-     * @return the two-sided probability of {@code P(D_n < d)}
-     * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
-     * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
-     * {@code 0 <= h < 1}.
-     */
-    private double exactK(double d) throws MathArithmeticException {
-
-        final int k = (int) FastMath.ceil(n * d);
-
-        final FieldMatrix<BigFraction> H = this.createH(d);
-        final FieldMatrix<BigFraction> Hpower = H.power(n);
-
-        BigFraction pFrac = Hpower.getEntry(k - 1, k - 1);
-
-        for (int i = 1; i <= n; ++i) {
-            pFrac = pFrac.multiply(i).divide(n);
-        }
-
-        /*
-         * BigFraction.doubleValue converts numerator to double and the
-         * denominator to double and divides afterwards. That gives NaN quite
-         * easy. This does not (scale is the number of digits):
-         */
-        return pFrac.bigDecimalValue(20, BigDecimal.ROUND_HALF_UP).doubleValue();
-    }
-
-    /**
-     * Calculates {@code P(D_n < d)} using method described in [1] and doubles
-     * (see above).
-     *
-     * @param d statistic
-     * @return the two-sided probability of {@code P(D_n < d)}
-     * @throws MathArithmeticException if algorithm fails to convert {@code h}
-     * to a {@link org.apache.commons.math3.fraction.BigFraction} in expressing
-     * {@code d} as {@code (k - h) / m} for integer {@code k, m} and
-     * {@code 0 <= h < 1}.
-     */
-    private double roundedK(double d) throws MathArithmeticException {
-
-        final int k = (int) FastMath.ceil(n * d);
-        final FieldMatrix<BigFraction> HBigFraction = this.createH(d);
-        final int m = HBigFraction.getRowDimension();
-
-        /*
-         * Here the rounding part comes into play: use
-         * RealMatrix instead of FieldMatrix<BigFraction>
-         */
-        final RealMatrix H = new Array2DRowRealMatrix(m, m);
-
-        for (int i = 0; i < m; ++i) {
-            for (int j = 0; j < m; ++j) {
-                H.setEntry(i, j, HBigFraction.getEntry(i, j).doubleValue());
-            }
-        }
-
-        final RealMatrix Hpower = H.power(n);
-
-        double pFrac = Hpower.getEntry(k - 1, k - 1);
-
-        for (int i = 1; i <= n; ++i) {
-            pFrac *= (double) i / (double) n;
-        }
-
-        return pFrac;
-    }
-
-    /***
-     * Creates {@code H} of size {@code m x m} as described in [1] (see above).
-     *
-     * @param d statistic
-     * @return H matrix
-     * @throws NumberIsTooLargeException if fractional part is greater than 1
-     * @throws FractionConversionException if algorithm fails to convert
-     * {@code h} to a {@link org.apache.commons.math3.fraction.BigFraction} in
-     * expressing {@code d} as {@code (k - h) / m} for integer {@code k, m} and
-     * {@code 0 <= h < 1}.
-     */
-    private FieldMatrix<BigFraction> createH(double d)
-            throws NumberIsTooLargeException, FractionConversionException {
-
-        int k = (int) FastMath.ceil(n * d);
-
-        int m = 2 * k - 1;
-        double hDouble = k - n * d;
-
-        if (hDouble >= 1) {
-            throw new NumberIsTooLargeException(hDouble, 1.0, false);
-        }
-
-        BigFraction h = null;
-
-        try {
-            h = new BigFraction(hDouble, 1.0e-20, 10000);
-        } catch (FractionConversionException e1) {
-            try {
-                h = new BigFraction(hDouble, 1.0e-10, 10000);
-            } catch (FractionConversionException e2) {
-                h = new BigFraction(hDouble, 1.0e-5, 10000);
-            }
-        }
-
-        final BigFraction[][] Hdata = new BigFraction[m][m];
-
-        /*
-         * Start by filling everything with either 0 or 1.
-         */
-        for (int i = 0; i < m; ++i) {
-            for (int j = 0; j < m; ++j) {
-                if (i - j + 1 < 0) {
-                    Hdata[i][j] = BigFraction.ZERO;
-                } else {
-                    Hdata[i][j] = BigFraction.ONE;
-                }
-            }
-        }
-
-        /*
-         * Setting up power-array to avoid calculating the same value twice:
-         * hPowers[0] = h^1 ... hPowers[m-1] = h^m
-         */
-        final BigFraction[] hPowers = new BigFraction[m];
-        hPowers[0] = h;
-        for (int i = 1; i < m; ++i) {
-            hPowers[i] = h.multiply(hPowers[i - 1]);
-        }
-
-        /*
-         * First column and last row has special values (each other reversed).
-         */
-        for (int i = 0; i < m; ++i) {
-            Hdata[i][0] = Hdata[i][0].subtract(hPowers[i]);
-            Hdata[m - 1][i] = Hdata[m - 1][i].subtract(hPowers[m - i - 1]);
-        }
-
-        /*
-         * [1] states: "For 1/2 < h < 1 the bottom left element of the matrix
-         * should be (1 - 2*h^m + (2h - 1)^m )/m!" Since 0 <= h < 1, then if h >
-         * 1/2 is sufficient to check:
-         */
-        if (h.compareTo(BigFraction.ONE_HALF) == 1) {
-            Hdata[m - 1][0] = Hdata[m - 1][0].add(h.multiply(2).subtract(1).pow(m));
-        }
-
-        /*
-         * Aside from the first column and last row, the (i, j)-th element is
-         * 1/(i - j + 1)! if i - j + 1 >= 0, else 0. 1's and 0's are already
-         * put, so only division with (i - j + 1)! is needed in the elements
-         * that have 1's. There is no need to calculate (i - j + 1)! and then
-         * divide - small steps avoid overflows.
-         *
-         * Note that i - j + 1 > 0 <=> i + 1 > j instead of j'ing all the way to
-         * m. Also note that it is started at g = 2 because dividing by 1 isn't
-         * really necessary.
-         */
-        for (int i = 0; i < m; ++i) {
-            for (int j = 0; j < i + 1; ++j) {
-                if (i - j + 1 > 0) {
-                    for (int g = 2; g <= i - j + 1; ++g) {
-                        Hdata[i][j] = Hdata[i][j].divide(g);
-                    }
-                }
-            }
-        }
-
-        return new Array2DRowFieldMatrix<BigFraction>(BigFractionField.getInstance(), Hdata);
-    }
-}