Linear Interpolation

Posted by marco.tarenghi on
URL: http://quantlib.414.s1.nabble.com/DiscretizedDiscountBond-and-Tree-tp1230p1232.html


Hi all,
I was performing some debug and I fell in the linearinterpolation.hpp file.
There is something puzzling me:
If I understood it right, the class LinearInterpolationImpl takes a vector of abscissas "x" and a vector of corresponding values "y"
They have obviously the same size
But there is also a vector "s_" which seems to be the vector of slopes necessary for the interpolation: it is set of the same size of "x" and "y" but the last value is never fixed and is left equal to zero.
So if I should need to extrapolate outside the last abscissa it would be done in a flat way
Shouldn't it be more natural to go on interpolating linearly, possibly using the same slope of the one between the last two abscissas?
I would write a condition like
        s_[s_.size()-1] = s_[s_.size()-2];
at the end of the function update()

What do you think?

Thanks a lot
Marco



-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users