Re: Exposing GeneralizedHullWhite in QuantLibXL

Posted by Luigi Ballabio on
URL: http://quantlib.414.s1.nabble.com/Exposing-GeneralizedHullWhite-in-QuantLibXL-tp14826p14836.html

Hi Hyungseok,
    it's not that practical if it blocks you :)

If you want to expose the information quickly, you'll be better off
keeping the two methods private and adding something like:

private:
    boost::function<Real (Time)> speed_() const;
    boost::function<Real (Time)> vol_() const;
public:
    Real speed(Time t) const { return speed_()(t); }
    Real vol(Time t) const { return vol_()(t); }

The two public methods above should be straightforward to export.
(They won't be fast, though, as they'll recreate the function every
time. As a further step, you could modify the class so that it caches
the two boost::function instances.)

Luigi

On Fri, Jan 10, 2014 at 12:48 AM, Hyung-Seok Hahm
<[hidden email]> wrote:

> Hi Peter,
>
> In fact, I moved the methods from private to public. I know it is not the
> smartest thing to do, but for the sake of practicality. After being sure
> that the code works, I will make the code prettier.
>
> Thanks for the heads up. I'll look into that then.
>
> Cheers,
>
> Hyungseok
>
>
> On Thu, Jan 9, 2014 at 7:44 PM, Peter Caspers <[hidden email]>
> wrote:
>>
>> > The corresponding part of GeneralizedHullWhite.hpp in QuantLib is
>> >
>> >         boost::function<Real (Time)> speed() const;
>> >         boost::function<Real (Time)> vol() const;
>>
>> no, it isn't. These are private methods of the class, if I am not
>> mistaken, not part of the constructor. The
>> latter reads
>>
>>         GeneralizedHullWhite(
>>             const Handle<YieldTermStructure>& yieldtermStructure,
>>             const std::vector<Date>& speedstructure,
>>             const std::vector<Date>& volstructure,
>>             const std::vector<Real>& speed,
>>             const std::vector<Real>& vol);
>>
>> so you should check your wrapper code (or post it here for further
>> clarification).
>>
>> Depending on what you are planning to do, a look into the sister
>> folder ql/experimental/models might also
>> be interesting (well at the moment probably only if you connect to the
>> current git master, not on a released
>> version).
>>
>> Best regards
>> Peter
>
>
>
>
> --
>
> Hyungseok Hahm, PhD, FRM
>
> Quantitative Analyst
>
> Industrial Bank of Korea
>
> Trading Department
>
> Tel      : 82-2-729-7081
>
> Fax       : 82-2-729-6084
>
> E-mail  : [hidden email]
>
> Yahoo Msn : hyungseok.hahm
>
> Google Talk : [hidden email]
>
> LinkedIn: http://kr.linkedin.com/pub/dir/Hyung-seok/Hahm
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&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>

------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users