Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.


EBS
Posts:
77
Registered:
2/11/09


Re: computation time of function lsqnonlin
Posted:
Sep 17, 2013 5:24 PM


"Rakesh Kumar" wrote in message <l1aa18$7n5$1@newscl01ah.mathworks.com>... > "Toan Cao" <toancv3010@gmail.com> wrote in message <l17cvm$558$1@newscl01ah.mathworks.com>... > > "Eric Sampson" wrote in message <l17906$ac5$1@newscl01ah.mathworks.com>... > > > "Toan Cao" <toancv3010@gmail.com> wrote in message <l11tt6$c0q$1@newscl01ah.mathworks.com>... > > > > > > > > > > What about the profiler report? Can you post the profiler report for top 10 selftime for functions and how many times they are called? > > > > > > > > Hi Rakesh, > > > > Here my profiler when i run two optimization processes, where testCM is mfile storing program of optimization, the object function in mfile is MydeformfuncSub7Ext, and in C mex file is MydeformfuncSub7ExtC. > > > > Profiler of optimzation using mfile: > > > > http://i906.photobucket.com/albums/ac264/toancv3010/Mtime_zps92ae907a.jpg > > > > Profiler of optimzation using C mexfile: > > > > http://i906.photobucket.com/albums/ac264/toancv3010/Ctime_zpsbbbc5fb3.jpg > > > > As seen, subfunction LevenbergMarquardt consumes almost time of optimization process. > > > > Is there any solution to reduce computation time for LevenbergMarquardt ? > > > > > > > > Toan > > > > > > Can you post some more images from clicking on the Profiler report for the LevenbergMarquardt.m function, and its slowest lines/function calls/etc? Maybe there is a way to speed it up. > > > > Hi Eric Sampson, > > here is spending time of levenbergmarquardt function: > > http://i906.photobucket.com/albums/ac264/toancv3010/levenbergTime_zps2f500238.jpg > > I hope to receive some comments from you. Thank you. > > > > Toan > > The backslash operator (where ~99% of the time is spent) has some heuristics to analyze and decide what method (and preprocessing) to use for solving the equation. It is likely that in these two cases, the backslash operator thinks the matrix structure (probably symmetry) is different and ends up with a different and expensive step. This is just a guess without looking at the actual matrices. > > Rakesh
I agree with Rakesh. If you want to pursue this matter further, then what I would suggest is to put a debugging breakpoint on line 178 of the LM function, run the code with the original M file objective function and then with the MEX objective function, and in each case when it stops at the breakpoint save the AugJac and AugRes variables to a .mat file. Then create a support request at The Mathworks, include the two M files, and tell them to run 'tic, AugJac \ AugRes;, toc' with the contents of each .mat file and ask for their help in explaining the difference. Good luck!



