BackwardFlat and ForwardFlat interpolations

Posted by Fabio Ramponi on
URL: http://quantlib.414.s1.nabble.com/BackwardFlat-and-ForwardFlat-interpolations-tp4861.html

Hi all,

I was trying to use BackwardFlatInterpolation and ForwardFlatInterpolation to create some kind of piecewise constant forward rate term structure using the InterpolatedForwardCurve class.

I noticed that the calculate() and primitive() methods for the two interpolations are exactly the same. In my opinion, in the ForwardFlatInterpolation, the y(x) value in the interval x[i]-x[i+1] should be y(x[i]), and not y(x[i+1]).

In this case, lines 49 and 59 in forwardflatinterpolation.hpp should respectively sound like these:

(line 49)     primitive_[i] = primitive_[i-1] + dx*this->yBegin_[i-1];

(line 59)     return
primitive_[i] + dx*this->yBegin_[i];

Is that right?

Thanks in advance.

Best regards,

Fabio


----
Email.it, the professional e-mail, gratis per te: clicca qui

Sponsor:
Refill srl il paradiso della tua stampante - cartucce e toner compatibili, inchiostri e accessori per la ricarica, carta speciale. Tutto a prezzi scontatissimi!
Clicca qui