You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by ss...@apache.org on 2013/06/12 22:44:21 UTC
svn commit: r1492416 [3/3] - in /mahout/trunk: ./
core/src/main/java/org/apache/mahout/cf/taste/hadoop/
core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/
core/src/main/java/org/apache/mahout/classifier/
core/src/main/java/org/apache/mahout/clas...
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java Wed Jun 12 20:44:19 2013
@@ -759,13 +759,13 @@ public abstract class AbstractMatrix imp
@Override
public String toString() {
- String s = "{\n";
+ StringBuilder s = new StringBuilder("{\n");
Iterator<MatrixSlice> it = iterator();
while (it.hasNext()) {
MatrixSlice next = it.next();
- s += " " + next.index() + " =>\t" + next.vector() + '\n';
+ s.append(" ").append(next.index()).append(" =>\t").append(next.vector()).append('\n');
}
- s += "}";
- return s;
+ s.append("}");
+ return s.toString();
}
}
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractVector.java Wed Jun 12 20:44:19 2013
@@ -562,7 +562,7 @@ public abstract class AbstractVector imp
public Matrix cross(Vector other) {
Matrix result = matrixLike(size, other.size());
Iterator<Vector.Element> it = iterateNonZero();
- while(it.hasNext()) {
+ while (it.hasNext()) {
Vector.Element e = it.next();
int row = e.index();
result.assignRow(row, other.times(getQuick(row)));
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/CardinalityException.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/CardinalityException.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/CardinalityException.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/CardinalityException.java Wed Jun 12 20:44:19 2013
@@ -18,7 +18,7 @@
package org.apache.mahout.math;
/**
- * Exception thrown when there is a cardinality mismatch in matrix or vector operations.
+ * Exception thrown when there is a cardinality mismatch in matrix or vector OPERATIONS.
* For example, vectors of differing cardinality cannot be added.
*/
public class CardinalityException extends IllegalArgumentException {
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/Centroid.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/Centroid.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/Centroid.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/Centroid.java Wed Jun 12 20:44:19 2013
@@ -20,7 +20,7 @@ package org.apache.mahout.math;
import org.apache.mahout.math.function.Functions;
/**
- * A centroid is a weighted vector. We have it delegate to the vector itself for lots of operations
+ * A centroid is a weighted vector. We have it delegate to the vector itself for lots of OPERATIONS
* to make it easy to use vector search classes and such.
*/
public class Centroid extends WeightedVector {
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedSparseBinaryMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedSparseBinaryMatrix.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedSparseBinaryMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/FileBasedSparseBinaryMatrix.java Wed Jun 12 20:44:19 2013
@@ -131,12 +131,12 @@ public final class FileBasedSparseBinary
// write rows
for (MatrixSlice row : m) {
List<Integer> columns = Lists.newArrayList(Iterables.transform(row.vector().nonZeroes(),
- new Function<Vector.Element, Integer>() {
- @Override
- public Integer apply(Vector.Element element) {
- return element.index();
- }
- }));
+ new Function<Vector.Element, Integer>() {
+ @Override
+ public Integer apply(Vector.Element element) {
+ return element.index();
+ }
+ }));
Collections.sort(columns);
for (Integer column : columns) {
@@ -438,7 +438,7 @@ public final class FileBasedSparseBinary
}
/**
- * Copy the vector for fast operations.
+ * Copy the vector for fast OPERATIONS.
*
* @return a Vector
*/
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/SequentialAccessSparseVector.java Wed Jun 12 20:44:19 2013
@@ -30,7 +30,7 @@ import org.apache.mahout.math.function.F
* one int[], one double[]. If there are <b>k</b> non-zero elements in the vector, this implementation has
* O(log(k)) random-access read performance, and O(k) random-access write performance, which is far below that
* of the hashmap based {@link org.apache.mahout.math.RandomAccessSparseVector RandomAccessSparseVector}. This
- * class is primarily used for operations where the all the elements will be accessed in a read-only fashion
+ * class is primarily used for OPERATIONS where the all the elements will be accessed in a read-only fashion
* sequentially: methods which operate not via get() or set(), but via iterateNonZero(), such as (but not limited
* to) :</p>
* <ul>
@@ -122,7 +122,7 @@ public class SequentialAccessSparseVecto
@Override
public void mergeUpdates(OrderedIntDoubleMapping updates) {
values.merge(updates);
- }
+ }
@Override
public String toString() {
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/Vector.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/Vector.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/Vector.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/Vector.java Wed Jun 12 20:44:19 2013
@@ -396,12 +396,12 @@ public interface Vector extends Cloneabl
double getDistanceSquared(Vector v);
/**
- * Gets an estimate of the cost (in number of operations) it takes to lookup a random element in this vector.
+ * Gets an estimate of the cost (in number of OPERATIONS) it takes to lookup a random element in this vector.
*/
double getLookupCost();
/**
- * Gets an estimate of the cost (in number of operations) it takes to advance an iterator through the nonzero
+ * Gets an estimate of the cost (in number of OPERATIONS) it takes to advance an iterator through the nonzero
* elements of this vector.
*/
double getIteratorAdvanceCost();
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAggregate.java Wed Jun 12 20:44:19 2013
@@ -6,7 +6,7 @@ import org.apache.mahout.math.set.OpenIn
import java.util.Iterator;
/**
- * Abstract class encapsulating different algorithms that perform the Vector operations aggregate().
+ * Abstract class encapsulating different algorithms that perform the Vector OPERATIONS aggregate().
* x.aggregte(y, fa, fc), for x and y Vectors and fa, fc DoubleDouble functions:
* - applies the function fc to every element in x and y, fc(xi, yi)
* - constructs a result iteratively, r0 = fc(x0, y0), ri = fc(r_{i-1}, fc(xi, yi)).
@@ -39,19 +39,19 @@ import java.util.Iterator;
* explanation.
*/
public abstract class VectorBinaryAggregate {
- public static final VectorBinaryAggregate[] operations = {
- new AggregateNonzerosIterateThisLookupThat(),
- new AggregateNonzerosIterateThatLookupThis(),
-
- new AggregateIterateIntersection(),
-
- new AggregateIterateUnionSequential(),
- new AggregateIterateUnionRandom(),
-
- new AggregateAllIterateSequential(),
- new AggregateAllIterateThisLookupThat(),
- new AggregateAllIterateThatLookupThis(),
- new AggregateAllLoop(),
+ public static final VectorBinaryAggregate[] OPERATIONS = {
+ new AggregateNonzerosIterateThisLookupThat(),
+ new AggregateNonzerosIterateThatLookupThis(),
+
+ new AggregateIterateIntersection(),
+
+ new AggregateIterateUnionSequential(),
+ new AggregateIterateUnionRandom(),
+
+ new AggregateAllIterateSequential(),
+ new AggregateAllIterateThisLookupThat(),
+ new AggregateAllIterateThatLookupThis(),
+ new AggregateAllLoop(),
};
/**
@@ -73,19 +73,20 @@ public abstract class VectorBinaryAggreg
/**
* The best operation is the least expensive valid one.
*/
- public static VectorBinaryAggregate getBestOperation(Vector x, Vector y, DoubleDoubleFunction fa, DoubleDoubleFunction fc) {
+ public static VectorBinaryAggregate getBestOperation(Vector x, Vector y, DoubleDoubleFunction fa,
+ DoubleDoubleFunction fc) {
int bestOperationIndex = -1;
double bestCost = Double.POSITIVE_INFINITY;
- for (int i = 0; i < operations.length; ++i) {
- if (operations[i].isValid(x, y, fa, fc)) {
- double cost = operations[i].estimateCost(x, y, fa, fc);
+ for (int i = 0; i < OPERATIONS.length; ++i) {
+ if (OPERATIONS[i].isValid(x, y, fa, fc)) {
+ double cost = OPERATIONS[i].estimateCost(x, y, fa, fc);
if (cost < bestCost) {
bestCost = cost;
bestOperationIndex = i;
}
}
}
- return operations[bestOperationIndex];
+ return OPERATIONS[bestOperationIndex];
}
/**
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/VectorBinaryAssign.java Wed Jun 12 20:44:19 2013
@@ -7,7 +7,7 @@ import org.apache.mahout.math.set.OpenIn
import java.util.Iterator;
/**
- * Abstract class encapsulating different algorithms that perform the Vector operations assign().
+ * Abstract class encapsulating different algorithms that perform the Vector OPERATIONS assign().
* x.assign(y, f), for x and y Vectors and f a DoubleDouble function:
* - applies the function f to every element in x and y, f(xi, yi)
* - assigns xi = f(xi, yi) for all indices i
@@ -43,26 +43,26 @@ import java.util.Iterator;
* explanation.
*/
public abstract class VectorBinaryAssign {
- public static final VectorBinaryAssign[] operations = {
- new AssignNonzerosIterateThisLookupThat(),
- new AssignNonzerosIterateThatLookupThisMergeUpdates(),
- new AssignNonzerosIterateThatLookupThisInplaceUpdates(),
-
- new AssignIterateIntersection(),
-
- new AssignIterateUnionSequentialMergeUpdates(),
- new AssignIterateUnionSequentialInplaceUpdates(),
- new AssignIterateUnionRandomMergeUpdates(),
- new AssignIterateUnionRandomInplaceUpdates(),
-
- new AssignAllIterateSequentialMergeUpdates(),
- new AssignAllIterateSequentialInplaceUpdates(),
- new AssignAllIterateThisLookupThatMergeUpdates(),
- new AssignAllIterateThisLookupThatInplaceUpdates(),
- new AssignAllIterateThatLookupThisMergeUpdates(),
- new AssignAllIterateThatLookupThisInplaceUpdates(),
- new AssignAllLoopMergeUpdates(),
- new AssignAllLoopInplaceUpdates(),
+ public static final VectorBinaryAssign[] OPERATIONS = {
+ new AssignNonzerosIterateThisLookupThat(),
+ new AssignNonzerosIterateThatLookupThisMergeUpdates(),
+ new AssignNonzerosIterateThatLookupThisInplaceUpdates(),
+
+ new AssignIterateIntersection(),
+
+ new AssignIterateUnionSequentialMergeUpdates(),
+ new AssignIterateUnionSequentialInplaceUpdates(),
+ new AssignIterateUnionRandomMergeUpdates(),
+ new AssignIterateUnionRandomInplaceUpdates(),
+
+ new AssignAllIterateSequentialMergeUpdates(),
+ new AssignAllIterateSequentialInplaceUpdates(),
+ new AssignAllIterateThisLookupThatMergeUpdates(),
+ new AssignAllIterateThisLookupThatInplaceUpdates(),
+ new AssignAllIterateThatLookupThisMergeUpdates(),
+ new AssignAllIterateThatLookupThisInplaceUpdates(),
+ new AssignAllLoopMergeUpdates(),
+ new AssignAllLoopInplaceUpdates(),
};
/**
@@ -87,16 +87,16 @@ public abstract class VectorBinaryAssign
public static VectorBinaryAssign getBestOperation(Vector x, Vector y, DoubleDoubleFunction f) {
int bestOperationIndex = -1;
double bestCost = Double.POSITIVE_INFINITY;
- for (int i = 0; i < operations.length; ++i) {
- if (operations[i].isValid(x, y, f)) {
- double cost = operations[i].estimateCost(x, y, f);
+ for (int i = 0; i < OPERATIONS.length; ++i) {
+ if (OPERATIONS[i].isValid(x, y, f)) {
+ double cost = OPERATIONS[i].estimateCost(x, y, f);
if (cost < bestCost) {
bestCost = cost;
bestOperationIndex = i;
}
}
}
- return operations[bestOperationIndex];
+ return OPERATIONS[bestOperationIndex];
}
/**
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/function/Functions.java Wed Jun 12 20:44:19 2013
@@ -1561,8 +1561,8 @@ public final class Functions {
if (b == 2) {
return a * a;
} else {
- return Math.pow(a, b);
- }
+ return Math.pow(a, b);
+ }
}
};
}
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/function/PlusMult.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/function/PlusMult.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/function/PlusMult.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/function/PlusMult.java Wed Jun 12 20:44:19 2013
@@ -113,8 +113,8 @@ public final class PlusMult extends Doub
*/
@Override
public boolean isAssociative() {
- return Math.abs(multiplicator - 0.0) < Constants.EPSILON ||
- Math.abs(multiplicator - 1.0) < Constants.EPSILON;
+ return Math.abs(multiplicator - 0.0) < Constants.EPSILON
+ || Math.abs(multiplicator - 1.0) < Constants.EPSILON;
}
public void setMultiplicator(double multiplicator) {
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/MersenneTwister.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/MersenneTwister.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/MersenneTwister.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/jet/random/engine/MersenneTwister.java Wed Jun 12 20:44:19 2013
@@ -132,8 +132,8 @@ import java.util.Date;
MersenneTwister generates random numbers in batches of 624 numbers at a time, so
the caching and pipelining of modern systems is exploited.
The generator is implemented to generate the output by using the fastest arithmetic
- operations only: 32-bit additions and bit operations (no division, no multiplication, no mod).
- These operations generate sequences of 32 random bits (<tt>int</tt>'s).
+ OPERATIONS only: 32-bit additions and bit OPERATIONS (no division, no multiplication, no mod).
+ These OPERATIONS generate sequences of 32 random bits (<tt>int</tt>'s).
<tt>long</tt>'s are formed by concatenating two 32 bit <tt>int</tt>'s.
<tt>float</tt>'s are formed by dividing the interval <tt>[0.0,1.0]</tt> into 2<sup>32</sup>
sub intervals, then randomly choosing one subinterval.
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/list/package-info.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/list/package-info.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/list/package-info.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/list/package-info.java Wed Jun 12 20:44:19 2013
@@ -17,9 +17,9 @@
* <tt>double</tt>, etc.
* </li>
* <li>Compact representations</li>
- * <li>A number of general purpose list operations including: adding, inserting,
+ * <li>A number of general purpose list OPERATIONS including: adding, inserting,
* removing, iterating, searching, sorting, extracting ranges and copying. All
- * operations are designed to perform well on mass data.
+ * OPERATIONS are designed to perform well on mass data.
* </li>
* <li>Support for quick access to list elements. This is achieved by bounds-checking
* and non-bounds-checking accessor methods as well as zero-copy transformations
@@ -90,7 +90,7 @@
* </td>
* </table>
* <p> For efficiency, all classes provide back doors to enable getting/setting the
- * backing array directly. In this way, the high level operations of these classes
+ * backing array directly. In this way, the high level OPERATIONS of these classes
* can be used where appropriate, and one can switch to <tt>[]</tt>-array index
* notations where necessary. The key methods for this are <tt>public <ElementType>[]
* elements()</tt> and <tt>public void elements(<ElementType>[])</tt>. The
@@ -101,7 +101,7 @@
* algorithm (or other algorithm) can operate on the returned primitive array.
* The latter method forces a list to internally hold a user provided array. Using
* this approach one can avoid needing to copy the elements into the list.
- * <p>As a consequence, operations on primitive arrays, Colt lists and JAL algorithms
+ * <p>As a consequence, OPERATIONS on primitive arrays, Colt lists and JAL algorithms
* can freely be mixed at zero-copy overhead.
* <p> Note that such special treatment certainly breaks encapsulation. This functionality
* is provided for performance reasons only and should only be used when absolutely
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/map/package-info.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/map/package-info.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/map/package-info.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/map/package-info.java Wed Jun 12 20:44:19 2013
@@ -16,7 +16,7 @@
* </li>
* <li>Compact representations</li>
* <li>Support for quick access to associations</li>
- * <li>A number of general purpose map operations</li>
+ * <li>A number of general purpose map OPERATIONS</li>
* </ul>
* <p>File-based I/O can be achieved through the standard Java built-in serialization
* mechanism. All classes implement the {@link java.io.Serializable} interface.
@@ -187,7 +187,7 @@
* </ul>
* Resizing large hash maps can be time consuming, <tt>O(size())</tt>, and should be avoided if possible (maintaining
* primes is not the reason).
- * Unnecessary growing operations can be avoided if the number of associations is known before they are added, or can be
+ * Unnecessary growing OPERATIONS can be avoided if the number of associations is known before they are added, or can be
* estimated.<p>
* In such a case good parameters are as follows:
* <p>
@@ -229,7 +229,7 @@
* <b>Performance:</b>
* <p>
* Time complexity:
- * <br>The classes offer <i>expected</i> time complexity <tt>O(1)</tt> (i.e. constant time) for the basic operations
+ * <br>The classes offer <i>expected</i> time complexity <tt>O(1)</tt> (i.e. constant time) for the basic OPERATIONS
* <tt>put</tt>, <tt>get</tt>, <tt>removeKey</tt>, <tt>containsKey</tt> and <tt>size</tt>,
* assuming the hash function disperses the elements properly among the buckets.
* Otherwise, pathological cases, although highly improbable, can occur, degrading performance to <tt>O(N)</tt> in the
Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractVectorTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractVectorTest.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractVectorTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/AbstractVectorTest.java Wed Jun 12 20:44:19 2013
@@ -13,7 +13,7 @@ import org.junit.Test;
/**
* Makes sure that a vector under test acts the same as a DenseVector or RandomAccessSparseVector
- * (according to whether it is dense or sparse). Most operations need to be done within a reasonable
+ * (according to whether it is dense or sparse). Most OPERATIONS need to be done within a reasonable
* tolerance.
*
* The idea is that a new vector implementation can extend AbstractVectorTest to get pretty high
Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateTest.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAggregateTest.java Wed Jun 12 20:44:19 2013
@@ -30,7 +30,7 @@ public final class VectorBinaryAggregate
ImmutableSet.of(Functions.PLUS, Functions.PLUS_ABS, Functions.MAX),
ImmutableSet.of(Functions.PLUS, Functions.PLUS_ABS, Functions.MULT, Functions.MULT_RIGHT_PLUS1,
Functions.MINUS),
- ImmutableSet.copyOf(VectorBinaryAggregate.operations)))) {
+ ImmutableSet.copyOf(VectorBinaryAggregate.OPERATIONS)))) {
data.add(entry.toArray());
}
return data;
Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignTest.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorBinaryAssignTest.java Wed Jun 12 20:44:19 2013
@@ -28,7 +28,7 @@ public final class VectorBinaryAssignTes
for (List entry : Sets.cartesianProduct(Lists.newArrayList(
ImmutableSet.of(Functions.PLUS, Functions.PLUS_ABS, Functions.MULT, Functions.MULT_RIGHT_PLUS1,
Functions.MINUS),
- ImmutableSet.copyOf(VectorBinaryAssign.operations)))) {
+ ImmutableSet.copyOf(VectorBinaryAssign.OPERATIONS)))) {
data.add(entry.toArray());
}
return data;
Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java?rev=1492416&r1=1492415&r2=1492416&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/randomized/RandomBlasting.java Wed Jun 12 20:44:19 2013
@@ -9,6 +9,8 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import org.apache.mahout.math.map.OpenIntIntHashMap;
import org.apache.mahout.math.map.OpenIntObjectHashMap;
import org.apache.mahout.math.map.OpenObjectIntHashMap;
@@ -31,11 +33,11 @@ public class RandomBlasting extends Rand
@Test
@Repeat(iterations = 20)
- public void testAgainstReference_OpenObjectIntHashMap() {
+ public void testAgainstReferenceOpenObjectIntHashMap() {
OpenObjectIntHashMap<Integer> base = new OpenObjectIntHashMap<Integer>();
Map<Integer, Integer> reference = new HashMap<Integer, Integer>();
- List<Operation> ops = new ArrayList<Operation>();
+ List<Operation> ops = Lists.newArrayList();
addOp(ops, Operation.ADD, 60);
addOp(ops, Operation.REMOVE, 30);
addOp(ops, Operation.INDEXOF, 30);
@@ -82,11 +84,11 @@ public class RandomBlasting extends Rand
@Test
@Repeat(iterations = 20)
- public void testAgainstReference_OpenIntObjectHashMap() {
+ public void testAgainstReferenceOpenIntObjectHashMap() {
OpenIntObjectHashMap<Integer> base = new OpenIntObjectHashMap<Integer>();
Map<Integer, Integer> reference = new HashMap<Integer, Integer>();
- List<Operation> ops = new ArrayList<Operation>();
+ List<Operation> ops = Lists.newArrayList();
addOp(ops, Operation.ADD, 60);
addOp(ops, Operation.REMOVE, 30);
addOp(ops, Operation.INDEXOF, 30);
@@ -133,11 +135,11 @@ public class RandomBlasting extends Rand
@Test
@Repeat(iterations = 20)
- public void testAgainstReference_OpenIntIntHashMap() {
+ public void testAgainstReferenceOpenIntIntHashMap() {
OpenIntIntHashMap base = new OpenIntIntHashMap();
HashMap<Integer, Integer> reference = new HashMap<Integer, Integer>();
- List<Operation> ops = new ArrayList<Operation>();
+ List<Operation> ops = Lists.newArrayList();
addOp(ops, Operation.ADD, 60);
addOp(ops, Operation.REMOVE, 30);
addOp(ops, Operation.INDEXOF, 30);
@@ -199,11 +201,11 @@ public class RandomBlasting extends Rand
@Test
@Repeat(iterations = 20)
- public void testAgainstReference_OpenIntHashSet() {
+ public void testAgainstReferenceOpenIntHashSet() {
AbstractIntSet base = new OpenIntHashSet();
- HashSet<Integer> reference = new HashSet<Integer>();
+ HashSet<Integer> reference = Sets.newHashSet();
- List<Operation> ops = new ArrayList<Operation>();
+ List<Operation> ops = Lists.newArrayList();
addOp(ops, Operation.ADD, 60);
addOp(ops, Operation.REMOVE, 30);
addOp(ops, Operation.INDEXOF, 30);
@@ -250,11 +252,11 @@ public class RandomBlasting extends Rand
@Seed("deadbeef")
@Test
@Repeat(iterations = 20)
- public void testAgainstReference_OpenHashSet() {
+ public void testAgainstReferenceOpenHashSet() {
Set<Integer> base = new OpenHashSet<Integer>();
- Set<Integer> reference = new HashSet<Integer>();
+ Set<Integer> reference = Sets.newHashSet();
- List<Operation> ops = new ArrayList<Operation>();
+ List<Operation> ops = Lists.newArrayList();
addOp(ops, Operation.ADD, 60);
addOp(ops, Operation.REMOVE, 30);
addOp(ops, Operation.INDEXOF, 30);
@@ -325,8 +327,7 @@ public class RandomBlasting extends Rand
tableField.setAccessible(true);
Object[] table = (Object[]) tableField.get(m);
- assertEquals(new HashSet<Object>(Arrays.asList(new Object[] {null})), new HashSet<Object>(
- Arrays.asList(table)));
+ assertEquals(Sets.newHashSet(Arrays.asList(new Object[] {null})), Sets.newHashSet(Arrays.asList(table)));
}
/** Add multiple repetitions of op to the list. */