LogCubic interpolator
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
JQuantLib |
Fix Released
|
Medium
|
Richard Gomes |
Bug Description
An user reported an issue with LogCubicInterpo
Please verify if our translation is in accordance with QuantLib 0.9.7.
If it is not (which means we have a bug, probably!), please validate an implement the fix sent by the user.
Additional information below.
Thanks
=======
Additional Information
=======
Richard,
I tried to test LogCubic interpolator (class LogCubic) and it produced incorrect results – in fact, returned interpolated argument vlaues instead of function values.
It turns out, the problem (most likely, typo) was in AbstractInterpo
public void update() {
for (int i=0; i<logY_.size(); i++) {
}
}
logY_ is initialized with x-values, and y-values (vy) are never used anywhere else, so argument becomes the value being interpolated.
Besides, intuitively it is evident that logY_ means log of Y, not X, and in the line above you make sure y-value is non-negative, obviously condition to take logarithm. So I figured it must be typo and replaced vx with vy - now, it worked fine.
The corrected version is below :
public void update() {
for (int i=0; i<logY_.size(); i++) {
}
}
Hope it helps.
I wasn’t sure how to report an issue, decided to write you directly.
Kind Regards,
Boris Ashman
I checked original code from QuantLib 0.9.7 and it uses vy so Boris is correct. I applied fix proposed