Hi all,
what are the necessary conditions for two matrices (DenseMatrix) to be
equal and how to check equality?
I tried the following code with *boolean java.lang.Object.equals(Object
obj)* method but it always returns *false*.
DenseMatrix m1 = new DenseMatrix(3, 3);
m1.assign(new double[][]{{1,2,3},{4,5,6},{7,8,9}});
DenseMatrix m2 = new DenseMatrix(3, 3);
m2.assign(new double[][]{{1,2,3},{4,5,6},{7,8,9}});
if(m1.equals(m2)){
System.out.println("m1 = m2");
}else{
System.out.println("m1 != m2");
}
However, *m1.asFormatString().equals(m2.asFormatString())*
returns true. Is there a more rigorous
way of checking this equality (of values and dimensions)
without converting the matrices to Strings?
Thanks,
--
M.P. Tharindu Rusira Kumara
Department of Computer Science and Engineering,
University of Moratuwa,
Sri Lanka.
+94757033733
www.tharindu-rusira.blogspot.com