I have a set of quadratic forms.
$L_{1}=u_1^TJ_{1}u_1$
$L_{2}=u_2^TJ_{2}u_2$
$L_{3}=u_3^TJ_{3}u_3$
where $u_{i=1,2,3}$ - 3$\times$1 vector;
where $J_{i=1,2,3}$ - 3$\times$3 matrix;
I need to pack their into a single operation in such a way that I get a matrix of the following form:
$\boldsymbol{L}=\begin{bmatrix}L_1 & 0 & 0\\0 & L_2 & 0\\0 & 0 & L_3\end{bmatrix}$
I'm assuming this can be done using a tensor operation as well as combining vectors into a matrix. Probably, something like that:
$\boldsymbol{L} \approx ? \boldsymbol{u}^T\boldsymbol{J}\boldsymbol{u}$ or $\boldsymbol{L} \approx \boldsymbol{u}^T \otimes ? \boldsymbol{J} \otimes ? \boldsymbol{u}$
But the problem turned out to be that, firstly, my $J$-matrices are different, and secondly, there are side off-diagonal elements in the result.So far, I haven't come up with a suitable operation.
TensorProduct[{Subscript[u, 1], Subscript[u, 2], Subscript[u, 3]},
TensorProduct[{Subscript[u, 1], Subscript[u, 2], Subscript[u,
3]}, {J}]]
I need help and advice. Thank you for attention!