I am working improving an existing program that does everything in matrices. So if I can express below concept in matrix that would make my life a bit easier.
We all know that for matrix multiplication $A = B C$, each element $A_{ij} = \sum_k B_{ik} C{kj} $
But if I want to compute $A = f(B, C)$, $A_{ij} = \text{std}( B_{ik} C_{kj} )$, where $\text{std}$ is standard deviation of sequence $B_{ik} C_{kj}$, defined by $\text{std}( a_n ) = \sqrt{ \frac{1}{n} \sum (a_i - \bar{a_n})^2}$, is there a way to expression function $f$ in some matrix form ?
I am ok with some approximation to measure the "deviation", such as redefining the function as $\text{std}( a_n ) = \frac{1}{n} \sum |a_i - \bar{a_n}|$ or something. I just want to find an easy matrix form to express that, so it's easy for me to model.