Notation for sum over element wise multiplication

2.5k Views Asked by At

Im looking for a typical notation for the sum over the elements after an element-wise multiplication of two matrices $A$, $B$ (hadamard product).

Is it correct to write $\sum A \odot B$ without further specifiying what $\sum$ is doing or do i need to use row and column indices? Thanks!

1

There are 1 best solutions below

3
On

$ \def\o{{\large\tt1}} \def\L{\left}\def\R{\right}\def\LR#1{\L(#1\R)} \def\trace#1{\operatorname{Tr}\LR{#1}} $The Frobenius product (aka the double-dot product) is what you want $$\eqalign{ A:B &= \sum_{i=1}^m\sum_{j=1}^n A_{ij}B_{ij} &\;=\; \trace{A^TB} \;=\; \trace{AB^T} \\ A:A &= \big\|A\big\|^2_F &\;=\; \trace{A^TA} \;=\; \trace{AA^T} \\ \\ }$$ Note that the Hadamard and Frobenius products commute $$\eqalign{ (A\odot B):C &= \sum_{i=1}^m\sum_{j=1}^n A_{ij}B_{ij}C_{ij} \\ &= A:(B\odot C) \\ }$$ and that the all-ones matrix $\o$ is the identity for the Hadamard product $$\o\odot A=A$$ Therefore one can sum over the elements of a Hadamard product $$\eqalign{ \sum_{i=1}^m\sum_{j=1}^n \;\o_{ij}\,\LR{A\odot B}_{ij} &= \o:(A\odot B) \\ &= (\o\odot A):B \\ &= A:B \\ }$$ which was your original intent.