You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by td...@apache.org on 2011/09/01 13:29:09 UTC
svn commit: r1164015 - in /mahout/trunk:
core/src/main/java/org/apache/mahout/clustering/lda/
math/src/main/java/org/apache/mahout/math/
Author: tdunning
Date: Thu Sep 1 11:29:08 2011
New Revision: 1164015
URL: http://svn.apache.org/viewvc?rev=1164015&view=rev
Log:
MAHOUT-790 - More get/view changes
Modified:
mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDAInference.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/DiagonalMatrix.java
mahout/trunk/math/src/main/java/org/apache/mahout/math/PivotedMatrix.java
Modified: mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDAInference.java
URL: http://svn.apache.org/viewvc/mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDAInference.java?rev=1164015&r1=1164014&r2=1164015&view=diff
==============================================================================
--- mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDAInference.java (original)
+++ mahout/trunk/core/src/main/java/org/apache/mahout/clustering/lda/LDAInference.java Thu Sep 1 11:29:08 2011
@@ -154,7 +154,7 @@ public class LDAInference {
}
private void createPhiMatrix(int docLength) {
- if (phi == null || phi.getRow(0).size() != docLength) {
+ if (phi == null || phi.rowSize() != docLength) {
phi = new DenseMatrix(state.getNumTopics(), docLength);
} else {
phi.assign(0);
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=1164015&r1=1164014&r2=1164015&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 Thu Sep 1 11:29:08 2011
@@ -67,21 +67,12 @@ public abstract class AbstractMatrix imp
return endOfData();
}
int i = slice++;
- return new MatrixSlice(slice(i), i);
+ return new MatrixSlice(viewRow(i), i);
}
};
}
/**
- * Abstracted out for iterating over either rows or columns (default is rows).
- * @param index the row or column number to grab as a vector (shallowly)
- * @return the row or column vector at that index.
- */
- protected Vector slice(int index) {
- return getRow(index);
- }
-
- /**
* Abstracted out for the iterator
* @return numRows() for row-based iterator, numColumns() for column-based.
*/
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/DiagonalMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/DiagonalMatrix.java?rev=1164015&r1=1164014&r2=1164015&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/DiagonalMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/DiagonalMatrix.java Thu Sep 1 11:29:08 2011
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.mahout.math;
/**
@@ -48,30 +65,6 @@ public class DiagonalMatrix extends Abst
}
/**
- * Return the column at the given index
- *
- * @param column an int column index
- * @return a Vector at the index
- * @throws IndexException if the index is out of bounds
- */
- @Override
- public Vector getColumn(int column) {
- return new MatrixVectorView(this, 0, column, 1, 0);
- }
-
- /**
- * Return the row at the given index
- *
- * @param row an int row index
- * @return a Vector at the index
- * @throws IndexException if the index is out of bounds
- */
- @Override
- public Vector getRow(int row) {
- return new MatrixVectorView(this, row, 0, 0, 1);
- }
-
- /**
* Provides a view of the diagonal of a matrix.
*/
@Override
Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/PivotedMatrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/PivotedMatrix.java?rev=1164015&r1=1164014&r2=1164015&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/PivotedMatrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/PivotedMatrix.java Thu Sep 1 11:29:08 2011
@@ -1,3 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.apache.mahout.math;
import com.google.common.base.Preconditions;
@@ -116,11 +133,11 @@ public class PivotedMatrix extends Abstr
* if the index is out of bounds
*/
@Override
- public Vector getColumn(int column) {
+ public Vector viewColumn(int column) {
if (column < 0 || column >= columnSize()) {
throw new IndexException(column, columnSize());
}
- return new PermutedVectorView(base.getColumn(columnPivot[column]), rowPivot, rowUnpivot);
+ return new PermutedVectorView(base.viewColumn(columnPivot[column]), rowPivot, rowUnpivot);
}
/**
@@ -132,11 +149,11 @@ public class PivotedMatrix extends Abstr
* if the index is out of bounds
*/
@Override
- public Vector getRow(int row) {
+ public Vector viewRow(int row) {
if (row < 0 || row >= rowSize()) {
throw new IndexException(row, rowSize());
}
- return new PermutedVectorView(base.getRow(rowPivot[row]), columnPivot, columnUnpivot);
+ return new PermutedVectorView(base.viewRow(rowPivot[row]), columnPivot, columnUnpivot);
}
/**