Posted by
Simon Ibbotson - Straumur on
Feb 25, 2008; 4:51pm
URL: http://quantlib.414.s1.nabble.com/Curve-interpolation-tp11687p11689.html
Hi Luigi,
Thanks for the reply: I did eventually find the document mentioned below
but found no way of replying to my own message on Sourceforge (so that I
could say that I'd found the answer).
On a separate note, do you know who is currently working on the curve
interface? I'd like to contribute a different Bootstrap to the library
(for localized approximations of global interpolations) but want to
check the current state of development: what interface(s) the Bootstrap
class needs to implement.
All the best,
Simon
-----Original Message-----
From:
[hidden email]
[mailto:
[hidden email]] On Behalf Of Luigi
Ballabio
Sent: 25 February 2008 16:44
To: Simon Ibbotson
Cc:
[hidden email]
Subject: Re: [Quantlib-dev] Curve interpolation
Hi Simon,
On Fri, 2008-02-15 at 09:57 +0000, Simon Ibbotson wrote:
> 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_;
>
> [...] 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...
No, you're right---it's not polymorphic. As you surmised, the
polymorphic behavior is delegated to the inner Interpolation::impl_
object, which is copied by pointer and continues to have the correct
type even when the containing Interpolation object is sliced.
> 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?
I confess that it's a while since we coded it, so I might be wrong. But
I think it's the same reason why we coded, say, the Calendar and
DayCounter classes in the same way---to avoid writing the shared_ptr
part. See <
http://quantlib.org/quep/quep001.html> for the full rationale
(the code samples are outdated, but the reasoning still holds.)
Luigi
--
Olmstead's Law:
After all is said and done, a hell of a lot more is said
than done.
------------------------------------------------------------------------
-
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-------------------------------------------------------------------------
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