I have a matrix A with size N*N*M and array b with the size of 1*M.
I want to multiply the elements of i^th dimension of matrix A (i.e. A(:,:,i) ) with the i^th dimension of array b (i.e. b(1,i)). Meaning that: e.g.:
A(:,:,1)=[1 1; 1 1]A(:,:,2)=[1 1; 1 1]A(:,:,3)=[1 1; 1 1]b=[1 2 3]=> A times bResults:C(:,:,1)=[1 1; 1 1]C(:,:,2)=[2 2; 2 2]C(:,:,3)=[3 3; 3 3]
I am not looking for writing a loop and go through every single layer separately.
I was wondering if you guys know a fast way to do it. Thanks
Best Answer