필터 지우기
필터 지우기

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 CenterFile Exchange에서 Array Geometries and Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by