mahout-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sro...@apache.org
Subject svn commit: r885213 [5/6] - in /lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout: jet/math/ jet/random/ jet/random/engine/ jet/random/sampling/ jet/stat/ jet/stat/quantile/ matrix/ matrix/bitvector/ matrix/buffer/ matrix/list/ matrix/list/ada...
Date Sun, 29 Nov 2009 11:20:11 GMT
Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/AbstractMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/AbstractMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/AbstractMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/AbstractMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -266,15 +266,15 @@
   /**
    * Sets up a matrix with a given number of slices and rows and the given strides.
    *
-   * @param slices        the number of slices the matrix shall have.
-   * @param rows          the number of rows the matrix shall have.
-   * @param columns       the number of columns the matrix shall have.
-   * @param sliceZero     the position of the first element.
-   * @param rowZero       the position of the first element.
-   * @param columnZero    the position of the first element.
-   * @param sliceStride   the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
-   * @param rowStride     the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
-   * @param columnStride  the number of elements between two columns, i.e. <tt>index(k,i,j+1)-index(k,i,j)</tt>.
+   * @param slices       the number of slices the matrix shall have.
+   * @param rows         the number of rows the matrix shall have.
+   * @param columns      the number of columns the matrix shall have.
+   * @param sliceZero    the position of the first element.
+   * @param rowZero      the position of the first element.
+   * @param columnZero   the position of the first element.
+   * @param sliceStride  the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
+   * @param rowStride    the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
+   * @param columnStride the number of elements between two columns, i.e. <tt>index(k,i,j+1)-index(k,i,j)</tt>.
    * @throws IllegalArgumentException if <tt>(double)slices*rows*columnss > Integer.MAX_VALUE</tt>.
    * @throws IllegalArgumentException if <tt>slices<0 || rows<0 || columns<0</tt>.
    */

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DelegateDoubleMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DelegateDoubleMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DelegateDoubleMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DelegateDoubleMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -22,11 +22,11 @@
   /*
    * The elements of the matrix.
    */
-  protected DoubleMatrix2D content;
+  private DoubleMatrix2D content;
   /*
   * The row this view is bound to.
   */
