Login  Register

Curve interpolation

Posted by Simon Ibbotson on Feb 15, 2008; 9:57am
URL: http://quantlib.414.s1.nabble.com/Curve-interpolation-tp11687.html

Hi guys,
 
I'm a little confused about the QuantLib curve classes ForwardCurve, DiscountCurve and ZeroCurve.
 
In the three class definitions we have the member variable

mutable Interpolation interpolation_;

but  in constructing a curve (using the PiecewiseYieldCurve) we use a factory class function (interpolator_.interpolate) to allocate an Interpolation object to the interpolation_ member variable. However, often the object allocated is an object of a derived class e.g. CubicSpline.

Now, I know pointers and references can be polymorphic. But in this case a derived class is being allocated to a base class instance...

I know most information required for interpolation is contained within the Interpolation::impl_ object but I'm wondering whether:

a) my C++ knowledge is lacking and the base class instance (e.g. ForwardCurve::interpolation_) can be polymorphic somehow. Or...

b) why a pointer to the derived Interpolation object isn't returned by the factory class (e.g. Cubic::interpolate) - to obviate the need for a polymorphic Interpolation::impl_ member variable?

Thanks in advance for enlightening me.

Simon 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev