commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1173690 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/util/ main/resources/data/ main/resources/data/org/ main/resources/data/org/apache/ main/resources/data/org/apache/commons/ main/resources/data/org/apache/commo...
Date Wed, 21 Sep 2011 14:53:31 GMT
Author: erans
Date: Wed Sep 21 14:53:31 2011
New Revision: 1173690

URL: http://svn.apache.org/viewvc?rev=1173690&view=rev
Log:
MATH-650
Suggesting to use "resource" files for storing large tables.
"FastMathResource" is a utility for creating and loading those resources.
"FastMathLoadCheck" modified to allow the benchmarking of the various ways
to create the tables needed in "FastMath".
"FastMathResourcesSave" shows how to create the resource files (not a "user"
functionality, as this should be done only once): The resource files have
been created and are located under "src/main/resources/data".

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMathResources.java
  (with props)
    commons/proper/math/trunk/src/main/resources/data/
    commons/proper/math/trunk/src/main/resources/data/org/
    commons/proper/math/trunk/src/main/resources/data/org/apache/
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_frac
  (with props)
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_int
  (with props)
    commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__ln_mant
  (with props)
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathResourcesSave.java
  (with props)
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathLoadCheck.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java?rev=1173690&r1=1173689&r2=1173690&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMath.java Wed
Sep 21 14:53:31 2011
@@ -93,6 +93,8 @@ 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 = true;
 
     /** log(2) (high bits). */
     private static final double LN_2_A = 0.693147063255310059;
