interpolation error

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

interpolation error

Grison PG Pierre (External DEXIA-US)

Hello,

 

Does anyone have an idea why the following code line

 

optionInterpolator_= LinearInterpolation(optionTimes_.begin(),                                                                                         optionTimes_.end(),

                           optionDatesAsReal_.begin());

 

where optionInterpolator_ is declared as

 

LinearInterpolation optionInterpolator_;

 

And inputs are declared as

 

                     mutable std::vector<Date> optionDates_;

                     mutable std::vector<Time> optionTimes_;

 

 

 

triggers the compile error

 

'QuantLib::LinearInterpolation' : no appropriate default constructor available

 

Thanks,

 

Pierre

 


------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: interpolation error

Luigi Ballabio
Hello,
    the line that's giving the problem is not the one where you build
the interpolation, it's the line

LinearInterpolation optionInterpolator_;

where you declare it. As the compiler says, I'm guessing the code that
builds the interpolation is inside the body of a constructor; but
before executing the body, the data members must be initialized.
LinearInterpolation doesn't have a default constructor, so that's not
possible. Instead, you can declare the data member as just:

Interpolation optionInterpolator_;

The above can be default-constructed, and you'll be able to assign to
it a LinearInterpolation anyway.

Luigi



On Mon, Sep 15, 2014 at 9:43 PM, Grison PG Pierre (External DEXIA-US)
<[hidden email]> wrote:

> Hello,
>
>
>
> Does anyone have an idea why the following code line
>
>
>
> optionInterpolator_= LinearInterpolation(optionTimes_.begin(),
> optionTimes_.end(),
>
>                            optionDatesAsReal_.begin());
>
>
>
> where optionInterpolator_ is declared as
>
>
>
> LinearInterpolation optionInterpolator_;
>
>
>
> And inputs are declared as
>
>
>
>                      mutable std::vector<Date> optionDates_;
>
>                      mutable std::vector<Time> optionTimes_;
>
>
>
>
>
>
>
> triggers the compile error
>
>
>
> 'QuantLib::LinearInterpolation' : no appropriate default constructor
> available
>
>
>
> Thanks,
>
>
>
> Pierre
>
>
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> QuantLib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users
>



--
<https://implementingquantlib.blogspot.com>
<https://twitter.com/lballabio>

------------------------------------------------------------------------------
Slashdot TV.  Video for Nerds.  Stuff that Matters.
http://pubads.g.doubleclick.net/gampad/clk?id=160591471&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users