フィルターのクリア

2 Matrix Multiplications faster than one matrix Multiplication

2 ビュー (過去 30 日間)
Lewei He
Lewei He 2018 年 3 月 26 日
編集済み: dpb 2018 年 3 月 26 日
Hello there,
im trying to optimize my program in reducing 2 matrix multiplcations into 1 multiplication like rewrite
for i = 1:10000
filtSig = filtMat * Frame;
recSig = recMat * filtSig:
end
into:
frMat = recMat * filtMat;
for i = 1:10000
recSig = frMat * Frame;
end
Frame is a 128x1 Vector, filtMat is 13x128, recMat is 128x13 and thus frMat is 128x128
when i add tic,toc commands to measure the time, it says that the first version used 16.57ms while the last one uses 25.39ms
My question is, why dose the single Matrix multiplication version much slower than first one?
  5 件のコメント
Lewei He
Lewei He 2018 年 3 月 26 日
i know that when it gose with compiler languages, have thought matlab makes more optimaze with matrix xD thx for the explanation
dpb
dpb 2018 年 3 月 26 日
Well, Matlab does wonders when you vectorize but even it can't do magic yet. The "Do What I Should Have Done Optimizer" toolbox is yet to be released.
Seriously, remember that there's really no difference between Matlab and any other language under the hood; it has to get translated to procedural code to be executed eventually. The benefit of Matlab syntax is you don't have to write the matrix multiply code loop constructs yourself or call the BLAS libraries directly as in C or Fortran but that's what Matlab is actually doing for you.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeArray Geometries and Analysis についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by