Computing A(:, m)*B(m, :) without a for loop
Ältere Kommentare anzeigen
Provided I have two matrices A and B of dimensions NxM and MxN I want to compute a matrix C of dimensions NxNxM such that each NxN slice is the result of the prduct A(:, m)*B(m, :). I know this can be obtained in the following way:
for m=1:M
C(:, :, m) = A(:, m)*B(m, :);
end
Is there a way of obtaining the same result without using a for loop (with the aim of making the computation faster)?
Akzeptierte Antwort
Weitere Antworten (1)
madhan ravi
am 12 Nov. 2018
C(:, :, 1:M) = A(:, 1:M)*B(1:M, :);
1 Kommentar
Nicolas Perez
am 12 Nov. 2018
Kategorien
Mehr zu Spline Postprocessing finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!