2 Matrix Multiplications faster than one matrix Multiplication
2 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
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 Exchange で Array Geometries and Analysis についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!