Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedDenseDoubleMatrix2D.java Tue Sep 14 01:05:30 2010 @@ -30,10 +30,10 @@ import org.apache.mahout.math.matrix.Dou * @author [email protected] * @version 1.0, 09/24/99 */ -class SelectedDenseDoubleMatrix2D extends DoubleMatrix2D { +final class SelectedDenseDoubleMatrix2D extends DoubleMatrix2D { /** The elements of this matrix. */ - protected final double[] elements; + double[] elements; /** The offsets of the visible cells of this matrix. */ private int[] rowOffsets; @@ -49,7 +49,7 @@ class SelectedDenseDoubleMatrix2D extend * @param rowOffsets The row offsets of the cells that shall be visible. * @param columnOffsets The column offsets of the cells that shall be visible. */ - protected SelectedDenseDoubleMatrix2D(double[] elements, int[] rowOffsets, int[] columnOffsets, int offset) { + SelectedDenseDoubleMatrix2D(double[] elements, int[] rowOffsets, int[] columnOffsets, int offset) { this(rowOffsets.length, columnOffsets.length, elements, 0, 0, 1, 1, rowOffsets, columnOffsets, offset); } @@ -66,7 +66,7 @@ class SelectedDenseDoubleMatrix2D extend * @param rowOffsets The row offsets of the cells that shall be visible. * @param columnOffsets The column offsets of the cells that shall be visible. */ - protected SelectedDenseDoubleMatrix2D(int rows, int columns, double[] elements, int rowZero, int columnZero, + SelectedDenseDoubleMatrix2D(int rows, int columns, double[] elements, int rowZero, int columnZero, int rowStride, int columnStride, int[] rowOffsets, int[] columnOffsets, int offset) { // be sure parameters are valid, we do not check... @@ -88,7 +88,7 @@ class SelectedDenseDoubleMatrix2D extend * @return the position. */ @Override - protected int _columnOffset(int absRank) { + protected int columnOffset(int absRank) { return columnOffsets[absRank]; } @@ -100,7 +100,7 @@ class SelectedDenseDoubleMatrix2D extend * @return the position. */ @Override - protected int _rowOffset(int absRank) { + protected int rowOffset(int absRank) { return rowOffsets[absRank]; } @@ -117,7 +117,8 @@ class SelectedDenseDoubleMatrix2D extend */ @Override public double getQuick(int row, int column) { - //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) throw new IndexOutOfBoundsException("row:"+row+", column:"+column); + //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) + // throw new IndexOutOfBoundsException("row:"+row+", column:"+column); //return elements[index(row,column)]; //manually inlined: return elements[offset + rowOffsets[rowZero + row * rowStride] + columnOffsets[columnZero + column * columnStride]]; @@ -196,7 +197,8 @@ class SelectedDenseDoubleMatrix2D extend */ @Override protected DoubleMatrix1D like1D(int size, int zero, int stride) { - throw new InternalError(); // this method is never called since viewRow() and viewColumn are overridden properly. + throw new UnsupportedOperationException(); + // this method is never called since viewRow() and viewColumn are overridden properly. } /** @@ -212,7 +214,8 @@ class SelectedDenseDoubleMatrix2D extend */ @Override public void setQuick(int row, int column, double value) { - //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) throw new IndexOutOfBoundsException("row:"+row+", column:"+column); + //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) + // throw new IndexOutOfBoundsException("row:"+row+", column:"+column); //elements[index(row,column)] = value; //manually inlined: elements[offset + rowOffsets[rowZero + row * rowStride] + columnOffsets[columnZero + column * columnStride]] = @@ -268,7 +271,7 @@ class SelectedDenseDoubleMatrix2D extend int viewZero = this.rowZero; int viewStride = this.rowStride; int[] viewOffsets = this.rowOffsets; - int viewOffset = this.offset + _columnOffset(_columnRank(column)); + int viewOffset = this.offset + columnOffset(columnRank(column)); return new SelectedDenseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset); } @@ -291,7 +294,7 @@ class SelectedDenseDoubleMatrix2D extend int viewZero = columnZero; int viewStride = this.columnStride; int[] viewOffsets = this.columnOffsets; - int viewOffset = this.offset + _rowOffset(_rowRank(row)); + int viewOffset = this.offset + rowOffset(rowRank(row)); return new SelectedDenseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset); }
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix1D.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix1D.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix1D.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix1D.java Tue Sep 14 01:05:30 2010 @@ -31,17 +31,17 @@ import org.apache.mahout.math.matrix.Dou * @author [email protected] * @version 1.0, 09/24/99 */ -class SelectedSparseDoubleMatrix1D extends DoubleMatrix1D { +final class SelectedSparseDoubleMatrix1D extends DoubleMatrix1D { /* * The elements of the matrix. */ - protected final AbstractIntDoubleMap elements; + final AbstractIntDoubleMap elements; /** The offsets of visible indexes of this matrix. */ - protected final int[] offsets; + private final int[] offsets; /** The offset. */ - protected int offset; + private int offset; /** * Constructs a matrix view with the given parameters. @@ -52,7 +52,7 @@ class SelectedSparseDoubleMatrix1D exten * @param stride the number of indexes between any two elements, i.e. <tt>index(i+1)-index(i)</tt>. * @param offsets the offsets of the cells that shall be visible. */ - protected SelectedSparseDoubleMatrix1D(int size, AbstractIntDoubleMap elements, int zero, int stride, int[] offsets, + SelectedSparseDoubleMatrix1D(int size, AbstractIntDoubleMap elements, int zero, int stride, int[] offsets, int offset) { setUp(size, zero, stride); @@ -68,7 +68,7 @@ class SelectedSparseDoubleMatrix1D exten * @param elements the cells. * @param offsets The indexes of the cells that shall be visible. */ - protected SelectedSparseDoubleMatrix1D(AbstractIntDoubleMap elements, int[] offsets) { + SelectedSparseDoubleMatrix1D(AbstractIntDoubleMap elements, int[] offsets) { this(offsets.length, elements, 0, 1, offsets, 0); } Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix2D.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix2D.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix2D.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SelectedSparseDoubleMatrix2D.java Tue Sep 14 01:05:30 2010 @@ -31,18 +31,18 @@ import org.apache.mahout.math.matrix.Dou * @author [email protected] * @version 1.0, 09/24/99 */ -class SelectedSparseDoubleMatrix2D extends DoubleMatrix2D { +final class SelectedSparseDoubleMatrix2D extends DoubleMatrix2D { /* * The elements of the matrix. */ - protected final AbstractIntDoubleMap elements; + final AbstractIntDoubleMap elements; /** The offsets of the visible cells of this matrix. */ - protected int[] rowOffsets; - protected int[] columnOffsets; + int[] rowOffsets; + int[] columnOffsets; /** The offset. */ - protected int offset; + int offset; /** * Constructs a matrix view with the given parameters. @@ -57,7 +57,7 @@ class SelectedSparseDoubleMatrix2D exten * @param rowOffsets The row offsets of the cells that shall be visible. * @param columnOffsets The column offsets of the cells that shall be visible. */ - protected SelectedSparseDoubleMatrix2D(int rows, int columns, AbstractIntDoubleMap elements, int rowZero, + SelectedSparseDoubleMatrix2D(int rows, int columns, AbstractIntDoubleMap elements, int rowZero, int columnZero, int rowStride, int columnStride, int[] rowOffsets, int[] columnOffsets, int offset) { // be sure parameters are valid, we do not check... @@ -78,7 +78,7 @@ class SelectedSparseDoubleMatrix2D exten * @param rowOffsets The row offsets of the cells that shall be visible. * @param columnOffsets The column offsets of the cells that shall be visible. */ - protected SelectedSparseDoubleMatrix2D(AbstractIntDoubleMap elements, int[] rowOffsets, int[] columnOffsets, + SelectedSparseDoubleMatrix2D(AbstractIntDoubleMap elements, int[] rowOffsets, int[] columnOffsets, int offset) { this(rowOffsets.length, columnOffsets.length, elements, 0, 0, 1, 1, rowOffsets, columnOffsets, offset); } @@ -91,7 +91,7 @@ class SelectedSparseDoubleMatrix2D exten * @return the position. */ @Override - protected int _columnOffset(int absRank) { + protected int columnOffset(int absRank) { return columnOffsets[absRank]; } @@ -103,7 +103,7 @@ class SelectedSparseDoubleMatrix2D exten * @return the position. */ @Override - protected int _rowOffset(int absRank) { + protected int rowOffset(int absRank) { return rowOffsets[absRank]; } @@ -120,7 +120,8 @@ class SelectedSparseDoubleMatrix2D exten */ @Override public double getQuick(int row, int column) { - //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) throw new IndexOutOfBoundsException("row:"+row+", column:"+column); + //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) + // throw new IndexOutOfBoundsException("row:"+row+", column:"+column); //return elements.get(index(row,column)); //manually inlined: return elements @@ -200,7 +201,8 @@ class SelectedSparseDoubleMatrix2D exten */ @Override protected DoubleMatrix1D like1D(int size, int zero, int stride) { - throw new InternalError(); // this method is never called since viewRow() and viewColumn are overridden properly. + throw new UnsupportedOperationException(); + // this method is never called since viewRow() and viewColumn are overridden properly. } /** @@ -216,7 +218,8 @@ class SelectedSparseDoubleMatrix2D exten */ @Override public void setQuick(int row, int column, double value) { - //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) throw new IndexOutOfBoundsException("row:"+row+", column:"+column); + //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) + // throw new IndexOutOfBoundsException("row:"+row+", column:"+column); //int index = index(row,column); //manually inlined: int index = offset + rowOffsets[rowZero + row * rowStride] + columnOffsets[columnZero + column * columnStride]; @@ -277,7 +280,7 @@ class SelectedSparseDoubleMatrix2D exten int viewZero = this.rowZero; int viewStride = this.rowStride; int[] viewOffsets = this.rowOffsets; - int viewOffset = this.offset + _columnOffset(_columnRank(column)); + int viewOffset = this.offset + columnOffset(columnRank(column)); return new SelectedSparseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset); } @@ -300,7 +303,7 @@ class SelectedSparseDoubleMatrix2D exten int viewZero = columnZero; int viewStride = this.columnStride; int[] viewOffsets = this.columnOffsets; - int viewOffset = this.offset + _rowOffset(_rowRank(row)); + int viewOffset = this.offset + rowOffset(rowRank(row)); return new SelectedSparseDoubleMatrix1D(viewSize, this.elements, viewZero, viewStride, viewOffsets, viewOffset); } Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix1D.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix1D.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix1D.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix1D.java Tue Sep 14 01:05:30 2010 @@ -15,11 +15,11 @@ import org.apache.mahout.math.matrix.Dou /** @deprecated until unit tests are in place. Until this time, this class/interface is unsupported. */ @Deprecated -public class SparseDoubleMatrix1D extends DoubleMatrix1D { +public final class SparseDoubleMatrix1D extends DoubleMatrix1D { /* * The elements of the matrix. */ - protected final AbstractIntDoubleMap elements; + final AbstractIntDoubleMap elements; /** * Constructs a matrix with a copy of the given values. The values are copied. So subsequent changes in @@ -70,7 +70,7 @@ public class SparseDoubleMatrix1D extend * @param stride the number of indexes between any two elements, i.e. <tt>index(i+1)-index(i)</tt>. * @throws IllegalArgumentException if <tt>size<0</tt>. */ - protected SparseDoubleMatrix1D(int size, AbstractIntDoubleMap elements, int offset, int stride) { + SparseDoubleMatrix1D(int size, AbstractIntDoubleMap elements, int offset, int stride) { setUp(size, offset, stride); this.elements = elements; this.isNoView = false; Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix2D.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix2D.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix2D.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/SparseDoubleMatrix2D.java Tue Sep 14 01:05:30 2010 @@ -22,12 +22,11 @@ import org.apache.mahout.math.matrix.Dou /** @deprecated until unit tests are in place. Until this time, this class/interface is unsupported. */ @Deprecated -public class SparseDoubleMatrix2D extends DoubleMatrix2D { +public final class SparseDoubleMatrix2D extends DoubleMatrix2D { /* * The elements of the matrix. */ - protected final AbstractIntDoubleMap elements; - protected int dummy; + final AbstractIntDoubleMap elements; /** * Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form @@ -88,7 +87,7 @@ public class SparseDoubleMatrix2D extend * @throws IllegalArgumentException if <tt>rows<0 || columns<0 || (double)columns*rows > Integer.MAX_VALUE</tt> or * flip's are illegal. */ - protected SparseDoubleMatrix2D(int rows, int columns, AbstractIntDoubleMap elements, int rowZero, int columnZero, + SparseDoubleMatrix2D(int rows, int columns, AbstractIntDoubleMap elements, int rowZero, int columnZero, int rowStride, int columnStride) { setUp(rows, columns, rowZero, columnZero, rowStride, columnStride); this.elements = elements; @@ -286,7 +285,8 @@ public class SparseDoubleMatrix2D extend */ @Override public double getQuick(int row, int column) { - //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) throw new IndexOutOfBoundsException("row:"+row+", column:"+column); + //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) + // throw new IndexOutOfBoundsException("row:"+row+", column:"+column); //return this.elements.get(index(row,column)); //manually inlined: return this.elements.get(rowZero + row * rowStride + columnZero + column * columnStride); @@ -381,7 +381,8 @@ public class SparseDoubleMatrix2D extend */ @Override public void setQuick(int row, int column, double value) { - //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) throw new IndexOutOfBoundsException("row:"+row+", column:"+column); + //if (debug) if (column<0 || column>=columns || row<0 || row>=rows) + // throw new IndexOutOfBoundsException("row:"+row+", column:"+column); //int index = index(row,column); //manually inlined: int index = rowZero + row * rowStride + columnZero + column * columnStride; @@ -431,8 +432,8 @@ public class SparseDoubleMatrix2D extend n = rows; } - boolean ignore = (z == null); - if (z == null) { + boolean ignore = z == null; + if (ignore) { z = new DenseDoubleMatrix1D(m); } @@ -459,7 +460,7 @@ public class SparseDoubleMatrix2D extend final int yi = y.index(0); if (yElements == null || zElements == null) { - throw new InternalError(); + throw new IllegalStateException(); } this.elements.forEachPair( Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix1D.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix1D.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix1D.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix1D.java Tue Sep 14 01:05:30 2010 @@ -22,7 +22,7 @@ class WrapperDoubleMatrix1D extends Doub /* * The elements of the matrix. */ - protected final DoubleMatrix1D content; + private final DoubleMatrix1D content; WrapperDoubleMatrix1D(DoubleMatrix1D newContent) { if (newContent != null) { @@ -210,7 +210,7 @@ class WrapperDoubleMatrix1D extends Doub */ @Override protected DoubleMatrix1D viewSelectionLike(int[] offsets) { - throw new InternalError(); // should never get called + throw new UnsupportedOperationException(); // should never get called } /** Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix2D.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix2D.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix2D.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/WrapperDoubleMatrix2D.java Tue Sep 14 01:05:30 2010 @@ -22,7 +22,7 @@ class WrapperDoubleMatrix2D extends Doub /* * The elements of the matrix. */ - protected final DoubleMatrix2D content; + private final DoubleMatrix2D content; /** * Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form @@ -108,7 +108,7 @@ class WrapperDoubleMatrix2D extends Doub */ @Override protected DoubleMatrix1D like1D(int size, int offset, int stride) { - throw new InternalError(); // should never get called + throw new UnsupportedOperationException(); // should never get called } /** @@ -368,7 +368,7 @@ class WrapperDoubleMatrix2D extends Doub */ @Override protected DoubleMatrix2D viewSelectionLike(int[] rowOffsets, int[] columnOffsets) { - throw new InternalError(); // should never be called + throw new UnsupportedOperationException(); // should never be called } /** Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/LUDecompositionQuick.java Tue Sep 14 01:05:30 2010 @@ -214,7 +214,7 @@ public class LUDecompositionQuick implem throw new IllegalArgumentException("Matrix must be square."); } - if (!isNonsingular()) { + if (!isNonSingular) { return 0; } // avoid rounding errors @@ -370,7 +370,7 @@ public class LUDecompositionQuick implem if (B.size() != m) { throw new IllegalArgumentException("Matrix dimensions must agree."); } - if (!this.isNonsingular()) { + if (!this.isNonSingular) { throw new IllegalArgumentException("Matrix is singular."); } @@ -433,7 +433,7 @@ public class LUDecompositionQuick implem if (B.rows() != m) { throw new IllegalArgumentException("Matrix row dimensions must agree."); } - if (!this.isNonsingular()) { + if (!this.isNonSingular) { throw new IllegalArgumentException("Matrix is singular."); } @@ -612,7 +612,7 @@ public class LUDecompositionQuick implem buf.append("isNonSingular = "); String unknown = "Illegal operation or error: "; try { - buf.append(String.valueOf(this.isNonsingular())); + buf.append(String.valueOf(this.isNonSingular)); } catch (IllegalArgumentException exc) { buf.append(unknown).append(exc.getMessage()); } @@ -626,7 +626,7 @@ public class LUDecompositionQuick implem buf.append("\npivot = "); try { - buf.append(String.valueOf(new IntArrayList(this.getPivot()))); + buf.append(String.valueOf(new IntArrayList(this.piv))); } catch (IllegalArgumentException exc) { buf.append(unknown).append(exc.getMessage()); } Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java (original) +++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/linalg/Property.java Tue Sep 14 01:05:30 2010 @@ -341,11 +341,8 @@ public class Property extends Persistent int columns = a.columns(); for (int row = rows; --row >= 0;) { for (int column = columns; --column >= 0;) { - if (!(row == column || row == column + 1)) { - //if (A.getQuick(row,column) != 0) return false; - if (Math.abs(a.getQuick(row, column)) > epsilon) { - return false; - } + if (!(row == column || row == column + 1) && Math.abs(a.getQuick(row, column)) > epsilon) { + return false; } } } @@ -532,11 +529,8 @@ public class Property extends Persistent int columns = a.columns(); for (int row = rows; --row >= 0;) { for (int column = columns; --column >= 0;) { - if (Math.abs(row - column) > 1) { - //if (A.getQuick(row,column) != 0) return false; - if (Math.abs(a.getQuick(row, column)) > epsilon) { - return false; - } + if (Math.abs(row - column) > 1 && Math.abs(a.getQuick(row, column)) > epsilon) { + return false; } } } @@ -572,11 +566,8 @@ public class Property extends Persistent int columns = a.columns(); for (int row = rows; --row >= 0;) { for (int column = columns; --column >= 0;) { - if (!(row == column || row == column - 1)) { - //if (A.getQuick(row,column) != 0) return false; - if (Math.abs(a.getQuick(row, column)) > epsilon) { - return false; - } + if (!(row == column || row == column - 1) && Math.abs(a.getQuick(row, column)) > epsilon) { + return false; } } } Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java (original) +++ mahout/trunk/math/src/test/java/org/apache/mahout/math/VectorTest.java Tue Sep 14 01:05:30 2010 @@ -160,7 +160,7 @@ public final class VectorTest extends Ma w.setQuick(4, 2.1); } - private void doTestGetDistanceSquared(Vector v, Vector w) { + private static void doTestGetDistanceSquared(Vector v, Vector w) { double expected = v.minus(w).getLengthSquared(); assertEquals(expected, v.getDistanceSquared(w), 1.0e-6); } @@ -187,7 +187,7 @@ public final class VectorTest extends Ma return d; } - private void doTestGetLengthSquared(Vector v) { + private static void doTestGetLengthSquared(Vector v) { double expected = lengthSquaredSlowly(v); assertEquals("v.getLengthSquared() != sum_of_squared_elements(v)", expected, v.getLengthSquared(), 0.0); @@ -207,7 +207,8 @@ public final class VectorTest extends Ma } } expected = lengthSquaredSlowly(v); - assertEquals("mutation via dense iterator.set fails to change lengthSquared", expected, v.getLengthSquared(), EPSILON); + assertEquals("mutation via dense iterator.set fails to change lengthSquared", + expected, v.getLengthSquared(), EPSILON); it = v.iterateNonZero(); int i = 0; Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/DistributionChecks.java URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/DistributionChecks.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/DistributionChecks.java (original) +++ mahout/trunk/math/src/test/java/org/apache/mahout/math/jet/random/DistributionChecks.java Tue Sep 14 01:05:30 2010 @@ -81,7 +81,7 @@ public final class DistributionChecks { UnivariateRealIntegrator integrator = new RombergIntegrator(); for (int i = 0; i < xs.length - 1; i++) { double delta = integrator.integrate(new UnivariateRealFunction() { - public double value(double v) throws FunctionEvaluationException { + public double value(double v) { return dist.pdf(v); } }, xs[i], xs[i + 1]); Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/benchmark/VectorBenchmarks.java Tue Sep 14 01:05:30 2010 @@ -26,6 +26,7 @@ import java.util.List; import java.util.Map; import java.util.Random; import java.util.Map.Entry; +import java.util.regex.Pattern; import org.apache.commons.cli2.CommandLine; import org.apache.commons.cli2.Group; @@ -64,6 +65,7 @@ import org.slf4j.LoggerFactory; public class VectorBenchmarks implements Summarizable { private static final Logger log = LoggerFactory.getLogger(VectorBenchmarks.class); + private static final Pattern TAB_PATTERN = Pattern.compile("\t"); private final Vector[][] vectors; private final List<Vector> randomVectors = new ArrayList<Vector>(); @@ -139,7 +141,7 @@ public class VectorBenchmarks implements while (implStats.size() < implId + 1) { implStats.add(new String[] {}); } - implStats.set(implId, info.split("\t")); + implStats.set(implId, TAB_PATTERN.split(info)); } public void createBenchmark() { Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwDriver.java Tue Sep 14 01:05:30 2010 @@ -59,8 +59,8 @@ public final class CDbwDriver extends Ab } @Override - public int run(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, - InterruptedException { + public int run(String[] args) + throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, InterruptedException { addInputOption(); addOutputOption(); addOption(DefaultOptionCreator.distanceMeasureOption().create()); @@ -104,8 +104,8 @@ public final class CDbwDriver extends Ab Path output, DistanceMeasure measure, int numIterations, - int numReducers) throws ClassNotFoundException, InstantiationException, IllegalAccessException, - IOException, InterruptedException { + int numReducers) + throws ClassNotFoundException, InstantiationException, IllegalAccessException, IOException, InterruptedException { job(clustersIn, clusteredPointsIn, output, measure, numIterations, numReducers); } @@ -114,8 +114,8 @@ public final class CDbwDriver extends Ab Path output, DistanceMeasure measure, int numIterations, - int numReducers) throws InstantiationException, IllegalAccessException, IOException, - InterruptedException, ClassNotFoundException { + int numReducers) + throws InstantiationException, IllegalAccessException, IOException, InterruptedException, ClassNotFoundException { Path stateIn = new Path(output, "representativePoints-0"); writeInitialState(stateIn, clustersIn); @@ -139,8 +139,8 @@ public final class CDbwDriver extends Ab System.out.println("Separation = " + evaluator.separation()); } - private static void writeInitialState(Path output, Path clustersIn) throws InstantiationException, IllegalAccessException, - IOException, SecurityException { + private static void writeInitialState(Path output, Path clustersIn) + throws InstantiationException, IllegalAccessException, IOException, SecurityException { Configuration conf = new Configuration(); FileSystem fs = FileSystem.get(output.toUri(), conf); for (FileStatus part : fs.listStatus(clustersIn)) { @@ -178,7 +178,7 @@ public final class CDbwDriver extends Ab * the number of Reducers desired */ private static void runIteration(Path input, Path stateIn, Path stateOut, DistanceMeasure measure, int numReducers) - throws IOException, InterruptedException, ClassNotFoundException { + throws IOException, InterruptedException, ClassNotFoundException { Configuration conf = new Configuration(); conf.set(STATE_IN_KEY, stateIn.toString()); conf.set(DISTANCE_MEASURE_KEY, measure.getClass().getName()); Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/clustering/cdbw/CDbwMapper.java Tue Sep 14 01:05:30 2010 @@ -53,7 +53,8 @@ public class CDbwMapper extends Mapper<I } @Override - protected void map(IntWritable clusterId, WeightedVectorWritable point, Context context) throws IOException, InterruptedException { + protected void map(IntWritable clusterId, WeightedVectorWritable point, Context context) + throws IOException, InterruptedException { int key = clusterId.get(); WeightedVectorWritable currentMDP = mostDistantPoints.get(key); Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/text/DefaultAnalyzer.java Tue Sep 14 01:05:30 2010 @@ -27,7 +27,7 @@ import org.apache.lucene.util.Version; public class DefaultAnalyzer extends StandardAnalyzer { public DefaultAnalyzer() { - super(Version.LUCENE_CURRENT); + super(Version.LUCENE_30); } } Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/clustering/ClusterDumper.java Tue Sep 14 01:05:30 2010 @@ -126,16 +126,16 @@ public final class ClusterDumper extends if (hasOption(SUBSTRING_OPTION)) { int sub = Integer.parseInt(getOption(SUBSTRING_OPTION)); if (sub >= 0) { - setSubString(sub); + subString = sub; } } if (hasOption(JSON_OPTION)) { - setUseJSON(true); + useJSON = true; } termDictionary = getOption(DICTIONARY_OPTION); dictionaryFormat = getOption(DICTIONARY_TYPE_OPTION); if (hasOption(NUM_WORDS_OPTION)) { - setNumTopFeatures(Integer.parseInt(getOption(NUM_WORDS_OPTION))); + numTopFeatures = Integer.parseInt(getOption(NUM_WORDS_OPTION)); } init(); printClusters(null); Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/nlp/collocations/llr/CollocCombiner.java Tue Sep 14 01:05:30 2010 @@ -18,7 +18,6 @@ package org.apache.mahout.utils.nlp.collocations.llr; import java.io.IOException; -import java.util.Iterator; import org.apache.hadoop.mapreduce.Reducer; @@ -30,11 +29,11 @@ public class CollocCombiner extends Redu int freq = 0; Gram value = null; - + // accumulate frequencies from values, preserve the last value // to write to the context. - for (Iterator<Gram> it = values.iterator(); it.hasNext(); ) { - value = it.next(); + for (Gram value1 : values) { + value = value1; freq += value.getFrequency(); } Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/common/PartialVectorMerger.java Tue Sep 14 01:05:30 2010 @@ -72,7 +72,7 @@ public final class PartialVectorMerger { * @throws ClassNotFoundException * @throws InterruptedException */ - public static void mergePartialVectors(List<Path> partialVectorPaths, + public static void mergePartialVectors(Iterable<Path> partialVectorPaths, Path output, float normPower, int dimension, Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/io/TermInfoWriter.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/io/TermInfoWriter.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/io/TermInfoWriter.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/io/TermInfoWriter.java Tue Sep 14 01:05:30 2010 @@ -17,13 +17,13 @@ package org.apache.mahout.utils.vectors.io; +import java.io.Closeable; import java.io.IOException; import org.apache.mahout.utils.vectors.TermInfo; -public interface TermInfoWriter { +public interface TermInfoWriter extends Closeable { void write(TermInfo ti) throws IOException; - - void close(); + } Modified: mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java (original) +++ mahout/trunk/utils/src/main/java/org/apache/mahout/utils/vectors/lucene/ClusterLabels.java Tue Sep 14 01:05:30 2010 @@ -194,7 +194,7 @@ public class ClusterLabels { log.info("# of documents in the index {}", reader.numDocs()); - Set<String> idSet = new HashSet<String>(); + Collection<String> idSet = new HashSet<String>(); for (WeightedVectorWritable wvw : wvws) { Vector vector = wvw.getVector(); if (vector instanceof NamedVector) { Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java (original) +++ mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/TestClusterDumper.java Tue Sep 14 01:05:30 2010 @@ -39,7 +39,6 @@ import org.apache.lucene.store.RAMDirect import org.apache.lucene.util.Version; import org.apache.mahout.clustering.canopy.CanopyDriver; import org.apache.mahout.clustering.dirichlet.DirichletDriver; -import org.apache.mahout.clustering.dirichlet.models.AbstractVectorModelDistribution; import org.apache.mahout.clustering.dirichlet.models.DistanceMeasureClusterDistribution; import org.apache.mahout.clustering.dirichlet.models.GaussianClusterDistribution; import org.apache.mahout.clustering.dirichlet.models.SampledNormalDistribution; @@ -72,14 +71,23 @@ import org.junit.Test; public final class TestClusterDumper extends MahoutTestCase { - private static final String[] DOCS = { "The quick red fox jumped over the lazy brown dogs.", - "The quick brown fox jumped over the lazy red dogs.", "The quick red cat jumped over the lazy brown dogs.", - "The quick brown cat jumped over the lazy red dogs.", "Mary had a little lamb whose fleece was white as snow.", - "Mary had a little goat whose fleece was white as snow.", "Mary had a little lamb whose fleece was black as tar.", - "Dick had a little goat whose fleece was white as snow.", "Moby Dick is a story of a whale and a man obsessed.", - "Moby Bob is a story of a walrus and a man obsessed.", "Moby Dick is a story of a whale and a crazy man.", - "The robber wore a black fleece jacket and a baseball cap.", "The robber wore a red fleece jacket and a baseball cap.", - "The robber wore a white fleece jacket and a baseball cap.", "The English Springer Spaniel is the best of all dogs." }; + private static final String[] DOCS = { + "The quick red fox jumped over the lazy brown dogs.", + "The quick brown fox jumped over the lazy red dogs.", + "The quick red cat jumped over the lazy brown dogs.", + "The quick brown cat jumped over the lazy red dogs.", + "Mary had a little lamb whose fleece was white as snow.", + "Mary had a little goat whose fleece was white as snow.", + "Mary had a little lamb whose fleece was black as tar.", + "Dick had a little goat whose fleece was white as snow.", + "Moby Dick is a story of a whale and a man obsessed.", + "Moby Bob is a story of a walrus and a man obsessed.", + "Moby Dick is a story of a whale and a crazy man.", + "The robber wore a black fleece jacket and a baseball cap.", + "The robber wore a red fleece jacket and a baseball cap.", + "The robber wore a white fleece jacket and a baseball cap.", + "The English Springer Spaniel is the best of all dogs." + }; private List<VectorWritable> sampleData; private String[] termDictionary; @@ -99,7 +107,7 @@ public final class TestClusterDumper ext sampleData = new ArrayList<VectorWritable>(); RAMDirectory directory = new RAMDirectory(); IndexWriter writer = new IndexWriter(directory, - new StandardAnalyzer(Version.LUCENE_CURRENT), + new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED); for (int i = 0; i < docs2.length; i++) { @@ -156,7 +164,8 @@ public final class TestClusterDumper ext Path output = getTestTempDirPath("output"); CanopyDriver.runJob(getTestTempDirPath("testdata"), output, measure, 8, 4, true, false); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-0"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-0"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -167,9 +176,11 @@ public final class TestClusterDumper ext Path output = getTestTempDirPath("output"); CanopyDriver.runJob(getTestTempDirPath("testdata"), output, measure, 8, 4, false, false); // now run the KMeans job - KMeansDriver.runJob(getTestTempDirPath("testdata"), new Path(output, "clusters-0"), output, measure, 0.001, 10, 1, true, false); + KMeansDriver.runJob(getTestTempDirPath("testdata"), + new Path(output, "clusters-0"), output, measure, 0.001, 10, 1, true, false); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-2"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-2"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -193,7 +204,8 @@ public final class TestClusterDumper ext 0, false); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-3"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-3"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -201,9 +213,11 @@ public final class TestClusterDumper ext public void testMeanShift() throws Exception { DistanceMeasure measure = new CosineDistanceMeasure(); Path output = getTestTempDirPath("output"); - MeanShiftCanopyDriver.runJob(getTestTempDirPath("testdata"), output, measure, 0.5, 0.01, 0.05, 10, false, true, false); + MeanShiftCanopyDriver.runJob( + getTestTempDirPath("testdata"), output, measure, 0.5, 0.01, 0.05, 10, false, true, false); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-1"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-1"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -211,10 +225,13 @@ public final class TestClusterDumper ext public void testDirichlet() throws Exception { Path output = getTestTempDirPath("output"); NamedVector prototype = (NamedVector) sampleData.get(0).get(); - AbstractVectorModelDistribution modelDistribution = new SampledNormalDistribution(new VectorWritable(prototype)); - DirichletDriver.runJob(getTestTempDirPath("testdata"), output, modelDistribution, 15, 10, 1.0, 1, true, true, 0, false); + ModelDistribution<VectorWritable> modelDistribution = + new SampledNormalDistribution(new VectorWritable(prototype)); + DirichletDriver.runJob( + getTestTempDirPath("testdata"), output, modelDistribution, 15, 10, 1.0, 1, true, true, 0, false); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-10"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-10"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -222,10 +239,13 @@ public final class TestClusterDumper ext public void testDirichlet2() throws Exception { Path output = getTestTempDirPath("output"); NamedVector prototype = (NamedVector) sampleData.get(0).get(); - AbstractVectorModelDistribution modelDistribution = new GaussianClusterDistribution(new VectorWritable(prototype)); - DirichletDriver.runJob(getTestTempDirPath("testdata"), output, modelDistribution, 15, 10, 1.0, 1, true, true, 0, true); + ModelDistribution<VectorWritable> modelDistribution = + new GaussianClusterDistribution(new VectorWritable(prototype)); + DirichletDriver.runJob( + getTestTempDirPath("testdata"), output, modelDistribution, 15, 10, 1.0, 1, true, true, 0, true); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-10"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-10"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -233,10 +253,13 @@ public final class TestClusterDumper ext public void testDirichlet3() throws Exception { Path output = getTestTempDirPath("output"); NamedVector prototype = (NamedVector) sampleData.get(0).get(); - AbstractVectorModelDistribution modelDistribution = new DistanceMeasureClusterDistribution(new VectorWritable(prototype)); - DirichletDriver.runJob(getTestTempDirPath("testdata"), output, modelDistribution, 15, 10, 1.0, 1, true, true, 0, true); + ModelDistribution<VectorWritable> modelDistribution = + new DistanceMeasureClusterDistribution(new VectorWritable(prototype)); + DirichletDriver.runJob( + getTestTempDirPath("testdata"), output, modelDistribution, 15, 10, 1.0, 1, true, true, 0, true); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-10"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-10"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -246,12 +269,12 @@ public final class TestClusterDumper ext Path output = getTestTempDirPath("output"); Path tmp = getTestTempDirPath("tmp"); Path eigenvectors = new Path(output, "eigenvectors"); - int desiredRank = 15; DistributedLanczosSolver solver = new DistributedLanczosSolver(); Configuration conf = new Configuration(); solver.setConf(conf); Path testData = getTestTempDirPath("testdata"); int sampleDimension = sampleData.get(0).get().size(); + int desiredRank = 15; solver.run(testData, tmp, eigenvectors, sampleData.size(), sampleDimension, false, desiredRank); new EigenVerificationJob().run(testData, eigenvectors, output, tmp, 0.5, 0.0, true, null); @@ -304,7 +327,8 @@ public final class TestClusterDumper ext // now run the KMeans job KMeansDriver.runJob(svdData, new Path(output, "clusters-0"), output, measure, 0.001, 10, 1, true, false); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-2"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-2"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } @@ -314,12 +338,12 @@ public final class TestClusterDumper ext Path output = getTestTempDirPath("output"); Path tmp = getTestTempDirPath("tmp"); Path eigenvectors = new Path(output, "eigenvectors"); - int desiredRank = 13; DistributedLanczosSolver solver = new DistributedLanczosSolver(); Configuration config = new Configuration(); solver.setConf(config); Path testData = getTestTempDirPath("testdata"); int sampleDimension = sampleData.get(0).get().size(); + int desiredRank = 13; solver.run(testData, tmp, eigenvectors, sampleData.size(), sampleDimension, false, desiredRank); new EigenVerificationJob().run(testData, eigenvectors, output, tmp, 0.5, 0.0, false, null); @@ -339,7 +363,8 @@ public final class TestClusterDumper ext // now run the KMeans job KMeansDriver.runJob(sData.getRowPath(), new Path(output, "clusters-0"), output, measure, 0.001, 10, 1, true, false); // run ClusterDumper - ClusterDumper clusterDumper = new ClusterDumper(new Path(output, "clusters-2"), new Path(output, "clusteredPoints")); + ClusterDumper clusterDumper = + new ClusterDumper(new Path(output, "clusters-2"), new Path(output, "clusteredPoints")); clusterDumper.printClusters(termDictionary); } } Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java (original) +++ mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/cdbw/TestCDbwEvaluator.java Tue Sep 14 01:05:30 2010 @@ -33,10 +33,10 @@ import org.apache.hadoop.io.Writable; import org.apache.mahout.clustering.AbstractCluster; import org.apache.mahout.clustering.Cluster; import org.apache.mahout.clustering.ClusteringTestUtils; +import org.apache.mahout.clustering.ModelDistribution; import org.apache.mahout.clustering.canopy.Canopy; import org.apache.mahout.clustering.canopy.CanopyDriver; import org.apache.mahout.clustering.dirichlet.DirichletDriver; -import org.apache.mahout.clustering.dirichlet.models.AbstractVectorModelDistribution; import org.apache.mahout.clustering.dirichlet.models.GaussianClusterDistribution; import org.apache.mahout.clustering.fuzzykmeans.FuzzyKMeansDriver; import org.apache.mahout.clustering.kmeans.KMeansDriver; @@ -216,7 +216,8 @@ public final class TestCDbwEvaluator ext @Test public void testDirichlet() throws Exception { - AbstractVectorModelDistribution modelDistribution = new GaussianClusterDistribution(new VectorWritable(new DenseVector(2))); + ModelDistribution<VectorWritable> modelDistribution = + new GaussianClusterDistribution(new VectorWritable(new DenseVector(2))); DirichletDriver.runJob(getTestTempDirPath("testdata"), getTestTempDirPath("output"), modelDistribution, Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java (original) +++ mahout/trunk/utils/src/test/java/org/apache/mahout/clustering/dirichlet/TestL1ModelClustering.java Tue Sep 14 01:05:30 2010 @@ -101,7 +101,7 @@ public final class TestL1ModelClustering sampleData = new ArrayList<VectorWritable>(); RAMDirectory directory = new RAMDirectory(); IndexWriter writer = new IndexWriter(directory, - new StandardAnalyzer(Version.LUCENE_CURRENT), + new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED); for (int i = 0; i < docs2.length; i++) { Modified: mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java URL: http://svn.apache.org/viewvc/mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java?rev=996730&r1=996729&r2=996730&view=diff ============================================================================== --- mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java (original) +++ mahout/trunk/utils/src/test/java/org/apache/mahout/utils/vectors/lucene/LuceneIterableTest.java Tue Sep 14 01:05:30 2010 @@ -51,7 +51,7 @@ public final class LuceneIterableTest ex directory = new RAMDirectory(); IndexWriter writer = new IndexWriter( directory, - new StandardAnalyzer(Version.LUCENE_CURRENT), + new StandardAnalyzer(Version.LUCENE_30), true, IndexWriter.MaxFieldLength.UNLIMITED); for (int i = 0; i < LuceneIterableTest.DOCS.length; i++){
