Apply Outer to list of matrices and vectors
I believe what you want is
Outer[#2.#1.#2 &, M, V, 1]
First of all, you don't need to Transpose
vectors in Mathematica. Dot
knows what to do automatically. Second, you need to use the optional extra argument for Outer
that tells it the level at which the "object" that you are feeding to the function lives. Otherwise, Outer
seeks the lowest level by default. Since your "objects" are at level 1 in both lists (the elements of the lists which are either matrices or vectors), use the level-spec 1 as the extra argument to Outer
.
Just use Table
SeedRandom@12;
m = Table[RandomInteger[5, {2, 2}], 3];
MatrixForm /@ m
m=$\{\left( \begin{array}{cc} 1 & 1 \\ 0 & 0 \\ \end{array} \right),\left( \begin{array}{cc} 5 & 4 \\ 1 & 4 \\ \end{array} \right),\left( \begin{array}{cc} 5 & 3 \\ 0 & 5 \\ \end{array} \right)\}$
v = Table[RandomInteger[5, 2], 3]
v={{3, 4}, {1, 1}, {2, 5}}
Table[v[[j]].m[[i]].v[[j]], {i, Length@m}, {j, Length@m}]
{{21, 2, 14}, {169, 14, 170}, {161, 13, 175}}
Second Solution
#2.#1.#2 & @@@ Tuples[{m, v}] // Partition[#, 3] &