I have a list of vectors and a list of matrices for each vector, what i need is to multiply each list of matrices to respective vector.
v = {{a1, a2}, {b1, b2}, {c1, c2}};
U = {
{{{U1a11, U1a12}, {U1a21, U1a22}},
{{U2a11, U2a12}, {U2a21, U2a22}},
{{U3a11, U3a12}, {U3a21, U3a22}},
{{U4a11, U4a12}, {U4a21, U4a22}}}},
{{{U1b11, U1b12}, {U1b21, U1b22}},
{{U2b11, U2b12}, {U2b21, U2b22}},
{{U3b11, U3b12}, {U3b21, U3b22}},
{{U4b11, U4b12}, {U4b21, U4b22}}},
{{{U1c11, U1c12}, {U1c21, U1c22}},
{{U2c11, U2c12}, {U2c21, U2c22}},
{{U3c11, U3c12}, {U3c21, U3c22}},
{{U4c11, U4c12}, {U4c21, U4c22}}}
};
I know that I can use a Do
vt = ConstantArray[0, {Length[U], Length[v]}];
Do[vt[[it]] = (#.v[[it]]) & /@ U[[it]], {it, 1, 3}]
vt
But I don't want to use a Do
cycle. Is
there a way to do it in an intelligent way?