Previous Up Next

14.3.8  Hadamard product

The hadamard command finds the Hadamard product of two matrices; namely, the term-by-term product of the two matrices.

The product command can do the same thing (see also Section 6.3.27 for other uses of product).

The infixed operator .* also finds the Hadamard product, and also works on lists.

Examples

hadamard([[1,2],[3,4]],[[5,6],[7,8]])

or:

hadamard([[1,2],[3,4]],[[5,6],[7,8]])

or:

[[1,2],[3,4]].*[[5,6],[7,8]]
     


512
2132


          
[1,2,3,4].*[5,6,7,8]
     

5,12,21,32
          

Previous Up Next