LocalVolCurve::localVolImpl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

LocalVolCurve::localVolImpl

Jens Thiel
Hi Luigi,


        template<class Interpolator1D>
        double LocalVolCurve<Interpolator1D>::localVolImpl(
            Time t, double, bool extrapolate) const {

            double dt = (1.0/365.0),
                   var1 = blackVarianceCurve_->blackVariance(t,extrapolate),
                   var2 = blackVarianceCurve_->blackVariance(t+dt,true),
                   derivative = (var2-var1)/dt;
            return QL_SQRT(derivative);
        }

in the calls to blackVarianceCurve_->blackVariance the only matching method
signature I could find is:

       //! Black present (a.k.a spot) variance
        double BlackVolTermStructure::blackVariance(Time maturity,
                             double strike,
                             bool extrapolate = false) const;

Is this, as I guess, a C++ type conversion "feature" (aka unnoticed error)
or am I missing something?


Happy new year!!

Jens.



Reply | Threaded
Open this post in threaded view
|

Re: LocalVolCurve::localVolImpl

Luigi Ballabio-2
At 3:29 PM +0100 12/31/02, Jens Thiel wrote:

>Hi Luigi,
>
>
>         template<class Interpolator1D>
>         double LocalVolCurve<Interpolator1D>::localVolImpl(
>             Time t, double, bool extrapolate) const {
>
>             double dt = (1.0/365.0),
>                    var1 = blackVarianceCurve_->blackVariance(t,extrapolate),
>                    var2 = blackVarianceCurve_->blackVariance(t+dt,true),
>                    derivative = (var2-var1)/dt;
>             return QL_SQRT(derivative);
>         }
>
>in the calls to blackVarianceCurve_->blackVariance the only matching method
>signature I could find is:
>
>        //! Black present (a.k.a spot) variance
>         double BlackVolTermStructure::blackVariance(Time maturity,
>                              double strike,
>                              bool extrapolate = false) const;
>
>Is this, as I guess, a C++ type conversion "feature" (aka unnoticed error)

I hate C++ when it does this.
I'll fix it when I'm back to work.

Happy new year,
                Luigi


Reply | Threaded
Open this post in threaded view
|

Re: LocalVolCurve::localVolImpl

Ferdinando Ametrano-3
In reply to this post by Jens Thiel
Jens,

>the only matching method
>signature I could find is:
>
>        //! Black present (a.k.a spot) variance
>         double BlackVolTermStructure::blackVariance(Time maturity,
>                              double strike,
>                              bool extrapolate = false) const;
>
>Is this, as I guess, a C++ type conversion "feature" (aka unnoticed error)
>or am I missing something?
you were right. I fixed the unwanted feature. The bad thing about that part
of the code it is that it's not actually used by anybody I know of. Well,
it will be for 0.4

ciao -- Nando