Matrix Product optimization with Bsxfun

1 view (last 30 days)
Dear community,
i am looking to do:
A % --> 128 x 128 (matrix)
B % --> 1 x 128 (vector)
And i need to calculate (repeated 1e5 times):
D = A*B'
% that is not the element wise A.*B
For speed, i have problem by doing the fast:
D = bsxfun(@mtimes, A, B');
That should be the same but gives me error.
How can i fix this regarding dimensions?

Sign in to comment.

Accepted Answer

Bruno Luong
Bruno Luong on 5 Nov 2022
Edited: Bruno Luong on 5 Nov 2022
You simply cannot invent something that does not exist (support) in MATLAB, the function mtimes is not supported by bsxfun see fun — Binary function to apply
Beside that I have the hard time to figure out what you would ;do with matrix multiplication with expansion
Bruno Luong
Bruno Luong on 5 Nov 2022
The runtime should be about the same even for complex data between matrix vector multiplcation with ' and .', since it takes care by the Blas and there is no conjugate explicitly performed.

Sign in to comment.

More Answers (0)





Community Treasure Hunt

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

Start Hunting!