Login  Register

Re: polynomial fitting with LeastSquareProblem / CurveFitting.cpp

Posted by piers august on Apr 07, 2009; 8:37am
URL: http://quantlib.414.s1.nabble.com/polynomial-fitting-with-LeastSquareProblem-CurveFitting-cpp-tp7378p7380.html

Thanks alot Bojan,
Seems fine,  output below.

rgds,
Piers


Optimal values  : [ 0.147014; 0.057302; 0.249964; 0.148556 ]

Optimal values  : [ 0.147014; 0.057302; 0.249964; 0.148556 ]Solution values : [ 0.147014; 0.057302; 0.249964; 0.148556 ]Solution Error  : [ -3.67345e-13; 2.74405e-13; 6.97664e-13; 1.66672e-13 ]



> To: [hidden email]
> CC: [hidden email]
> Subject: Re: [Quantlib-users] polynomial fitting with LeastSquareProblem / CurveFitting.cpp
> From: [hidden email]
> Date: Tue, 7 Apr 2009 09:09:41 +0100
>
>
> Hi Piers,
>
> The problem is that you are mixing the example which was originally
> called CurvedFitting.cpp with the current implementation of
> least-square-fitting in QuantLib which is significantly different. For
> example, LeastSquareProblem is not a template class and this is why
> you get the first error that you do get. There are a few other
> adjustments that need to be made:
>
> * No need to define operator<<
>
> * Need to supply a constraint for the LeastSquareProblem
>
> * targetValueAndGradient not targetValueAndfirstDerivative
>
> * size_t or QuantLib::Size not int
>
> I've put the modified example that does compile and seems to work at
> the following address:
>
> http://www.bnikolic.co.uk/blog/ql-fitting-curves.html
>
> Best,
> Bojan
>
> --
> Bojan Nikolic || http://www.bnikolic.co.uk


Share your photos with Windows Live Photos – Free. Try it Now!
------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users