mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r907540 - in /lucene/mahout/trunk: collections/ collections/src/ collections/src/main/java-templates/org/apache/mahout/math/list/ collections/src/main/java/org/apache/mahout/collections/ collections/src/main/java/org/apache/mahout/math/ col...
Date Mon, 08 Feb 2010 02:03:14 GMT
Author: bimargulies
Date: Mon Feb  8 02:03:12 2010
New Revision: 907540

URL: http://svn.apache.org/viewvc?rev=907540&view=rev
Log:
MAHOUT-275: populate collections on as a separate project. Next patch will hollow out math

Added:
    lucene/mahout/trunk/collections/
    lucene/mahout/trunk/collections/src/
      - copied from r907311, lucene/mahout/trunk/math/src/
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Arithmetic.java
      - copied, changed from r907311, lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Constants.java
      - copied, changed from r907311, lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java
Removed:
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/AbstractMatrix.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/AbstractVector.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/CardinalityException.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/DenseMatrix.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/DenseVector.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/GenericPermuting.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/IndexException.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/JsonMatrixAdapter.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/JsonVectorAdapter.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/Matrix.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/MatrixSlice.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/MatrixView.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/OrderedIntDoubleMapping.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/Partitioning.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/RandomAccessSparseVector.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/SparseColumnMatrix.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/SparseMatrix.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/SparseRowMatrix.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/Timer.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/UnboundLabelException.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/Vector.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/VectorIterable.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/VectorView.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/decomposer/
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/function/Functions.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/jet/
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/DistinctNumberList.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/MinMaxNumberList.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/matrix/
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/stats/
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/AIOOBInSortingTest.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/MatrixTest.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestDenseMatrix.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestDenseVector.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestMatrixView.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestOrderedIntDoubleMapping.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestSparseColumnMatrix.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestSparseMatrix.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestSparseRowMatrix.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestSparseVector.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/TestVectorView.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/VectorTest.java
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/decomposer/
    lucene/mahout/trunk/collections/src/test/java/org/apache/mahout/math/stats/
Modified:
    lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
    lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/ValueTypeArrayList.java.t
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/AbstractList.java
    lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java
    lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java

Modified: lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t?rev=907540&r1=907311&r2=907540&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
(original)
+++ lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/AbstractValueTypeList.java.t
Mon Feb  8 02:03:12 2010
@@ -31,8 +31,6 @@
 import org.apache.mahout.math.buffer.${valueTypeCap}BufferConsumer;
 import org.apache.mahout.math.function.${valueTypeCap}Comparator;
 import org.apache.mahout.math.function.${valueTypeCap}Procedure;
-import org.apache.mahout.math.jet.random.Uniform;
-import org.apache.mahout.math.jet.random.engine.DRand;
 //CHECKSTYLE:ON
 
 import java.util.ArrayList;
@@ -802,29 +800,6 @@
     size = newSize;
   }
 
