Product of three 1d vectors and a 3d array

1 次查看(过去 30 天)
Say I am given three n-dimesional vectors and an array T. Is there a way to compute the quantity without using a for loop?

采纳的回答

Abdolkarim Mohammadi
aPermuted = a(:);
bPermuted = permute (b(:),[2,1,3]);
cPermuted = permute (c(:),[3,2,1]);
Z = T .* aPermuted .* bPermuted .* cPermuted;
Result = sum (Z,'all');

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by