Quantlib-users digest, Vol 1 #206 - 10 msgs

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Quantlib-users digest, Vol 1 #206 - 10 msgs

quantlib-users-request
Send Quantlib-users mailing list submissions to
        [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
        https://lists.sourceforge.net/lists/listinfo/quantlib-users
or, via email, send a message with subject or body 'help' to
        [hidden email]

You can reach the person managing the list at
        [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Quantlib-users digest..."

Today's Topics:

    1. Re: bugs in quantlib in bootstrap and
        CumulativeNormalDistribution (Luigi Ballabio)
    2. Re: bugs in quantlib in bootstrap
        andCumulativeNormalDistribution (Chak Jack Wong)
    3. Re: bugs in quantlib in bootstrap
        andCumulativeNormalDistribution (Luigi Ballabio)
    4. Re: bugs in quantlib in bootstrap
        andCumulativeNormalDistribution (Chak Jack Wong)
    5. Re: bugs in quantlib in bootstrap
        andCumulativeNormalDistribution (Luigi Ballabio)

From: Luigi Ballabio <[hidden email]>
Date: Mer sep 18, 2002  15:31:00 Europe/Paris
To: [hidden email], [hidden email]
Subject: Re: [Quantlib-users] bugs in quantlib in bootstrap and
CumulativeNormalDistribution



Hi Xavier,
         sorry for the delay, but we're having some hectic weeks and
QuantLib has to get behind...

At 07:21 PM 9/11/02 +0200, [hidden email] wrote:

> Bug 1: already reported  :
>
> "Crashing error in bootstrap:
> Building piecewiseFlatForward curve with futures and swaps only, the
> function crash.
> As far as I understand,  This is because in FuturesRateHelper'
> discountGuess() function it calls discountImpl which try to get a value
> with array index -1.
> As a safety guard, I think in bootstrap() of PiecewiseFlatForward, we
> should have
>  double guess= ( (i==1)? Null< double >() :
> instrument->discountGuess() );
> instead of
> double guess = instrument->discountGuess();
> To prevent this from happening. "

I haven't been able to reproduce this (and besides, I've had a look at
discountImpl and it seems sound---i.e., steps are taken to ensure that
the array is not accessed out of bounds).
Can you send me a set of data for which the bootstrapping fails?


> Bug2: Europeanoption pricing on Unix:
> We check the code and found that in "europeanoption.hpp" the following
> const static member is declared:
>
>    static const Math::CumulativeNormalDistribution f_;
>
> This variable "f_" is never explicitly initialized, thus it is up to
> the
> compilor to decide what to do when it is first used.

Argh. I'm tempted to blame the compiler for this, as the above is
initialized in europeanoption.cpp as
     const Math::CumulativeNormalDistribution EuropeanOption::f_;
which should be equivalent to
     const Math::CumulativeNormalDistribution EuropeanOption::f_ =
         Math::CumulativeNormalDistribution();
which in turn should properly initialize f_ with a sigma=1.
However, I'm too lazy to look up the C++ standard, so I might be wrong.

Anyway, let's try to code around this. What happens on Unix if you:
a) remove the line
         static const Math::CumulativeNormalDistribution f_;
    from europeanoption.hpp
b) replace the line
         const Math::CumulativeNormalDistribution EuropeanOption::f_;
    in europeanoption.cpp with
         namespace {
             const Math::CumulativeNormalDistribution f_;
         }
and leave the rest unmodified?

Later,
         Luigi





From: Chak Jack Wong <[hidden email]>
Date: Mer sep 18, 2002  15:36:26 Europe/Paris
To: Luigi Ballabio <[hidden email]>
Cc: [hidden email], [hidden email]
Subject: Re: [Quantlib-users] bugs in quantlib in bootstrap  
andCumulativeNormalDistribution
Reply-To: [hidden email]


Hi,
I actually discover this bug.
To reproduce the bug is not difficult.  Simply build the curve using
futures and
swaps only will give crash.

Jack

Luigi Ballabio wrote:

> Hi Xavier,
>          sorry for the delay, but we're having some hectic weeks and
> QuantLib has to get behind...
>
> At 07:21 PM 9/11/02 +0200, [hidden email] wrote:
>> Bug 1: already reported  :
>>
>> "Crashing error in bootstrap:
>> Building piecewiseFlatForward curve with futures and swaps only, the
>> function crash.
>> As far as I understand,  This is because in FuturesRateHelper'
>> discountGuess() function it calls discountImpl which try to get a
>> value
>> with array index -1.
>> As a safety guard, I think in bootstrap() of PiecewiseFlatForward, we
>> should have
>>  double guess= ( (i==1)? Null< double >() :
>> instrument->discountGuess() );
>> instead of
>> double guess = instrument->discountGuess();
>> To prevent this from happening. "
>
> I haven't been able to reproduce this (and besides, I've had a look at
> discountImpl and it seems sound---i.e., steps are taken to ensure that
> the array is not accessed out of bounds).
> Can you send me a set of data for which the bootstrapping fails?
>
>> Bug2: Europeanoption pricing on Unix:
>> We check the code and found that in "europeanoption.hpp" the following
>> const static member is declared:
>>
>>    static const Math::CumulativeNormalDistribution f_;
>>
>> This variable "f_" is never explicitly initialized, thus it is up to
>> the
>> compilor to decide what to do when it is first used.
>
> Argh. I'm tempted to blame the compiler for this, as the above is
> initialized in europeanoption.cpp as
>      const Math::CumulativeNormalDistribution EuropeanOption::f_;
> which should be equivalent to
>      const Math::CumulativeNormalDistribution EuropeanOption::f_ =
>          Math::CumulativeNormalDistribution();
> which in turn should properly initialize f_ with a sigma=1.
> However, I'm too lazy to look up the C++ standard, so I might be wrong.
>
> Anyway, let's try to code around this. What happens on Unix if you:
> a) remove the line
>          static const Math::CumulativeNormalDistribution f_;
>     from europeanoption.hpp
> b) replace the line
>          const Math::CumulativeNormalDistribution EuropeanOption::f_;
>     in europeanoption.cpp with
>          namespace {
>              const Math::CumulativeNormalDistribution f_;
>          }
> and leave the rest unmodified?
>
> Later,
>          Luigi
>
> -------------------------------------------------------
> This SF.NET email is sponsored by: AMD - Your access to the experts
> on Hammer Technology! Open Source & Linux Developers, register now
> for the AMD Developer Symposium. Code: EX8664
> http://www.developwithamd.com/developerlab
> _______________________________________________
> Quantlib-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/quantlib-users





From: Luigi Ballabio <[hidden email]>
Date: Mer sep 18, 2002  16:27:55 Europe/Paris
To: [hidden email]
Cc: [hidden email], [hidden email]
Subject: Re: [Quantlib-users] bugs in quantlib in bootstrap  
andCumulativeNormalDistribution


At 02:36 PM 9/18/02 +0100, you wrote:
> Hi,
> I actually discover this bug.
> To reproduce the bug is not difficult.  Simply build the curve using
> futures and swaps only will give crash.

Well, that's what I tried, but the thing worked. However, I've used the
cvs version of the library. Are you using cvs or 0.3.0?

Later,
         Luigi





From: Chak Jack Wong <[hidden email]>
Date: Mer sep 18, 2002  16:48:02 Europe/Paris
To: Luigi Ballabio <[hidden email]>
Cc: [hidden email], [hidden email]
Subject: Re: [Quantlib-users] bugs in quantlib in bootstrap  
andCumulativeNormalDistribution
Reply-To: [hidden email]


I used 0.3.

Jack

Luigi Ballabio wrote:

> At 02:36 PM 9/18/02 +0100, you wrote:
>> Hi,
>> I actually discover this bug.
>> To reproduce the bug is not difficult.  Simply build the curve using
>> futures and swaps only will give crash.
>
> Well, that's what I tried, but the thing worked. However, I've used
> the cvs
> version of the library. Are you using cvs or 0.3.0?
>
> Later,
>          Luigi





From: Luigi Ballabio <[hidden email]>
Date: Mer sep 18, 2002  17:38:55 Europe/Paris
To: [hidden email]
Cc: [hidden email], [hidden email]
Subject: Re: [Quantlib-users] bugs in quantlib in bootstrap  
andCumulativeNormalDistribution


At 03:48 PM 9/18/02 +0100, Chak Jack Wong wrote:
> I used 0.3.

Ok, I used 0.3.0 and got the crash. The good news are that the current
cvs version doesn't crash, so next version will be safe to use. The bad
news are that the current cvs version is, well, only on cvs. However, I
might send you a tarball if you need it and can't/don't want get
through cvs...

Bye,
         Luigi







_______________________________________________
Quantlib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users


--
Alexandre Avanian
[hidden email]


--
Alexandre Avanian
[hidden email]