-  /**
-   * Randomly permutes the part of the receiver between <code>from</code> (inclusive)
and <code>to</code> (inclusive).
-   *
-   * @param from the index of the first element (inclusive) to be permuted.
-   * @param to   the index of the last element (inclusive) to be permuted.
-   * @throws IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 &&
(from&lt;0 || from&gt;to ||
-   *                                   to&gt;=size())</tt>).
-   */
-  @Override
-  public void shuffleFromTo(int from, int to) {
-    checkRangeFromTo(from, to, size());
-
-    Uniform gen = new Uniform(new DRand(new Date()));
-    for (int i = from; i < to; i++) {
-      int random = gen.nextIntFromTo(i, to);
-
-      //swap(i, random)
-      ${valueType} tmpElement = getQuick(random);
-      setQuick(random, getQuick(i));
-      setQuick(i, tmpElement);
-    }
-  }
-
   /** Returns the number of elements contained in the receiver. */
   @Override
   public int size() {

Modified: lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/ValueTypeArrayList.java.t
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/ValueTypeArrayList.java.t?rev=907540&r1=907311&r2=907540&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/ValueTypeArrayList.java.t
(original)
+++ lucene/mahout/trunk/collections/src/main/java-templates/org/apache/mahout/math/list/ValueTypeArrayList.java.t
Mon Feb  8 02:03:12 2010
@@ -27,8 +27,6 @@
 package org.apache.mahout.math.list;
 
 import org.apache.mahout.math.function.${valueTypeCap}Procedure;
-import org.apache.mahout.math.jet.random.Uniform;
-import org.apache.mahout.math.jet.random.engine.DRand;
 
 import java.util.Date;
 /**
@@ -432,7 +430,7 @@
 
     double N = (double) other.size();
     double M = (double) mySize;
-    if ((N + M) * org.apache.mahout.math.jet.math.Arithmetic.log2(N) < M * N) {
+    if ((N + M) * org.apache.mahout.collections.Arithmetic.log2(N) < M * N) {
       // it is faster to sort other before searching in it
       ${valueTypeCap}ArrayList sortedList = (${valueTypeCap}ArrayList) other.clone();
       sortedList.quickSort();
@@ -513,7 +511,7 @@
 
     double N = (double) other.size();
     double M = (double) mySize;
-    if ((N + M) * org.apache.mahout.math.jet.math.Arithmetic.log2(N) < M * N) {
+    if ((N + M) * org.apache.mahout.collections.Arithmetic.log2(N) < M * N) {
       // it is faster to sort other before searching in it
       ${valueTypeCap}ArrayList sortedList = (${valueTypeCap}ArrayList) other.clone();
       sortedList.quickSort();
@@ -590,25 +588,6 @@
    * @throws IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 &&
(from&lt;0 || from&gt;to ||
    *                                   to&gt;=size())</tt>).
    */
-  @Override
-  public void shuffleFromTo(int from, int to) {
-    // overridden for performance only.
-    if (size == 0) {
-      return;
-    }
-    checkRangeFromTo(from, to, size);
-
-    Uniform gen = new Uniform(new DRand(new Date()));
-    ${valueType}[] theElements = elements;
-    for (int i = from; i < to; i++) {
-      int random = gen.nextIntFromTo(i, to);
-
-      //swap(i, random)
-      ${valueType} tmpElement = theElements[random];
-      theElements[random] = theElements[i];
-      theElements[i] = tmpElement;
-    }
-  }
 
   /**
    * Sorts the specified range of the receiver into ascending order.

Copied: lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Arithmetic.java
(from r907311, lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java)
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Arithmetic.java?p2=lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Arithmetic.java&p1=lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java&r1=907311&r2=907540&rev=907540&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Arithmetic.java
(original)
+++ lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Arithmetic.java
Mon Feb  8 02:03:12 2010
@@ -24,7 +24,7 @@
 CERN makes no representations about the suitability of this software for any purpose. 
 It is provided "as is" without expressed or implied warranty.
 */
-package org.apache.mahout.math.jet.math;
+package org.apache.mahout.collections;
 
 /**
  * Arithmetic functions.

Copied: lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Constants.java
(from r907311, lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java)
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Constants.java?p2=lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Constants.java&p1=lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java&r1=907311&r2=907540&rev=907540&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/math/Constants.java
(original)
+++ lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/collections/Constants.java
Mon Feb  8 02:03:12 2010
@@ -25,7 +25,7 @@
 CERN makes no representations about the suitability of this software for any purpose. 
 It is provided "as is" without expressed or implied warranty.
 */
-package org.apache.mahout.math.jet.math;
+package org.apache.mahout.collections;
 
 /**
  * Defines some useful constants.

Modified: lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/AbstractList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/AbstractList.java?rev=907540&r1=907311&r2=907540&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/AbstractList.java
(original)
+++ lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/AbstractList.java
Mon Feb  8 02:03:12 2010
@@ -208,20 +208,6 @@
     }
   }
 
-  /** Randomly permutes the receiver. After invocation, all elements will be at random positions.
*/
-  public final void shuffle() {
-    shuffleFromTo(0, size() - 1);
-  }
-
-  /**
-   * Randomly permutes the receiver between <code>from</code> (inclusive) and
<code>to</code> (inclusive).
-   *
-   * @param from the start position (inclusive)
-   * @param to   the end position (inclusive)
-   * @throws IndexOutOfBoundsException if <tt>(from&lt;0 || from&gt;to || to&gt;=size())
&& to!=from-1</tt>.
-   */
-  public abstract void shuffleFromTo(int from, int to);
-
   /**
    * Sorts the receiver into ascending order.
    *

Modified: lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java?rev=907540&r1=907311&r2=907540&view=diff
==============================================================================
--- lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java
(original)
+++ lucene/mahout/trunk/collections/src/main/java/org/apache/mahout/math/list/ObjectArrayList.java
Mon Feb  8 02:03:12 2010
@@ -27,8 +27,6 @@
 package org.apache.mahout.math.list;
 
 import org.apache.mahout.math.function.ObjectProcedure;
-import org.apache.mahout.math.jet.random.Uniform;
-import org.apache.mahout.math.jet.random.engine.DRand;
 
 import java.util.Collection;
 import java.util.Date;
@@ -380,36 +378,6 @@
   }
 
   /**
-   * Randomly permutes the part of the receiver between <code>from</code> (inclusive)
and <code>to</code> (inclusive).
-   *
-   * @param from the index of the first element (inclusive) to be permuted.
-   * @param to   the index of the last element (inclusive) to be permuted.
-   * @throws IndexOutOfBoundsException index is out of range (<tt>size()&gt;0 &&
(from&lt;0 || from&gt;to ||
-   *                                   to&gt;=size())</tt>).
-   */
-  @Override
-  public void shuffleFromTo(int from, int to) {
-    // overridden for performance only.
-    if (size == 0) {
-      return;
-    }
-    checkRangeFromTo(from, to, size);
-
-    Uniform gen = new Uniform(new DRand(new Date()));
-    Object[] theElements = elements;
-    for (int i = from; i < to; i++) {
-      int random = gen.nextIntFromTo(i, to);
-
-      //swap(i, random)
-      Object tmpElement = theElements[random];
-      theElements[random] = theElements[i];
-      theElements[i] = tmpElement;
-    }
-  }
-  
-  
-
-  /**
    * Trims the capacity of the receiver to be the receiver's current size. Releases any superfluous
internal memory. An
    * application can use this operation to minimize the storage of the receiver.
    */

Modified: lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java?rev=907540&r1=907539&r2=907540&view=diff
==============================================================================
--- lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java (original)
+++ lucene/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/AbstractList.java Mon
Feb  8 02:03:12 2010
@@ -208,20 +208,6 @@
     }
   }
 
-  /** Randomly permutes the receiver. After invocation, all elements will be at random positions.
*/
-  public final void shuffle() {
-    shuffleFromTo(0, size() - 1);
-  }
-
-  /**
-   * Randomly permutes the receiver between <code>from</code> (inclusive) and
<code>to</code> (inclusive).
-   *
-   * @param from the start position (inclusive)
-   * @param to   the end position (inclusive)
-   * @throws IndexOutOfBoundsException if <tt>(from&lt;0 || from&gt;to || to&gt;=size())
&& to!=from-1</tt>.
-   */
-  public abstract void shuffleFromTo(int from, int to);
-
   /**
    * Sorts the receiver into ascending order.
    *



Mime
View raw message