Re: Pricing Engine: IntegralEngine not working?

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

Re: Pricing Engine: IntegralEngine not working?

Paul Buettiker
Hi Luigi

Sorry for my huge delay in replying....

In the meantime I installed QuantLib-1.5. Furthermore, I updated the Intel compiler to Intel Parallel Studio XE 15 (64-bit), icc 15.0.2. Nevertheless, the problem mentioned above persits.

So, as suggested by you, I attached a debugger to the program (compiling options: -g -O0). Now I get for the IntegralEngine the following output:

...

Method                             European      Bermudan      American     
Black-Scholes                      3.844308      N/A           N/A          
Heston semi-analytic               3.844306      N/A           N/A          
Bates semi-analytic                3.844306      N/A           N/A          
Barone-Adesi/Whaley                N/A           N/A           4.459628     
Bjerksund/Stensland                N/A           N/A           4.453064     
Integral                           stdDev (-nan) must be non-negative


I assume, that the difference in the error message with regards to my first mail may be due to the different compiler option used to debug.

When running the program, the debugger tells me the following calls in the given order:
  1. QuantLib::Instrument::NPV() ...
  2. QuantLib::Instrument::calculate() ...
  3. QuantLib::LazyObject::calculate() ...
  4. QuantLib::Instrument::performCalculations() ...
  5. QuantLib::IntegralEngine::calculate() ...
  6. QuantLib::Integrator::operator() ...
  7. QuantLib::SegmentIntegral::integrate(...) ...
  8. boost::function1<double,double>::operator() ...
  9. boost::detail::function::function_obj_invoker1<QuantLib......
  10. QuantLib::(anonymous namespace)::Integrand::operator at analyticvariancegammaengine.cpp:49 0x7ffff5ed9521


I then can see that the (-nan) error message comes from the attempt of calculating the sqrt of a negative number (line 49 of analyticvariancegammaengine.cpp) , so far so good.
BUT: I don't understand why the program calls the Integrand class of analyticvariancegammaengine.cpp and not the one of integralengine.cpp.

I did the same analysis using gcc. Here step 10 of the above list shows a call of the Integral class of integralengine.cpp!


Many thanks for your help & kind regards,

Paul.


2014-11-25 10:32 GMT+01:00 Luigi Ballabio <[hidden email]>:
This is odd. The error seems to come from the BlackCalculator class, but the IntegralEngine class shouldn't use it.
Can you attach a debugger to the program and get a traceback from the error?

Luigi


On Sat, Nov 22, 2014 at 11:06 PM, Paul Buettiker <[hidden email]> wrote:
Dear all

