arrayfun for multiple least squares problems?
Ältere Kommentare anzeigen
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?
Antworten (2)
bym
am 4 Okt. 2011
0 Stimmen
see if my answer on fitting multiple curves would help
Walter Roberson
am 5 Okt. 2011
0 Stimmen
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
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!