Closed marci543 closed 4 years ago
I was wondering about the meaning of matrix operation
A == B
. Based on this code I thought it can be used to compare whether two matrices are equal.
That test code is broken, sorry it led you astray, I'll fix it up.
The following code shows that it's not the case: it is making an element-wise comparison (only if the sizes match), then the
__nonzero__
function returns true as it has a true element. Do I understand it correctly? For comparison should is useA.iseq(B)
instead?
Yes. A.iseq(B) calls LAGraph_isequal() which is what you want. The behavior of A == B is meant to be identical to that of the MATLAB wrapper and I based it off of Tim's work. you're right, it does element-wise comparison and returns a dense boolean matrix. The above test you reference was from before I did that work and was more confused about it.
Thanks for the detailed explanation. I removed those two lines in #27.
I was wondering about the meaning of matrix operation
A == B
. Based on this code I thought it can be used to compare whether two matrices are equal. https://github.com/michelp/pygraphblas/blob/ab6d8e3290d62b887b6a52142f31f29971af99c8/tests/test_matrix.py#L112-L114The following code shows that it's not the case: it is making an element-wise comparison (only if the sizes match), then the
__nonzero__
function returns true as it has a true element. Do I understand it correctly? For comparison should is useA.iseq(B)
instead?