Merge pull request #722 from Egoscio/patch-1 to fix #719

Made Matrix equality comparison deep.
This commit is contained in:
Libin Yang
2019-03-22 10:43:47 +08:00
committed by GitHub

View File

@ -211,7 +211,15 @@ public class Matrix {
* @return boolean
*/
public boolean equals(Matrix other) {
return this == other;
if (this.getRows() != other.getRows() || this.getColumns() != other.getColumns())
return false;
for (int i = 0; i < this.data.length; i++)
for (int j = 0; j < this.data[0].length; j++)
if (this.data[i][j] != other.data[i][j])
return false;
return true;
}
/**