Fix Python – How to get element-wise matrix multiplication (Hadamard product) in numpy?

I have two matrices
a = np.matrix([[1,2], [3,4]])
b = np.matrix([[5,6], [7,8]])

and I want to get the element-wise product, [[1*5,2*6], [3*7,4*8]], equaling
[[5,12], [21,32]]
I have tried
print(np.dot(a,b))

and
print(a*b)

but both give the result
[[19 22], [43 50]]
which is the matrix product, not the element-wise product. How can I get the ….

Fix Python – Comparing two NumPy arrays for equality, element-wise

What is the simplest way to compare two NumPy arrays for equality (where equality is defined as: A = B iff for all indices i: A[i] == B[i])?
Simply using == gives me a boolean array:
>>> numpy.array([1,1,1]) == numpy.array([1,1,1])

array([ True, True, True], dtype=bool)

Do I have to and the elements of this array to determine if the arrays ar….