I have a list, M
, of square $ n \times n $ matrices, {M1, M2, M3, ...}
, and a list, V
, of $ n \times 1 $ vectors, {v1, v2, v3, ...}
, and the corresponding transposes of those vectors {r1, r2, r3, ...}
. I'm trying to form the matrix
{{r1.M1.v1, r2.M1.v2, r3.M1.v3, ...}, {{r1.M2.v1, r2.M2.v2, r3.M2.v3, ...}, ...}
. Note that M
and V
are not necessarily the same length (i.e. there may only be 5 matrices, but 100 vectors).
It seemed like a method using Outer
would work, such as: Outer[Transpose[#2].#1.#2 &, M, V]
, which should then just be a 2-dimensional matrix of scalars.
However, I think that this runs into a problem because the lists M
and V
are themselves technically lists of lists (M
being a list of matrices, V
being a list of vectors), and so the outer gets distributed into the sublists, rather than doing the calculation I want and it ends up being a high dimensional object. I've tried playing around with various flattening schemes, but haven't quite figured it out - any assistance on how to implement this functionality (is Outer
even the correct functional tool to use)?
Outer[#2.#1.#2 &, M, V, 1, 1]
? $\endgroup$