You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2012/02/15 22:05:50 UTC

svn commit: r1244725 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math3/util/ main/resources/data/org/apache/commons/math3/util/ site/xdoc/ test/java/org/apache/commons/math3/util/

Author: luc
Date: Wed Feb 15 21:05:50 2012
New Revision: 1244725

URL: http://svn.apache.org/viewvc?rev=1244725&view=rev
Log:
Use literal arrays for FastMath pre-computed tables.

JIRA: MATH-650

Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMathResources.java
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math3/util/FastMath__exp_frac
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math3/util/FastMath__exp_int
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math3/util/FastMath__ln_mant
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/FastMathLoadCheck.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math3/util/FastMathResourcesSave.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java
    commons/proper/math/trunk/src/site/xdoc/changes.xml

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java?rev=1244725&r1=1244724&r2=1244725&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/util/FastMath.java Wed Feb 15 21:05:50 2012
@@ -102,8 +102,6 @@ public class FastMath {
      * </p>
      */
     private static /* final */ boolean RECOMPUTE_TABLES_AT_RUNTIME = false;
-    /** Indicator for loading big tables from "resource" files. */
-    private static /* final */ boolean LOAD_RESOURCES = false;
 
     /** log(2) (high bits). */
     private static final double LN_2_A = 0.693147063255310059;
@@ -3738,10 +3736,6 @@ public class FastMath {
                         EXP_INT_TABLE_B[FastMath.EXP_INT_TABLE_MAX_INDEX - i] = recip[1];
                     }
                 }
-            } else if (LOAD_RESOURCES) {
-                final double[][] expInt = FastMathResources.loadExpInt();
-                EXP_INT_TABLE_A = expInt[0];
-                EXP_INT_TABLE_B = expInt[1];
             } else {
                 EXP_INT_TABLE_A = FastMathLiteralArrays.loadExpIntA();
                 EXP_INT_TABLE_B = FastMathLiteralArrays.loadExpIntB();
@@ -3775,10 +3769,6 @@ public class FastMath {
                     EXP_FRAC_TABLE_A[i] = tmp[0];
                     EXP_FRAC_TABLE_B[i] = tmp[1];
                 }
-            } else if (LOAD_RESOURCES) {
-                final double[][] expFrac = FastMathResources.loadExpFrac();
-                EXP_FRAC_TABLE_A = expFrac[0];
-                EXP_FRAC_TABLE_B = expFrac[1];
             } else {
                 EXP_FRAC_TABLE_A = FastMathLiteralArrays.loadExpFracA();
                 EXP_FRAC_TABLE_B = FastMathLiteralArrays.loadExpFracB();
@@ -3800,8 +3790,6 @@ public class FastMath {
                     final double d = Double.longBitsToDouble( (((long) i) << 42) | 0x3ff0000000000000L );
                     LN_MANT[i] = FastMathCalc.slowLog(d);
                 }
-            } else if (LOAD_RESOURCES) {
-                LN_MANT = FastMathResources.loadLnMant();
             } else {
                 LN_MANT = FastMathLiteralArrays.loadLnMant();
             }

Modified: commons/proper/math/trunk/src/site/xdoc/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/changes.xml?rev=1244725&r1=1244724&r2=1244725&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/changes.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/changes.xml Wed Feb 15 21:05:50 2012
@@ -52,9 +52,12 @@ The <action> type attribute can be add,u
     If the output is not quite correct, check for invisible trailing spaces!
      -->
     <release version="3.0" date="TBD" description="TBD">
+      <action dev="sebb" type="fix" issue="MATH-650" >
+        Added pre-computed arrays to speed up initial loading time for FastMath.
+      </action>
       <action dev="luc" type="update">
         Resources for error messages translations have been moved out of META-INF
-        folder in the jar, to avoid interferences with some build systems
+        folder in the jar, to avoid interferences with some build systems.
       </action>
       <action dev="erans" type="fix" issue="MATH-744" due-to="Thundre">
         Fixed "doubleValue" and "floatValue" method in "BigFraction" when