I tried to make a random symmetric matrix to test my program. I don't care about the data at all as long as it is symmetric (sufficient randomness is no concern at all).
My first attempt was this:
x=np.random.random((100,100))
x+=x.T
However, np.all(x==x.T)
returns False. print x==x.T
yields
array([[ True, True, True, ..., False, False, False],
[ True, True, True, ..., False, False, False],
[ True, True, True, ..., False, False, False],
...,
[False, False, False, ..., True, True, True],
[False, False, False, ..., True, True, True],
[False, False, False, ..., True, True, True]], dtype=bool)
I tried to run a small test example with n=10 to see what was going on, but that example works just as you would expect it to.
If I do it like this instead:
x=np.random.random((100,100))
x=x+x.T
then it works just fine.
What's going on here? Aren't these statements semantically equivalent? What's the difference?