Suppose $B$ is an $N\times N$ matrix and $V$ is an $N\times 1$ vector.
I need to find a matrix representation for $V$:
$V_k = \sum_{j}B_{kj}^4 + 2\sum_{i\neq j}\sum_{j}B_{ki}^2B_{kj}^2$
Previously, I asked a somewhat similar question here: Need to find matrix formulation and I can't find the answer of this one either.
For typing convenience, define $$A=\big(B\odot B\big)$$ where $\odot$ represents the elementwise/Hadamard product.
Then the vector can be written in matrix notation as $$\eqalign{ v &= (A\odot A)\,e + \big(2Ae\big)\odot\big(Ae-{\rm diag}(A)\big) \cr }$$ where $e$ is the vector whose elements are all equal to unity.