For a small project of mine, I would like to model a phenomenon (impact of mood and opinion on a social network's member). The data I have is stored in square, same-sized matrices. I would like to find the mathematical expression of a function, taking the data matrices as input, and giving a square matrices with a specific form as output.
From matrices $A,B \text{ and } D$, the desired output of such a function $f$ would be $f(A,B,D)_{i;j} = A_{i;j} \times D_{i;i} \times B_{i;j} \text{, } \forall (i;j) \in [[1;n]]^2$. As such, $f(A,B,D)$ is also a square, $n \times n$ matrix. All those matrices are numerical, populated by reals. $A$ and $B$ are square, $n \times n$ matrices, and $D$ is a square, diagonal $n \times n$ matrix. My problem is that I struggle to find the mathematical expression of such a function.
So far, I have only found a partial solution where I could retrieve this expression. It is however in a vector, and as a sum. For example the expression $diag(A^T \times D \times B)$ gives a $n \times 1$ vector, whose factor number $j$ gives $\sum_{i=1}^n = A_{i;j} \times D_{i;i} \times B_{i;j}$. However, this is not ideal, since I would need a matrix with each element of the sum individually to solve some maximization problems, among other things.
Finally, if that makes the problem any easier, it would be possible to use the assumption that $A$ is symmetrical, even if ideally that would not be used (it reduces some liberty in the phenomenon's modelling).
Thank you
Can you do:
For i in range(n): For j in range(n): $f[i][j]=a_{ij}×d_{ii}×b_{ji}$.
Sorry I was a bit confused, is $A_{ij}$ the i,j-th element on A? In this case I don't know an issue with a double sum, or in code, a double for loop.