arrayfun for multiple least squares problems?
显示 更早的评论
I want to solve thousands of very tiny least squares problems, all of the same size. It is taking forever to do them one at a time, but I can't seem to figure out how to use arrayfun, or accumarray, or ... to do this. Is there a way to speed this up?
回答(2 个)
bym
2011-10-4
0 个投票
see if my answer on fitting multiple curves would help
Walter Roberson
2011-10-5
0 个投票
arrayfun() over enough elements usually times as being slightly slower than a "for" loop that has had preallocation done.
If you are using the \ operator (mldivide), sometimes you can do better. The \ operator has to analyze what kind of problem is involved each time, but you already know the problem type.
You might, for example, be able to figure out which BLAS or LAPACK routines are suitable, and call them directly using a MATLAB File Exchange contribution http://www.mathworks.com/matlabcentral/fileexchange/16777
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!