From: Luigi B. <lui...@gm...> - 2009-10-29 14:28:54
|
On Sat, 2009-10-17 at 10:35 -0500, Dirk Eddelbuettel wrote: > While working on RQuantLib [1], Khanh and I discovered a number of numerical > issues with Cubic interpolation on yield curves. The RQuantLib side of the > code that triggers it is actually pretty old and used to run so I am confused > as to when this changed. > > A relatively simple way to trigger the same issue is to modify the > swapvaluation.cpp example as follows: > > edd@ron:~/svn/quantlib/Examples/Swap$ diff -u swapvaluation.cpp.orig swapvaluation.cpp > --- swapvaluation.cpp.orig 2008-08-01 03:55:43.000000000 -0500 > +++ swapvaluation.cpp 2009-10-17 10:08:42.000000000 -0500 > @@ -316,7 +316,7 @@ > depoSwapInstruments.push_back(s10y); > depoSwapInstruments.push_back(s15y); > boost::shared_ptr<YieldTermStructure> depoSwapTermStructure( > - new PiecewiseYieldCurve<Discount,LogLinear>( > + new PiecewiseYieldCurve<Discount,Cubic>( > settlementDate, depoSwapInstruments, > termStructureDayCounter, > std::vector<Handle<Quote> >(), > > and you get to trigger the bug as easily as > > edd@ron:~/svn/quantlib/Examples/Swap$ g++ -o newswap swapvaluation.cpp -lQuantLib -lm && ./newswap Dirk, as of today, I couldn't reproduce the error on the 0.9.9 release branch (branches/R000909-branch in Subversion.) The swap example runs successfully after the change. Does it work for you? Of course it's not picking up some other library version you installed earlier, is it? Later, Luigi -- It is better to know some of the questions than all of the answers. -- James Thurber |