Directory of Open Source for Quantitative Finance and Trading
Username: Password: Not registered?
 
Quick Search:    (AJAX based: No need to press button)

Main : C++ : 


Category: C++ View Full Details
Download Now!Levenberg-Marquardt for Visual C++ 2005
Submitter: vanna Date: 2008/5/21
Description:
1.Create new project in C++ - win32 console application. Uncheck option "precompiled header" in Application Settings dialog
2.click on Project->Add new item. Select code and C++ file.Enter name lmdif.hpp

3.Copy all the code from here
Paste it into file lmdif.hpp

4.Edit lmdiff.hpp file
Comment out line 64 : #include <ql/math/optimization/levenbergmarquardt.hpp>
Comment out line 270: QuantLib::LevenbergMarquardt::fcn(m, n, x, fvec, iflag);

5.Implement function to be minimized
Modify the function fcn in file lmdif.hpp
Change the values of fvec being passed into this function.Set it to result of function values using the parameter vector x.


6. In the main.cpp file call QuantLib::MINPACK::lmdif to minimize the function. The solution is found in the x vector after completion of the function call

Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 1244 times  1244  File Size 0 bytes  Supported Platforms C C++  Home Page http://quantlib.svn.sourceforge.net/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (5)

Poster Thread
BCox
Posted: 2009/3/9 20:58  Updated: 2009/3/9 20:58
Just popping in
Joined: 2009/3/9
From:
Posts: 9
 Re: Levenberg-Marquardt for Visual C++ 2005
Hello:

What exactly is meant by (in the 5th step)
"Modify the function fcn in file lmdif.hpp
Change the values of fvec being passed into this function.Set it to result of function values using the parameter vector x."

Where and how am I changing fvec?

Thanks so much

Poster Thread
vanna
Posted: 2009/3/10 2:24  Updated: 2009/3/10 2:24
Just can't stay away
Joined: 2007/3/21
From:
Posts: 104
 Re: Levenberg-Marquardt for Visual C++ 2005
Bcox, Thanks for your feedback and for using QuantCode!

Following file demonstrates usage of the function:
Tutorial for using MINPACK's C version of Levenberg Marquardt optimizer (please see example of fcn usage)

Hope it helps

Poster Thread
BCox
Posted: 2009/3/23 15:44  Updated: 2009/3/23 15:44
Just popping in
Joined: 2009/3/9
From:
Posts: 9
 Re: Levenberg-Marquardt for Visual C++ 2005
Thank you. I created the main.cpp program as noted in the Tutorial above. But, when I built the solution in Visual Studio, I only got the following in the log:

1>Levenberg-Marquardt - 0 error(s), 0 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

I don't see where the optimization results are... Thank you! I'm still new to this environment.

Poster Thread
BCox
Posted: 2009/4/24 8:27  Updated: 2009/4/24 8:27
Just popping in
Joined: 2009/3/9
From:
Posts: 9
 Re: Levenberg-Marquardt for Visual C++ 2005
If we were to run this in Dev C++, what would change?

Poster Thread
Anonymous
Posted: 2012/12/30 20:42  Updated: 2013/2/10 12:51
 Levenberg-Marquardt for Visual C++ 2005
Here we started with a cpmloex system, then we ignore the hard parts so the problem is amenable to a mathematical analysis, then we solve the simpler problem, then we pray that it's a reasonable approximation to the actual cases of the Swine Flu

Discuss this file. Just enter your message and click on submit. No registration is required.
Similar Links:
Levenberg Marquardt in Excel (Software)
Levenberg-Marquardt nonlinear least squares algorithms in C/C++ (Software)
Levenberg Marquardt for function minimization (Forum)
Hull White model calibration using Levenberg Marquardt (Software)
Tutorial for using MINPACKs C version of Levenberg Marquardt optimizer (Software)

Subscribe to RSS or daily email updates of latest quantitative finance code listings
Email address :
Copyright © 2011 QuantCode Inc. All rights reserved.