mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tdunn...@apache.org
Subject svn commit: r1164009 - in /mahout/trunk/math/src/main/java/org/apache/mahout/math: AbstractMatrix.java Matrix.java
Date Thu, 01 Sep 2011 11:28:06 GMT
Author: tdunning
Date: Thu Sep  1 11:28:06 2011
New Revision: 1164009

URL: http://svn.apache.org/viewvc?rev=1164009&view=rev
Log:
MAHOUT-790 - Add view for diagonal of a matrix.

Modified:
    mahout/trunk/math/src/main/java/org/apache/mahout/math/AbstractMatrix.java
    mahout/trunk/math/src/main/java/org/apache/mahout/math/Matrix.java

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=1164009&r1=1164008&r2=1164009&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:28:06 2011
@@ -308,6 +308,14 @@ public abstract class AbstractMatrix imp
   }
 
   /**
+   * Provides a view of the diagonal of a matrix.
+   */
+  @Override
+  public Vector viewDiagonal() {
+    return new MatrixVectorView(this, 0, 0, 1, 1);
+  }
+
+  /**
    * Collects the results of a function applied to each column of a matrix.
    *
    * @param f The function to be applied to each column.

Modified: mahout/trunk/math/src/main/java/org/apache/mahout/math/Matrix.java
URL: http://svn.apache.org/viewvc/mahout/trunk/math/src/main/java/org/apache/mahout/math/Matrix.java?rev=1164009&r1=1164008&r2=1164009&view=diff
==============================================================================
--- mahout/trunk/math/src/main/java/org/apache/mahout/math/Matrix.java (original)
+++ mahout/trunk/math/src/main/java/org/apache/mahout/math/Matrix.java Thu Sep  1 11:28:06
2011
@@ -409,4 +409,6 @@ public interface Matrix extends Cloneabl
   Vector viewRow(int row);
 
   Vector viewColumn(int column);
+
+  Vector viewDiagonal();
 }



Mime
View raw message