## 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 – Element-wise addition of 2 lists?

I have now:
list1 = [1, 2, 3]
list2 = [4, 5, 6]

I wish to have:
[1, 2, 3]
+ + +
[4, 5, 6]
|| || ||
[5, 7, 9]

Simply an element-wise addition of two lists.
I can surely iterate the two lists, but I don’t want do that.
What is the most Pythonic way of doing so?
….

## 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….