Return-Path: Delivered-To: apmail-lucene-mahout-commits-archive@minotaur.apache.org Received: (qmail 43586 invoked from network); 8 Feb 2010 02:03:36 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 8 Feb 2010 02:03:36 -0000 Received: (qmail 55057 invoked by uid 500); 8 Feb 2010 02:03:36 -0000 Delivered-To: apmail-lucene-mahout-commits-archive@lucene.apache.org Received: (qmail 54988 invoked by uid 500); 8 Feb 2010 02:03:36 -0000 Mailing-List: contact mahout-commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: mahout-dev@lucene.apache.org Delivered-To: mailing list mahout-commits@lucene.apache.org Received: (qmail 54976 invoked by uid 99); 8 Feb 2010 02:03:35 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 02:03:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Feb 2010 02:03:34 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 84F60238890B; Mon, 8 Feb 2010 02:03:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: mahout-commits@lucene.apache.org From: bimargulies@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100208020314.84F60238890B@eris.apache.org> 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 from (inclusive) and to (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 (size()>0 && (from<0 || from>to || - * to>=size())). - */ - @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 (size()>0 && (from<0 || from>to || * to>=size())). */ - @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 from (inclusive) and to (inclusive). - * - * @param from the start position (inclusive) - * @param to the end position (inclusive) - * @throws IndexOutOfBoundsException if (from<0 || from>to || to>=size()) && to!=from-1. - */ - 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 from (inclusive) and to (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 (size()>0 && (from<0 || from>to || - * to>=size())). - */ - @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 from (inclusive) and to (inclusive). - * - * @param from the start position (inclusive) - * @param to the end position (inclusive) - * @throws IndexOutOfBoundsException if (from<0 || from>to || to>=size()) && to!=from-1. - */ - public abstract void shuffleFromTo(int from, int to); - /** * Sorts the receiver into ascending order. *