Posted by
Chuck Swiger-4 on
Nov 18, 2009; 11:04pm
URL: http://quantlib.414.s1.nabble.com/building-on-Fedora-11-tp7036p7041.html
On Wed, 2009-11-18 at 17:16 -0500, Chuck Swiger wrote:
> On Wed, 2009-11-18 at 11:21 -0500, Chuck Swiger wrote:
> > On Wed, 2009-11-18 at 11:01 +0100, Luigi Ballabio wrote:
> > > On Mon, 2009-11-16 at 15:42 -0500, Chuck Swiger wrote:
> > > > Got QuantLib-SWIG to build and Python runs the examples ok but Perl stil
> > > > segfaults.
> > >
> > > Yes, this has bugged me for a long time. Do you think you can find some
> > > time to try and debug it? (Or to reduce the error to a smaller,
> > > self-contained example we can send to the SWIG mailing list?)
>
> Ok - There seems to be a problem with, what you my call, 'embedded instantiation'. Doing stuff like this:
>
> my($exercise) = new QuantLib::EuropeanExercise(
> new QuantLib::Date(17,$QuantLib::May, 1999));
>
> or:
>
> $inst = new $Class1 ( new $Class2 )
>
> By removing all of those, and fixing some function calls, it runs and produces the two answers, /then/ segfaults ;)
>
and it'll do lots of useful calculations before the ungraceful exit:
--Chuck
------------------------------------------
...
# removed $process from the following args
my($option) = new QuantLib::VanillaOption($payoff, $exercise);
# and added it here
$option->setPricingEngine(new QuantLib::AnalyticEuropeanEngine($process));
%option_prices = ();
for ($price=7.5; $price<8.5; $price+=0.05) {
$underlying->setValue($price);
printf("Underlying: %4.2f \tanalytic: %f\n", $price,$option->NPV());
$option_prices{$price} = $option->NPV();
}
print "\nCalculating IV from the option values\n";
for ($price=7.5; $price<8.5; $price+=0.05) {
$underlying->setValue($price);
printf("Underlying: %4.2f \tOption Price: %f \tVolatility: %f\n",$underlying->value(),$option_prices{$price},$option->impliedVolatility($option_prices{$price},$process))
}
print "\n";
$option->setPricingEngine(new QuantLib::IntegralEngine($process));
print "integral: ", $option->NPV(), "\n";
print "\n\nPrepare to crash!\n";
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.
http://p.sf.net/sfu/bobj-july_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users