I’ve recently been thinking about the following question: When does one use the Hadamard product or array multiplication of two matrices?
If you have two m x n matrices, A and B, with elements {aij} and {bij}, respectively. Also, i and j are indices for the row and column of the matrices. Then their Hadamard product is defined as
A ○ B = {aijbij}.
In MATLAB, one uses the following syntax to compute the Hadamard product:
C = A .* B
For example,
>> A = [1, 2; 3, 4]; >> C = A .* A C = 1 4 9 16
But the question remains: When would one want to perform this type of multiplication on two matrices? After a bit of digging around, I found the following interesting use cases: