JAL-4090 JAL-4281 JAL-4311 release notes
[jalview.git] / src / jalview / math / Matrix.java
index 1e8f39d..ad91464 100755 (executable)
@@ -464,7 +464,7 @@ public class Matrix implements MatrixI
           }
           else
           {
-            // System.out.println("Iteration " + iter);
+            // jalview.bin.Console.outPrintln("Iteration " + iter);
           }
 
           g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);
@@ -728,7 +728,7 @@ public class Matrix implements MatrixI
           }
           else
           {
-            // System.out.println("Iteration " + iter);
+            // jalview.bin.Console.outPrintln("Iteration " + iter);
           }
 
           g = (d[l] - d[l - 1]) / (2.0 * e[l - 1]);
@@ -985,12 +985,6 @@ public class Matrix implements MatrixI
     e = v;
   }
 
-  @Override
-  public int hashCode()
-  {
-    return (int) getTotal();
-  }
-
   public double getTotal()
   {
     double d = 0d;
@@ -1004,15 +998,14 @@ public class Matrix implements MatrixI
     return d;
   }
 
+  /**
+   * {@inheritDoc}
+   */
   @Override
-  public boolean equals(Object obj)
+  public boolean equals(MatrixI m2, double delta)
   {
-    if (!(obj instanceof MatrixI))
-    {
-      return false;
-    }
-    MatrixI m2 = (MatrixI) obj;
-    if (this.height() != m2.height() || this.width() != m2.width())
+    if (m2 == null || this.height() != m2.height()
+            || this.width() != m2.width())
     {
       return false;
     }
@@ -1020,7 +1013,8 @@ public class Matrix implements MatrixI
     {
       for (int j = 0; j < this.width(); j++)
       {
-        if (this.getValue(i, j) != m2.getValue(i, j))
+        double diff = this.getValue(i, j) - m2.getValue(i, j);
+        if (Math.abs(diff) > delta)
         {
           return false;
         }