Multiply all combinations of rows of matrices in MATLAB -
i have 2 matrices a(3x4) , b(3x4). calculate new matrix (3x3x4) has row elements element-wise multiplication of each row of each row of b. guess it's multi-dimensional outer product. way in vectorized fashion?
bsxfun(@times, a, permute(b, [3, 2, 1]))
or possibly
permute(bsxfun(@times, a, permute(b, [3,2,1])), [1,3,2])
Comments
Post a Comment