For instance:
a = RandomReal[{0, 10}, {4, 4}];
b = RandomReal[{0, 10}, {4, 4}];
MapThread[Equal, {a, b}, 2] // Flatten
(*
{False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False}
*)
The above equates the matrices element by element. To see this, define
c = Array[Subscript[d, #1, #2] &, {4, 4}]
then try the code I gave, ie, MapThread[Equal, {c, b}, 2] and your code, Thread /@ Thread[c == b] // Flatten; they give the same answer. But yours does not work for numeric matrices: Thread /@ Thread[a \[Equal] b] // Flatten errors. To see why, trace what is happening: Thread /@ Thread[a == b] // Trace and you see it first evaluates a==b, then threads. So, if one of the matrices is symbolic, this works OK as the Equal returns unevaluated, then gets threaded; but if both are numeric, the Equal[a,b] evaluates to False, and then there's nothing to thread or flatten.
Thus, your code and Rojo's answer rely on one of the matrices being symbolic so that the Equal[a,b] part remains unevaluated. They don't equate a and b elementwise if they are numeric (not that this matters for what you want to do; I just thought it was worth mentioning).
A==B, then mapsFlattenover the result; is this what you intended? (compareThread[Flatten /@ (a \[Equal] b)] // Traceto the trace of the code I give in my answer to see what I mean) – acl Mar 19 '12 at 22:262– Rojo Mar 19 '12 at 22:34Length@Dimensions[c]to fix that, but there must be a better way – acl Mar 19 '12 at 22:45