@@ -3649,10 +3651,10 @@ public class FastMath {
 
 
     /** Index of exp(0) in the array of integer exponentials. */
-    private static final int EXP_INT_TABLE_MAX_INDEX = 750;
+    static final int EXP_INT_TABLE_MAX_INDEX = 750;
 
     /** Length of the array of integer exponentials. */
-    private static final int EXP_INT_TABLE_LEN = EXP_INT_TABLE_MAX_INDEX * 2;
+    static final int EXP_INT_TABLE_LEN = EXP_INT_TABLE_MAX_INDEX * 2;
 
     // Enclose large data table in nested static class so it's only loaded on first access
     private static class ExpIntTable {
@@ -3666,7 +3668,7 @@ public class FastMath {
         private static final double[] EXP_INT_TABLE_B;
 
         static {
-            if (FastMath.RECOMPUTE_TABLES_AT_RUNTIME) {
+            if (RECOMPUTE_TABLES_AT_RUNTIME) {
                 EXP_INT_TABLE_A = new double[FastMath.EXP_INT_TABLE_LEN];
                 EXP_INT_TABLE_B = new double[FastMath.EXP_INT_TABLE_LEN];
 
@@ -3686,6 +3688,10 @@ 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 = new double[] {
         +0.0d,
@@ -6696,7 +6702,7 @@ public class FastMath {
         }
     }
 
-    private static final int EXP_FRAC_TABLE_LEN = TWO_POWER_10 + 1; // 0, 1/1024, ... 1024/1024
+    static final int EXP_FRAC_TABLE_LEN = TWO_POWER_10 + 1; // 0, 1/1024, ... 1024/1024
 
     // Enclose large data table in nested static class so it's only loaded on first access
     private static class ExpFracTable {
@@ -6711,7 +6717,7 @@ public class FastMath {
         private static final double[] EXP_FRAC_TABLE_B;
 
         static {
-            if (FastMath.RECOMPUTE_TABLES_AT_RUNTIME) {
+            if (RECOMPUTE_TABLES_AT_RUNTIME) {
                 EXP_FRAC_TABLE_A = new double[FastMath.EXP_FRAC_TABLE_LEN];
                 EXP_FRAC_TABLE_B = new double[FastMath.EXP_FRAC_TABLE_LEN];
 
@@ -6723,6 +6729,10 @@ 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 = new double[] {
       +1.0d,
@@ -8783,7 +8793,7 @@ public class FastMath {
         }
     }
 
-    private static final int LN_MANT_LEN = TWO_POWER_10; // (see LN_MANT comment below)
+    static final int LN_MANT_LEN = TWO_POWER_10; // (see LN_MANT comment below)
 
     // Enclose large data table in nested static class so it's only loaded on first access
     private static class lnMant {
@@ -8791,7 +8801,7 @@ public class FastMath {
         private static final double[][] LN_MANT;
 
         static {
-            if (FastMath.RECOMPUTE_TABLES_AT_RUNTIME) {
+            if (RECOMPUTE_TABLES_AT_RUNTIME) {
                 LN_MANT = new double[FastMath.LN_MANT_LEN][];
 
                 // Populate lnMant table
@@ -8799,6 +8809,8 @@ 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 = new double[][] { 
       {+0.0d,                   +0.0d,                   }, // 0

Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMathResources.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMathResources.java?rev=1173690&view=auto
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMathResources.java
(added)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMathResources.java
Wed Sep 21 14:53:31 2011
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.commons.math.util;
+
+import java.io.File;
+import java.io.DataOutputStream;
+import java.io.DataInputStream;
+import java.io.BufferedOutputStream;
+import java.io.BufferedInputStream;
+import java.io.FileOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import  org.apache.commons.math.exception.MathInternalError;
+
+/**
+ * Utility class for saving and loading tabulated data used by
+ * {@link FastMath}.
+ *
+ * @version $Id$
+ */
+public class FastMathResources {
+    /**
+     * Resource directory. Assuming that this class and the resource files
+     * are located in the same package as "FastMath".
+     */
+    private static final String RES_DIR = "data/" +
+        FastMath.class.getPackage().getName().replace('.', '/') + "/";
+    /** File resource prefix. */
+    private static final String RES_PREFIX = RES_DIR + "FastMath__";
+    /** Resource basename for "EXP_INT_TABLE_A" and "EXP_INT_TABLE_B". */
+    private static final String EXP_INT = "exp_int";
+    /** Resource basename for "EXP_FRAC_TABLE_A" and "EXP_FRAC_TABLE_B". */
+    private static final String EXP_FRAC = "exp_frac";
+    /** Resource basename for "LN_MANT". */
+    private static final String LN_MANT = "ln_mant";
+
+    /**
+     * Class contains only static methods.
+     */
+    private FastMathResources() {}
+
+    /**
+     * Compute and save all the resources.
+     */
+    static void createAll() {
+        // Create resource directory.
+        final File resDir = new File(RES_DIR);
+        if (resDir.exists()) {
+            if (!resDir.isDirectory()) {
+                throw new MathInternalError();
+            }
+        } else {
+            try {
+                resDir.mkdirs();
+            } catch (SecurityException e) {
+                throw new MathInternalError(e);
+            }
+        }
+
+        // "EXP_INT" tables.
+        final double[] expIntA = new double[FastMath.EXP_INT_TABLE_LEN];
+        final double[] expIntB = new double[FastMath.EXP_INT_TABLE_LEN];
+
+        final double tmp[] = new double[2];
+        final double recip[] = new double[2];
+
+        for (int i = 0; i < FastMath.EXP_INT_TABLE_MAX_INDEX; i++) {
+            FastMathCalc.expint(i, tmp);
+            expIntA[i + FastMath.EXP_INT_TABLE_MAX_INDEX] = tmp[0];
+            expIntB[i + FastMath.EXP_INT_TABLE_MAX_INDEX] = tmp[1];
+
+            if (i != 0) {
+                // Negative integer powers.
+                FastMathCalc.splitReciprocal(tmp, recip);
+                expIntA[FastMath.EXP_INT_TABLE_MAX_INDEX - i] = recip[0];
+                expIntB[FastMath.EXP_INT_TABLE_MAX_INDEX - i] = recip[1];
+            }
+        }
+
+        saveTable2d(EXP_INT, 2, FastMath.EXP_INT_TABLE_LEN,
+                    new double[][] { expIntA, expIntB });
+
+        // "EXP_FRAC" tables.
+        final double[] expFracA = new double[FastMath.EXP_FRAC_TABLE_LEN];
+        final double[] expFracB = new double[FastMath.EXP_FRAC_TABLE_LEN];
+
+        for (int i = 0; i < FastMath.EXP_FRAC_TABLE_LEN; i++) {
+            FastMathCalc.slowexp(i / 1024d, tmp); // TWO_POWER_10
+            expFracA[i] = tmp[0];
+            expFracB[i] = tmp[1];
+        }
+
+        saveTable2d(EXP_FRAC, 2, FastMath.EXP_FRAC_TABLE_LEN,
+                    new double[][] { expFracA, expFracB });
+
+        // "LN_MANT" table.
+        final double[][] lnMant = new double[FastMath.LN_MANT_LEN][];
+
+        for (int i = 0; i < FastMath.LN_MANT_LEN; i++) {
+            final double d = Double.longBitsToDouble((((long) i) << 42) |
+                                                     0x3ff0000000000000L);
+            lnMant[i] = FastMathCalc.slowLog(d);
+        }
+
+        saveTable2d(LN_MANT, FastMath.LN_MANT_LEN, 2, lnMant);
+    }
+
+    /**
+     * Load "EXP_INT" tables.
+     * "EXP_INT_TABLE_A" is at index 0.
+     * "EXP_INT_TABLE_B" is at index 1.
+     *
+     * @return the retrieved data.
+     */
+    public static double[][] loadExpInt() {
+        return loadTable2d(EXP_INT, 2, FastMath.EXP_INT_TABLE_LEN);
+    }
+    /**
+     * Load "EXP_FRAC" tables.
+     * "EXP_FRAC_TABLE_A" is at index 0.
+     * "EXP_FRAC_TABLE_B" is at index 1.
+     *
+     * @return the retrieved data.
+     */
+
+    public static double[][] loadExpFrac() {
+        return loadTable2d(EXP_FRAC, 2, FastMath.EXP_FRAC_TABLE_LEN);
+    }
+    /**
+     * Load "LN_MANT".
+     *
+     * @return the retrieved data.
+     */
+
+    public static double[][] loadLnMant() {
+        return loadTable2d(LN_MANT, FastMath.LN_MANT_LEN, 2);
+    }
+
+    /**
+     * @param name Basename of the resource.
+     * @return an output stream.
+     * @throws FileNotFoundException if the file cannot be opened.
+     */
+    private static DataOutputStream out(String name)
+        throws FileNotFoundException {
+        final String fullName = RES_PREFIX + name;
+        return new DataOutputStream(new BufferedOutputStream(new FileOutputStream(fullName)));
+    }
+
+    /**
+     * @param name Basename of the resource.
+     * @param len Number of {@code double}s to be stored.
+     * @param data Data to be stored.
+     */
+    private static void saveTable1d(String name,
+                                    int len,
+                                    double[] data) {
+        try {
+            final DataOutputStream out = out(name);
+
+            for (int i = 0; i < len; i++) {
+                out.writeDouble(data[i]);
+            }
+
+            out.close();
+        } catch (IOException e) {
+            throw new MathInternalError(e);
+        }
+    }
+
+    /**
+     * @param name Basename of the resource.
+     * @param len Number of table rows to be stored.
+     * @param rowLen Number of {@code double}s per table row.
+     * @param data Data to be stored.
+     */
+    private static void saveTable2d(String name,
+                                    int len,
+                                    int rowLen,
+                                    double[][] data) {
+        try {
+            final DataOutputStream out = out(name);
+
+            for (int i = 0; i < len; i++) {
+                for (int j = 0; j < rowLen; j++) {
+                    out.writeDouble(data[i][j]);
+                }
+            }
+
+            out.close();
+        } catch (IOException e) {
+            throw new MathInternalError(e);
+        }
+    }
+
+    /**
+     * @param name Basename of the resource.
+     * @return an input stream.
+     * @throws FileNotFoundException if the resource cannot be accessed.
+     */
+    private static DataInputStream in(String name)
+        throws FileNotFoundException {
+        final String fullName = "/" + RES_PREFIX + name;
+        return new DataInputStream(new BufferedInputStream(FastMathResources.class.getResourceAsStream(fullName)));
+    }
+
+
+    /**
+     * @param name Basename of the resource.
+     * @param len Number of {@code double}s to be retrieved.
+     * @return the retrieved data.
+     */
+    private static double[] loadTable1d(String name,
+                                        int len) {
+        try {
+            final DataInputStream in = in(name);
+
+            final double[] data = new double[len];
+            for (int i = 0; i < len; i++) {
+                data[i] = in.readDouble();
+            }
+
+            in.close();
+            return data;
+        } catch (IOException e) {
+            throw new MathInternalError(e);
+        }
+    }
+
+    /**
+     * @param name Basename of the resource.
+     * @param len Number of table rows to be retrieved.
+     * @param rowLen Number of {@code double}s per table row.
+     * @return the retrieved data.
+     */
+    private static double[][] loadTable2d(String name,
+                                          int len,
+                                          int rowLen) {
+        try {
+            final DataInputStream in = in(name);
+
+            final double[][] data = new double[len][rowLen];
+            for (int i = 0; i < len; i++) {
+                for (int j = 0; j < rowLen; j++) {
+                    data[i][j] = in.readDouble();
+                }
+            }
+
+            in.close();
+            return data;
+        } catch (IOException e) {
+            throw new MathInternalError(e);
+        }
+    }
+}

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/FastMathResources.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_frac
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_frac?rev=1173690&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_frac
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_int
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_int?rev=1173690&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__exp_int
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__ln_mant
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__ln_mant?rev=1173690&view=auto
==============================================================================
Binary file - no diff available.

Propchange: commons/proper/math/trunk/src/main/resources/data/org/apache/commons/math/util/FastMath__ln_mant
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathLoadCheck.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathLoadCheck.java?rev=1173690&r1=1173689&r2=1173690&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathLoadCheck.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathLoadCheck.java
Wed Sep 21 14:53:31 2011
@@ -3,55 +3,89 @@ package org.apache.commons.math.util;
 import java.lang.reflect.Field;
 
 /*
- * FastMath load test - requires that FastMath.USE_PRECOMPUTED_TABLES be set to non-final.
+ * FastMath load performance test - requires that
+ * <ul>
+ *  <li>{@code FastMath.USE_PRECOMPUTED_TABLES}</li>
+ *  <li>{@code FastMath.LOAD_RESOURCES}</li>
+ * </ul>
+ * be non-"final".
  * 
-Sample output from:
-java -cp target/classes;target/test-classes org.apache.commons.math.util.FastMathLoadCheck
false false
-java -cp target/classes;target/test-classes org.apache.commons.math.util.FastMathLoadCheck
false true
-java -cp target/classes;target/test-classes org.apache.commons.math.util.FastMathLoadCheck
true  false
-java -cp target/classes;target/test-classes org.apache.commons.math.util.FastMathLoadCheck
true  true
-
-Using exp(100); compute=false
-new   12155456       9219       5308       5029       5587       5308       5029       5029
      5029       5308
-Using exp(100); compute=true
-new   34929579       9499       5308       5308       5029       5029       5029       5308
      5028       5029
-Using max(0,0); compute=false
-new       5029       3632       3073       3073       3073       3073       3073       3073
      3073       3073
-Using max(0,0); compute=true
-new       5028       3911       3073       3073       3073       3073       3073       3073
      3073       3073
-
+ * For example, this shell command:
+ * <pre>
+ *  $ for max in false true ; do for how in compute resources array; do java -cp target/classes:target/test-classes
org.apache.commons.math.util.FastMathLoadCheck $max $how ; done ; done
+ * </pre>
+ * will produce an output similar to the following:
+ * <pre>
+ *  Using exp(100); how=compute
+ *  times  50955053      4062      1783      1708      1731      1728      1739      1735
     1746      1735
+ *  Using exp(100); how=resources
+ *  times  18467554      4822      1953      1769      1851      1746      1821      1817
     1813      1742
+ *  Using exp(100); how=array
+ *  times   5952415      2960      1839      1776      1720      1847      1839      1780
     1788      1742
+ *  Using max(0,0); how=compute
+ *  times      1596       521       401       352       345       405       393       390
      397       382
+ *  Using max(0,0); how=resources
+ *  times      1517       521       401       386       386       394       363       386
      382       383
+ *  Using max(0,0); how=array
+ *  times      1569       453       398       390       389       394       333       390
      334       359
+ * </pre>
  */
 public class FastMathLoadCheck {
+    private final static String COMP = "compute";
+    private final static String RES = "resources";
+    private final static String ARR = "array";
 
     private static int LOOPS = 10;
     private static boolean MAX = false;
-    private static boolean compute = true;
+    private static String how = ARR;
 
     public static void main(String[] args) throws Exception {
-        if (args.length>0) MAX = Boolean.valueOf(args[0]);
-        if (args.length>1) compute = Boolean.valueOf(args[1]);
-        if (args.length>2) LOOPS = Integer.valueOf(args[2]);
-        p("Using "+ (MAX ? "max(0,0)" : "exp(100)") + "; compute=" + compute+"\n");
-        Field usePrecompute = FastMath.class.getDeclaredField("RECOMPUTE_TABLES_AT_RUNTIME");
-        usePrecompute.setAccessible(true);
-        if (usePrecompute.getBoolean(null) != compute) {
-            usePrecompute.setBoolean(null, compute);
+        if (args.length > 0) MAX = Boolean.valueOf(args[0]);
+        if (args.length > 1) how = args[1];
+        if (args.length > 2) LOOPS = Integer.valueOf(args[2]);
+        p("Using "+ (MAX ? "max(0,0)" : "exp(100)") + "; how=" + how + "\n");
+
+        final Field recompute = FastMath.class.getDeclaredField("RECOMPUTE_TABLES_AT_RUNTIME");
+        final Field load = FastMath.class.getDeclaredField("LOAD_RESOURCES");
+        if (how.equals(COMP)) {
+            recompute.setAccessible(true);
+            recompute.setBoolean(null, true);
+            recompute.setAccessible(false);
+            load.setAccessible(true);
+            load.setBoolean(null, false);
+            load.setAccessible(false);
+        } else if (how.equals(RES)) {
+            recompute.setAccessible(true);
+            recompute.setBoolean(null, false);
+            recompute.setAccessible(false);
+            load.setAccessible(true);
+            load.setBoolean(null, true);
+            load.setAccessible(false);
+        } else if (how.equals(ARR)) {
+            recompute.setAccessible(true);
+            recompute.setBoolean(null, false);
+            recompute.setAccessible(false);
+            load.setAccessible(true);
+            load.setBoolean(null, false);
+            load.setAccessible(false);
+        } else {
+            throw new IllegalArgumentException("'how' must be 'compute' or 'resources' or
'array'");
         }
-        usePrecompute.setAccessible(false);
+
         test();
     }
     private static void test(){
         p("times");
-        for(int i=0; i< LOOPS; i++){
+        for(int i = 0; i < LOOPS; i++){
             p(" ");
             long t1 = System.nanoTime();
             if (MAX) {
-                FastMath.max(0,0);
+                FastMath.max(0, 0);
             } else {
                 FastMath.exp(100);
             }
             long t2 = System.nanoTime();
-            p("%10d",t2-t1);
+            p("%9d", t2 - t1);
         }
         p("\n");
     }

Added: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathResourcesSave.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathResourcesSave.java?rev=1173690&view=auto
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathResourcesSave.java
(added)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathResourcesSave.java
Wed Sep 21 14:53:31 2011
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.util;
+
+/**
+ * Not a test class.
+ * It is used to generate the resource data used by the "FastMath" class.
+ * You should run it from inside the "resources" directory, i.e. use as:
+ * <pre>
+ *  $ cd src/main/resources/
+ *  $ java -cp ../../../target/classes:../../../target/test-classes org.apache.commons.math.util.FastMathResourcesSave
+ * </pre>
+ */
+public class FastMathResourcesSave {
+    public static void main(String[] args) throws Exception {
+        FastMathResources.createAll();
+    }
+}

Propchange: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/FastMathResourcesSave.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message