Hull White Tree

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

Hull White Tree

Guowen Han-2
Hi Group,
 
In the Hull White class, as of the document, the member function tree() returns a trinomial tree. However the prototype is boost::shared_ptr<NumericMethod>, it does not have member functions such as discount(), probability(). Can someone tell me how to access the trinomial tree structure?
 
Thanks.
 
Guowen
Reply | Threaded
Open this post in threaded view
|

Re : Hull White Tree

keztenpens
Hi,

You have to perform a dynamic cast to the required type :
boost::shared_ptr<ShortRateTree> shortRateTree = 
boost::dynamic_pointer_cast<
<ShortRateTree>(hw->tree());


----- Message d'origine ----
De : Guowen Han <[hidden email]>
À : [hidden email]
Envoyé le : Mercredi, 20 Septembre 2006, 5h47mn 43s
Objet : [Quantlib-users] Hull White Tree

Hi Group,
 
In the Hull White class, as of the document, the member function tree() returns a trinomial tree. However the prototype is boost::shared_ptr<NumericMethod>, it does not have member functions such as discount(), probability(). Can someone tell me how to access the trinomial tree structure?
 
Thanks.
 
Guowen
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Reply | Threaded
Open this post in threaded view
|

Re: Re : Hull White Tree

Guowen Han-2
This does not work. Anyone has different suggestions?
 
Thanks.

 
On 9/20/06, keztenpens <[hidden email]> wrote:
Hi,

You have to perform a dynamic cast to the required type :
boost::shared_ptr<ShortRateTree> shortRateTree = 

boost::dynamic_pointer_cast<
<ShortRateTree>(hw->tree());


----- Message d'origine ----
De : Guowen Han <[hidden email]>
À : [hidden email]
Envoyé le : Mercredi, 20 Septembre 2006, 5h47mn 43s
Objet : [Quantlib-users] Hull White Tree


Hi Group,
 
In the Hull White class, as of the document, the member function tree() returns a trinomial tree. However the prototype is boost::shared_ptr<NumericMethod>, it does not have member functions such as discount(), probability(). Can someone tell me how to access the trinomial tree structure?
 
Thanks.
 
Guowen
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
<a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.techsay.com/default.php?page=join.php&amp;p=sourceforge&amp;CID=DEVDEV" target="_blank">http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
QuantLib-users mailing list
[hidden email]
<a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.sourceforge.net/lists/listinfo/quantlib-users" target="_blank">https://lists.sourceforge.net/lists/listinfo/quantlib-users
 

 

Reply | Threaded
Open this post in threaded view
|

Re: Re : Hull White Tree

Guowen Han-2
Hi Luigi,
 
I am using QuantLib 3.10.

I have an error message saying that ShortRateTree is not defined even the ql/ShortRateModel/onefactormodel.hpp is includeed. I guess this is because that the ShortRateTree is an inner class of OneFactorModel. Then I changed it to use OneFactorModel::ShortRateTree, the problem then changed to be that ShortRateTree is protected.
 
Looks like I am missing something here.
 
Thanks,
 
Guowen
 
On 9/24/06, Luigi Ballabio <[hidden email]> wrote:

On Sep 24, 2006, at 3:02 AM, Guowen Han wrote:

> This does not work. Anyone has different suggestions?

In which way it doesn't work? (except for the double << which should be
a single one)

Luigi


> On 9/20/06, keztenpens <[hidden email]> wrote: Hi,
>>
>> You have to perform a dynamic cast to the required type :
>> boost::shared_ptr<ShortRateTree> shortRateTree =
>>
>>         boost::dynamic_pointer_cast<<ShortRateTree>(hw->tree());



Reply | Threaded
Open this post in threaded view
|

Re: Re : Hull White Tree

Luigi Ballabio
On Sun, 2006-09-24 at 10:07 -0400, Guowen Han wrote:
> I have an error message saying that ShortRateTree is not defined even
> the ql/ShortRateModel/onefactormodel.hpp is includeed. I guess this is
> because that the ShortRateTree is an inner class of OneFactorModel.
> Then I changed it to use OneFactorModel::ShortRateTree, the problem
> then changed to be that ShortRateTree is protected.

Oh, I see. The inner class is no longer protected in the latest
releases. You can just declare it as public and recompile.

Luigi



 

> On 9/24/06, Luigi Ballabio <[hidden email]> wrote:
>        
>         On Sep 24, 2006, at 3:02 AM, Guowen Han wrote:
>        
>         > This does not work. Anyone has different suggestions?
>        
>         In which way it doesn't work? (except for the double << which
>         should be
>         a single one)
>        
>         Luigi
>        
>        
>         > On 9/20/06, keztenpens <[hidden email]> wrote: Hi,
>         >>
>         >> You have to perform a dynamic cast to the required type :
>         >> boost::shared_ptr<ShortRateTree> shortRateTree =
>         >>
>         >>
>         boost::dynamic_pointer_cast<<ShortRateTree>(hw->tree());
>        
>        
>

----------------------------------------

Age is an issue of mind over matter. If you don't mind, it doesn't
matter.
-- Mark Twain