You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by sr...@apache.org on 2009/11/25 04:41:31 UTC

svn commit: r883974 [18/20] - in /lucene/mahout/trunk/matrix/src/main/java/org/apache/mahout/matrix/matrix: ./ bench/ doublealgo/ impl/ linalg/ objectalgo/

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=883974&r1=883973&r2=883974&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 Wed Nov 25 03:41:28 2009
@@ -46,122 +46,122 @@
 Here are some example properties
 <table border="1" cellspacing="0">
   <tr align="left" valign="top"> 
-	<td valign="middle" align="left"><tt>matrix</tt></td>
-	<td> <tt>4&nbsp;x&nbsp;4&nbsp;<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0 </tt></td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;1&nbsp;0<br>
-	  0&nbsp;1&nbsp;1&nbsp;1<br>
-	  0&nbsp;0&nbsp;1&nbsp;1 </tt></td>
-	<td><tt> 4&nbsp;x&nbsp;4<br>
-	  0&nbsp;1&nbsp;1&nbsp;1<br>
-	  0&nbsp;1&nbsp;1&nbsp;1<br>
-	  0&nbsp;0&nbsp;0&nbsp;1<br>
-	  0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
-	<td><tt> 4&nbsp;x&nbsp;4<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;1&nbsp;1 </tt></td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  0&nbsp;1&nbsp;1&nbsp;0<br>
-	  0&nbsp;1&nbsp;0&nbsp;1<br>
-	  1&nbsp;0&nbsp;1&nbsp;1 </tt><tt> </tt> </td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;1&nbsp;1&nbsp;0<br>
-	  0&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;0&nbsp;1<br>
-	  0&nbsp;0&nbsp;1&nbsp;1 </tt> </td>
+  <td valign="middle" align="left"><tt>matrix</tt></td>
+  <td> <tt>4&nbsp;x&nbsp;4&nbsp;<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0 </tt></td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;1&nbsp;0<br>
+    0&nbsp;1&nbsp;1&nbsp;1<br>
+    0&nbsp;0&nbsp;1&nbsp;1 </tt></td>
+  <td><tt> 4&nbsp;x&nbsp;4<br>
+    0&nbsp;1&nbsp;1&nbsp;1<br>
+    0&nbsp;1&nbsp;1&nbsp;1<br>
+    0&nbsp;0&nbsp;0&nbsp;1<br>
+    0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
+  <td><tt> 4&nbsp;x&nbsp;4<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;1&nbsp;1 </tt></td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    0&nbsp;1&nbsp;1&nbsp;0<br>
+    0&nbsp;1&nbsp;0&nbsp;1<br>
+    1&nbsp;0&nbsp;1&nbsp;1 </tt><tt> </tt> </td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;1&nbsp;1&nbsp;0<br>
+    0&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;0&nbsp;1<br>
+    0&nbsp;0&nbsp;1&nbsp;1 </tt> </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>upperBandwidth</tt></td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td><tt>3</tt></td>
-	<td align="center" valign="middle"><tt>0</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>2</tt></div>
-	</td>
+  <td><tt>upperBandwidth</tt></td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td><tt>3</tt></td>
+  <td align="center" valign="middle"><tt>0</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>2</tt></div>
+  </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>lowerBandwidth</tt></td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td><tt>0</tt></td>
-	<td align="center" valign="middle"><tt>3</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>3</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>2</tt></div>
-	</td>
+  <td><tt>lowerBandwidth</tt></td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td><tt>0</tt></td>
+  <td align="center" valign="middle"><tt>3</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>3</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>2</tt></div>
+  </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>semiBandwidth</tt></td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>2</tt></div>
-	</td>
-	<td><tt>4</tt></td>
-	<td align="center" valign="middle"><tt>4</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>4</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>3</tt></div>
-	</td>
+  <td><tt>semiBandwidth</tt></td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>2</tt></div>
+  </td>
+  <td><tt>4</tt></td>
+  <td align="center" valign="middle"><tt>4</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>4</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>3</tt></div>
+  </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>description</tt></td>
-	<td> 
-	  <div align="center"><tt>zero</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>diagonal</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>tridiagonal</tt></div>
-	</td>
-	<td><tt>upper triangular</tt></td>
-	<td align="center" valign="middle"><tt>lower triangular</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>unstructured</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>unstructured</tt></div>
-	</td>
+  <td><tt>description</tt></td>
+  <td> 
+    <div align="center"><tt>zero</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>diagonal</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>tridiagonal</tt></div>
+  </td>
+  <td><tt>upper triangular</tt></td>
+  <td align="center" valign="middle"><tt>lower triangular</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>unstructured</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>unstructured</tt></div>
+  </td>
   </tr>
 </table>
 
