Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: computation time of function lsqnonlin
Replies: 12   Last Post: Sep 17, 2013 5:24 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
EBS

Posts: 76
Registered: 2/11/09
Re: computation time of function lsqnonlin
Posted: Sep 17, 2013 5:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"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 self-time for functions and how many times they are called?

> > > >
> > > > Hi Rakesh,
> > > > Here my profiler when i run two optimization processes, where testCM is m-file storing program of optimization, the object function in m-file is MydeformfuncSub7Ext, and in C mex file is MydeformfuncSub7ExtC.
> > > > Profiler of optimzation using m-file:
> > > > 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 levenberg-marquardt 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 pre-processing) 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!



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.