-  protected int row;
+  private int row;
 
   DelegateDoubleMatrix1D(DoubleMatrix2D newContent, int row) {
     super(null);

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,9 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.jet.math.Mult;
+import org.apache.mahout.jet.math.PlusMult;
+import org.apache.mahout.matrix.function.DoubleFunction;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 /**
@@ -38,7 +41,7 @@
 public class DenseDoubleMatrix1D extends DoubleMatrix1D {
 
   /** The elements of this matrix. */
-  protected double[] elements;
+  protected final double[] elements;
 
   /**
    * Constructs a matrix with a copy of the given values. The values are copied. So subsequent changes in
@@ -124,7 +127,7 @@
    * <pre>
    * // change each cell to its sine
    * matrix =   0.5      1.5      2.5       3.5
-   * matrix.assign(org.apache.mahout.jet.math.Functions.sin);
+   * matrix.assign(Functions.sin);
    * -->
    * matrix ==  0.479426 0.997495 0.598472 -0.350783
    * </pre>
@@ -135,7 +138,7 @@
    * @see org.apache.mahout.jet.math.Functions
    */
   @Override
-  public DoubleMatrix1D assign(org.apache.mahout.matrix.function.DoubleFunction function) {
+  public DoubleMatrix1D assign(DoubleFunction function) {
     int s = stride;
     int i = index(0);
     double[] elems = this.elements;
@@ -144,8 +147,8 @@
     }
 
     // specialization for speed
-    if (function instanceof org.apache.mahout.jet.math.Mult) { // x[i] = mult*x[i]
-      double multiplicator = ((org.apache.mahout.jet.math.Mult) function).getMultiplicator();
+    if (function instanceof Mult) { // x[i] = mult*x[i]
+      double multiplicator = ((Mult) function).getMultiplicator();
       if (multiplicator == 1) {
         return this;
       }
@@ -271,8 +274,8 @@
         index += s;
         otherIndex += ys;
       }
-    } else if (function instanceof org.apache.mahout.jet.math.PlusMult) {
-      double multiplicator = ((org.apache.mahout.jet.math.PlusMult) function).getMultiplicator();
+    } else if (function instanceof PlusMult) {
+      double multiplicator = ((PlusMult) function).getMultiplicator();
       if (multiplicator == 0) { // x[i] = x[i] + 0*y[i]
         return this;
       } else if (multiplicator == 1) { // x[i] = x[i] + y[i]

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,9 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.jet.math.Mult;
+import org.apache.mahout.jet.math.PlusMult;
+import org.apache.mahout.matrix.function.DoubleFunction;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 /**
@@ -171,7 +174,7 @@
    * 2.5 3.5
    *
    * // change each cell to its sine
-   * matrix.assign(org.apache.mahout.jet.math.Functions.sin);
+   * matrix.assign(Functions.sin);
    * -->
    * 2 x 2 matrix
    * 0.479426  0.997495
@@ -184,7 +187,7 @@
    * @see org.apache.mahout.jet.math.Functions
    */
   @Override
-  public DoubleMatrix2D assign(org.apache.mahout.matrix.function.DoubleFunction function) {
+  public DoubleMatrix2D assign(DoubleFunction function) {
     double[] elems = this.elements;
     if (elems == null) {
       throw new InternalError();
@@ -194,8 +197,8 @@
     int rs = this.rowStride;
 
     // specialization for speed
-    if (function instanceof org.apache.mahout.jet.math.Mult) { // x[i] = mult*x[i]
-      double multiplicator = ((org.apache.mahout.jet.math.Mult) function).getMultiplicator();
+    if (function instanceof Mult) { // x[i] = mult*x[i]
+      double multiplicator = ((Mult) function).getMultiplicator();
       if (multiplicator == 1) {
         return this;
       }
@@ -351,8 +354,8 @@
         index += rs;
         otherIndex += ors;
       }
-    } else if (function instanceof org.apache.mahout.jet.math.PlusMult) {
-      double multiplicator = ((org.apache.mahout.jet.math.PlusMult) function).getMultiplicator();
+    } else if (function instanceof PlusMult) {
+      double multiplicator = ((PlusMult) function).getMultiplicator();
       if (multiplicator == 0) { // x[i] = x[i] + 0*y[i]
         return this;
       } else if (multiplicator == 1) { // x[i] = x[i] + y[i]
@@ -545,14 +548,14 @@
    * Make sure that cells of <tt>this</tt> and <tt>B</tt> do not overlap. In case of overlapping views, behaviour is
    * unspecified. </pre> <p> <b>Example:</b> <pre> final double alpha = 0.25; final double beta = 0.75;
    *
-   * // 8 neighbors org.apache.mahout.matrix.function.Double9Function f = new org.apache.mahout.matrix.function.Double9Function()
-   * { &nbsp;&nbsp;&nbsp;public final double apply( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a00, double a01, double
+   * // 8 neighbors org.apache.mahout.matrix.function.Double9Function f = new Double9Function() {
+   * &nbsp;&nbsp;&nbsp;public final double apply( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a00, double a01, double
    * a02, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a10, double a11, double a12, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double
    * a20, double a21, double a22) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return beta*a11 +
    * alpha*(a00+a01+a02 + a10+a12 + a20+a21+a22); &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} }; A.zAssign8Neighbors(B,f);
    *
-   * // 4 neighbors org.apache.mahout.matrix.function.Double9Function g = new org.apache.mahout.matrix.function.Double9Function()
-   * { &nbsp;&nbsp;&nbsp;public final double apply( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a00, double a01, double
+   * // 4 neighbors org.apache.mahout.matrix.function.Double9Function g = new Double9Function() {
+   * &nbsp;&nbsp;&nbsp;public final double apply( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a00, double a01, double
    * a02, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a10, double a11, double a12, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double
    * a20, double a21, double a22) { &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return beta*a11 + alpha*(a01+a10+a12+a21);
    * &nbsp;&nbsp;&nbsp;} C.zAssign8Neighbors(B,g); // fast, even though it doesn't look like it }; </pre>
@@ -677,16 +680,6 @@
     int cols = columns;
     for (int row = rows; --row >= 0;) {
       double sum = 0;
-
-      /*
-      // not loop unrolled
-      for (int i=indexA, j=indexY, column=columns; --column >= 0; ) {
-        sum += AElems[i] * yElems[j];
-        i += As;
-        j += ys;
-      }
-      */
-
       // loop unrolled
       int i = indexA - As;
       int j = indexY - ys;
@@ -724,19 +717,6 @@
         B.zMult(this, C.viewDice(), alpha, beta, !transposeB, true);
         return C;
       }
-      /*
-      final RCDoubleMatrix2D transB = new RCDoubleMatrix2D(B.columns,B.rows);
-      B.forEachNonZero(
-        new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
-          public double apply(int i, int j, double value) {
-            transB.setQuick(j,i,value);
-            return value;
-          }
-        }
-      );
-
-      return transB.zMult(this.viewDice(),C.viewDice()).viewDice();
-      */
     }
     if (transposeB) {
       return this.zMult(B.viewDice(), C, alpha, beta, transposeA, false);

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseDoubleMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -102,15 +102,15 @@
   /**
    * Constructs a view with the given parameters.
    *
-   * @param slices        the number of slices the matrix shall have.
-   * @param rows          the number of rows the matrix shall have.
-   * @param columns       the number of columns the matrix shall have.
-   * @param elements      the cells.
-   * @param sliceZero     the position of the first element.
-   * @param rowZero       the position of the first element.
-   * @param columnZero    the position of the first element.
-   * @param sliceStride   the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
-   * @param rowStride     the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
+   * @param slices       the number of slices the matrix shall have.
+   * @param rows         the number of rows the matrix shall have.
+   * @param columns      the number of columns the matrix shall have.
+   * @param elements     the cells.
+   * @param sliceZero    the position of the first element.
+   * @param rowZero      the position of the first element.
+   * @param columnZero   the position of the first element.
+   * @param sliceStride  the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
+   * @param rowStride    the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
    * @param columnStride the number of elements between two columns, i.e. <tt>index(k,i,j+1)-index(k,i,j)</tt>.
    * @throws IllegalArgumentException if <tt>(double)slices*columns*rows > Integer.MAX_VALUE</tt>.
    * @throws IllegalArgumentException if <tt>slices<0 || rows<0 || columns<0</tt>.
@@ -353,10 +353,10 @@
    * Make sure that cells of <tt>this</tt> and <tt>B</tt> do not overlap. In case of overlapping views, behaviour is
    * unspecified. </pre> <p> <b>Example:</b> <pre> final double alpha = 0.25; final double beta = 0.75;
    *
-   * org.apache.mahout.matrix.function.Double27Function f = new org.apache.mahout.matrix.function.Double27Function() {
-   * &nbsp;&nbsp;&nbsp;public final double apply( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a000, double a001, double
-   * a002, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a010, double a011, double a012,
-   * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a020, double a021, double a022,
+   * org.apache.mahout.matrix.function.Double27Function f = new Double27Function() { &nbsp;&nbsp;&nbsp;public final
+   * double apply( &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a000, double a001, double a002,
+   * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a010, double a011, double a012, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double
+   * a020, double a021, double a022,
    *
    * &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a100, double a101, double a102, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double
    * a110, double a111, double a112, &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double a120, double a121, double a122,

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,7 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.matrix.function.ObjectFunction;
 import org.apache.mahout.matrix.matrix.ObjectMatrix1D;
 import org.apache.mahout.matrix.matrix.ObjectMatrix2D;
 /**
@@ -38,7 +39,7 @@
 public class DenseObjectMatrix1D extends ObjectMatrix1D {
 
   /** The elements of this matrix. */
-  protected Object[] elements;
+  protected final Object[] elements;
 
   /**
    * Constructs a matrix with a copy of the given values. The values are copied. So subsequent changes in
@@ -106,7 +107,7 @@
    * <pre>
    * // change each cell to its sine
    * matrix =   0.5      1.5      2.5       3.5
-   * matrix.assign(org.apache.mahout.jet.math.Functions.sin);
+   * matrix.assign(Functions.sin);
    * -->
    * matrix ==  0.479426 0.997495 0.598472 -0.350783
    * </pre>
@@ -117,7 +118,7 @@
    * @see org.apache.mahout.jet.math.Functions
    */
   @Override
-  public ObjectMatrix1D assign(org.apache.mahout.matrix.function.ObjectFunction function) {
+  public ObjectMatrix1D assign(ObjectFunction function) {
     int s = stride;
     int i = index(0);
     Object[] elems = this.elements;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,7 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.matrix.function.ObjectFunction;
 import org.apache.mahout.matrix.matrix.ObjectMatrix1D;
 import org.apache.mahout.matrix.matrix.ObjectMatrix2D;
 /**
@@ -61,7 +62,7 @@
    * columnOf(index)==index%columns rowOf(index)==index/columns i.e. {row0 column0..m}, {row1 column0..m}, ..., {rown
    * column0..m}
    */
-  protected Object[] elements;
+  protected final Object[] elements;
 
   /**
    * Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form
@@ -149,7 +150,7 @@
    * 2.5 3.5
    *
    * // change each cell to its sine
-   * matrix.assign(org.apache.mahout.jet.math.Functions.sin);
+   * matrix.assign(Functions.sin);
    * -->
    * 2 x 2 matrix
    * 0.479426  0.997495
@@ -162,7 +163,7 @@
    * @see org.apache.mahout.jet.math.Functions
    */
   @Override
-  public ObjectMatrix2D assign(org.apache.mahout.matrix.function.ObjectFunction function) {
+  public ObjectMatrix2D assign(ObjectFunction function) {
     Object[] elems = this.elements;
     if (elems == null) {
       throw new InternalError();

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/DenseObjectMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -102,15 +102,15 @@
   /**
    * Constructs a view with the given parameters.
    *
-   * @param slices        the number of slices the matrix shall have.
-   * @param rows          the number of rows the matrix shall have.
-   * @param columns       the number of columns the matrix shall have.
-   * @param elements      the cells.
-   * @param sliceZero     the position of the first element.
-   * @param rowZero       the position of the first element.
-   * @param columnZero    the position of the first element.
-   * @param sliceStride   the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
-   * @param rowStride     the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
+   * @param slices       the number of slices the matrix shall have.
+   * @param rows         the number of rows the matrix shall have.
+   * @param columns      the number of columns the matrix shall have.
+   * @param elements     the cells.
+   * @param sliceZero    the position of the first element.
+   * @param rowZero      the position of the first element.
+   * @param columnZero   the position of the first element.
+   * @param sliceStride  the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
+   * @param rowStride    the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
    * @param columnStride the number of elements between two columns, i.e. <tt>index(k,i,j+1)-index(k,i,j)</tt>.
    * @throws IllegalArgumentException if <tt>(Object)slices*columns*rows > Integer.MAX_VALUE</tt>.
    * @throws IllegalArgumentException if <tt>slices<0 || rows<0 || columns<0</tt>.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,11 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.jet.math.Mult;
+import org.apache.mahout.jet.math.PlusMult;
+import org.apache.mahout.matrix.function.DoubleFunction;
+import org.apache.mahout.matrix.function.IntIntDoubleFunction;
 import org.apache.mahout.matrix.list.DoubleArrayList;
 import org.apache.mahout.matrix.list.IntArrayList;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
@@ -82,7 +87,7 @@
  <pre>
  // Linear algebraic y = A * x
  A.forEachNonZero(
- &nbsp;&nbsp;&nbsp;new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+ &nbsp;&nbsp;&nbsp;new IntIntDoubleFunction() {
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public double apply(int row, int column, double value) {
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;y.setQuick(row,y.getQuick(row) + value * x.getQuick(column));
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return value;
@@ -99,7 +104,7 @@
  <pre>
  // Elementwise A = A + alpha*B
  B.forEachNonZero(
- &nbsp;&nbsp;&nbsp;new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+ &nbsp;&nbsp;&nbsp;new IntIntDoubleFunction() {
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;public double apply(int row, int column, double value) {
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A.setQuick(row,column,A.getQuick(row,column) + alpha*value);
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return value;
@@ -122,9 +127,9 @@
   /*
    * The elements of the matrix.
    */
-  protected IntArrayList indexes;
-  protected DoubleArrayList values;
-  protected int[] starts;
+  private IntArrayList indexes;
+  private DoubleArrayList values;
+  private int[] starts;
 
   //protected int N;
 
@@ -186,9 +191,9 @@
   }
 
   @Override
-  public DoubleMatrix2D assign(org.apache.mahout.matrix.function.DoubleFunction function) {
-    if (function instanceof org.apache.mahout.jet.math.Mult) { // x[i] = mult*x[i]
-      double alpha = ((org.apache.mahout.jet.math.Mult) function).getMultiplicator();
+  public DoubleMatrix2D assign(DoubleFunction function) {
+    if (function instanceof Mult) { // x[i] = mult*x[i]
+      double alpha = ((Mult) function).getMultiplicator();
       if (alpha == 1) {
         return this;
       }
@@ -206,7 +211,7 @@
 
       /*
       forEachNonZero(
-        new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+        new IntIntDoubleFunction() {
           public double apply(int i, int j, double value) {
             return function.apply(value);
           }
@@ -241,7 +246,7 @@
 
       assign(0);
       source.forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               setQuick(i, j, value);
@@ -286,13 +291,13 @@
   public DoubleMatrix2D assign(DoubleMatrix2D y, org.apache.mahout.matrix.function.DoubleDoubleFunction function) {
     checkShape(y);
 
-    if (function instanceof org.apache.mahout.jet.math.PlusMult) { // x[i] = x[i] + alpha*y[i]
-      final double alpha = ((org.apache.mahout.jet.math.PlusMult) function).getMultiplicator();
+    if (function instanceof PlusMult) { // x[i] = x[i] + alpha*y[i]
+      final double alpha = ((PlusMult) function).getMultiplicator();
       if (alpha == 0) {
         return this;
       } // nothing to do
       y.forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               setQuick(i, j, getQuick(i, j) + alpha * value);
@@ -341,7 +346,7 @@
   }
 
   @Override
-  public DoubleMatrix2D forEachNonZero(org.apache.mahout.matrix.function.IntIntDoubleFunction function) {
+  public DoubleMatrix2D forEachNonZero(IntIntDoubleFunction function) {
     int[] idx = indexes.elements();
     double[] vals = values.elements();
 
@@ -510,7 +515,7 @@
 
     /*
     forEachNonZero(
-      new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+      new IntIntDoubleFunction() {
         public double apply(int i, int j, double value) {
           zElements[zi + zStride*i] += value * yElements[yi + yStride*j];
           //z.setQuick(row,z.getQuick(row) + value * y.getQuick(column));
@@ -538,7 +543,7 @@
       }
     } else {
       if (!ignore) {
-        z.assign(org.apache.mahout.jet.math.Functions.mult(beta));
+        z.assign(Functions.mult(beta));
       }
       for (int i = 0; i < s; i++) {
         int high = starts[i + 1];
@@ -585,7 +590,7 @@
     }
 
     if (!ignore) {
-      C.assign(org.apache.mahout.jet.math.Functions.mult(beta));
+      C.assign(Functions.mult(beta));
     }
 
     // cache views
@@ -598,7 +603,7 @@
       Crows[i] = C.viewRow(i);
     }
 
-    org.apache.mahout.jet.math.PlusMult fun = org.apache.mahout.jet.math.PlusMult.plusMult(0);
+    PlusMult fun = org.apache.mahout.jet.math.PlusMult.plusMult(0);
 
     int[] idx = indexes.elements();
     double[] vals = values.elements();

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCMDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCMDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCMDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/RCMDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,7 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.jet.math.Functions;
 import org.apache.mahout.matrix.list.DoubleArrayList;
 import org.apache.mahout.matrix.list.IntArrayList;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
@@ -23,8 +24,8 @@
   /*
    * The elements of the matrix.
    */
-  private IntArrayList[] indexes;
-  private DoubleArrayList[] values;
+  private final IntArrayList[] indexes;
+  private final DoubleArrayList[] values;
 
   /**
    * Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form
@@ -207,7 +208,7 @@
           "Incompatible args: " + toStringShort() + ", " + y.toStringShort() + ", " + z.toStringShort());
     }
 
-    z.assign(org.apache.mahout.jet.math.Functions.mult(beta / alpha));
+    z.assign(Functions.mult(beta / alpha));
     for (int i = indexes.length; --i >= 0;) {
       if (indexes[i] != null) {
         for (int k = indexes[i].size(); --k >= 0;) {
@@ -218,6 +219,6 @@
       }
     }
 
-    z.assign(org.apache.mahout.jet.math.Functions.mult(alpha));
+    z.assign(Functions.mult(alpha));
   }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -36,10 +36,10 @@
   protected final double[] 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.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -36,11 +36,11 @@
   protected final double[] elements;
 
   /** The offsets of the visible cells of this matrix. */
-  protected int[] rowOffsets;
-  protected int[] columnOffsets;
+  private int[] rowOffsets;
+  private int[] columnOffsets;
 
   /** The offset. */
-  protected int offset;
+  private int offset;
 
   /**
    * Constructs a matrix view with the given parameters.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseDoubleMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -36,12 +36,12 @@
   protected final double[] elements;
 
   /** The offsets of the visible cells of this matrix. */
-  protected int[] sliceOffsets;
-  protected int[] rowOffsets;
-  protected int[] columnOffsets;
+  private int[] sliceOffsets;
+  private int[] rowOffsets;
+  private int[] columnOffsets;
 
   /** The offset. */
-  protected int offset;
+  private int offset;
 
   /**
    * Constructs a matrix view with the given parameters.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -36,10 +36,10 @@
   protected final Object[] 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.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -36,11 +36,11 @@
   protected final Object[] elements;
 
   /** The offsets of the visible cells of this matrix. */
-  protected int[] rowOffsets;
-  protected int[] columnOffsets;
+  private int[] rowOffsets;
+  private int[] columnOffsets;
 
   /** The offset. */
-  protected int offset;
+  private int offset;
 
   /**
    * Constructs a matrix view with the given parameters.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedDenseObjectMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -36,12 +36,12 @@
   protected final Object[] elements;
 
   /** The offsets of the visible cells of this matrix. */
-  protected int[] sliceOffsets;
-  protected int[] rowOffsets;
-  protected int[] columnOffsets;
+  private int[] sliceOffsets;
+  private int[] rowOffsets;
+  private int[] columnOffsets;
 
   /** The offset. */
-  protected int offset;
+  private int offset;
 
   /**
    * Constructs a matrix view with the given parameters.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -35,10 +35,10 @@
   /*
    * The elements of the matrix.
    */
-  protected AbstractIntDoubleMap elements;
+  protected final AbstractIntDoubleMap elements;
 
   /** The offsets of visible indexes of this matrix. */
-  protected int[] offsets;
+  protected final int[] offsets;
 
   /** The offset. */
   protected int offset;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -35,7 +35,7 @@
   /*
    * The elements of the matrix.
    */
-  protected AbstractIntDoubleMap elements;
+  protected final AbstractIntDoubleMap elements;
 
   /** The offsets of the visible cells of this matrix. */
   protected int[] rowOffsets;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseDoubleMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -34,7 +34,7 @@
 class SelectedSparseDoubleMatrix3D extends DoubleMatrix3D {
 
   /** The elements of this matrix. */
-  protected AbstractIntDoubleMap elements;
+  protected final AbstractIntDoubleMap elements;
 
   /** The offsets of the visible cells of this matrix. */
   protected int[] sliceOffsets;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -35,10 +35,10 @@
   /*
    * The elements of the matrix.
    */
-  protected AbstractIntObjectMap elements;
+  protected final AbstractIntObjectMap elements;
 
   /** The offsets of visible indexes of this matrix. */
-  protected int[] offsets;
+  protected final int[] offsets;
 
   /** The offset. */
   protected int offset;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -35,7 +35,7 @@
   /*
    * The elements of the matrix.
    */
-  protected AbstractIntObjectMap elements;
+  protected final AbstractIntObjectMap elements;
 
   /** The offsets of the visible cells of this matrix. */
   protected int[] rowOffsets;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SelectedSparseObjectMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -34,7 +34,7 @@
 class SelectedSparseObjectMatrix3D extends ObjectMatrix3D {
 
   /** The elements of this matrix. */
-  protected AbstractIntObjectMap elements;
+  protected final AbstractIntObjectMap elements;
 
   /** The offsets of the visible cells of this matrix. */
   protected int[] sliceOffsets;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -55,7 +55,7 @@
   /*
    * The elements of the matrix.
    */
-  protected AbstractIntDoubleMap elements;
+  protected final AbstractIntDoubleMap elements;
 
   /**
    * Constructs a matrix with a copy of the given values. The values are copied. So subsequent changes in

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,13 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.jet.math.Mult;
+import org.apache.mahout.jet.math.PlusMult;
+import org.apache.mahout.matrix.function.DoubleDoubleFunction;
+import org.apache.mahout.matrix.function.DoubleFunction;
+import org.apache.mahout.matrix.function.IntDoubleProcedure;
+import org.apache.mahout.matrix.function.IntIntDoubleFunction;
 import org.apache.mahout.matrix.map.AbstractIntDoubleMap;
 import org.apache.mahout.matrix.map.OpenIntDoubleHashMap;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
@@ -171,7 +178,7 @@
    * 2.5 3.5
    *
    * // change each cell to its sine
-   * matrix.assign(org.apache.mahout.jet.math.Functions.sin);
+   * matrix.assign(Functions.sin);
    * -->
    * 2 x 2 matrix
    * 0.479426  0.997495
@@ -184,8 +191,8 @@
    * @see org.apache.mahout.jet.math.Functions
    */
   @Override
-  public DoubleMatrix2D assign(org.apache.mahout.matrix.function.DoubleFunction function) {
-    if (this.isNoView && function instanceof org.apache.mahout.jet.math.Mult) { // x[i] = mult*x[i]
+  public DoubleMatrix2D assign(DoubleFunction function) {
+    if (this.isNoView && function instanceof Mult) { // x[i] = mult*x[i]
       this.elements.assign(function);
     } else {
       super.assign(function);
@@ -224,20 +231,20 @@
 
   @Override
   public DoubleMatrix2D assign(final DoubleMatrix2D y,
-                               org.apache.mahout.matrix.function.DoubleDoubleFunction function) {
+                               DoubleDoubleFunction function) {
     if (!this.isNoView) {
       return super.assign(y, function);
     }
 
     checkShape(y);
 
-    if (function instanceof org.apache.mahout.jet.math.PlusMult) { // x[i] = x[i] + alpha*y[i]
-      final double alpha = ((org.apache.mahout.jet.math.PlusMult) function).getMultiplicator();
+    if (function instanceof PlusMult) { // x[i] = x[i] + alpha*y[i]
+      final double alpha = ((PlusMult) function).getMultiplicator();
       if (alpha == 0) {
         return this;
       } // nothing to do
       y.forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               setQuick(i, j, getQuick(i, j) + alpha * value);
@@ -250,7 +257,7 @@
 
     if (function == org.apache.mahout.jet.math.Functions.mult) { // x[i] = x[i] * y[i]
       this.elements.forEachPair(
-          new org.apache.mahout.matrix.function.IntDoubleProcedure() {
+          new IntDoubleProcedure() {
             @Override
             public boolean apply(int key, double value) {
               int i = key / columns;
@@ -267,7 +274,7 @@
 
     if (function == org.apache.mahout.jet.math.Functions.div) { // x[i] = x[i] / y[i]
       this.elements.forEachPair(
-          new org.apache.mahout.matrix.function.IntDoubleProcedure() {
+          new IntDoubleProcedure() {
             @Override
             public boolean apply(int key, double value) {
               int i = key / columns;
@@ -313,7 +320,7 @@
   public DoubleMatrix2D forEachNonZero(final org.apache.mahout.matrix.function.IntIntDoubleFunction function) {
     if (this.isNoView) {
       this.elements.forEachPair(
-          new org.apache.mahout.matrix.function.IntDoubleProcedure() {
+          new IntDoubleProcedure() {
             @Override
             public boolean apply(int key, double value) {
               int i = key / columns;
@@ -506,7 +513,7 @@
     }
 
     if (!ignore) {
-      z.assign(org.apache.mahout.jet.math.Functions.mult(beta / alpha));
+      z.assign(Functions.mult(beta / alpha));
     }
 
     DenseDoubleMatrix1D zz = (DenseDoubleMatrix1D) z;
@@ -524,7 +531,7 @@
     }
 
     this.elements.forEachPair(
-        new org.apache.mahout.matrix.function.IntDoubleProcedure() {
+        new IntDoubleProcedure() {
           @Override
           public boolean apply(int key, double value) {
             int i = key / columns;
@@ -543,7 +550,7 @@
 
     /*
     forEachNonZero(
-      new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+      new IntIntDoubleFunction() {
         public double apply(int i, int j, double value) {
           if (transposeA) { int tmp=i; i=j; j=tmp; }
           zElements[zi + zStride*i] += value * yElements[yi + yStride*j];
@@ -556,7 +563,7 @@
     */
 
     if (alpha != 1) {
-      z.assign(org.apache.mahout.jet.math.Functions.mult(alpha));
+      z.assign(Functions.mult(alpha));
     }
     return z;
   }
@@ -596,7 +603,7 @@
     }
 
     if (!ignore) {
-      C.assign(org.apache.mahout.jet.math.Functions.mult(beta));
+      C.assign(Functions.mult(beta));
     }
 
     // cache views
@@ -612,7 +619,7 @@
     final org.apache.mahout.jet.math.PlusMult fun = org.apache.mahout.jet.math.PlusMult.plusMult(0);
 
     this.elements.forEachPair(
-        new org.apache.mahout.matrix.function.IntDoubleProcedure() {
+        new IntDoubleProcedure() {
           @Override
           public boolean apply(int key, double value) {
             int i = key / columns;

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseDoubleMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -141,15 +141,15 @@
   /**
    * Constructs a view with the given parameters.
    *
-   * @param slices        the number of slices the matrix shall have.
-   * @param rows          the number of rows the matrix shall have.
-   * @param columns       the number of columns the matrix shall have.
-   * @param elements      the cells.
-   * @param sliceZero     the position of the first element.
-   * @param rowZero       the position of the first element.
-   * @param columnZero    the position of the first element.
-   * @param sliceStride   the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
-   * @param rowStride     the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
+   * @param slices       the number of slices the matrix shall have.
+   * @param rows         the number of rows the matrix shall have.
+   * @param columns      the number of columns the matrix shall have.
+   * @param elements     the cells.
+   * @param sliceZero    the position of the first element.
+   * @param rowZero      the position of the first element.
+   * @param columnZero   the position of the first element.
+   * @param sliceStride  the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
+   * @param rowStride    the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
    * @param columnStride the number of elements between two columns, i.e. <tt>index(k,i,j+1)-index(k,i,j)</tt>.
    * @throws IllegalArgumentException if <tt>(double)slices*columns*rows > Integer.MAX_VALUE</tt>.
    * @throws IllegalArgumentException if <tt>slices<0 || rows<0 || columns<0</tt>.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -55,7 +55,7 @@
   /*
    * The elements of the matrix.
    */
-  protected AbstractIntObjectMap elements;
+  protected final AbstractIntObjectMap elements;
 
   /**
    * Constructs a matrix with a copy of the given values. The values are copied. So subsequent changes in

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -77,7 +77,7 @@
   /*
    * The elements of the matrix.
    */
-  protected AbstractIntObjectMap elements;
+  protected final AbstractIntObjectMap elements;
 
   /**
    * Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix3D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix3D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix3D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/SparseObjectMatrix3D.java Sun Nov 29 11:19:58 2009
@@ -141,15 +141,15 @@
   /**
    * Constructs a view with the given parameters.
    *
-   * @param slices        the number of slices the matrix shall have.
-   * @param rows          the number of rows the matrix shall have.
-   * @param columns       the number of columns the matrix shall have.
-   * @param elements      the cells.
-   * @param sliceZero     the position of the first element.
-   * @param rowZero       the position of the first element.
-   * @param columnZero    the position of the first element.
-   * @param sliceStride   the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
-   * @param rowStride     the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
+   * @param slices       the number of slices the matrix shall have.
+   * @param rows         the number of rows the matrix shall have.
+   * @param columns      the number of columns the matrix shall have.
+   * @param elements     the cells.
+   * @param sliceZero    the position of the first element.
+   * @param rowZero      the position of the first element.
+   * @param columnZero   the position of the first element.
+   * @param sliceStride  the number of elements between two slices, i.e. <tt>index(k+1,i,j)-index(k,i,j)</tt>.
+   * @param rowStride    the number of elements between two rows, i.e. <tt>index(k,i+1,j)-index(k,i,j)</tt>.
    * @param columnStride the number of elements between two columns, i.e. <tt>index(k,i,j+1)-index(k,i,j)</tt>.
    * @throws IllegalArgumentException if <tt>(Object)slices*columns*rows > Integer.MAX_VALUE</tt>.
    * @throws IllegalArgumentException if <tt>slices<0 || rows<0 || columns<0</tt>.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/TridiagonalDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/TridiagonalDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/TridiagonalDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/TridiagonalDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,11 @@
 */
 package org.apache.mahout.matrix.matrix.impl;
 
+import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.jet.math.Mult;
+import org.apache.mahout.jet.math.PlusMult;
+import org.apache.mahout.matrix.function.DoubleDoubleFunction;
+import org.apache.mahout.matrix.function.IntIntDoubleFunction;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 
@@ -23,7 +28,7 @@
   /*
    * The non zero elements of the matrix: {lower, diagonal, upper}.
    */
-  protected final double[] values;
+  private final double[] values;
 
   /*
   * The startIndexes and number of non zeros: {lowerStart, diagonalStart, upperStart, values.length, lowerNonZeros, diagonalNonZeros, upperNonZeros}.
@@ -31,9 +36,9 @@
   * diagonalStart = lowerStart + lower.length
   * upperStart = diagonalStart + diagonal.length
   */
-  protected final int[] dims;
+  private final int[] dims;
 
-  protected static final int NONZERO = 4;
+  private static final int NONZERO = 4;
 
   //protected double diagonal[];
   //protected double lower[];
@@ -83,14 +88,6 @@
     int[] dimensions = {0, l, l + d, l + d + u, 0, 0,
         0}; // {lowerStart, diagonalStart, upperStart, values.length, lowerNonZeros, diagonalNonZeros, upperNonZeros}
     dims = dimensions;
-
-    //diagonal = new double[d];
-    //lower = new double[l];
-    //upper = new double[u];
-
-    //diagonalNonZeros = 0;
-    //lowerNonZeros = 0;
-    //upperNonZeros = 0;
   }
 
   /**
@@ -110,13 +107,6 @@
         dims[i] = 0;
       }
 
-      //for (int i=diagonal.length; --i >= 0; ) diagonal[i]=0;
-      //for (int i=upper.length; --i >= 0; ) upper[i]=0;
-      //for (int i=lower.length; --i >= 0; ) lower[i]=0;
-
-      //diagonalNonZeros = 0;
-      //lowerNonZeros = 0;
-      //upperNonZeros = 0;
     } else {
       super.assign(value);
     }
@@ -125,8 +115,8 @@
 
   @Override
   public DoubleMatrix2D assign(final org.apache.mahout.matrix.function.DoubleFunction function) {
-    if (function instanceof org.apache.mahout.jet.math.Mult) { // x[i] = mult*x[i]
-      double alpha = ((org.apache.mahout.jet.math.Mult) function).getMultiplicator();
+    if (function instanceof Mult) { // x[i] = mult*x[i]
+      double alpha = ((Mult) function).getMultiplicator();
       if (alpha == 1) {
         return this;
       }
@@ -137,15 +127,8 @@
         return assign(alpha);
       } // the funny definition of isNaN(). This should better not happen.
 
-      /*
-      double[] vals = values.elements();
-      for (int j=values.size(); --j >= 0; ) {
-        vals[j] *= alpha;
-      }
-      */
-
       forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               return function.apply(value);
@@ -188,7 +171,7 @@
     if (source instanceof RCDoubleMatrix2D || source instanceof SparseDoubleMatrix2D) {
       assign(0);
       source.forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               setQuick(i, j, value);
@@ -204,16 +187,16 @@
 
   @Override
   public DoubleMatrix2D assign(final DoubleMatrix2D y,
-                               org.apache.mahout.matrix.function.DoubleDoubleFunction function) {
+                               DoubleDoubleFunction function) {
     checkShape(y);
 
-    if (function instanceof org.apache.mahout.jet.math.PlusMult) { // x[i] = x[i] + alpha*y[i]
-      final double alpha = ((org.apache.mahout.jet.math.PlusMult) function).getMultiplicator();
+    if (function instanceof PlusMult) { // x[i] = x[i] + alpha*y[i]
+      final double alpha = ((PlusMult) function).getMultiplicator();
       if (alpha == 0) {
         return this;
       } // nothing to do
       y.forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               setQuick(i, j, getQuick(i, j) + alpha * value);
@@ -226,7 +209,7 @@
 
     if (function == org.apache.mahout.jet.math.Functions.mult) { // x[i] = x[i] * y[i]
       forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               setQuick(i, j, getQuick(i, j) * y.getQuick(i, j));
@@ -239,7 +222,7 @@
 
     if (function == org.apache.mahout.jet.math.Functions.div) { // x[i] = x[i] / y[i]
       forEachNonZero(
-          new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+          new IntIntDoubleFunction() {
             @Override
             public double apply(int i, int j, double value) {
               setQuick(i, j, getQuick(i, j) / y.getQuick(i, j));
@@ -254,7 +237,7 @@
   }
 
   @Override
-  public DoubleMatrix2D forEachNonZero(org.apache.mahout.matrix.function.IntIntDoubleFunction function) {
+  public DoubleMatrix2D forEachNonZero(IntIntDoubleFunction function) {
     for (int kind = 0; kind <= 2; kind++) {
       int i = 0, j = 0;
       switch (kind) {
@@ -415,62 +398,6 @@
               value);
     }
 
-    //int k = -1;
-    //int q = 0;
-
-    //if (i==j) { k=0; q=i; } // diagonal
-    //if (i==j+1) { k=1; q=j; } // lower diagonal
-    //if (i==j-1) { k=2; q=i; } // upper diagonal
-
-    //if (k>0) {
-    //int index = dims[k]+q;
-    //if (values[index]!=0) {
-    //if (isZero) dims[k+NONZERO]--; // one nonZero less
-    //}
-    //else {
-    //if (!isZero) dims[k+NONZERO]++; // one nonZero more
-    //}
-    //values[index] = value;
-    //return;
-    //}
-
-    //if (!isZero) throw new IllegalArgumentException("Can't store non-zero value to non-tridiagonal coordinate: row="+row+", column="+column+", value="+value);
-
-
-    //if (i==j) {
-    //if (diagonal[i]!=0) {
-    //if (isZero) diagonalNonZeros--;
-    //}
-    //else {
-    //if (!isZero) diagonalNonZeros++;
-    //}
-    //diagonal[i] = value;
-    //return;
-    //}
-
-    //if (i==j+1) {
-    //if (lower[j]!=0) {
-    //if (isZero) lowerNonZeros--;
-    //}
-    //else {
-    //if (!isZero) lowerNonZeros++;
-    //}
-    //lower[j] = value;
-    //return;
-    //}
-
-    //if (i==j-1) {
-    //if (upper[i]!=0) {
-    //if (isZero) upperNonZeros--;
-    //}
-    //else {
-    //if (!isZero) upperNonZeros++;
-    //}
-    //upper[i] = value;
-    //return;
-    //}
-
-    //if (!isZero) throw new IllegalArgumentException("Can't store non-zero value to non-tridiagonal coordinate: row="+row+", column="+column+", value="+value);
   }
 
   @Override
@@ -498,7 +425,7 @@
     }
 
     if (!ignore) {
-      z.assign(org.apache.mahout.jet.math.Functions.mult(beta / alpha));
+      z.assign(Functions.mult(beta / alpha));
     }
 
     DenseDoubleMatrix1D zz = (DenseDoubleMatrix1D) z;
@@ -516,7 +443,7 @@
     }
 
     forEachNonZero(
-        new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+        new IntIntDoubleFunction() {
           @Override
           public double apply(int i, int j, double value) {
             if (transposeA) {
@@ -533,7 +460,7 @@
     );
 
     if (alpha != 1) {
-      z.assign(org.apache.mahout.jet.math.Functions.mult(alpha));
+      z.assign(Functions.mult(alpha));
     }
     return z;
   }
@@ -570,7 +497,7 @@
     }
 
     if (!ignore) {
-      C.assign(org.apache.mahout.jet.math.Functions.mult(beta));
+      C.assign(Functions.mult(beta));
     }
 
     // cache views
@@ -586,7 +513,7 @@
     final org.apache.mahout.jet.math.PlusMult fun = org.apache.mahout.jet.math.PlusMult.plusMult(0);
 
     forEachNonZero(
-        new org.apache.mahout.matrix.function.IntIntDoubleFunction() {
+        new IntIntDoubleFunction() {
           @Override
           public double apply(int i, int j, double value) {
             fun.setMultiplicator(value * alpha);

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix1D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix1D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix1D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix1D.java Sun Nov 29 11:19:58 2009
@@ -22,7 +22,7 @@
   /*
    * The elements of the matrix.
    */
-  protected DoubleMatrix1D content;
+  protected final DoubleMatrix1D content;
 
   WrapperDoubleMatrix1D(DoubleMatrix1D newContent) {
     if (newContent != null) {

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix2D.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix2D.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix2D.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/impl/WrapperDoubleMatrix2D.java Sun Nov 29 11:19:58 2009
@@ -22,7 +22,7 @@
   /*
    * The elements of the matrix.
    */
-  protected DoubleMatrix2D content;
+  protected final DoubleMatrix2D content;
 
   /**
    * Constructs a matrix with a copy of the given values. <tt>values</tt> is required to have the form

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Algebra.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Algebra.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Algebra.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Algebra.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,15 @@
 */
 package org.apache.mahout.matrix.matrix.linalg;
 
+import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.matrix.GenericPermuting;
+import org.apache.mahout.matrix.GenericSorting;
+import org.apache.mahout.matrix.PersistentObject;
+import org.apache.mahout.matrix.Swapper;
+import org.apache.mahout.matrix.bitvector.QuickBitVector;
+import org.apache.mahout.matrix.function.DoubleDoubleFunction;
+import org.apache.mahout.matrix.function.IntComparator;
+import org.apache.mahout.matrix.list.ObjectArrayList;
 import org.apache.mahout.matrix.matrix.DoubleFactory2D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
@@ -18,7 +27,7 @@
 
 /** @deprecated until unit tests are in place.  Until this time, this class/interface is unsupported. */
 @Deprecated
-public class Algebra extends org.apache.mahout.matrix.PersistentObject {
+public class Algebra extends PersistentObject {
 
   /**
    * A default Algebra object; has {@link Property#DEFAULT} attached for tolerance. Allows ommiting to construct an
@@ -38,10 +47,10 @@
    * <tt>setProperty</tt>), or to alter the tolerance of its property object (via <tt>property().setTolerance(...)</tt>)
    * will throw an exception.
    */
-  public static final Algebra ZERO;
+  private static final Algebra ZERO;
 
   /** The property object attached to this instance. */
-  protected Property property;
+  private Property property;
 
   static {
     // don't use new Algebra(Property.DEFAULT.tolerance()), because then property object would be mutable.
@@ -117,8 +126,8 @@
   }
 
   /** Returns sqrt(a^2 + b^2) without under/overflow. */
-  protected static org.apache.mahout.matrix.function.DoubleDoubleFunction hypotFunction() {
-    return new org.apache.mahout.matrix.function.DoubleDoubleFunction() {
+  private static org.apache.mahout.matrix.function.DoubleDoubleFunction hypotFunction() {
+    return new DoubleDoubleFunction() {
       @Override
       public double apply(double a, double b) {
         return hypot(a, b);
@@ -222,7 +231,7 @@
     if (x.size() == 0) {
       return 0;
     }
-    return x.aggregate(org.apache.mahout.jet.math.Functions.plus, org.apache.mahout.jet.math.Functions.abs);
+    return x.aggregate(Functions.plus, org.apache.mahout.jet.math.Functions.abs);
   }
 
   /** Returns the one-norm of matrix <tt>A</tt>, which is the maximum absolute column sum. */
@@ -258,9 +267,9 @@
     if (x.size() == 0) {
       return 0;
     }
-    return x.aggregate(org.apache.mahout.jet.math.Functions.max, org.apache.mahout.jet.math.Functions.abs);
+    return x.aggregate(Functions.max, org.apache.mahout.jet.math.Functions.abs);
 //  if (x.size()==0) return 0;
-//  return x.aggregate(org.apache.mahout.jet.math.Functions.plus,org.apache.mahout.jet.math.Functions.abs);
+//  return x.aggregate(Functions.plus,org.apache.mahout.jet.math.Functions.abs);
 //  double max = 0;
 //  for (int i = x.size(); --i >= 0; ) {
 //    max = Math.max(max, x.getQuick(i));
@@ -401,14 +410,14 @@
       return A;
     }
 
-    org.apache.mahout.matrix.Swapper swapper = new org.apache.mahout.matrix.Swapper() {
+    Swapper swapper = new Swapper() {
       @Override
       public void swap(int a, int b) {
         A.viewRow(a).swap(A.viewRow(b));
       }
     };
 
-    org.apache.mahout.matrix.GenericPermuting.permute(indexes, swapper, work, null);
+    GenericPermuting.permute(indexes, swapper, work, null);
     return A;
   }
 
@@ -444,8 +453,7 @@
       return T;
     }
 
-    int k =
-        org.apache.mahout.matrix.bitvector.QuickBitVector.mostSignificantBit(p); // index of highest bit in state "true"
+    int k = QuickBitVector.mostSignificantBit(p); // index of highest bit in state "true"
 
     /*
     this is the naive version:
@@ -457,7 +465,7 @@
     */
 
     // here comes the optimized version:
-    //org.apache.mahout.matrix.Timer timer = new org.apache.mahout.matrix.Timer().start();
+    //org.apache.mahout.matrix.Timer timer = new Timer().start();
 
     int i = 0;
     while (i <= k && (p & (1 << i)) == 0) { // while (bit i of p == false)
@@ -647,8 +655,8 @@
    * </pre>
    */
   public String toString(DoubleMatrix2D matrix) {
-    final org.apache.mahout.matrix.list.ObjectArrayList names = new org.apache.mahout.matrix.list.ObjectArrayList();
-    final org.apache.mahout.matrix.list.ObjectArrayList values = new org.apache.mahout.matrix.list.ObjectArrayList();
+    final org.apache.mahout.matrix.list.ObjectArrayList names = new ObjectArrayList();
+    final org.apache.mahout.matrix.list.ObjectArrayList values = new ObjectArrayList();
 
     // determine properties
     names.add("cond");
@@ -718,13 +726,13 @@
 
 
     // sort ascending by property name
-    org.apache.mahout.matrix.function.IntComparator comp = new org.apache.mahout.matrix.function.IntComparator() {
+    IntComparator comp = new IntComparator() {
       @Override
       public int compare(int a, int b) {
         return Property.get(names, a).compareTo(Property.get(names, b));
       }
     };
-    org.apache.mahout.matrix.Swapper swapper = new org.apache.mahout.matrix.Swapper() {
+    Swapper swapper = new Swapper() {
       @Override
       public void swap(int a, int b) {
         Object tmp = names.get(a);
@@ -735,7 +743,7 @@
         values.set(b, tmp);
       }
     };
-    org.apache.mahout.matrix.GenericSorting.quickSort(0, names.size(), comp, swapper);
+    GenericSorting.quickSort(0, names.size(), comp, swapper);
 
     // determine padding for nice formatting
     int maxLength = 0;
@@ -1025,34 +1033,4 @@
     return A;
   }
 
-  /**
-   * Outer product of two vectors; Returns a matrix with <tt>A[i,j] = x[i] * y[j]</tt>.
-   *
-   * @param x the first source vector.
-   * @param y the second source vector.
-   * @return the outer product </tt>A</tt>.
-   */
-  private DoubleMatrix2D xmultOuter(DoubleMatrix1D x, DoubleMatrix1D y) {
-    DoubleMatrix2D A = x.like2D(x.size(), y.size());
-    multOuter(x, y, A);
-    return A;
-  }
-
-  /**
-   * Linear algebraic matrix power; <tt>B = A<sup>k</sup> <==> B = A*A*...*A</tt>.
-   *
-   * @param A the source matrix; must be square.
-   * @param k the exponent, can be any number.
-   * @return a new result matrix.
-   * @throws IllegalArgumentException if <tt>!Testing.isSquare(A)</tt>.
-   */
-  private DoubleMatrix2D xpowSlow(DoubleMatrix2D A, int k) {
-    //org.apache.mahout.matrix.Timer timer = new org.apache.mahout.matrix.Timer().start();
-    DoubleMatrix2D result = A.copy();
-    for (int i = 0; i < k - 1; i++) {
-      result = mult(result, A);
-    }
-    //timer.stop().display();
-    return result;
-  }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Blas.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Blas.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Blas.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Blas.java Sun Nov 29 11:19:58 2009
@@ -86,7 +86,7 @@
 
   /**
    * Returns the sum of absolute values; <tt>|x[0]| + |x[1]| + ... </tt>. In fact equivalent to
-   * <tt>x.aggregate(org.apache.mahout.jet.math.Functions.plus, org.apache.mahout.jet.math.Functions.abs)</tt>.
+   * <tt>x.aggregate(Functions.plus, org.apache.mahout.jet.math.Functions.abs)</tt>.
    *
    * @param x the first vector.
    */
@@ -211,14 +211,14 @@
    * Constructs a Givens plane rotation for <tt>(a,b)</tt>. Taken from the LINPACK translation from FORTRAN to Java,
    * interface slightly modified. In the LINPACK listing DROTG is attributed to Jack Dongarra
    *
-   * @param a        rotational elimination parameter a.
-   * @param b        rotational elimination parameter b.
+   * @param a      rotational elimination parameter a.
+   * @param b      rotational elimination parameter b.
    * @param rotvec Must be at least of length 4. On output contains the values <tt>{a,b,c,s}</tt>.
    */
   void drotg(double a, double b, double[] rotvec);
 
   /**
-   * Vector scaling; <tt>x = alpha*x</tt>. In fact equivalent to <tt>x.assign(org.apache.mahout.jet.math.Functions.mult(alpha))</tt>.
+   * Vector scaling; <tt>x = alpha*x</tt>. In fact equivalent to <tt>x.assign(Functions.mult(alpha))</tt>.
    *
    * @param alpha a scale factor.
    * @param x     the first vector.
@@ -226,7 +226,7 @@
   void dscal(double alpha, DoubleMatrix1D x);
 
   /**
-   * Matrix scaling; <tt>A = alpha*A</tt>. In fact equivalent to <tt>A.assign(org.apache.mahout.jet.math.Functions.mult(alpha))</tt>.
+   * Matrix scaling; <tt>A = alpha*A</tt>. In fact equivalent to <tt>A.assign(Functions.mult(alpha))</tt>.
    *
    * @param alpha a scale factor.
    * @param A     the matrix.

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/CholeskyDecomposition.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/CholeskyDecomposition.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/CholeskyDecomposition.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/CholeskyDecomposition.java Sun Nov 29 11:19:58 2009
@@ -9,6 +9,7 @@
 package org.apache.mahout.matrix.matrix.linalg;
 
 import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.matrix.matrix.DoubleFactory2D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 /**
@@ -223,7 +224,7 @@
 
     buf.append("\n\ninverse(A) = ");
     try {
-      buf.append(String.valueOf(this.solve(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.identity(L.rows()))));
+      buf.append(String.valueOf(this.solve(DoubleFactory2D.dense.identity(L.rows()))));
     }
     catch (IllegalArgumentException exc) {
       buf.append(unknown).append(exc.getMessage());

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecomposition.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecomposition.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecomposition.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecomposition.java Sun Nov 29 11:19:58 2009
@@ -26,7 +26,7 @@
 @Deprecated
 public class LUDecomposition implements java.io.Serializable {
 
-  protected final LUDecompositionQuick quick;
+  private final LUDecompositionQuick quick;
 
   /**
    * Constructs and returns a new LU Decomposition object; The decomposed matrices can be retrieved via instance methods

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecompositionQuick.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecompositionQuick.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecompositionQuick.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/LUDecompositionQuick.java Sun Nov 29 11:19:58 2009
@@ -8,6 +8,9 @@
 */
 package org.apache.mahout.matrix.matrix.linalg;
 
+import org.apache.mahout.jet.math.Mult;
+import org.apache.mahout.jet.math.PlusMult;
+import org.apache.mahout.matrix.list.IntArrayList;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 /**
@@ -46,20 +49,20 @@
 public class LUDecompositionQuick implements java.io.Serializable {
 
   /** Array for internal storage of decomposition. */
-  protected DoubleMatrix2D LU;
+  private DoubleMatrix2D LU;
 
   /** pivot sign. */
-  protected int pivsign;
+  private int pivsign;
 
   /** Internal storage of pivot vector. */
-  protected int[] piv;
+  private int[] piv;
 
-  protected boolean isNonSingular;
+  private boolean isNonSingular;
 
-  protected Algebra algebra;
+  private final Algebra algebra;
 
-  protected transient double[] workDouble;
-  protected transient int[] work1;
+  private transient double[] workDouble;
+  private transient int[] work1;
   protected transient int[] work2;
 
   /**
@@ -107,10 +110,10 @@
       LUrows[i] = LU.viewRow(i);
     }
 
-    org.apache.mahout.matrix.list.IntArrayList nonZeroIndexes =
-        new org.apache.mahout.matrix.list.IntArrayList(); // sparsity
+    IntArrayList nonZeroIndexes =
+        new IntArrayList(); // sparsity
     DoubleMatrix1D LUcolj = LU.viewColumn(0).like();  // blocked column j
-    org.apache.mahout.jet.math.Mult multFunction = org.apache.mahout.jet.math.Mult.mult(0);
+    Mult multFunction = org.apache.mahout.jet.math.Mult.mult(0);
 
     // Outer loop.
     int CUT_OFF = 10;
@@ -492,11 +495,11 @@
     }
 
     // transformations
-    org.apache.mahout.jet.math.Mult div = org.apache.mahout.jet.math.Mult.div(0);
-    org.apache.mahout.jet.math.PlusMult minusMult = org.apache.mahout.jet.math.PlusMult.minusMult(0);
+    Mult div = org.apache.mahout.jet.math.Mult.div(0);
+    PlusMult minusMult = org.apache.mahout.jet.math.PlusMult.minusMult(0);
 
-    org.apache.mahout.matrix.list.IntArrayList nonZeroIndexes =
-        new org.apache.mahout.matrix.list.IntArrayList(); // sparsity
+    IntArrayList nonZeroIndexes =
+        new IntArrayList(); // sparsity
     DoubleMatrix1D Browk = org.apache.mahout.matrix.matrix.DoubleFactory1D.dense.make(nx); // blocked row k
 
     // Solve L*Y = B(piv,:)
@@ -660,7 +663,7 @@
 
     buf.append("\npivot = ");
     try {
-      buf.append(String.valueOf(new org.apache.mahout.matrix.list.IntArrayList(this.getPivot())));
+      buf.append(String.valueOf(new IntArrayList(this.getPivot())));
     }
     catch (IllegalArgumentException exc) {
       buf.append(unknown).append(exc.getMessage());
@@ -718,17 +721,4 @@
     return A;
   }
 
-  /**
-   * Returns pivot permutation vector as a one-dimensional double array
-   *
-   * @return (double) piv
-   */
-  private double[] xgetDoublePivot() {
-    int m = m();
-    double[] vals = new double[m];
-    for (int i = 0; i < m; i++) {
-      vals[i] = (double) piv[i];
-    }
-    return vals;
-  }
 }

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Property.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Property.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Property.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Property.java Sun Nov 29 11:19:58 2009
@@ -9,6 +9,12 @@
 package org.apache.mahout.matrix.matrix.linalg;
 
 import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.matrix.GenericSorting;
+import org.apache.mahout.matrix.PersistentObject;
+import org.apache.mahout.matrix.Swapper;
+import org.apache.mahout.matrix.function.IntComparator;
+import org.apache.mahout.matrix.list.ObjectArrayList;
+import org.apache.mahout.matrix.matrix.DoubleFactory2D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix3D;
@@ -173,7 +179,7 @@
 
 /** @deprecated until unit tests are in place.  Until this time, this class/interface is unsupported. */
 @Deprecated
-public class Property extends org.apache.mahout.matrix.PersistentObject {
+public class Property extends PersistentObject {
 
   /** The default Property object; currently has <tt>tolerance()==1.0E-9</tt>. */
   public static final Property DEFAULT = new Property(1.0E-9);
@@ -184,7 +190,7 @@
   /** A Property object with <tt>tolerance()==1.0E-12</tt>. */
   public static final Property TWELVE = new Property(1.0E-12);
 
-  protected double tolerance;
+  private double tolerance;
 
   /** Not instantiable by no-arg constructor. */
   private Property() {
@@ -480,7 +486,7 @@
 
   /**
    */
-  protected static String get(org.apache.mahout.matrix.list.ObjectArrayList list, int index) {
+  protected static String get(ObjectArrayList list, int index) {
     return ((String) list.get(index));
   }
 
@@ -629,7 +635,7 @@
   public boolean isOrthogonal(DoubleMatrix2D A) {
     checkSquare(A);
     return equals(A.zMult(A, null, 1, 0, false, true),
-        org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.identity(A.rows()));
+        DoubleFactory2D.dense.identity(A.rows()));
   }
 
   /** A matrix <tt>A</tt> is <i>positive</i> if <tt>A[i,j] &gt; 0</tt> holds for all cells. <p> Note: Ignores tolerance. */
@@ -983,8 +989,8 @@
    * </pre>
    */
   public String toString(DoubleMatrix2D A) {
-    final org.apache.mahout.matrix.list.ObjectArrayList names = new org.apache.mahout.matrix.list.ObjectArrayList();
-    final org.apache.mahout.matrix.list.ObjectArrayList values = new org.apache.mahout.matrix.list.ObjectArrayList();
+    final org.apache.mahout.matrix.list.ObjectArrayList names = new ObjectArrayList();
+    final org.apache.mahout.matrix.list.ObjectArrayList values = new ObjectArrayList();
 
     // determine properties
     names.add("density");
@@ -1201,13 +1207,13 @@
 
 
     // sort ascending by property name
-    org.apache.mahout.matrix.function.IntComparator comp = new org.apache.mahout.matrix.function.IntComparator() {
+    IntComparator comp = new IntComparator() {
       @Override
       public int compare(int a, int b) {
         return get(names, a).compareTo(get(names, b));
       }
     };
-    org.apache.mahout.matrix.Swapper swapper = new org.apache.mahout.matrix.Swapper() {
+    Swapper swapper = new Swapper() {
       @Override
       public void swap(int a, int b) {
         Object tmp = names.get(a);
@@ -1218,12 +1224,12 @@
         values.set(b, tmp);
       }
     };
-    org.apache.mahout.matrix.GenericSorting.quickSort(0, names.size(), comp, swapper);
+    GenericSorting.quickSort(0, names.size(), comp, swapper);
 
     // determine padding for nice formatting
     int maxLength = 0;
     for (int i = 0; i < names.size(); i++) {
-      int length = ((String) names.get(i)).length();
+      int length = ((CharSequence) names.get(i)).length();
       maxLength = Math.max(length, maxLength);
     }
 

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/QRDecomposition.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/QRDecomposition.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/QRDecomposition.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/QRDecomposition.java Sun Nov 29 11:19:58 2009
@@ -9,6 +9,7 @@
 package org.apache.mahout.matrix.matrix.linalg;
 
 import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.matrix.matrix.DoubleFactory2D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 
@@ -84,7 +85,7 @@
         if (QR.getQuick(k, k) < 0) {
           nrm = -nrm;
         }
-        QRcolumnsPart[k].assign(org.apache.mahout.jet.math.Functions.div(nrm));
+        QRcolumnsPart[k].assign(Functions.div(nrm));
         /*
         for (int i = k; i < m; i++) {
            QR[i][k] /= nrm;
@@ -283,7 +284,7 @@
 
     buf.append("\n\npseudo inverse(A) = ");
     try {
-      buf.append(String.valueOf(this.solve(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.identity(QR.rows()))));
+      buf.append(String.valueOf(this.solve(DoubleFactory2D.dense.identity(QR.rows()))));
     }
     catch (IllegalArgumentException exc) {
       buf.append(unknown).append(exc.getMessage());

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/SeqBlas.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/SeqBlas.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/SeqBlas.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/SeqBlas.java Sun Nov 29 11:19:58 2009
@@ -9,6 +9,8 @@
 package org.apache.mahout.matrix.matrix.linalg;
 
 import org.apache.mahout.jet.math.Functions;
+import org.apache.mahout.jet.math.PlusMult;
+import org.apache.mahout.matrix.function.DoubleDoubleFunction;
 import org.apache.mahout.matrix.matrix.DoubleMatrix1D;
 import org.apache.mahout.matrix.matrix.DoubleMatrix2D;
 /**
@@ -25,7 +27,7 @@
   public static final Blas seqBlas = new SeqBlas();
 
   /** Makes this class non instantiable, but still let's others inherit from it. */
-  protected SeqBlas() {
+  private SeqBlas() {
   }
 
   @Override
@@ -35,7 +37,7 @@
 
   @Override
   public void assign(DoubleMatrix2D A, DoubleMatrix2D B,
-                     org.apache.mahout.matrix.function.DoubleDoubleFunction function) {
+                     DoubleDoubleFunction function) {
     A.assign(B, function);
   }
 
@@ -83,7 +85,7 @@
 
   @Override
   public void dger(double alpha, DoubleMatrix1D x, DoubleMatrix1D y, DoubleMatrix2D A) {
-    org.apache.mahout.jet.math.PlusMult fun = org.apache.mahout.jet.math.PlusMult.plusMult(0);
+    PlusMult fun = org.apache.mahout.jet.math.PlusMult.plusMult(0);
     for (int i = A.rows(); --i >= 0;) {
       fun.setMultiplicator(alpha * x.getQuick(i));
       A.viewRow(i).assign(y, fun);
@@ -190,7 +192,7 @@
     }
     Property.DEFAULT.checkSquare(A);
     int size = A.rows();
-    if (size != x.size() || size != y.size()) {
+    if (size != x.size() && size != y.size()) {
       throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort() + ", " + y.toStringShort());
     }
     DoubleMatrix1D tmp = x.like();

Modified: lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Smp.java
URL: http://svn.apache.org/viewvc/lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Smp.java?rev=885213&r1=885212&r2=885213&view=diff
==============================================================================
--- lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Smp.java (original)
+++ lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix/linalg/Smp.java Sun Nov 29 11:19:58 2009
@@ -16,7 +16,7 @@
 
   protected final FJTaskRunnerGroup taskGroup; // a very efficient and light weight thread pool
 
-  protected final int maxThreads;
+  private final int maxThreads;
 
   /** Constructs a new Smp using a maximum of <tt>maxThreads<tt> threads. */
   protected Smp(int maxThreads) {



Mime
View raw message