So you have one matrix R
of size=[3 3 N], and you want to multiply a 1x3xN
vector V
(presumably one theta corresponds to one page of V). This means you want the sum over the second dimension. Solution
result = squeeze(sum(bsxfun(@times, R, V), 2));
First multiply elements (bsxfun
takes care of the magical expansion along the first dimension), then sum over the second dimension (which is what a matrix multiplication would do), then squeeze
out the singleton second dimension to give a 3xN
result.