Hadamard product gradient

107 Views Asked by At

I have a cost function as such: $$ c = ||y-A(b:x)||_2^2 $$ Where $:$ denotes Hadamard product. I need to differentiate this with respect to $x$. What I come up with is as follows: $$A = [\alpha_1 ... \alpha_N]$$ $$A(b:x) = [\alpha_1 ... \alpha_N][b_1x_1 ... b_Nx_N]^T=[\alpha_1b_1...\alpha_Nb_N][x_1...x_N]^T=Bx$$ where $$B=[\alpha_1b_1...\alpha_Nb_N]$$ Then I write cost function as $$c = ||y-Bx||_2^2$$ which has a gradient of $$2Re[B^H(Bx-y)]$$ However, results do not seem to be correct. Any ideas or suggestions are much appreciated. Thanks in advance and have a nice day

1

There are 1 best solutions below

1
On

The Hadamard product with a vector can be replaced by the regular matrix product with a diagonal matrix generated from the vector, i.e. $$B={\rm Diag}(b) \quad\implies\quad (b:x) = Bx\qquad\quad$$ This converts your problem to a more standard form, i.e. $$\eqalign{ c &= \big\|ABx-y\big\|^2_2 \\ }$$ In the complex case, one has the well-known Wirtinger gradients $$\eqalign{ \frac{\partial c}{\partial x} &= (AB)^T(ABx-y)^* \\ \frac{\partial c}{\partial x^*} &= (AB)^H(ABx-y) \\}$$ and in the real case, the mundane gradient $$\eqalign{ \frac{\partial c}{\partial x} &= 2(AB)^T(ABx-y) \\ }$$