Re: LogLinear Interpolation
Posted by Luigi Ballabio-4 on Jun 27, 2002; 10:16am
URL: http://quantlib.414.s1.nabble.com/LogLinear-interpolation-tp10120p10126.html
At 01:05 PM 6/27/02 +0200, Andre Louw wrote:
>Disregard my previous rant. I got my facts a bit mixed up.
I know the feeling. And vacations are still sooo far away...
>Could you give me a bit more on how one would go about giving DiscountCurve
>the ability to distinguish which to use?
Sure. Modifying DiscountCurve so that it can use different interpolations
in easy enough: you just have to declare it as:
template <class DfInterpolation>
class DiscountCurve : public DiscountStructure {
... blah blah ...
// typedef Math::LogLinearInterpolation < remove this typedef!!
// std::vector < Time >::const_iterator,
// std::vector < double >::const_iterator > DfInterpolation;
Handle < DfInterpolation > interpolation_;
};
on the other hand, the instantiation would be kind of clumsy as one would
be forced to write:
DiscountCurve<LogLinearInterpolation <
std::vector<Time>::const_iterator,
std::vector<double>::const_iterator > > curve(...);
Then again, we could provide a few typedefs such as:
typedef DiscountCurve<LogLinearInterpolation <
std::vector<Time>::const_iterator,
std::vector<double>::const_iterator > > LogLinearDiscountCurve;
so that the instantiation would be written as:
LogLinearDiscountCurve curve(...);
Also, I'm sure that there's some other syntax one could use so that one
could instantiate the curve as
DiscountCurve<LogLinearInterpolation> curve(...);
but a) I don't remember it so I have to dig it out and b) I'm not sure that
all compiler will allow it.
I'll do my homework and come back.
Later,
Luigi