Given:
vectors $v1, v2$ $(n\times1)$ where entries in each vector are in the interval $[0,1]$. $v1$ and $v2$ can be sparse or dense
a dense symmetric matrix $M$ $(n\times n)$ (actually a logic matrix where entries are $0$ or $1$)
a dense matrix $E$ $(n\times n)$ where $E(i,j) = 1-E(j,i)$ if $E(i,j) \neq 0$, $E(i,j) = 0$ if $i=j$ and $E(i,j$) is in the interval $[0,1[$. Is there a name for this type of matrix?
I would like to compute $s = Sum[(v1 * v2^{T}) .* M]$ where .* is the element-wise multiplication operation and Sum is the sum over all entries of the resulting matrix. ^$T$ is the transposition operation.
Given $s$ I would like to obtain $x = Sum[(v1 \cdot v2^{T}) \cdot * E] / s$
Is there any computationally more efficient way to perform these multiplications and obtain $x$?
Thanks.