When I run the QuantLib example EquityOption.cpp (http://quantlib.org/reference/_equity_option_8cpp-example.html) compiled with QuantLib-1.4.1 (or QuantLib-1.4), I get the error message "forward (0) must be positive" when pricing an equity option using the PricingEngine IntegralEngine:

=====================     Terminal Output    ============================

orca@linux-r2kn:/tmp> ./EquityOption

Option type = Put
Maturity = May 17th, 1999
Underlying price = 36
Strike = 40
Risk-free interest rate = 6.000000 %
Dividend yield = 0.000000 %
Volatility = 20.000000 %


Method                             European      Bermudan      American     
Black-Scholes                      3.844308      N/A           N/A          
Heston semi-analytic               3.844306      N/A           N/A          
Bates semi-analytic                3.844306      N/A           N/A          
Barone-Adesi/Whaley                N/A           N/A           4.459628     
Bjerksund/Stensland                N/A           N/A           4.453064     
Integral                           forward (0) must be positive


==================================================================
The same happens when running quantlib-test-suite.

I do NOT get this error when working with QuantLib-1.3.


The compiler used is from the new Intel Parallel Studio XE 15 (64-bit), icc 15.0.0.0090.

Anybody else who observed this? Does someone  know a solution?

Many thanks and kind regards,
Paul.



------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




--


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Pricing Engine: IntegralEngine not working?

Luigi Ballabio
Hello Paul,
    that's weird.

Anyone else here using Intel's compiler?

Luigi


On Sun, Mar 22, 2015 at 9:30 PM, Paul Buettiker <[hidden email]> wrote:
Hi Luigi

Sorry for my huge delay in replying....

In the meantime I installed QuantLib-1.5. Furthermore, I updated the Intel compiler to Intel Parallel Studio XE 15 (64-bit), icc 15.0.2. Nevertheless, the problem mentioned above persits.

So, as suggested by you, I attached a debugger to the program (compiling options: -g -O0). Now I get for the IntegralEngine the following output:

...

Method                             European      Bermudan      American     
Black-Scholes                      3.844308      N/A           N/A          
Heston semi-analytic               3.844306      N/A           N/A          
Bates semi-analytic                3.844306      N/A           N/A          
Barone-Adesi/Whaley                N/A           N/A           4.459628     
Bjerksund/Stensland                N/A           N/A           4.453064     
Integral                           stdDev (-nan) must be non-negative


I assume, that the difference in the error message with regards to my first mail may be due to the different compiler option used to debug.

When running the program, the debugger tells me the following calls in the given order:
  1. QuantLib::Instrument::NPV() ...
  2. QuantLib::Instrument::calculate() ...
  3. QuantLib::LazyObject::calculate() ...
  4. QuantLib::Instrument::performCalculations() ...
  5. QuantLib::IntegralEngine::calculate() ...
  6. QuantLib::Integrator::operator() ...
  7. QuantLib::SegmentIntegral::integrate(...) ...
  8. boost::function1<double,double>::operator() ...
  9. boost::detail::function::function_obj_invoker1<QuantLib......
  10. QuantLib::(anonymous namespace)::Integrand::operator at analyticvariancegammaengine.cpp:49 0x7ffff5ed9521


I then can see that the (-nan) error message comes from the attempt of calculating the sqrt of a negative number (line 49 of analyticvariancegammaengine.cpp) , so far so good.
BUT: I don't understand why the program calls the Integrand class of analyticvariancegammaengine.cpp and not the one of integralengine.cpp.

I did the same analysis using gcc. Here step 10 of the above list shows a call of the Integral class of integralengine.cpp!


Many thanks for your help & kind regards,

Paul.


2014-11-25 10:32 GMT+01:00 Luigi Ballabio <[hidden email]>:
This is odd. The error seems to come from the BlackCalculator class, but the IntegralEngine class shouldn't use it.
Can you attach a debugger to the program and get a traceback from the error?

Luigi


On Sat, Nov 22, 2014 at 11:06 PM, Paul Buettiker <[hidden email]> wrote:
Dear all

When I run the QuantLib example EquityOption.cpp (http://quantlib.org/reference/_equity_option_8cpp-example.html) compiled with QuantLib-1.4.1 (or QuantLib-1.4), I get the error message "forward (0) must be positive" when pricing an equity option using the PricingEngine IntegralEngine:

=====================     Terminal Output    ============================

orca@linux-r2kn:/tmp> ./EquityOption

Option type = Put
Maturity = May 17th, 1999
Underlying price = 36
Strike = 40
Risk-free interest rate = 6.000000 %
Dividend yield = 0.000000 %
Volatility = 20.000000 %


Method                             European      Bermudan      American     
Black-Scholes                      3.844308      N/A           N/A          
Heston semi-analytic               3.844306      N/A           N/A          
Bates semi-analytic                3.844306      N/A           N/A          
Barone-Adesi/Whaley                N/A           N/A           4.459628     
Bjerksund/Stensland                N/A           N/A           4.453064     
Integral                           forward (0) must be positive


==================================================================
The same happens when running quantlib-test-suite.

I do NOT get this error when working with QuantLib-1.3.


The compiler used is from the new Intel Parallel Studio XE 15 (64-bit), icc 15.0.0.0090.

Anybody else who observed this? Does someone  know a solution?

Many thanks and kind regards,
Paul.



------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users




--




--

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users