Sum of element-wise division

480 Views Asked by At

I want to compute the (row) sum of a matrix $A$ obtained by Hadamard division of $B$ by $C$.

I found that if I were to do instead Hadamard multiplication (i.e. the standard Hadamard product, also called elementwise product), there is the nice formula:

$$\sum_i \left[B\odot C\right]_{ij}=\left[B^TC\right]_{jj}$$

I am trying to find if there is a similar representation when using Hadamard division, but could not find anything?

1

There are 1 best solutions below

1
On

To vectorize a product, there is a formula involving the Kronecker product. $$\eqalign{ {\rm vec}\big(XYZ\big) &= (Z^T\otimes X)\,y \\ y &= {\rm vec}(Y)\\ }$$ There's an analogous formula for diagonalization involving the Hadamard product. $$\eqalign{ Y &= {\rm Diag}(y) \\ {\rm diag}\big(XYZ\big) &= (Z^T\odot X)\,y \\ }$$ The latter formula with $\,(X,Y,Z)\to(B^T,I,C)\,$ yields $$\eqalign{ {\rm diag}(B^TC) &= (C^T\odot B^T){\tt1} \\ &= (C\odot B)^T{\tt1} \;\doteq\; A^T{\tt1} \\ }$$ which is the nice formula that you have obtained.

Replacing the Hadamard product $(\odot)$ by division $(\oslash),\,$ requires the replacement of $C$ by its Hadamard inverse within the diag() operation.

Note that diag() creates a vector from the diagonal of its matrix argument, while Diag() creates a diagonal matrix from the input vector.