You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by tc...@apache.org on 2012/05/15 05:47:40 UTC
svn commit: r1338525 [2/2] - in /mahout/trunk:
core/src/main/java/org/apache/mahout/cf/taste/hadoop/als/
core/src/main/java/org/apache/mahout/cf/taste/hadoop/item/
core/src/main/java/org/apache/mahout/cf/taste/hadoop/preparation/
core/src/main/java/org...
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleMatrix2D.java?rev=1338525&r1=1338524&r2=1338525&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleMatrix2D.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/DoubleMatrix2D.java Tue May 15 03:47:39 2012
@@ -53,8 +53,8 @@ public abstract class DoubleMatrix2D ext
}
double a = f.apply(getQuick(rows - 1, columns - 1));
int d = 1; // last cell already done
- for (int row = rows; --row >= 0; ) {
- for (int column = columns - d; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns - d; --column >= 0;) {
a = aggr.apply(a, f.apply(getQuick(row, column)));
}
d = 0;
@@ -101,8 +101,8 @@ public abstract class DoubleMatrix2D ext
}
double a = f.apply(getQuick(rows - 1, columns - 1), other.getQuick(rows - 1, columns - 1));
int d = 1; // last cell already done
- for (int row = rows; --row >= 0; ) {
- for (int column = columns - d; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns - d; --column >= 0;) {
a = aggr.apply(a, f.apply(getQuick(row, column), other.getQuick(row, column)));
}
d = 0;
@@ -123,13 +123,13 @@ public abstract class DoubleMatrix2D ext
if (values.length != rows) {
throw new IllegalArgumentException("Must have same number of rows: rows=" + values.length + "rows()=" + rows());
}
- for (int row = rows; --row >= 0; ) {
+ for (int row = rows; --row >= 0;) {
double[] currentRow = values[row];
if (currentRow.length != columns) {
throw new IllegalArgumentException(
"Must have same number of columns in every row: columns=" + currentRow.length + "columns()=" + columns());
}
- for (int column = columns; --column >= 0; ) {
+ for (int column = columns; --column >= 0;) {
setQuick(row, column, currentRow[column]);
}
}
@@ -144,8 +144,8 @@ public abstract class DoubleMatrix2D ext
public DoubleMatrix2D assign(double value) {
int r = rows;
int c = columns;
- //for (int row=rows; --row >= 0; ) {
- // for (int column=columns; --column >= 0; ) {
+ //for (int row=rows; --row >= 0;) {
+ // for (int column=columns; --column >= 0;) {
for (int row = 0; row < r; row++) {
for (int column = 0; column < c; column++) {
setQuick(row, column, value);
@@ -174,8 +174,8 @@ public abstract class DoubleMatrix2D ext
* @see org.apache.mahout.math.function.Functions
*/
public void assign(DoubleFunction function) {
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
setQuick(row, column, function.apply(getQuick(row, column)));
}
}
@@ -202,8 +202,8 @@ public abstract class DoubleMatrix2D ext
//for (int row=0; row<rows; row++) {
//for (int column=0; column<columns; column++) {
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
setQuick(row, column, other.getQuick(row, column));
}
}
@@ -240,8 +240,8 @@ public abstract class DoubleMatrix2D ext
*/
public DoubleMatrix2D assign(DoubleMatrix2D y, DoubleDoubleFunction function) {
checkShape(y);
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
setQuick(row, column, function.apply(getQuick(row, column), y.getQuick(row, column)));
}
}
@@ -251,8 +251,8 @@ public abstract class DoubleMatrix2D ext
/** Returns the number of cells having non-zero values; ignores tolerance. */
public int cardinality() {
int cardinality = 0;
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
if (getQuick(row, column) != 0) {
cardinality++;
}
@@ -315,8 +315,8 @@ public abstract class DoubleMatrix2D ext
* @param function a function object taking as argument the current non-zero cell's row, column and value.
*/
public void forEachNonZero(IntIntDoubleFunction function) {
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
double value = getQuick(row, column);
if (value != 0) {
double r = function.apply(row, column, value);
@@ -467,9 +467,9 @@ public abstract class DoubleMatrix2D ext
*/
public double[][] toArray() {
double[][] values = new double[rows][columns];
- for (int row = rows; --row >= 0; ) {
+ for (int row = rows; --row >= 0;) {
double[] currentRow = values[row];
- for (int column = columns; --column >= 0; ) {
+ for (int column = columns; --column >= 0;) {
currentRow[column] = getQuick(row, column);
}
}
@@ -638,13 +638,13 @@ public abstract class DoubleMatrix2D ext
// check for "all"
if (rowIndexes == null) {
rowIndexes = new int[rows];
- for (int i = rows; --i >= 0; ) {
+ for (int i = rows; --i >= 0;) {
rowIndexes[i] = i;
}
}
if (columnIndexes == null) {
columnIndexes = new int[columns];
- for (int i = columns; --i >= 0; ) {
+ for (int i = columns; --i >= 0;) {
columnIndexes[i] = i;
}
}
@@ -653,10 +653,10 @@ public abstract class DoubleMatrix2D ext
checkColumnIndexes(columnIndexes);
int[] rowOffsets = new int[rowIndexes.length];
int[] columnOffsets = new int[columnIndexes.length];
- for (int i = rowIndexes.length; --i >= 0; ) {
+ for (int i = rowIndexes.length; --i >= 0;) {
rowOffsets[i] = rowOffset(rowRank(rowIndexes[i]));
}
- for (int i = columnIndexes.length; --i >= 0; ) {
+ for (int i = columnIndexes.length; --i >= 0;) {
columnOffsets[i] = columnOffset(columnRank(columnIndexes[i]));
}
return viewSelectionLike(rowOffsets, columnOffsets);
@@ -739,9 +739,9 @@ public abstract class DoubleMatrix2D ext
throw new IllegalArgumentException("Incompatible args");
}
- for (int i = rows; --i >= 0; ) {
+ for (int i = rows; --i >= 0;) {
double s = 0;
- for (int j = columns; --j >= 0; ) {
+ for (int j = columns; --j >= 0;) {
s += getQuick(i, j) * y.getQuick(j);
}
z.setQuick(i, alpha * s + beta * z.getQuick(i));
@@ -788,10 +788,10 @@ public abstract class DoubleMatrix2D ext
throw new IllegalArgumentException("Matrices must not be identical");
}
- for (int j = p; --j >= 0; ) {
- for (int i = m; --i >= 0; ) {
+ for (int j = p; --j >= 0;) {
+ for (int i = m; --i >= 0;) {
double s = 0;
- for (int k = n; --k >= 0; ) {
+ for (int k = n; --k >= 0;) {
s += getQuick(i, k) * B.getQuick(k, j);
}
C.setQuick(i, j, alpha * s + beta * C.getQuick(i, j));
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractMatrix2D.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractMatrix2D.java?rev=1338525&r1=1338524&r2=1338525&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractMatrix2D.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/AbstractMatrix2D.java Tue May 15 03:47:39 2012
@@ -118,7 +118,7 @@ public abstract class AbstractMatrix2D e
* @throws IndexOutOfBoundsException if <tt>! (0 <= indexes[i] < columns())</tt> for any i=0..indexes.length()-1.
*/
protected void checkColumnIndexes(int[] indexes) {
- for (int i = indexes.length; --i >= 0; ) {
+ for (int i = indexes.length; --i >= 0;) {
int index = indexes[i];
if (index < 0 || index >= columns) {
checkColumn(index);
@@ -143,7 +143,7 @@ public abstract class AbstractMatrix2D e
* @throws IndexOutOfBoundsException if <tt>! (0 <= indexes[i] < rows())</tt> for any i=0..indexes.length()-1.
*/
protected void checkRowIndexes(int[] indexes) {
- for (int i = indexes.length; --i >= 0; ) {
+ for (int i = indexes.length; --i >= 0;) {
int index = indexes[i];
if (index < 0 || index >= rows) {
checkRow(index);
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix1D.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix1D.java?rev=1338525&r1=1338524&r2=1338525&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix1D.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix1D.java Tue May 15 03:47:39 2012
@@ -91,7 +91,7 @@ public class DenseDoubleMatrix1D extends
int index = index(0);
int s = this.stride;
double[] elems = this.elements;
- for (int i = size; --i >= 0; ) {
+ for (int i = size; --i >= 0;) {
elems[index] = value;
index += s;
}
@@ -127,12 +127,12 @@ public class DenseDoubleMatrix1D extends
if (multiplicator == 1) {
return;
}
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[i] *= multiplicator;
i += s;
}
} else { // the general case x[i] = f(x[i])
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[i] = function.apply(elems[i]);
i += s;
}
@@ -181,7 +181,7 @@ public class DenseDoubleMatrix1D extends
int index = index(0);
int otherIndex = other.index(0);
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[index] = otherElems[otherIndex];
index += s;
otherIndex += ys;
@@ -237,13 +237,13 @@ public class DenseDoubleMatrix1D extends
// specialized for speed
if (function == Functions.MULT) { // x[i] = x[i] * y[i]
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[index] *= otherElems[otherIndex];
index += s;
otherIndex += ys;
}
} else if (function == Functions.DIV) { // x[i] = x[i] / y[i]
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[index] /= otherElems[otherIndex];
index += s;
otherIndex += ys;
@@ -253,26 +253,26 @@ public class DenseDoubleMatrix1D extends
if (multiplicator == 0) { // x[i] = x[i] + 0*y[i]
return this;
} else if (multiplicator == 1) { // x[i] = x[i] + y[i]
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[index] += otherElems[otherIndex];
index += s;
otherIndex += ys;
}
} else if (multiplicator == -1) { // x[i] = x[i] - y[i]
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[index] -= otherElems[otherIndex];
index += s;
otherIndex += ys;
}
} else { // the general case x[i] = x[i] + mult*y[i]
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[index] += multiplicator * otherElems[otherIndex];
index += s;
otherIndex += ys;
}
}
} else { // the general case x[i] = f(x[i],y[i])
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
elems[index] = function.apply(elems[index], otherElems[otherIndex]);
index += s;
otherIndex += ys;
@@ -418,7 +418,7 @@ public class DenseDoubleMatrix1D extends
int index = index(0);
int otherIndex = y.index(0);
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
double tmp = elems[index];
elems[index] = otherElems[otherIndex];
otherElems[otherIndex] = tmp;
@@ -497,7 +497,7 @@ public class DenseDoubleMatrix1D extends
/*
// unoptimized
- for (int k = min; --k >= 0; ) {
+ for (int k = min; --k >= 0;) {
sum += elems[i] * yElems[j];
i += s;
j += ys;
@@ -509,13 +509,13 @@ public class DenseDoubleMatrix1D extends
i -= s;
j -= ys;
double sum = 0;
- for (int k = min / 4; --k >= 0; ) {
+ for (int k = min / 4; --k >= 0;) {
sum += elems[i += s] * yElems[j += ys]
+ elems[i += s] * yElems[j += ys]
+ elems[i += s] * yElems[j += ys]
+ elems[i += s] * yElems[j += ys];
}
- for (int k = min % 4; --k >= 0; ) {
+ for (int k = min % 4; --k >= 0;) {
sum += elems[i += s] * yElems[j += ys];
}
return sum;
@@ -535,7 +535,7 @@ public class DenseDoubleMatrix1D extends
throw new IllegalStateException();
}
double sum = 0;
- for (int k = size; --k >= 0; ) {
+ for (int k = size; --k >= 0;) {
sum += elems[i];
i += s;
}
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java?rev=1338525&r1=1338524&r2=1338525&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/matrix/impl/DenseDoubleMatrix2D.java Tue May 15 03:47:39 2012
@@ -56,7 +56,7 @@ public final class DenseDoubleMatrix2D e
/** Constructs an identity matrix (having ones on the diagonal and zeros elsewhere). */
public static DoubleMatrix2D identity(int rowsAndColumns) {
DoubleMatrix2D matrix = new DenseDoubleMatrix2D(rowsAndColumns, rowsAndColumns);
- for (int i = rowsAndColumns; --i >= 0; ) {
+ for (int i = rowsAndColumns; --i >= 0;) {
matrix.setQuick(i, i, 1);
}
return matrix;
@@ -78,7 +78,7 @@ public final class DenseDoubleMatrix2D e
throw new IllegalArgumentException("Must have same number of rows: rows=" + values.length + "rows()=" + rows());
}
int i = columns * (rows - 1);
- for (int row = rows; --row >= 0; ) {
+ for (int row = rows; --row >= 0;) {
double[] currentRow = values[row];
if (currentRow.length != columns) {
throw new IllegalArgumentException(
@@ -104,8 +104,8 @@ public final class DenseDoubleMatrix2D e
int index = index(0, 0);
int cs = this.columnStride;
int rs = this.rowStride;
- for (int row = rows; --row >= 0; ) {
- for (int i = index, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, column = columns; --column >= 0;) {
elems[i] = value;
i += cs;
}
@@ -153,16 +153,16 @@ public final class DenseDoubleMatrix2D e
assign(0);
return;
}
- for (int row = rows; --row >= 0; ) { // the general case
- for (int i = index, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) { // the general case
+ for (int i = index, column = columns; --column >= 0;) {
elems[i] *= multiplicator;
i += cs;
}
index += rs;
}
} else { // the general case x[i] = f(x[i])
- for (int row = rows; --row >= 0; ) {
- for (int i = index, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, column = columns; --column >= 0;) {
elems[i] = function.apply(elems[i]);
i += cs;
}
@@ -218,8 +218,8 @@ public final class DenseDoubleMatrix2D e
int otherIndex = other.index(0, 0);
int index = index(0, 0);
- for (int row = rows; --row >= 0; ) {
- for (int i = index, j = otherIndex, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, j = otherIndex, column = columns; --column >= 0;) {
elems[i] = otherElems[j];
i += cs;
j += ocs;
@@ -282,8 +282,8 @@ public final class DenseDoubleMatrix2D e
// specialized for speed
if (function == Functions.MULT) { // x[i] = x[i] * y[i]
- for (int row = rows; --row >= 0; ) {
- for (int i = index, j = otherIndex, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, j = otherIndex, column = columns; --column >= 0;) {
elems[i] *= otherElems[j];
i += cs;
j += ocs;
@@ -292,8 +292,8 @@ public final class DenseDoubleMatrix2D e
otherIndex += ors;
}
} else if (function == Functions.DIV) { // x[i] = x[i] / y[i]
- for (int row = rows; --row >= 0; ) {
- for (int i = index, j = otherIndex, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, j = otherIndex, column = columns; --column >= 0;) {
elems[i] /= otherElems[j];
i += cs;
j += ocs;
@@ -306,8 +306,8 @@ public final class DenseDoubleMatrix2D e
if (multiplicator == 0) { // x[i] = x[i] + 0*y[i]
return this;
} else if (multiplicator == 1) { // x[i] = x[i] + y[i]
- for (int row = rows; --row >= 0; ) {
- for (int i = index, j = otherIndex, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, j = otherIndex, column = columns; --column >= 0;) {
elems[i] += otherElems[j];
i += cs;
j += ocs;
@@ -316,8 +316,8 @@ public final class DenseDoubleMatrix2D e
otherIndex += ors;
}
} else if (multiplicator == -1) { // x[i] = x[i] - y[i]
- for (int row = rows; --row >= 0; ) {
- for (int i = index, j = otherIndex, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, j = otherIndex, column = columns; --column >= 0;) {
elems[i] -= otherElems[j];
i += cs;
j += ocs;
@@ -326,8 +326,8 @@ public final class DenseDoubleMatrix2D e
otherIndex += ors;
}
} else { // the general case
- for (int row = rows; --row >= 0; ) { // x[i] = x[i] + mult*y[i]
- for (int i = index, j = otherIndex, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) { // x[i] = x[i] + mult*y[i]
+ for (int i = index, j = otherIndex, column = columns; --column >= 0;) {
elems[i] += multiplicator * otherElems[j];
i += cs;
j += ocs;
@@ -337,8 +337,8 @@ public final class DenseDoubleMatrix2D e
}
}
} else { // the general case x[i] = f(x[i],y[i])
- for (int row = rows; --row >= 0; ) {
- for (int i = index, j = otherIndex, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, j = otherIndex, column = columns; --column >= 0;) {
elems[i] = function.apply(elems[i], otherElems[j]);
i += cs;
j += ocs;
@@ -512,15 +512,15 @@ public final class DenseDoubleMatrix2D e
int indexZ = zz.index(0);
int cols = columns;
- for (int row = rows; --row >= 0; ) {
+ for (int row = rows; --row >= 0;) {
double sum = 0;
// loop unrolled
int i = indexA - As;
int j = indexY - ys;
- for (int k = cols % 4; --k >= 0; ) {
+ for (int k = cols % 4; --k >= 0;) {
sum += AElems[i += As] * yElems[j += ys];
}
- for (int k = cols / 4; --k >= 0; ) {
+ for (int k = cols / 4; --k >= 0;) {
sum += AElems[i += As] * yElems[j += ys]
+ AElems[i += As] * yElems[j += ys]
+ AElems[i += As] * yElems[j += ys]
@@ -629,16 +629,16 @@ public final class DenseDoubleMatrix2D e
mOptimal += m - rr;
}
- for (int j = p; --j >= 0; ) {
+ for (int j = p; --j >= 0;) {
int iA = indexA;
int iC = jC;
- for (int i = mOptimal; --i >= 0; ) {
+ for (int i = mOptimal; --i >= 0;) {
int kA = iA;
int kB = jB;
/*
// not unrolled:
- for (int k = n; --k >= 0; ) {
+ for (int k = n; --k >= 0;) {
//s += getQuick(i,k) * B.getQuick(k,j);
s += AElems[kA] * BElems[kB];
kB += rB;
@@ -651,10 +651,10 @@ public final class DenseDoubleMatrix2D e
kB -= rB;
double s = 0;
- for (int k = n % 4; --k >= 0; ) {
+ for (int k = n % 4; --k >= 0;) {
s += AElems[kA += cA] * BElems[kB += rB];
}
- for (int k = n / 4; --k >= 0; ) {
+ for (int k = n / 4; --k >= 0;) {
s += AElems[kA += cA] * BElems[kB += rB]
+ AElems[kA += cA] * BElems[kB += rB]
+ AElems[kA += cA] * BElems[kB += rB]
@@ -687,8 +687,8 @@ public final class DenseDoubleMatrix2D e
int cs = this.columnStride;
int rs = this.rowStride;
double sum = 0;
- for (int row = rows; --row >= 0; ) {
- for (int i = index, column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int i = index, column = columns; --column >= 0;) {
sum += elems[i];
i += cs;
}
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=1338525&r1=1338524&r2=1338525&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 May 15 03:47:39 2012
@@ -489,11 +489,11 @@ public final class SparseDoubleMatrix2D
// cache views
final DoubleMatrix1D[] Brows = new DoubleMatrix1D[n];
- for (int i = n; --i >= 0; ) {
+ for (int i = n; --i >= 0;) {
Brows[i] = B.viewRow(i);
}
final DoubleMatrix1D[] Crows = new DoubleMatrix1D[m];
- for (int i = m; --i >= 0; ) {
+ for (int i = m; --i >= 0;) {
Crows[i] = C.viewRow(i);
}
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=1338525&r1=1338524&r2=1338525&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 May 15 03:47:39 2012
@@ -326,13 +326,13 @@ class WrapperDoubleMatrix2D extends Doub
// check for "all"
if (rowIndexes == null) {
rowIndexes = new int[rows];
- for (int i = rows; --i >= 0; ) {
+ for (int i = rows; --i >= 0;) {
rowIndexes[i] = i;
}
}
if (columnIndexes == null) {
columnIndexes = new int[columns];
- for (int i = columns; --i >= 0; ) {
+ for (int i = columns; --i >= 0;) {
columnIndexes[i] = i;
}
}
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=1338525&r1=1338524&r2=1338525&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 May 15 03:47:39 2012
@@ -115,7 +115,7 @@ public final class Property {
}
double epsilon = tolerance();
- for (int i = size; --i >= 0; ) {
+ for (int i = size; --i >= 0;) {
//if (!(getQuick(i) == B.getQuick(i))) return false;
//if (Math.abs(A.getQuick(i) - B.getQuick(i)) > epsilon) return false;
double x = a.getQuick(i);
@@ -148,8 +148,8 @@ public final class Property {
int columns = a.columns();
double epsilon = tolerance();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
//if (!(A.getQuick(row,column) == value)) return false;
//if (Math.abs(value - A.getQuick(row,column)) > epsilon) return false;
double x = a.getQuick(row, column);
@@ -189,8 +189,8 @@ public final class Property {
}
double epsilon = tolerance();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
//if (!(A.getQuick(row,column) == B.getQuick(row,column))) return false;
//if (Math.abs((A.getQuick(row,column) - B.getQuick(row,column)) > epsilon) return false;
double x = a.getQuick(row, column);
@@ -215,8 +215,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
//if (row!=column && A.getQuick(row,column) != 0) return false;
if (row != column && Math.abs(a.getQuick(row, column)) > epsilon) {
return false;
@@ -235,7 +235,7 @@ public final class Property {
public static boolean isDiagonallyDominantByColumn(DoubleMatrix2D a) {
//double epsilon = tolerance();
int min = Math.min(a.rows(), a.columns());
- for (int i = min; --i >= 0; ) {
+ for (int i = min; --i >= 0;) {
double diag = Math.abs(a.getQuick(i, i));
diag += diag;
if (diag <= a.viewColumn(i).aggregate(Functions.PLUS, Functions.ABS)) {
@@ -254,7 +254,7 @@ public final class Property {
public static boolean isDiagonallyDominantByRow(DoubleMatrix2D a) {
//double epsilon = tolerance();
int min = Math.min(a.rows(), a.columns());
- for (int i = min; --i >= 0; ) {
+ for (int i = min; --i >= 0;) {
double diag = Math.abs(a.getQuick(i, i));
diag += diag;
if (diag <= a.viewRow(i).aggregate(Functions.PLUS, Functions.ABS)) {
@@ -272,8 +272,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
double v = a.getQuick(row, column);
if (row == column) {
if (Math.abs(1 - v) > epsilon) {
@@ -295,8 +295,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
if (!(row == column || row == column + 1) && Math.abs(a.getQuick(row, column)) > epsilon) {
return false;
}
@@ -313,7 +313,7 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int column = columns; --column >= 0; ) {
+ for (int column = columns; --column >= 0;) {
for (int row = Math.min(column, rows); --row >= 0;) {
//if (A.getQuick(row,column) != 0) return false;
if (Math.abs(a.getQuick(row, column)) > epsilon) {
@@ -331,8 +331,8 @@ public final class Property {
public static boolean isNonNegative(DoubleMatrix2D a) {
int rows = a.rows();
int columns = a.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
if (a.getQuick(row, column) < 0) {
return false;
}
@@ -358,8 +358,8 @@ public final class Property {
public static boolean isPositive(DoubleMatrix2D a) {
int rows = a.rows();
int columns = a.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
if (a.getQuick(row, column) <= 0) {
return false;
}
@@ -379,8 +379,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
//int columns = A.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = rows; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = rows; --column >= 0;) {
//if (A.getQuick(row,column) != -A.getQuick(column,row)) return false;
if (Math.abs(a.getQuick(row, column) + a.getQuick(column, row)) > epsilon) {
return false;
@@ -403,7 +403,7 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int column = columns; --column >= 0; ) {
+ for (int column = columns; --column >= 0;) {
for (int row = Math.min(rows, column + 1); --row >= 0;) {
//if (A.getQuick(row,column) != 0) return false;
if (Math.abs(a.getQuick(row, column)) > epsilon) {
@@ -441,8 +441,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int column = columns; --column >= 0; ) {
- for (int row = rows; --row >= column; ) {
+ for (int column = columns; --column >= 0;) {
+ for (int row = rows; --row >= column;) {
//if (A.getQuick(row,column) != 0) return false;
if (Math.abs(a.getQuick(row, column)) > epsilon) {
return false;
@@ -478,8 +478,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
if (Math.abs(row - column) > 1 && Math.abs(a.getQuick(row, column)) > epsilon) {
return false;
}
@@ -515,8 +515,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int row = rows; --row >= 0; ) {
- for (int column = columns; --column >= 0; ) {
+ for (int row = rows; --row >= 0;) {
+ for (int column = columns; --column >= 0;) {
if (!(row == column || row == column - 1) && Math.abs(a.getQuick(row, column)) > epsilon) {
return false;
}
@@ -533,8 +533,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
int columns = a.columns();
- for (int column = columns; --column >= 0; ) {
- for (int row = rows; --row > column; ) {
+ for (int column = columns; --column >= 0;) {
+ for (int row = rows; --row > column;) {
//if (A.getQuick(row,column) != 0) return false;
if (Math.abs(a.getQuick(row, column)) > epsilon) {
return false;
@@ -565,8 +565,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
- for (int k = rows; --k >= 0; ) {
- for (int i = rows - k; --i >= 0; ) {
+ for (int k = rows; --k >= 0;) {
+ for (int i = rows - k; --i >= 0;) {
int j = i + k;
//if (A.getQuick(j,i) != 0) return k;
if (Math.abs(a.getQuick(j, i)) > epsilon) {
@@ -627,8 +627,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
- for (int k = rows; --k >= 0; ) {
- for (int i = rows - k; --i >= 0; ) {
+ for (int k = rows; --k >= 0;) {
+ for (int i = rows - k; --i >= 0;) {
int j = i + k;
//if (A.getQuick(j,i) != 0) return k+1;
//if (A.getQuick(i,j) != 0) return k+1;
@@ -664,8 +664,8 @@ public final class Property {
double epsilon = tolerance();
int rows = a.rows();
- for (int k = rows; --k >= 0; ) {
- for (int i = rows - k; --i >= 0; ) {
+ for (int k = rows; --k >= 0;) {
+ for (int i = rows - k; --i >= 0;) {
int j = i + k;
//if (A.getQuick(i,j) != 0) return k;
if (!(Math.abs(a.getQuick(i, j)) <= epsilon)) {
Modified: mahout/trunk/math/src/test/java/org/apache/mahout/math/stats/LogLikelihoodTest.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/test/java/org/apache/mahout/math/stats/LogLikelihoodTest.java?rev=1338525&r1=1338524&r2=1338525&view=diff
==============================================================================
--- mahout/trunk/math/src/test/java/org/apache/mahout/math/stats/LogLikelihoodTest.java (original)
+++ mahout/trunk/math/src/test/java/org/apache/mahout/math/stats/LogLikelihoodTest.java Tue May 15 03:47:39 2012
@@ -39,7 +39,7 @@ public final class LogLikelihoodTest ext
assertEquals(0.0, LogLikelihood.entropy(1), 0.0);
//TODO: more tests here
try {
- LogLikelihood.entropy(-1, -1);//exception
+ LogLikelihood.entropy(-1, -1); //exception
fail();
} catch (IllegalArgumentException e) {