How to make faster row-wise Matrix multiplication ?

3 ビュー (過去 30 日間)
Raihan Ul Islam
Raihan Ul Islam 2019 年 4 月 22 日
コメント済み: Raihan Ul Islam 2019 年 4 月 22 日
Hi All,
I want to make my code run faster. I have to do row wise multiplication. But i do not want to use for loop.
For example
A =
11 11 6
7 11 9
2 2 2
4 11 5
7 11 11
B =
1 2 3
1 4 3
1 2 5
For i:1:5
A(i,:).*B
End
I want to skip the last for loop. As number of rows of A can grow upto 10,000
Any suggestion how to replace or make the code faster instead of using parfor?

採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 4 月 22 日
編集済み: Andrei Bobrov 2019 年 4 月 22 日
Just use:
out = permute(A,[3,2,1]).*B;
  3 件のコメント
Andrei Bobrov
Andrei Bobrov 2019 年 4 月 22 日
I'm fixed my answer.
Raihan Ul Islam
Raihan Ul Islam 2019 年 4 月 22 日
Thanks a lot..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by