# Converting an indexed equation to a matrix one

I am helping a friend with a project involving neural networks and he wants to convert this equation into matrix notation: $$w_{ij} = \sum_{n=1}^N\left[\sum_{i=1}^I(r_{in}-y_{in})v_{ih}\right](1-z_{hn}^2)x_{jn}$$ with $$W$$ an $$H\times J$$ matrix, $$R,Y$$ $$N \times I$$ matrices, $$Z$$ an $$N\times H$$ matrix, $$X$$ an $$N\times J$$ matrix, and $$V$$ an $$I\times H$$ matrix.

I was able to get the first part, which is $$\left(\sum_{n=1}^N\left[\sum_{i=1}^I(r_{in}-y_{in})v_{ih}\right]x_{jn}\right)$$ after distributing over $$(1-z_{ht}^2)x_{jt}$$, to be reduced to what I think is $$(R-Y)VX$$. The second part I got something involving elementwise products, but I couldn't get any further. I suspect it involves tensors since we need to take the dot product over the index $$t$$ and the product $$z_{ht}^2x_{jt}$$ involves two other indices.

Hopefully this is not too much of a mess. If anyone can help that would be great.

• Your initial equation makes no sense as written. The l.h.s. depends on $i$, whereas the r.h.s. is summed over $i$, and therefore doesn't depend on $i$. And how do you know the l.h.s. doesn't depend on $h$? Mar 30 at 14:25