[SciPy-user] test matrix equality

Alan G Isaac aisaac at american.edu
Fri Nov 26 10:22:52 CST 2004

Newbie question:

What is the right/efficient way to test
for equality between two matrices?
While alltrue(ravel(A==B)) works,
I am guessing alltrue(alltrue(A==B))
is better.

If I import MA it seems I can use
allequal, but this does not seem
to be available otherwise.  (Why??)
Also, although this behaves like
I want, it is oddly inconsistent
with the other 'all' functions.

I'd like to be able to just look at
A.eq(B) for any matrices A and B.

Thank you,
Alan Isaac

PS Suggestion: allow setting index=None
for alltrue to test all individual

More information about the SciPy-user mailing list