SegFault with with impliedVolatility
Posted by Dirk Eddelbuettel on
URL: http://quantlib.414.s1.nabble.com/SegFault-with-with-impliedVolatility-tp3333.html
Hi all,
I've been scratching my head over this one for the last two hours, and I
can't make any sense of it.
My RQuantLib glue package for R has a few of the option pricers, as well as
some of the implieds. Right now (i.e. with 0.3.7) I am getting a weird
segfault when I do what is essentially a straight copy of the corresponding
code in test-suite/europeanoption.cpp.
In particular, the segfault only occurs if the second assignment in
if (value != 0.0) {
vol->setValue(volguess*1.5); // shift guess somehow
implVol = option->impliedVolatility(value, tolerance, maxEvaluations);
}
is run, i.e. if the impliedVolatility() search is done. What is weirder
still is that the code appears to return, give control back to the
dynamically-loaded function loaded by R, and then segfaults when that outer
R interface function terminates. Nothing has changed on the R side of
things. On the other hand, running the QL code as a small C++ standalone
works too.
Now, both R and QL do 'things' with dynamic memory. Could there be a new
corruption coming in somewhere? This error only showed up after I converted
(belatedly) to the boost framework. And for what it is worth, the other
examples (pricers for european, american, binary, barrier, ...) all work
fine with boost. Likewise, the impliedVol code works if I comment out the
call to option->impliedVolatility(...)
Any ideas?
Dirk
--
Those are my principles, and if you don't like them... well, I have others.
-- Groucho Marx