0

Is it possible to efficiently compute the Hadamard product (= entrywise product) of 2 matrices in MAGMA? I can't find anything in the documentation.

The best thing I can come up with is computing it directly with 2 nested for loops, but this is really slow.

1 Answers1

1

How big are the matrices? And what field? If you write your own function, I would imagine it's pretty efficient.

function HadProduct(A,B)
 return Matrix([[A[i,j]*B[i,j] : j in [1..Ncols(A)]] : i in [1..Ncols(A)]]);
end function;
xxxxxxxxx
  • 13,302