Help for optimizing a code
信息
此问题已关闭。 请重新打开它进行编辑或回答。
显示 更早的评论
Hi
I'm trying to optimize a code with nested for loops (originally written in another language ), and I try to get it in the proper "matlab" form... I've already asked many questions in this forum but now I don't know if I'm going the proper way or not. I've attached to this post a m file with the original loops, and the way I think optimized...
Could anyone of you have a look and tell me if it's just rubbish or if I'm going the good way ?
Thanks...
5 个评论
Geoff Hayes
2014-11-17
Stéphane - your m file isn't attached. Make sure you press the Attach File button after you have chosen it. Note that you can just edit your above question and use the paperclip button to add the file.
Sean de Wolski
2014-11-17
Why do you want to remove the loops? other than looks is there a reason? For performance, there's no guarantee a vectorized method is going to be faster and it might take longer than the total running time to vectorize it.
Stéphane
2014-11-17
Geoff Hayes
2014-11-17
Stéphane - does your testLoop.m code contain the small matrix that takes a really long time to evaluate? When I ran the attached, tic and toc indicated that the elapsed time was 0.056486 seconds which is pretty quick…
Note that there did seem to be some differences between dm and dm2. Have you observed the same?
Stéphane
2014-11-18
回答(0 个)
此问题已关闭。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!