commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbros...@apache.org
Subject svn commit: r1517418 - in /commons/proper/math/trunk/src/main/java/org/apache/commons/math3: analysis/differentiation/ distribution/ distribution/fitting/ geometry/euclidean/threed/ geometry/euclidean/twod/ ode/ optim/linear/ optimization/linear/
Date Mon, 26 Aug 2013 03:18:55 GMT
Author: dbrosius
Date: Mon Aug 26 03:18:55 2013
New Revision: 1517418

URL: http://svn.apache.org/r1517418
Log:
presize collections

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/AbstractIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexTableau.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/linear/SimplexTableau.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/DSCompiler.java
Mon Aug 26 03:18:55 2013
@@ -361,7 +361,7 @@ public class DSCompiler {
 
         for (int i = 0; i < dSize; ++i) {
             final int[][] dRow = derivativeCompiler.multIndirection[i];
-            List<int[]> row = new ArrayList<int[]>();
+            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]]
});

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateNormalDistribution.java
Mon Aug 26 03:18:55 2013
@@ -83,7 +83,7 @@ public class MixtureMultivariateNormalDi
                                                                                        double[][]
means,
                                                                                        double[][][]
covariances) {
         final List<Pair<Double, MultivariateNormalDistribution>> mvns
-            = new ArrayList<Pair<Double, MultivariateNormalDistribution>>();
+            = new ArrayList<Pair<Double, MultivariateNormalDistribution>>(weights.length);
 
         for (int i = 0; i < weights.length; i++) {
             final MultivariateNormalDistribution dist

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/MixtureMultivariateRealDistribution.java
Mon Aug 26 03:18:55 2013
@@ -153,7 +153,7 @@ public class MixtureMultivariateRealDist
      * @return the component distributions and associated weights.
      */
     public List<Pair<Double, T>> getComponents() {
-        final List<Pair<Double, T>> list = new ArrayList<Pair<Double, T>>();
+        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)));

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/fitting/MultivariateNormalMixtureExpectationMaximization.java
Mon Aug 26 03:18:55 2013
@@ -327,7 +327,7 @@ public class MultivariateNormalMixtureEx
 
         // components of mixture model to be created
         final List<Pair<Double, MultivariateNormalDistribution>> components =
-                new ArrayList<Pair<Double, MultivariateNormalDistribution>>();
+                new ArrayList<Pair<Double, MultivariateNormalDistribution>>(numComponents);
 
         // create a component based on data in each bin
         for (int binIndex = 0; binIndex < numComponents; binIndex++) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/threed/SubLine.java
Mon Aug 26 03:18:55 2013
@@ -81,7 +81,7 @@ public class SubLine {
     public List<Segment> getSegments() {
 
         final List<Interval> list = remainingRegion.asList();
-        final List<Segment> segments = new ArrayList<Segment>();
+        final List<Segment> segments = new ArrayList<Segment>(list.size());
 
         for (final Interval interval : list) {
             final Vector3D start = line.toSpace(new Vector1D(interval.getInf()));

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/PolygonsSet.java
Mon Aug 26 03:18:55 2013
@@ -186,7 +186,7 @@ public class PolygonsSet extends Abstrac
         }
 
         // build the edges
-        List<Edge> edges = new ArrayList<Edge>();
+        List<Edge> edges = new ArrayList<Edge>(n);
         for (int i = 0; i < n; ++i) {
 
             // get the endpoints of the edge

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/geometry/euclidean/twod/SubLine.java
Mon Aug 26 03:18:55 2013
@@ -81,7 +81,7 @@ public class SubLine extends AbstractSub
 
         final Line line = (Line) getHyperplane();
         final List<Interval> list = ((IntervalsSet) getRemainingRegion()).asList();
-        final List<Segment> segments = new ArrayList<Segment>();
+        final List<Segment> segments = new ArrayList<Segment>(list.size());
 
         for (final Interval interval : list) {
             final Vector2D start = line.toSpace(new Vector1D(interval.getInf()));

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/AbstractIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/AbstractIntegrator.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/AbstractIntegrator.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/ode/AbstractIntegrator.java
Mon Aug 26 03:18:55 2013
@@ -141,7 +141,7 @@ public abstract class AbstractIntegrator
 
     /** {@inheritDoc} */
     public Collection<EventHandler> getEventHandlers() {
-        final List<EventHandler> list = new ArrayList<EventHandler>();
+        final List<EventHandler> list = new ArrayList<EventHandler>(eventsStates.size());
         for (EventState state : eventsStates) {
             list.add(state.getEventHandler());
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexTableau.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexTableau.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexTableau.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optim/linear/SimplexTableau.java
Mon Aug 26 03:18:55 2013
@@ -269,7 +269,7 @@ class SimplexTableau implements Serializ
      * @return new versions of the constraints
      */
     public List<LinearConstraint> normalizeConstraints(Collection<LinearConstraint>
originalConstraints) {
-        List<LinearConstraint> normalized = new ArrayList<LinearConstraint>();
+        List<LinearConstraint> normalized = new ArrayList<LinearConstraint>(originalConstraints.size());
         for (LinearConstraint constraint : originalConstraints) {
             normalized.add(normalize(constraint));
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/linear/SimplexTableau.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/linear/SimplexTableau.java?rev=1517418&r1=1517417&r2=1517418&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/linear/SimplexTableau.java
(original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/optimization/linear/SimplexTableau.java
Mon Aug 26 03:18:55 2013
@@ -249,7 +249,7 @@ class SimplexTableau implements Serializ
      * @return new versions of the constraints
      */
     public List<LinearConstraint> normalizeConstraints(Collection<LinearConstraint>
originalConstraints) {
-        List<LinearConstraint> normalized = new ArrayList<LinearConstraint>();
+        List<LinearConstraint> normalized = new ArrayList<LinearConstraint>(originalConstraints.size());
         for (LinearConstraint constraint : originalConstraints) {
             normalized.add(normalize(constraint));
         }



Mime
View raw message