@@ -173,66 +173,66 @@
  */
 @Deprecated
 public class Property extends org.apache.mahout.matrix.PersistentObject {
-	/**
-	 * The default Property object; currently has <tt>tolerance()==1.0E-9</tt>.
-	 */
-	public static final Property DEFAULT = new Property(1.0E-9);
-	
-	/**
-	 * A Property object with <tt>tolerance()==0.0</tt>.
-	 */
-	public static final Property ZERO = new Property(0.0);
-	
-	/**
-	 * A Property object with <tt>tolerance()==1.0E-12</tt>.
-	 */
-	public static final Property TWELVE = new Property(1.0E-12);
-	
-	protected double tolerance;
+  /**
+   * The default Property object; currently has <tt>tolerance()==1.0E-9</tt>.
+   */
+  public static final Property DEFAULT = new Property(1.0E-9);
+  
+  /**
+   * A Property object with <tt>tolerance()==0.0</tt>.
+   */
+  public static final Property ZERO = new Property(0.0);
+  
+  /**
+   * A Property object with <tt>tolerance()==1.0E-12</tt>.
+   */
+  public static final Property TWELVE = new Property(1.0E-12);
+  
+  protected double tolerance;
 /**
  * Not instantiable by no-arg constructor.
  */
 private Property() {
-	this(1.0E-9); // just to be on the safe side
+  this(1.0E-9); // just to be on the safe side
 }
 /**
  * Constructs an instance with a tolerance of <tt>Math.abs(newTolerance)</tt>.
  */
 public Property(double newTolerance) {
-	tolerance = Math.abs(newTolerance);
+  tolerance = Math.abs(newTolerance);
 }
 /**
  * Returns a String with <tt>length</tt> blanks.
  */
 protected static String blanks(int length) {
-	if (length <0 ) length = 0;
-	StringBuffer buf = new StringBuffer(length);
-	for (int k = 0; k < length; k++) {
-		buf.append(' ');
-	}
-	return buf.toString();
+  if (length <0 ) length = 0;
+  StringBuffer buf = new StringBuffer(length);
+  for (int k = 0; k < length; k++) {
+    buf.append(' ');
+  }
+  return buf.toString();
 }
 /**
  * Checks whether the given matrix <tt>A</tt> is <i>rectangular</i>.
  * @throws IllegalArgumentException if <tt>A.rows() < A.columns()</tt>.
  */
 public void checkRectangular(DoubleMatrix2D A) {
-	if (A.rows() < A.columns()) {
-		throw new IllegalArgumentException("Matrix must be rectangular: "+ org.apache.mahout.matrix.matrix.doublealgo.Formatter.shape(A));
-	}
+  if (A.rows() < A.columns()) {
+    throw new IllegalArgumentException("Matrix must be rectangular: "+ org.apache.mahout.matrix.matrix.doublealgo.Formatter.shape(A));
+  }
 }
 /**
  * Checks whether the given matrix <tt>A</tt> is <i>square</i>.
  * @throws IllegalArgumentException if <tt>A.rows() != A.columns()</tt>.
  */
 public void checkSquare(DoubleMatrix2D A) {
-	if (A.rows() != A.columns()) throw new IllegalArgumentException("Matrix must be square: "+ org.apache.mahout.matrix.matrix.doublealgo.Formatter.shape(A));
+  if (A.rows() != A.columns()) throw new IllegalArgumentException("Matrix must be square: "+ org.apache.mahout.matrix.matrix.doublealgo.Formatter.shape(A));
 }
 /**
  * Returns the matrix's fraction of non-zero cells; <tt>A.cardinality() / A.size()</tt>.
  */
 public double density(DoubleMatrix2D A) {
-	return A.cardinality() / (double) A.size();
+  return A.cardinality() / (double) A.size();
 }
 /**
  * Returns whether all cells of the given matrix <tt>A</tt> are equal to the given value.
@@ -244,17 +244,17 @@
  *          <tt>false</tt> otherwise.
  */
 public boolean equals(DoubleMatrix1D A, double value) {
-	if (A==null) return false;
-	double epsilon = tolerance();
-	for (int i = A.size(); --i >= 0;) {
-		//if (!(A.getQuick(i) == value)) return false;
-		//if (Math.abs(value - A.getQuick(i)) > epsilon) return false;
-		double x = A.getQuick(i);
-		double diff = Math.abs(value - x);
-		if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
-		if (!(diff <= epsilon)) return false;
-	}
-	return true;
+  if (A==null) return false;
+  double epsilon = tolerance();
+  for (int i = A.size(); --i >= 0;) {
+    //if (!(A.getQuick(i) == value)) return false;
+    //if (Math.abs(value - A.getQuick(i)) > epsilon) return false;
+    double x = A.getQuick(i);
+    double diff = Math.abs(value - x);
+    if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
+    if (!(diff <= epsilon)) return false;
+  }
+  return true;
 }
 /**
  * Returns whether both given matrices <tt>A</tt> and <tt>B</tt> are equal.
@@ -268,22 +268,22 @@
  *          <tt>false</tt> otherwise.
  */
 public boolean equals(DoubleMatrix1D A, DoubleMatrix1D B) {
-	if (A==B) return true;
-	if (! (A != null && B != null)) return false;
-	int size = A.size();
-	if (size != B.size()) return false;
+  if (A==B) return true;
+  if (! (A != null && B != null)) return false;
+  int size = A.size();
+  if (size != B.size()) return false;
 
-	double epsilon = tolerance();
-	for (int i=size; --i >= 0;) {
-		//if (!(getQuick(i) == B.getQuick(i))) return false;
-		//if (Math.abs(A.getQuick(i) - B.getQuick(i)) > epsilon) return false;
-		double x = A.getQuick(i);
-		double value = B.getQuick(i);
-		double diff = Math.abs(value - x);
-		if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
-		if (!(diff <= epsilon)) return false;
-	}
-	return true;
+  double epsilon = tolerance();
+  for (int i=size; --i >= 0;) {
+    //if (!(getQuick(i) == B.getQuick(i))) return false;
+    //if (Math.abs(A.getQuick(i) - B.getQuick(i)) > epsilon) return false;
+    double x = A.getQuick(i);
+    double value = B.getQuick(i);
+    double diff = Math.abs(value - x);
+    if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
+    if (!(diff <= epsilon)) return false;
+  }
+  return true;
 }
 /**
  * Returns whether all cells of the given matrix <tt>A</tt> are equal to the given value.
@@ -295,22 +295,22 @@
  *          <tt>false</tt> otherwise.
  */
 public boolean equals(DoubleMatrix2D A, double value) {
-	if (A==null) return false;
-	int rows = A.rows();
-	int columns = A.columns();
+  if (A==null) return false;
+  int rows = A.rows();
+  int columns = A.columns();
 
-	double epsilon = tolerance();
-	for (int row=rows; --row >= 0;) {
-		for (int column=columns; --column >= 0;) {
-			//if (!(A.getQuick(row,column) == value)) return false;
-			//if (Math.abs(value - A.getQuick(row,column)) > epsilon) return false;
-			double x = A.getQuick(row,column);
-			double diff = Math.abs(value - x);
-			if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
-			if (!(diff <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  for (int row=rows; --row >= 0;) {
+    for (int column=columns; --column >= 0;) {
+      //if (!(A.getQuick(row,column) == value)) return false;
+      //if (Math.abs(value - A.getQuick(row,column)) > epsilon) return false;
+      double x = A.getQuick(row,column);
+      double diff = Math.abs(value - x);
+      if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
+      if (!(diff <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * Returns whether both given matrices <tt>A</tt> and <tt>B</tt> are equal.
@@ -324,25 +324,25 @@
  *          <tt>false</tt> otherwise.
  */
 public boolean equals(DoubleMatrix2D A, DoubleMatrix2D B) {
-	if (A==B) return true;
-	if (! (A != null && B != null)) return false;
-	int rows = A.rows();
-	int columns = A.columns();
-	if (columns != B.columns() || rows != B.rows()) return false;
+  if (A==B) return true;
+  if (! (A != null && B != null)) return false;
+  int rows = A.rows();
+  int columns = A.columns();
+  if (columns != B.columns() || rows != B.rows()) return false;
 
-	double epsilon = tolerance();
-	for (int row=rows; --row >= 0;) {
-		for (int column=columns; --column >= 0;) {
-			//if (!(A.getQuick(row,column) == B.getQuick(row,column))) return false;
-			//if (Math.abs((A.getQuick(row,column) - B.getQuick(row,column)) > epsilon) return false;
-			double x = A.getQuick(row,column);
-			double value = B.getQuick(row,column);
-			double diff = Math.abs(value - x);
-			if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
-			if (!(diff <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  for (int row=rows; --row >= 0;) {
+    for (int column=columns; --column >= 0;) {
+      //if (!(A.getQuick(row,column) == B.getQuick(row,column))) return false;
+      //if (Math.abs((A.getQuick(row,column) - B.getQuick(row,column)) > epsilon) return false;
+      double x = A.getQuick(row,column);
+      double value = B.getQuick(row,column);
+      double diff = Math.abs(value - x);
+      if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
+      if (!(diff <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * Returns whether all cells of the given matrix <tt>A</tt> are equal to the given value.
@@ -354,24 +354,24 @@
  *          <tt>false</tt> otherwise.
  */
 public boolean equals(DoubleMatrix3D A, double value) {
-	if (A==null) return false;
-	int rows = A.rows();
-	int columns = A.columns();
+  if (A==null) return false;
+  int rows = A.rows();
+  int columns = A.columns();
 
-	double epsilon = tolerance();
-	for (int slice=A.slices(); --slice >= 0;) {
-		for (int row=rows; --row >= 0;) {
-			for (int column=columns; --column >= 0;) {
-				//if (!(A.getQuick(slice,row,column) == value)) return false;
-				//if (Math.abs(value - A.getQuick(slice,row,column)) > epsilon) return false;
-				double x = A.getQuick(slice,row,column);
-				double diff = Math.abs(value - x);
-				if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
-				if (!(diff <= epsilon)) return false;
-			}
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  for (int slice=A.slices(); --slice >= 0;) {
+    for (int row=rows; --row >= 0;) {
+      for (int column=columns; --column >= 0;) {
+        //if (!(A.getQuick(slice,row,column) == value)) return false;
+        //if (Math.abs(value - A.getQuick(slice,row,column)) > epsilon) return false;
+        double x = A.getQuick(slice,row,column);
+        double diff = Math.abs(value - x);
+        if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
+        if (!(diff <= epsilon)) return false;
+      }
+    }
+  }
+  return true;
 }
 /**
  * Returns whether both given matrices <tt>A</tt> and <tt>B</tt> are equal.
@@ -385,28 +385,28 @@
  *          <tt>false</tt> otherwise.
  */
 public boolean equals(DoubleMatrix3D A, DoubleMatrix3D B) {
-	if (A==B) return true;
-	if (! (A != null && B != null)) return false;
-	int slices = A.slices();
-	int rows = A.rows();
-	int columns = A.columns();
-	if (columns != B.columns() || rows != B.rows() || slices != B.slices()) return false;
+  if (A==B) return true;
+  if (! (A != null && B != null)) return false;
+  int slices = A.slices();
+  int rows = A.rows();
+  int columns = A.columns();
+  if (columns != B.columns() || rows != B.rows() || slices != B.slices()) return false;
 
-	double epsilon = tolerance();
-	for (int slice=slices; --slice >= 0;) {
-		for (int row=rows; --row >= 0;) {
-			for (int column=columns; --column >= 0;) {
-				//if (!(A.getQuick(slice,row,column) == B.getQuick(slice,row,column))) return false;
-				//if (Math.abs(A.getQuick(slice,row,column) - B.getQuick(slice,row,column)) > epsilon) return false;
-				double x = A.getQuick(slice,row,column);
-				double value = B.getQuick(slice,row,column);
-				double diff = Math.abs(value - x);
-				if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
-				if (!(diff <= epsilon)) return false;
-			}
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  for (int slice=slices; --slice >= 0;) {
+    for (int row=rows; --row >= 0;) {
+      for (int column=columns; --column >= 0;) {
+        //if (!(A.getQuick(slice,row,column) == B.getQuick(slice,row,column))) return false;
+        //if (Math.abs(A.getQuick(slice,row,column) - B.getQuick(slice,row,column)) > epsilon) return false;
+        double x = A.getQuick(slice,row,column);
+        double value = B.getQuick(slice,row,column);
+        double diff = Math.abs(value - x);
+        if ((diff!=diff) && ((value!=value && x!=x) || value==x)) diff = 0;
+        if (!(diff <= epsilon)) return false;
+      }
+    }
+  }
+  return true;
 }
 /**
 Modifies the given matrix square matrix <tt>A</tt> such that it is diagonally dominant by row and column, hence non-singular, hence invertible.
@@ -415,38 +415,38 @@
 @throws IllegalArgumentException if <tt>!isSquare(A)</tt>.
 */
 public void generateNonSingular(DoubleMatrix2D A) {
-	checkSquare(A);
-	org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
-	int min = Math.min(A.rows(), A.columns());
-	for (int i = min; --i >= 0; ) {
-		A.setQuick(i,i, 0);
-	}
-	for (int i = min; --i >= 0; ) {
-		double rowSum = A.viewRow(i).aggregate(F.plus,F.abs);
-		double colSum = A.viewColumn(i).aggregate(F.plus,F.abs);
-		A.setQuick(i,i, Math.max(rowSum,colSum) + i+1);
-	}
+  checkSquare(A);
+  org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
+  int min = Math.min(A.rows(), A.columns());
+  for (int i = min; --i >= 0; ) {
+    A.setQuick(i,i, 0);
+  }
+  for (int i = min; --i >= 0; ) {
+    double rowSum = A.viewRow(i).aggregate(F.plus,F.abs);
+    double colSum = A.viewColumn(i).aggregate(F.plus,F.abs);
+    A.setQuick(i,i, Math.max(rowSum,colSum) + i+1);
+  }
 }
 /**
  */
 protected static String get(org.apache.mahout.matrix.list.ObjectArrayList list, int index) {
-	return ((String) list.get(index));
+  return ((String) list.get(index));
 }
 /**
  * A matrix <tt>A</tt> is <i>diagonal</i> if <tt>A[i,j] == 0</tt> whenever <tt>i != j</tt>.
  * Matrix may but need not be square.
  */
 public boolean isDiagonal(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = columns; --column >= 0; ) {
-			//if (row!=column && A.getQuick(row,column) != 0) return false;
-			if (row!=column && !(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = columns; --column >= 0; ) {
+      //if (row!=column && A.getQuick(row,column) != 0) return false;
+      if (row!=column && !(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>diagonally dominant by column</i> if the absolute value of each diagonal element is larger than the sum of the absolute values of the off-diagonal elements in the corresponding column.
@@ -456,15 +456,15 @@
  * Note: Ignores tolerance.
  */
 public boolean isDiagonallyDominantByColumn(DoubleMatrix2D A) {
-	org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
-	double epsilon = tolerance();
-	int min = Math.min(A.rows(), A.columns());
-	for (int i = min; --i >= 0; ) {
-		double diag = Math.abs(A.getQuick(i,i));
-		diag += diag;
-		if (diag <= A.viewColumn(i).aggregate(F.plus,F.abs)) return false;
-	}
-	return true;
+  org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
+  double epsilon = tolerance();
+  int min = Math.min(A.rows(), A.columns());
+  for (int i = min; --i >= 0; ) {
+    double diag = Math.abs(A.getQuick(i,i));
+    diag += diag;
+    if (diag <= A.viewColumn(i).aggregate(F.plus,F.abs)) return false;
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>diagonally dominant by row</i> if the absolute value of each diagonal element is larger than the sum of the absolute values of the off-diagonal elements in the corresponding row.
@@ -474,68 +474,68 @@
  * Note: Ignores tolerance.
  */
 public boolean isDiagonallyDominantByRow(DoubleMatrix2D A) {
-	org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
-	double epsilon = tolerance();
-	int min = Math.min(A.rows(), A.columns());
-	for (int i = min; --i >= 0; ) {
-		double diag = Math.abs(A.getQuick(i,i));
-		diag += diag;
-		if (diag <= A.viewRow(i).aggregate(F.plus,F.abs)) return false;
-	}
-	return true;
+  org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
+  double epsilon = tolerance();
+  int min = Math.min(A.rows(), A.columns());
+  for (int i = min; --i >= 0; ) {
+    double diag = Math.abs(A.getQuick(i,i));
+    diag += diag;
+    if (diag <= A.viewRow(i).aggregate(F.plus,F.abs)) return false;
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is an <i>identity</i> matrix if <tt>A[i,i] == 1</tt> and all other cells are zero.
  * Matrix may but need not be square.
  */
 public boolean isIdentity(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = columns; --column >= 0; ) {
-			double v = A.getQuick(row,column);
-			if (row==column) {
-				if (!(Math.abs(1-v) < epsilon)) return false;
-			}
-			else if (!(Math.abs(v) <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = columns; --column >= 0; ) {
+      double v = A.getQuick(row,column);
+      if (row==column) {
+        if (!(Math.abs(1-v) < epsilon)) return false;
+      }
+      else if (!(Math.abs(v) <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>lower bidiagonal</i> if <tt>A[i,j]==0</tt> unless <tt>i==j || i==j+1</tt>.
  * Matrix may but need not be square.
  */
 public boolean isLowerBidiagonal(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = columns; --column >= 0; ) {
-			if (!(row==column || row==column+1)) {
-				//if (A.getQuick(row,column) != 0) return false;
-				if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-			}
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = columns; --column >= 0; ) {
+      if (!(row==column || row==column+1)) {
+        //if (A.getQuick(row,column) != 0) return false;
+        if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+      }
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>lower triangular</i> if <tt>A[i,j]==0</tt> whenever <tt>i &lt; j</tt>.
  * Matrix may but need not be square.
  */
 public boolean isLowerTriangular(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int column = columns; --column >= 0; ) {
-		for (int row = Math.min(column,rows); --row >= 0; ) {
-			//if (A.getQuick(row,column) != 0) return false;
-			if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int column = columns; --column >= 0; ) {
+    for (int row = Math.min(column,rows); --row >= 0; ) {
+      //if (A.getQuick(row,column) != 0) return false;
+      if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>non-negative</i> if <tt>A[i,j] &gt;= 0</tt> holds for all cells.
@@ -543,22 +543,22 @@
  * Note: Ignores tolerance.
  */
 public boolean isNonNegative(DoubleMatrix2D A) {
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = columns; --column >= 0; ) {
-			if (! (A.getQuick(row,column) >= 0)) return false;
-		}
-	}
-	return true;
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = columns; --column >= 0; ) {
+      if (! (A.getQuick(row,column) >= 0)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A square matrix <tt>A</tt> is <i>orthogonal</i> if <tt>A*transpose(A) = I</tt>.
  * @throws IllegalArgumentException if <tt>!isSquare(A)</tt>.
  */
 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()));
+  checkSquare(A);
+  return equals(A.zMult(A,null,1,0,false,true), org.apache.mahout.matrix.matrix.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.
@@ -566,176 +566,176 @@
  * Note: Ignores tolerance.
  */
 public boolean isPositive(DoubleMatrix2D A) {
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = columns; --column >= 0; ) {
-			if (!(A.getQuick(row,column) > 0)) return false;
-		}
-	}
-	return true;
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = columns; --column >= 0; ) {
+      if (!(A.getQuick(row,column) > 0)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>singular</i> if it has no inverse, that is, iff <tt>det(A)==0</tt>.
  */
 public boolean isSingular(DoubleMatrix2D A) {
-	return !(Math.abs(Algebra.DEFAULT.det(A)) >= tolerance());
+  return !(Math.abs(Algebra.DEFAULT.det(A)) >= tolerance());
 }
 /**
  * A square matrix <tt>A</tt> is <i>skew-symmetric</i> if <tt>A = -transpose(A)</tt>, that is <tt>A[i,j] == -A[j,i]</tt>.
  * @throws IllegalArgumentException if <tt>!isSquare(A)</tt>.
  */
 public boolean isSkewSymmetric(DoubleMatrix2D A) {
-	checkSquare(A);
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = rows; --column >= 0; ) {
-			//if (A.getQuick(row,column) != -A.getQuick(column,row)) return false;
-			if (!(Math.abs(A.getQuick(row,column) + A.getQuick(column,row)) <= epsilon)) return false;
-		}
-	}
-	return true;
+  checkSquare(A);
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = rows; --column >= 0; ) {
+      //if (A.getQuick(row,column) != -A.getQuick(column,row)) return false;
+      if (!(Math.abs(A.getQuick(row,column) + A.getQuick(column,row)) <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>square</i> if it has the same number of rows and columns.
  */
 public boolean isSquare(DoubleMatrix2D A) {
-	return A.rows() == A.columns();
+  return A.rows() == A.columns();
 }
 /**
  * A matrix <tt>A</tt> is <i>strictly lower triangular</i> if <tt>A[i,j]==0</tt> whenever <tt>i &lt;= j</tt>.
  * Matrix may but need not be square.
  */
 public boolean isStrictlyLowerTriangular(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int column = columns; --column >= 0; ) {
-		for (int row = Math.min(rows,column+1); --row >= 0; ) {
-			//if (A.getQuick(row,column) != 0) return false;
-			if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int column = columns; --column >= 0; ) {
+    for (int row = Math.min(rows,column+1); --row >= 0; ) {
+      //if (A.getQuick(row,column) != 0) return false;
+      if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>strictly triangular</i> if it is triangular and its diagonal elements all equal 0.
  * Matrix may but need not be square.
  */
 public boolean isStrictlyTriangular(DoubleMatrix2D A) {
-	if (!isTriangular(A)) return false;
+  if (!isTriangular(A)) return false;
 
-	double epsilon = tolerance();
-	for (int i = Math.min(A.rows(), A.columns()); --i >= 0; ) {
-		//if (A.getQuick(i,i) != 0) return false;
-		if (!(Math.abs(A.getQuick(i,i)) <= epsilon)) return false;
-	}
-	return true;
+  double epsilon = tolerance();
+  for (int i = Math.min(A.rows(), A.columns()); --i >= 0; ) {
+    //if (A.getQuick(i,i) != 0) return false;
+    if (!(Math.abs(A.getQuick(i,i)) <= epsilon)) return false;
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>strictly upper triangular</i> if <tt>A[i,j]==0</tt> whenever <tt>i &gt;= j</tt>.
  * Matrix may but need not be square.
  */
 public boolean isStrictlyUpperTriangular(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int column = columns; --column >= 0; ) {
-		for (int row = rows; --row >= column; ) {
-			//if (A.getQuick(row,column) != 0) return false;
-			if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int column = columns; --column >= 0; ) {
+    for (int row = rows; --row >= column; ) {
+      //if (A.getQuick(row,column) != 0) return false;
+      if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>symmetric</i> if <tt>A = tranpose(A)</tt>, that is <tt>A[i,j] == A[j,i]</tt>.
  * @throws IllegalArgumentException if <tt>!isSquare(A)</tt>.
  */
 public boolean isSymmetric(DoubleMatrix2D A) {
-	checkSquare(A);
-	return equals(A,A.viewDice());
+  checkSquare(A);
+  return equals(A,A.viewDice());
 }
 /**
  * A matrix <tt>A</tt> is <i>triangular</i> iff it is either upper or lower triangular.
  * Matrix may but need not be square.
  */
 public boolean isTriangular(DoubleMatrix2D A) {
-	return isLowerTriangular(A) || isUpperTriangular(A);
+  return isLowerTriangular(A) || isUpperTriangular(A);
 }
 /**
  * A matrix <tt>A</tt> is <i>tridiagonal</i> if <tt>A[i,j]==0</tt> whenever <tt>Math.abs(i-j) > 1</tt>.
  * Matrix may but need not be square.
  */
 public boolean isTridiagonal(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = columns; --column >= 0; ) {
-			if (Math.abs(row-column) > 1) {
-				//if (A.getQuick(row,column) != 0) return false;
-				if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-			}
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = columns; --column >= 0; ) {
+      if (Math.abs(row-column) > 1) {
+        //if (A.getQuick(row,column) != 0) return false;
+        if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+      }
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>unit triangular</i> if it is triangular and its diagonal elements all equal 1.
  * Matrix may but need not be square.
  */
 public boolean isUnitTriangular(DoubleMatrix2D A) {
-	if (!isTriangular(A)) return false;
-	
-	double epsilon = tolerance();
-	for (int i = Math.min(A.rows(), A.columns()); --i >= 0; ) {
-		//if (A.getQuick(i,i) != 1) return false;
-		if (!(Math.abs(1 - A.getQuick(i,i)) <= epsilon)) return false;
-	}
-	return true;
+  if (!isTriangular(A)) return false;
+  
+  double epsilon = tolerance();
+  for (int i = Math.min(A.rows(), A.columns()); --i >= 0; ) {
+    //if (A.getQuick(i,i) != 1) return false;
+    if (!(Math.abs(1 - A.getQuick(i,i)) <= epsilon)) return false;
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>upper bidiagonal</i> if <tt>A[i,j]==0</tt> unless <tt>i==j || i==j-1</tt>.
  * Matrix may but need not be square.
  */
 public boolean isUpperBidiagonal(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int row = rows; --row >=0; ) {
-		for (int column = columns; --column >= 0; ) {
-			if (!(row==column || row==column-1)) {
-				//if (A.getQuick(row,column) != 0) return false;
-				if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-			}
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int row = rows; --row >=0; ) {
+    for (int column = columns; --column >= 0; ) {
+      if (!(row==column || row==column-1)) {
+        //if (A.getQuick(row,column) != 0) return false;
+        if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+      }
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>upper triangular</i> if <tt>A[i,j]==0</tt> whenever <tt>i &gt; j</tt>.
  * Matrix may but need not be square.
  */
 public boolean isUpperTriangular(DoubleMatrix2D A) {
-	double epsilon = tolerance();
-	int rows = A.rows();
-	int columns = A.columns();
-	for (int column = columns; --column >= 0; ) {
-		for (int row = rows; --row > column; ) {
-			//if (A.getQuick(row,column) != 0) return false;
-			if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
-		}
-	}
-	return true;
+  double epsilon = tolerance();
+  int rows = A.rows();
+  int columns = A.columns();
+  for (int column = columns; --column >= 0; ) {
+    for (int row = rows; --row > column; ) {
+      //if (A.getQuick(row,column) != 0) return false;
+      if (!(Math.abs(A.getQuick(row,column)) <= epsilon)) return false;
+    }
+  }
+  return true;
 }
 /**
  * A matrix <tt>A</tt> is <i>zero</i> if all its cells are zero.
  */
 public boolean isZero(DoubleMatrix2D A) {
-	return equals(A,0);
+  return equals(A,0);
 }
 /**
 The <i>lower bandwidth</i> of a square matrix <tt>A</tt> is the maximum <tt>i-j</tt> for which <tt>A[i,j]</tt> is nonzero and <tt>i &gt; j</tt>.
@@ -749,18 +749,18 @@
 @see #upperBandwidth(DoubleMatrix2D)
 */
 public int lowerBandwidth(DoubleMatrix2D A) {
-	checkSquare(A);
-	double epsilon = tolerance();
-	int rows = A.rows();
+  checkSquare(A);
+  double epsilon = tolerance();
+  int rows = A.rows();
 
-	for (int k=rows; --k >= 0; ) {
-		for (int i = rows-k; --i >= 0; ) {
-			int j = i+k;
-			//if (A.getQuick(j,i) != 0) return k;
-			if (!(Math.abs(A.getQuick(j,i)) <= epsilon)) return k;
-		}
-	}
-	return 0;
+  for (int k=rows; --k >= 0; ) {
+    for (int i = rows-k; --i >= 0; ) {
+      int j = i+k;
+      //if (A.getQuick(j,i) != 0) return k;
+      if (!(Math.abs(A.getQuick(j,i)) <= epsilon)) return k;
+    }
+  }
+  return 0;
 }
 /**
 Returns the <i>semi-bandwidth</i> of the given square matrix <tt>A</tt>.
@@ -780,122 +780,122 @@
 Examples:
 <table border="1" cellspacing="0">
   <tr align="left" valign="top"> 
-	<td valign="middle" align="left"><tt>matrix</tt></td>
-	<td> <tt>4&nbsp;x&nbsp;4&nbsp;<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0 </tt></td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;1&nbsp;0<br>
-	  0&nbsp;1&nbsp;1&nbsp;1<br>
-	  0&nbsp;0&nbsp;1&nbsp;1 </tt></td>
-	<td><tt> 4&nbsp;x&nbsp;4<br>
-	  0&nbsp;1&nbsp;1&nbsp;1<br>
-	  0&nbsp;1&nbsp;1&nbsp;1<br>
-	  0&nbsp;0&nbsp;0&nbsp;1<br>
-	  0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
-	<td><tt> 4&nbsp;x&nbsp;4<br>
-	  0&nbsp;0&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;1&nbsp;1 </tt></td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;1&nbsp;0&nbsp;0<br>
-	  0&nbsp;1&nbsp;1&nbsp;0<br>
-	  0&nbsp;1&nbsp;0&nbsp;1<br>
-	  1&nbsp;0&nbsp;1&nbsp;1 </tt><tt> </tt> </td>
-	<td><tt>4&nbsp;x&nbsp;4<br>
-	  1&nbsp;1&nbsp;1&nbsp;0<br>
-	  0&nbsp;1&nbsp;0&nbsp;0<br>
-	  1&nbsp;1&nbsp;0&nbsp;1<br>
-	  0&nbsp;0&nbsp;1&nbsp;1 </tt> </td>
+  <td valign="middle" align="left"><tt>matrix</tt></td>
+  <td> <tt>4&nbsp;x&nbsp;4&nbsp;<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0 </tt></td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;1&nbsp;0<br>
+    0&nbsp;1&nbsp;1&nbsp;1<br>
+    0&nbsp;0&nbsp;1&nbsp;1 </tt></td>
+  <td><tt> 4&nbsp;x&nbsp;4<br>
+    0&nbsp;1&nbsp;1&nbsp;1<br>
+    0&nbsp;1&nbsp;1&nbsp;1<br>
+    0&nbsp;0&nbsp;0&nbsp;1<br>
+    0&nbsp;0&nbsp;0&nbsp;1 </tt></td>
+  <td><tt> 4&nbsp;x&nbsp;4<br>
+    0&nbsp;0&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;1&nbsp;1 </tt></td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;1&nbsp;0&nbsp;0<br>
+    0&nbsp;1&nbsp;1&nbsp;0<br>
+    0&nbsp;1&nbsp;0&nbsp;1<br>
+    1&nbsp;0&nbsp;1&nbsp;1 </tt><tt> </tt> </td>
+  <td><tt>4&nbsp;x&nbsp;4<br>
+    1&nbsp;1&nbsp;1&nbsp;0<br>
+    0&nbsp;1&nbsp;0&nbsp;0<br>
+    1&nbsp;1&nbsp;0&nbsp;1<br>
+    0&nbsp;0&nbsp;1&nbsp;1 </tt> </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>upperBandwidth</tt></td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td><tt>3</tt></td>
-	<td align="center" valign="middle"><tt>0</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>2</tt></div>
-	</td>
+  <td><tt>upperBandwidth</tt></td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td><tt>3</tt></td>
+  <td align="center" valign="middle"><tt>0</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>2</tt></div>
+  </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>lowerBandwidth</tt></td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>0</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td><tt>0</tt></td>
-	<td align="center" valign="middle"><tt>3</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>3</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>2</tt></div>
-	</td>
+  <td><tt>lowerBandwidth</tt></td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>0</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td><tt>0</tt></td>
+  <td align="center" valign="middle"><tt>3</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>3</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>2</tt></div>
+  </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>semiBandwidth</tt></td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>1</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>2</tt></div>
-	</td>
-	<td><tt>4</tt></td>
-	<td align="center" valign="middle"><tt>4</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>4</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>3</tt></div>
-	</td>
+  <td><tt>semiBandwidth</tt></td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>1</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>2</tt></div>
+  </td>
+  <td><tt>4</tt></td>
+  <td align="center" valign="middle"><tt>4</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>4</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>3</tt></div>
+  </td>
   </tr>
   <tr align="center" valign="middle"> 
-	<td><tt>description</tt></td>
-	<td> 
-	  <div align="center"><tt>zero</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>diagonal</tt></div>
-	</td>
-	<td> 
-	  <div align="center"><tt>tridiagonal</tt></div>
-	</td>
-	<td><tt>upper triangular</tt></td>
-	<td align="center" valign="middle"><tt>lower triangular</tt></td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>unstructured</tt></div>
-	</td>
-	<td align="center" valign="middle"> 
-	  <div align="center"><tt>unstructured</tt></div>
-	</td>
+  <td><tt>description</tt></td>
+  <td> 
+    <div align="center"><tt>zero</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>diagonal</tt></div>
+  </td>
+  <td> 
+    <div align="center"><tt>tridiagonal</tt></div>
+  </td>
+  <td><tt>upper triangular</tt></td>
+  <td align="center" valign="middle"><tt>lower triangular</tt></td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>unstructured</tt></div>
+  </td>
+  <td align="center" valign="middle"> 
+    <div align="center"><tt>unstructured</tt></div>
+  </td>
   </tr>
 </table>
 
@@ -906,37 +906,37 @@
 @see #upperBandwidth(DoubleMatrix2D)
 */
 public int semiBandwidth(DoubleMatrix2D A) {
-	checkSquare(A);
-	double epsilon = tolerance();
-	int rows = A.rows();
+  checkSquare(A);
+  double epsilon = tolerance();
+  int rows = A.rows();
 
-	for (int k=rows; --k >= 0; ) {
-		for (int i = rows-k; --i >= 0; ) {
-			int j = i+k;
-			//if (A.getQuick(j,i) != 0) return k+1;
-			//if (A.getQuick(i,j) != 0) return k+1;
-			if (!(Math.abs(A.getQuick(j,i)) <= epsilon)) return k+1;
-			if (!(Math.abs(A.getQuick(i,j)) <= epsilon)) return k+1;
-		}
-	}
-	return 1;
+  for (int k=rows; --k >= 0; ) {
+    for (int i = rows-k; --i >= 0; ) {
+      int j = i+k;
+      //if (A.getQuick(j,i) != 0) return k+1;
+      //if (A.getQuick(i,j) != 0) return k+1;
+      if (!(Math.abs(A.getQuick(j,i)) <= epsilon)) return k+1;
+      if (!(Math.abs(A.getQuick(i,j)) <= epsilon)) return k+1;
+    }
+  }
+  return 1;
 }
 /**
  * Sets the tolerance to <tt>Math.abs(newTolerance)</tt>.
  * @throws UnsupportedOperationException if <tt>this==DEFAULT || this==ZERO || this==TWELVE</tt>.
  */
 public void setTolerance(double newTolerance) {
-	if (this==DEFAULT || this==ZERO || this==TWELVE) {
-		throw new IllegalArgumentException("Attempted to modify immutable object."); 
-		//throw new UnsupportedOperationException("Attempted to modify object."); // since JDK1.2
-	}
-	tolerance = Math.abs(newTolerance);
+  if (this==DEFAULT || this==ZERO || this==TWELVE) {
+    throw new IllegalArgumentException("Attempted to modify immutable object."); 
+    //throw new UnsupportedOperationException("Attempted to modify object."); // since JDK1.2
+  }
+  tolerance = Math.abs(newTolerance);
 }
 /**
  * Returns the current tolerance.
  */
 public double tolerance() {
-	return tolerance;
+  return tolerance;
 }
 /**
 Returns summary information about the given matrix <tt>A</tt>.
@@ -973,154 +973,154 @@
 </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();
-	String unknown = "Illegal operation or error: ";
+  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();
+  String unknown = "Illegal operation or error: ";
 
-	// determine properties
-	names.add("density");
-	try { values.add(String.valueOf(density(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	// determine properties
-	names.add("isDiagonal");
-	try { values.add(String.valueOf(isDiagonal(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	// determine properties
-	names.add("isDiagonallyDominantByRow");
-	try { values.add(String.valueOf(isDiagonallyDominantByRow(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	// determine properties
-	names.add("isDiagonallyDominantByColumn");
-	try { values.add(String.valueOf(isDiagonallyDominantByColumn(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isIdentity");
-	try { values.add(String.valueOf(isIdentity(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isLowerBidiagonal");
-	try { values.add(String.valueOf(isLowerBidiagonal(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isLowerTriangular");
-	try { values.add(String.valueOf(isLowerTriangular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isNonNegative");
-	try { values.add(String.valueOf(isNonNegative(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isOrthogonal");
-	try { values.add(String.valueOf(isOrthogonal(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isPositive");
-	try { values.add(String.valueOf(isPositive(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isSingular");
-	try { values.add(String.valueOf(isSingular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isSkewSymmetric");
-	try { values.add(String.valueOf(isSkewSymmetric(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isSquare");
-	try { values.add(String.valueOf(isSquare(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isStrictlyLowerTriangular");
-	try { values.add(String.valueOf(isStrictlyLowerTriangular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isStrictlyTriangular");
-	try { values.add(String.valueOf(isStrictlyTriangular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isStrictlyUpperTriangular");
-	try { values.add(String.valueOf(isStrictlyUpperTriangular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isSymmetric");
-	try { values.add(String.valueOf(isSymmetric(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isTriangular");
-	try { values.add(String.valueOf(isTriangular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isTridiagonal");
-	try { values.add(String.valueOf(isTridiagonal(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isUnitTriangular");
-	try { values.add(String.valueOf(isUnitTriangular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isUpperBidiagonal");
-	try { values.add(String.valueOf(isUpperBidiagonal(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-	
-	names.add("isUpperTriangular");
-	try { values.add(String.valueOf(isUpperTriangular(A)));} 
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
-		
-	names.add("isZero");
-	try { values.add(String.valueOf(isZero(A))); }
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  // determine properties
+  names.add("density");
+  try { values.add(String.valueOf(density(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  // determine properties
+  names.add("isDiagonal");
+  try { values.add(String.valueOf(isDiagonal(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  // determine properties
+  names.add("isDiagonallyDominantByRow");
+  try { values.add(String.valueOf(isDiagonallyDominantByRow(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  // determine properties
+  names.add("isDiagonallyDominantByColumn");
+  try { values.add(String.valueOf(isDiagonallyDominantByColumn(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isIdentity");
+  try { values.add(String.valueOf(isIdentity(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isLowerBidiagonal");
+  try { values.add(String.valueOf(isLowerBidiagonal(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isLowerTriangular");
+  try { values.add(String.valueOf(isLowerTriangular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isNonNegative");
+  try { values.add(String.valueOf(isNonNegative(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isOrthogonal");
+  try { values.add(String.valueOf(isOrthogonal(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isPositive");
+  try { values.add(String.valueOf(isPositive(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isSingular");
+  try { values.add(String.valueOf(isSingular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isSkewSymmetric");
+  try { values.add(String.valueOf(isSkewSymmetric(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isSquare");
+  try { values.add(String.valueOf(isSquare(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isStrictlyLowerTriangular");
+  try { values.add(String.valueOf(isStrictlyLowerTriangular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isStrictlyTriangular");
+  try { values.add(String.valueOf(isStrictlyTriangular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isStrictlyUpperTriangular");
+  try { values.add(String.valueOf(isStrictlyUpperTriangular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isSymmetric");
+  try { values.add(String.valueOf(isSymmetric(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isTriangular");
+  try { values.add(String.valueOf(isTriangular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isTridiagonal");
+  try { values.add(String.valueOf(isTridiagonal(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isUnitTriangular");
+  try { values.add(String.valueOf(isUnitTriangular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isUpperBidiagonal");
+  try { values.add(String.valueOf(isUpperBidiagonal(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  
+  names.add("isUpperTriangular");
+  try { values.add(String.valueOf(isUpperTriangular(A)));} 
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+    
+  names.add("isZero");
+  try { values.add(String.valueOf(isZero(A))); }
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
 
-	names.add("lowerBandwidth");
-	try { values.add(String.valueOf(lowerBandwidth(A))); }
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  names.add("lowerBandwidth");
+  try { values.add(String.valueOf(lowerBandwidth(A))); }
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
 
-	names.add("semiBandwidth");
-	try { values.add(String.valueOf(semiBandwidth(A))); }
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  names.add("semiBandwidth");
+  try { values.add(String.valueOf(semiBandwidth(A))); }
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
 
-	names.add("upperBandwidth");
-	try { values.add(String.valueOf(upperBandwidth(A))); }
-	catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
+  names.add("upperBandwidth");
+  try { values.add(String.valueOf(upperBandwidth(A))); }
+  catch (IllegalArgumentException exc) { values.add(unknown+exc.getMessage()); }
 
-	
-	// sort ascending by property name
-	org.apache.mahout.matrix.function.IntComparator comp = new org.apache.mahout.matrix.function.IntComparator() {
-		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() {
-		public void swap(int a, int b) {
-			Object tmp;
-			tmp = names.get(a); names.set(a,names.get(b)); names.set(b,tmp);
-			tmp = values.get(a); values.set(a,values.get(b)); values.set(b,tmp);
-		}
-	};	
-	org.apache.mahout.matrix.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();
-		maxLength = Math.max(length, maxLength);
-	}
+  
+  // sort ascending by property name
+  org.apache.mahout.matrix.function.IntComparator comp = new org.apache.mahout.matrix.function.IntComparator() {
+    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() {
+    public void swap(int a, int b) {
+      Object tmp;
+      tmp = names.get(a); names.set(a,names.get(b)); names.set(b,tmp);
+      tmp = values.get(a); values.set(a,values.get(b)); values.set(b,tmp);
+    }
+  };  
+  org.apache.mahout.matrix.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();
+    maxLength = Math.max(length, maxLength);
+  }
 
-	// finally, format properties
-	StringBuffer buf = new StringBuffer();
-	for (int i = 0; i < names.size(); i++) {
-		String name = ((String) names.get(i));
-		buf.append(name);
-		buf.append(blanks(maxLength - name.length()));
-		buf.append(" : ");
-		buf.append(values.get(i));
-		if (i < names.size() - 1)
-			buf.append('\n');
-	}
-	
-	return buf.toString();
+  // finally, format properties
+  StringBuffer buf = new StringBuffer();
+  for (int i = 0; i < names.size(); i++) {
+    String name = ((String) names.get(i));
+    buf.append(name);
+    buf.append(blanks(maxLength - name.length()));
+    buf.append(" : ");
+    buf.append(values.get(i));
+    if (i < names.size() - 1)
+      buf.append('\n');
+  }
+  
+  return buf.toString();
 }
 /**
 The <i>upper bandwidth</i> of a square matrix <tt>A</tt> is the 
@@ -1135,17 +1135,17 @@
 @see #lowerBandwidth(DoubleMatrix2D)
 */
 public int upperBandwidth(DoubleMatrix2D A) {
-	checkSquare(A);
-	double epsilon = tolerance();
-	int rows = A.rows();
+  checkSquare(A);
+  double epsilon = tolerance();
+  int rows = A.rows();
 
-	for (int k=rows; --k >= 0; ) {
-		for (int i = rows-k; --i >= 0; ) {
-			int j = i+k;
-			//if (A.getQuick(i,j) != 0) return k;
-			if (!(Math.abs(A.getQuick(i,j)) <= epsilon)) return k;
-		}
-	}
-	return 0;
+  for (int k=rows; --k >= 0; ) {
+    for (int i = rows-k; --i >= 0; ) {
+      int j = i+k;
+      //if (A.getQuick(i,j) != 0) return k;
+      if (!(Math.abs(A.getQuick(i,j)) <= epsilon)) return k;
+    }
+  }
+  return 0;
 }
 }

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=883974&r1=883973&r2=883974&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 Wed Nov 25 03:41:28 2009
@@ -27,23 +27,23 @@
  */
 @Deprecated
 public class QRDecomposition implements java.io.Serializable {
-	static final long serialVersionUID = 1020;
-	/** Array for internal storage of decomposition.
-	@serial internal array storage.
-	*/
-	private DoubleMatrix2D QR;
-	//private double[][] QR;
-	
-	/** Row and column dimensions.
-	@serial column dimension.
-	@serial row dimension.
-	*/
-	private int m, n;
-	
-	/** Array for internal storage of diagonal of R.
-	@serial diagonal of R.
-	*/
-	private DoubleMatrix1D Rdiag;
+  static final long serialVersionUID = 1020;
+  /** Array for internal storage of decomposition.
+  @serial internal array storage.
+  */
+  private DoubleMatrix2D QR;
+  //private double[][] QR;
+  
+  /** Row and column dimensions.
+  @serial column dimension.
+  @serial row dimension.
+  */
+  private int m, n;
+  
+  /** Array for internal storage of diagonal of R.
+  @serial diagonal of R.
+  */
+  private DoubleMatrix1D Rdiag;
 /** 
 Constructs and returns a new QR decomposition object;  computed by Householder reflections;
 The decomposed matrices can be retrieved via instance methods of the returned decomposition object.
@@ -53,130 +53,130 @@
 */
 
 public QRDecomposition (DoubleMatrix2D A) {
-	Property.DEFAULT.checkRectangular(A);
+  Property.DEFAULT.checkRectangular(A);
 
-	org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
-	// Initialize.
-	QR = A.copy();
-	m = A.rows();
-	n = A.columns();
-	Rdiag = A.like1D(n);
-	//Rdiag = new double[n];
-	org.apache.mahout.matrix.function.DoubleDoubleFunction hypot = Algebra.hypotFunction();
-	
-	// precompute and cache some views to avoid regenerating them time and again
-	DoubleMatrix1D[] QRcolumns = new DoubleMatrix1D[n];
-	DoubleMatrix1D[] QRcolumnsPart = new DoubleMatrix1D[n];
-	for (int k = 0; k < n; k++) {
-		QRcolumns[k] = QR.viewColumn(k);
-		QRcolumnsPart[k] = QR.viewColumn(k).viewPart(k,m-k);
-	}
-	
-	// Main loop.
-	for (int k = 0; k < n; k++) {
-		//DoubleMatrix1D QRcolk = QR.viewColumn(k).viewPart(k,m-k);
-		// Compute 2-norm of k-th column without under/overflow.
-		double nrm = 0;
-		//if (k<m) nrm = QRcolumnsPart[k].aggregate(hypot,F.identity);
-		
-		for (int i = k; i < m; i++) { // fixes bug reported by hong.44@osu.edu
-			nrm = Algebra.hypot(nrm,QR.getQuick(i,k));
-		}
-		
-		
-		if (nrm != 0.0) {
-			// Form k-th Householder vector.
-			if (QR.getQuick(k,k) < 0) nrm = -nrm;
-			QRcolumnsPart[k].assign(org.apache.mahout.jet.math.Functions.div(nrm));
-			/*
-			for (int i = k; i < m; i++) {
-			   QR[i][k] /= nrm;
-			}
-			*/
-			
-			QR.setQuick(k,k, QR.getQuick(k,k) + 1);
-			
-			// Apply transformation to remaining columns.
-			for (int j = k+1; j < n; j++) {
-				DoubleMatrix1D QRcolj = QR.viewColumn(j).viewPart(k,m-k);
-				double s = QRcolumnsPart[k].zDotProduct(QRcolj);
-				/*
-				// fixes bug reported by John Chambers
-				DoubleMatrix1D QRcolj = QR.viewColumn(j).viewPart(k,m-k);
-				double s = QRcolumnsPart[k].zDotProduct(QRcolumns[j]);
-				double s = 0.0; 
-				for (int i = k; i < m; i++) {
-				  s += QR[i][k]*QR[i][j];
-				}
-				*/
-				s = -s / QR.getQuick(k,k);
-				//QRcolumnsPart[j].assign(QRcolumns[k], F.plusMult(s));
-				
-				for (int i = k; i < m; i++) {
-				  QR.setQuick(i,j, QR.getQuick(i,j) + s*QR.getQuick(i,k));
-				}
-				
-			}
-		}
-		Rdiag.setQuick(k, -nrm);
-	}
+  org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
+  // Initialize.
+  QR = A.copy();
+  m = A.rows();
+  n = A.columns();
+  Rdiag = A.like1D(n);
+  //Rdiag = new double[n];
+  org.apache.mahout.matrix.function.DoubleDoubleFunction hypot = Algebra.hypotFunction();
+  
+  // precompute and cache some views to avoid regenerating them time and again
+  DoubleMatrix1D[] QRcolumns = new DoubleMatrix1D[n];
+  DoubleMatrix1D[] QRcolumnsPart = new DoubleMatrix1D[n];
+  for (int k = 0; k < n; k++) {
+    QRcolumns[k] = QR.viewColumn(k);
+    QRcolumnsPart[k] = QR.viewColumn(k).viewPart(k,m-k);
+  }
+  
+  // Main loop.
+  for (int k = 0; k < n; k++) {
+    //DoubleMatrix1D QRcolk = QR.viewColumn(k).viewPart(k,m-k);
+    // Compute 2-norm of k-th column without under/overflow.
+    double nrm = 0;
+    //if (k<m) nrm = QRcolumnsPart[k].aggregate(hypot,F.identity);
+    
+    for (int i = k; i < m; i++) { // fixes bug reported by hong.44@osu.edu
+      nrm = Algebra.hypot(nrm,QR.getQuick(i,k));
+    }
+    
+    
+    if (nrm != 0.0) {
+      // Form k-th Householder vector.
+      if (QR.getQuick(k,k) < 0) nrm = -nrm;
+      QRcolumnsPart[k].assign(org.apache.mahout.jet.math.Functions.div(nrm));
+      /*
+      for (int i = k; i < m; i++) {
+         QR[i][k] /= nrm;
+      }
+      */
+      
+      QR.setQuick(k,k, QR.getQuick(k,k) + 1);
+      
+      // Apply transformation to remaining columns.
+      for (int j = k+1; j < n; j++) {
+        DoubleMatrix1D QRcolj = QR.viewColumn(j).viewPart(k,m-k);
+        double s = QRcolumnsPart[k].zDotProduct(QRcolj);
+        /*
+        // fixes bug reported by John Chambers
+        DoubleMatrix1D QRcolj = QR.viewColumn(j).viewPart(k,m-k);
+        double s = QRcolumnsPart[k].zDotProduct(QRcolumns[j]);
+        double s = 0.0; 
+        for (int i = k; i < m; i++) {
+          s += QR[i][k]*QR[i][j];
+        }
+        */
+        s = -s / QR.getQuick(k,k);
+        //QRcolumnsPart[j].assign(QRcolumns[k], F.plusMult(s));
+        
+        for (int i = k; i < m; i++) {
+          QR.setQuick(i,j, QR.getQuick(i,j) + s*QR.getQuick(i,k));
+        }
+        
+      }
+    }
+    Rdiag.setQuick(k, -nrm);
+  }
 }
 /** 
 Returns the Householder vectors <tt>H</tt>.
 @return A lower trapezoidal matrix whose columns define the householder reflections.
 */
 public DoubleMatrix2D getH () {
-	return Algebra.DEFAULT.trapezoidalLower(QR.copy());
+  return Algebra.DEFAULT.trapezoidalLower(QR.copy());
 }
 /** 
 Generates and returns the (economy-sized) orthogonal factor <tt>Q</tt>.
 @return <tt>Q</tt>
 */
 public DoubleMatrix2D getQ () {
-	org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
-	DoubleMatrix2D Q = QR.like();
-	//double[][] Q = X.getArray();
-	for (int k = n-1; k >= 0; k--) {
-		DoubleMatrix1D QRcolk = QR.viewColumn(k).viewPart(k,m-k);
-		Q.setQuick(k,k, 1);
-		for (int j = k; j < n; j++) {
-			if (QR.getQuick(k,k) != 0) {
-				DoubleMatrix1D Qcolj = Q.viewColumn(j).viewPart(k,m-k);
-				double s = QRcolk.zDotProduct(Qcolj);
-				s = -s / QR.getQuick(k,k);
-				Qcolj.assign(QRcolk, F.plusMult(s));
-			}
-		}
-	}
-	return Q;
+  org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
+  DoubleMatrix2D Q = QR.like();
+  //double[][] Q = X.getArray();
+  for (int k = n-1; k >= 0; k--) {
+    DoubleMatrix1D QRcolk = QR.viewColumn(k).viewPart(k,m-k);
+    Q.setQuick(k,k, 1);
+    for (int j = k; j < n; j++) {
+      if (QR.getQuick(k,k) != 0) {
+        DoubleMatrix1D Qcolj = Q.viewColumn(j).viewPart(k,m-k);
+        double s = QRcolk.zDotProduct(Qcolj);
+        s = -s / QR.getQuick(k,k);
+        Qcolj.assign(QRcolk, F.plusMult(s));
+      }
+    }
+  }
+  return Q;
 }
 /** 
 Returns the upper triangular factor, <tt>R</tt>.
 @return <tt>R</tt>
 */
 public DoubleMatrix2D getR() {
-	DoubleMatrix2D R = QR.like(n,n);
-	for (int i = 0; i < n; i++) {
-		for (int j = 0; j < n; j++) {
-			if (i < j) 
-				R.setQuick(i,j, QR.getQuick(i,j));
-			else if (i == j) 
-				R.setQuick(i,j, Rdiag.getQuick(i));
-			else 
-				R.setQuick(i,j, 0);
-		}
-	}
-	return R;
+  DoubleMatrix2D R = QR.like(n,n);
+  for (int i = 0; i < n; i++) {
+    for (int j = 0; j < n; j++) {
+      if (i < j) 
+        R.setQuick(i,j, QR.getQuick(i,j));
+      else if (i == j) 
+        R.setQuick(i,j, Rdiag.getQuick(i));
+      else 
+        R.setQuick(i,j, 0);
+    }
+  }
+  return R;
 }
 /** 
 Returns whether the matrix <tt>A</tt> has full rank.
 @return true if <tt>R</tt>, and hence <tt>A</tt>, has full rank.
 */
 public boolean hasFullRank() {
-	for (int j = 0; j < n; j++) {
-		if (Rdiag.getQuick(j) == 0) return false;
-	}
-	return true;
+  for (int j = 0; j < n; j++) {
+    if (Rdiag.getQuick(j) == 0) return false;
+  }
+  return true;
 }
 /** 
 Least squares solution of <tt>A*X = B</tt>; <tt>returns X</tt>.
@@ -186,43 +186,43 @@
 @exception  IllegalArgumentException  if <tt>!this.hasFullRank()</tt> (<tt>A</tt> is rank deficient).
 */
 public DoubleMatrix2D solve(DoubleMatrix2D B) {
-	org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
-	if (B.rows() != m) {
-		throw new IllegalArgumentException("Matrix row dimensions must agree.");
-	}
-	if (!this.hasFullRank()) {
-		throw new IllegalArgumentException("Matrix is rank deficient.");
-	}
-	
-	// Copy right hand side
-	int nx = B.columns();
-	DoubleMatrix2D X = B.copy();
-	
-	// Compute Y = transpose(Q)*B
-	for (int k = 0; k < n; k++) {
-		for (int j = 0; j < nx; j++) {
-			double s = 0.0; 
-			for (int i = k; i < m; i++) {
-				s += QR.getQuick(i,k)*X.getQuick(i,j);
-			}
-			s = -s / QR.getQuick(k,k);
-			for (int i = k; i < m; i++) {
-				X.setQuick(i,j, X.getQuick(i,j) + s*QR.getQuick(i,k));
-			}
-		}
-	}
-	// Solve R*X = Y;
-	for (int k = n-1; k >= 0; k--) {
-		for (int j = 0; j < nx; j++) {
-			X.setQuick(k,j, X.getQuick(k,j) / Rdiag.getQuick(k));
-		}
-		for (int i = 0; i < k; i++) {
-			for (int j = 0; j < nx; j++) {
-				X.setQuick(i,j, X.getQuick(i,j) - X.getQuick(k,j)*QR.getQuick(i,k));
-			}
-		}
-	}
-	return X.viewPart(0,0,n,nx);
+  org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
+  if (B.rows() != m) {
+    throw new IllegalArgumentException("Matrix row dimensions must agree.");
+  }
+  if (!this.hasFullRank()) {
+    throw new IllegalArgumentException("Matrix is rank deficient.");
+  }
+  
+  // Copy right hand side
+  int nx = B.columns();
+  DoubleMatrix2D X = B.copy();
+  
+  // Compute Y = transpose(Q)*B
+  for (int k = 0; k < n; k++) {
+    for (int j = 0; j < nx; j++) {
+      double s = 0.0; 
+      for (int i = k; i < m; i++) {
+        s += QR.getQuick(i,k)*X.getQuick(i,j);
+      }
+      s = -s / QR.getQuick(k,k);
+      for (int i = k; i < m; i++) {
+        X.setQuick(i,j, X.getQuick(i,j) + s*QR.getQuick(i,k));
+      }
+    }
+  }
+  // Solve R*X = Y;
+  for (int k = n-1; k >= 0; k--) {
+    for (int j = 0; j < nx; j++) {
+      X.setQuick(k,j, X.getQuick(k,j) / Rdiag.getQuick(k));
+    }
+    for (int i = 0; i < k; i++) {
+      for (int j = 0; j < nx; j++) {
+        X.setQuick(i,j, X.getQuick(i,j) - X.getQuick(k,j)*QR.getQuick(i,k));
+      }
+    }
+  }
+  return X.viewPart(0,0,n,nx);
 }
 /**
 Returns a String with (propertyName, propertyValue) pairs.
@@ -234,33 +234,33 @@
 </pre>
 */
 public String toString() {
-	StringBuffer buf = new StringBuffer();
-	String unknown = "Illegal operation or error: ";
+  StringBuffer buf = new StringBuffer();
+  String unknown = "Illegal operation or error: ";
 
-	buf.append("-----------------------------------------------------------------\n");
-	buf.append("QRDecomposition(A) --> hasFullRank(A), H, Q, R, pseudo inverse(A)\n");
-	buf.append("-----------------------------------------------------------------\n");
+  buf.append("-----------------------------------------------------------------\n");
+  buf.append("QRDecomposition(A) --> hasFullRank(A), H, Q, R, pseudo inverse(A)\n");
+  buf.append("-----------------------------------------------------------------\n");
 
-	buf.append("hasFullRank = ");
-	try { buf.append(String.valueOf(this.hasFullRank()));} 
-	catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
-	
-	buf.append("\n\nH = ");
-	try { buf.append(String.valueOf(this.getH()));} 
-	catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
-	
-	buf.append("\n\nQ = ");
-	try { buf.append(String.valueOf(this.getQ()));} 
-	catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
-	
-	buf.append("\n\nR = ");
-	try { buf.append(String.valueOf(this.getR()));} 
-	catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
-	
-	buf.append("\n\npseudo inverse(A) = ");
-	try { buf.append(String.valueOf(this.solve(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.identity(QR.rows()))));}
-	catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
-	
-	return buf.toString();
+  buf.append("hasFullRank = ");
+  try { buf.append(String.valueOf(this.hasFullRank()));} 
+  catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
+  
+  buf.append("\n\nH = ");
+  try { buf.append(String.valueOf(this.getH()));} 
+  catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
+  
+  buf.append("\n\nQ = ");
+  try { buf.append(String.valueOf(this.getQ()));} 
+  catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
+  
+  buf.append("\n\nR = ");
+  try { buf.append(String.valueOf(this.getR()));} 
+  catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
+  
+  buf.append("\n\npseudo inverse(A) = ");
+  try { buf.append(String.valueOf(this.solve(org.apache.mahout.matrix.matrix.DoubleFactory2D.dense.identity(QR.rows()))));}
+  catch (IllegalArgumentException exc) { buf.append(unknown+exc.getMessage()); }
+  
+  return buf.toString();
 }
 }

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=883974&r1=883973&r2=883974&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 Wed Nov 25 03:41:28 2009
@@ -21,201 +21,201 @@
  */
 @Deprecated
 public class SeqBlas implements Blas {
-	/**
-	Little trick to allow for "aliasing", that is, renaming this class.
-	Time and again writing code like
-	<p>
-	<tt>SeqBlas.blas.dgemm(...);</tt>
-	<p>
-	is a bit awkward. Using the aliasing you can instead write
-	<p>
-	<tt>Blas B = SeqBlas.blas; <br>
-	B.dgemm(...);</tt>
-	*/
-	public static final Blas seqBlas = new SeqBlas();
-	
-	private static final org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
+  /**
+  Little trick to allow for "aliasing", that is, renaming this class.
+  Time and again writing code like
+  <p>
+  <tt>SeqBlas.blas.dgemm(...);</tt>
+  <p>
+  is a bit awkward. Using the aliasing you can instead write
+  <p>
+  <tt>Blas B = SeqBlas.blas; <br>
+  B.dgemm(...);</tt>
+  */
+  public static final Blas seqBlas = new SeqBlas();
+  
+  private static final org.apache.mahout.jet.math.Functions F = org.apache.mahout.jet.math.Functions.functions;
 /**
 Makes this class non instantiable, but still let's others inherit from it.
 */
 protected SeqBlas() {}
 public void assign(DoubleMatrix2D A, org.apache.mahout.matrix.function.DoubleFunction function) {
-	A.assign(function);
+  A.assign(function);
 }
 public void assign(DoubleMatrix2D A, DoubleMatrix2D B, org.apache.mahout.matrix.function.DoubleDoubleFunction function) {
-	A.assign(B,function);
+  A.assign(B,function);
 }
 public double dasum(DoubleMatrix1D x) {
-	return x.aggregate(F.plus, F.abs);
+  return x.aggregate(F.plus, F.abs);
 }
 public void daxpy(double alpha, DoubleMatrix1D x, DoubleMatrix1D y) {
-	y.assign(x,F.plusMult(alpha));
+  y.assign(x,F.plusMult(alpha));
 }
 public void daxpy(double alpha, DoubleMatrix2D A, DoubleMatrix2D B) {
-	B.assign(A, F.plusMult(alpha));
+  B.assign(A, F.plusMult(alpha));
 }
 public void dcopy(DoubleMatrix1D x, DoubleMatrix1D y) {
-	y.assign(x);
+  y.assign(x);
 }
 public void dcopy(DoubleMatrix2D A, DoubleMatrix2D B) {
-	B.assign(A);
+  B.assign(A);
 }
 public double ddot(DoubleMatrix1D x, DoubleMatrix1D y) {
-	return x.zDotProduct(y);
+  return x.zDotProduct(y);
 }
 public void dgemm(boolean transposeA, boolean transposeB, double alpha, DoubleMatrix2D A, DoubleMatrix2D B, double beta, DoubleMatrix2D C) {
-	A.zMult(B,C,alpha,beta,transposeA,transposeB);
+  A.zMult(B,C,alpha,beta,transposeA,transposeB);
 }
 public void dgemv(boolean transposeA, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y) {
-	A.zMult(x,y,alpha,beta,transposeA);
+  A.zMult(x,y,alpha,beta,transposeA);
 }
 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);
-	for (int i=A.rows(); --i >= 0; ) {
-		fun.multiplicator = alpha * x.getQuick(i);
- 		A.viewRow(i).assign(y,fun);
-		
-	}
+  org.apache.mahout.jet.math.PlusMult fun = org.apache.mahout.jet.math.PlusMult.plusMult(0);
+  for (int i=A.rows(); --i >= 0; ) {
+    fun.multiplicator = alpha * x.getQuick(i);
+     A.viewRow(i).assign(y,fun);
+    
+  }
 }
 public double dnrm2(DoubleMatrix1D x) {
-	return Math.sqrt(Algebra.DEFAULT.norm2(x));
+  return Math.sqrt(Algebra.DEFAULT.norm2(x));
 }
 public void drot(DoubleMatrix1D x, DoubleMatrix1D y, double c, double s) {
-	x.checkSize(y);
-	DoubleMatrix1D tmp = x.copy();
-	
-	x.assign(F.mult(c));
-	x.assign(y,F.plusMult(s));
+  x.checkSize(y);
+  DoubleMatrix1D tmp = x.copy();
+  
+  x.assign(F.mult(c));
+  x.assign(y,F.plusMult(s));
 
-	y.assign(F.mult(c));
-	y.assign(tmp,F.minusMult(s));
+  y.assign(F.mult(c));
+  y.assign(tmp,F.minusMult(s));
 }
 public void drotg(double a, double b, double rotvec[]) {
-	double c,s,roe,scale,r,z,ra,rb;
+  double c,s,roe,scale,r,z,ra,rb;
 
-	roe = b;
+  roe = b;
 
-	if (Math.abs(a) > Math.abs(b)) roe = a;
+  if (Math.abs(a) > Math.abs(b)) roe = a;
 
-	scale = Math.abs(a) + Math.abs(b);
+  scale = Math.abs(a) + Math.abs(b);
 
-	if (scale != 0.0) {
+  if (scale != 0.0) {
 
-		ra = a/scale;
-		rb = b/scale;
-		r = scale*Math.sqrt(ra*ra + rb*rb);
-		r = sign(1.0,roe)*r;
-		c = a/r;
-		s = b/r;
-		z = 1.0;
-		if (Math.abs(a) > Math.abs(b)) z = s;
-		if ((Math.abs(b) >= Math.abs(a)) && (c != 0.0)) z = 1.0/c;
+    ra = a/scale;
+    rb = b/scale;
+    r = scale*Math.sqrt(ra*ra + rb*rb);
+    r = sign(1.0,roe)*r;
+    c = a/r;
+    s = b/r;
+    z = 1.0;
+    if (Math.abs(a) > Math.abs(b)) z = s;
+    if ((Math.abs(b) >= Math.abs(a)) && (c != 0.0)) z = 1.0/c;
 
-	} else {
+  } else {
 
-		c = 1.0;
-		s = 0.0;
-		r = 0.0;
-		z = 0.0;
+    c = 1.0;
+    s = 0.0;
+    r = 0.0;
+    z = 0.0;
 
-	}
+  }
 
-	a = r;
-	b = z;
+  a = r;
+  b = z;
 
-	rotvec[0] = a;
-	rotvec[1] = b;
-	rotvec[2] = c;
-	rotvec[3] = s;
+  rotvec[0] = a;
+  rotvec[1] = b;
+  rotvec[2] = c;
+  rotvec[3] = s;
 
 }
 public void dscal(double alpha, DoubleMatrix1D x) {
-	x.assign(F.mult(alpha));
+  x.assign(F.mult(alpha));
 }
 
 public void dscal(double alpha, DoubleMatrix2D A) {
-	A.assign(F.mult(alpha));
+  A.assign(F.mult(alpha));
 }
 
 public void dswap(DoubleMatrix1D x, DoubleMatrix1D y) {
-	y.swap(x);
+  y.swap(x);
 }
 public void dswap(DoubleMatrix2D A, DoubleMatrix2D B) {
-	//B.swap(A); not yet implemented
-	A.checkShape(B);
-	for(int i = A.rows(); --i >= 0;) A.viewRow(i).swap(B.viewRow(i));
+  //B.swap(A); not yet implemented
+  A.checkShape(B);
+  for(int i = A.rows(); --i >= 0;) A.viewRow(i).swap(B.viewRow(i));
 }
 public void dsymv(boolean isUpperTriangular, double alpha, DoubleMatrix2D A, DoubleMatrix1D x, double beta, DoubleMatrix1D y) {
-	if (isUpperTriangular) A = A.viewDice();
-	Property.DEFAULT.checkSquare(A);
-	int size = A.rows();
-	if (size != x.size() || size!=y.size()) {
-		throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort() + ", " + y.toStringShort());
-	}
-	DoubleMatrix1D tmp = x.like();
-	for (int i = 0; i < size; i++) {
-		double sum = 0;
-		for (int j = 0; j <= i; j++) {
-			sum += A.getQuick(i,j) * x.getQuick(j);
-		}
-		for (int j = i + 1; j < size; j++) {
-			sum += A.getQuick(j,i) * x.getQuick(j);
-		}
-		tmp.setQuick(i, alpha * sum + beta * y.getQuick(i));
-	}
-	y.assign(tmp);
+  if (isUpperTriangular) A = A.viewDice();
+  Property.DEFAULT.checkSquare(A);
+  int size = A.rows();
+  if (size != x.size() || size!=y.size()) {
+    throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort() + ", " + y.toStringShort());
+  }
+  DoubleMatrix1D tmp = x.like();
+  for (int i = 0; i < size; i++) {
+    double sum = 0;
+    for (int j = 0; j <= i; j++) {
+      sum += A.getQuick(i,j) * x.getQuick(j);
+    }
+    for (int j = i + 1; j < size; j++) {
+      sum += A.getQuick(j,i) * x.getQuick(j);
+    }
+    tmp.setQuick(i, alpha * sum + beta * y.getQuick(i));
+  }
+  y.assign(tmp);
 }
 public void dtrmv(boolean isUpperTriangular, boolean transposeA, boolean isUnitTriangular, DoubleMatrix2D A, DoubleMatrix1D x) {
-	if (transposeA) {
-		A = A.viewDice();
-		isUpperTriangular = !isUpperTriangular;
-	}
-	
-	Property.DEFAULT.checkSquare(A);
-	int size = A.rows();
-	if (size != x.size()) {
-		throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort());
-	}
-	    
-	DoubleMatrix1D b = x.like();
-	DoubleMatrix1D y = x.like();
-	if (isUnitTriangular) {
-		y.assign(1);
-	}
-	else {
-		for (int i = 0; i < size; i++) {
-			y.setQuick(i, A.getQuick(i,i));
-		}
-	}
-	
-	for (int i = 0; i < size; i++) {
-		double sum = 0;
-		if (!isUpperTriangular) {
-			for (int j = 0; j < i; j++) {
-				sum += A.getQuick(i,j) * x.getQuick(j);
-			}
-			sum += y.getQuick(i) * x.getQuick(i);
-		}
-		else {
-			sum += y.getQuick(i) * x.getQuick(i);
-			for (int j = i + 1; j < size; j++) {
-				sum += A.getQuick(i,j) * x.getQuick(j);			}
-		}
-		b.setQuick(i,sum);
-	}
-	x.assign(b);
+  if (transposeA) {
+    A = A.viewDice();
+    isUpperTriangular = !isUpperTriangular;
+  }
+  
+  Property.DEFAULT.checkSquare(A);
+  int size = A.rows();
+  if (size != x.size()) {
+    throw new IllegalArgumentException(A.toStringShort() + ", " + x.toStringShort());
+  }
+      
+  DoubleMatrix1D b = x.like();
+  DoubleMatrix1D y = x.like();
+  if (isUnitTriangular) {
+    y.assign(1);
+  }
+  else {
+    for (int i = 0; i < size; i++) {
+      y.setQuick(i, A.getQuick(i,i));
+    }
+  }
+  
+  for (int i = 0; i < size; i++) {
+    double sum = 0;
+    if (!isUpperTriangular) {
+      for (int j = 0; j < i; j++) {
+        sum += A.getQuick(i,j) * x.getQuick(j);
+      }
+      sum += y.getQuick(i) * x.getQuick(i);
+    }
+    else {
+      sum += y.getQuick(i) * x.getQuick(i);
+      for (int j = i + 1; j < size; j++) {
+        sum += A.getQuick(i,j) * x.getQuick(j);      }
+    }
+    b.setQuick(i,sum);
+  }
+  x.assign(b);
 }
 public int idamax(DoubleMatrix1D x) {
-	int maxIndex = -1;
-	double maxValue = Double.MIN_VALUE;
-	for (int i=x.size(); --i >= 0; ) {
-		double v = Math.abs(x.getQuick(i));
-		if (v > maxValue) {
-			maxValue = v;
-			maxIndex = i;
-		}
-	}
-	return maxIndex;
+  int maxIndex = -1;
+  double maxValue = Double.MIN_VALUE;
+  for (int i=x.size(); --i >= 0; ) {
+    double v = Math.abs(x.getQuick(i));
+    if (v > maxValue) {
+      maxValue = v;
+      maxIndex = i;
+    }
+  }
+  return maxIndex;
 }
 /**
 Implements the FORTRAN sign (not sin) function.
@@ -224,10 +224,10 @@
 @param  b   b
 */
 private double sign(double a, double b) {
-	if (b < 0.0) {
-		return -Math.abs(a);
-	} else {
-		return Math.abs(a);      
-	}
+  if (b < 0.0) {
+    return -Math.abs(a);
+  } else {
+    return Math.abs(a);      
+  }
 }
 }