Changed interpolation on periodStart to round simulation time to libor
period discretization point.
@@ -1225,11 +1225,11 @@ public class LIBORMarketModelFromCovarianceModel extends AbstractProcessModel im
// Interpolation on tenor using interpolationMethod
if(periodStartIndex < 0) {
int previousStartIndex = (-periodStartIndex-1)-1;
+ double prevStartTime = getLiborPeriod(previousStartIndex);
double nextStartTime = getLiborPeriod(previousStartIndex+1);
if(nextStartTime > periodEnd) throw new AssertionError("Interpolation not possible.");
- RandomVariable onePlusLongLIBORdt = periodEnd > nextStartTime ?
- getLIBOR(time, nextStartTime, periodEnd).mult(periodEnd - nextStartTime).add(1.0) :
- getRandomVariableForConstant(1.0);
+ if(nextStartTime == periodEnd) return getOnePlusInterpolatedLIBORDt(timeIndex, periodStart, previousStartIndex).sub(1.0).div(periodEnd - periodStart);
+ RandomVariable onePlusLongLIBORdt = getLIBOR(Math.min(prevStartTime, time), nextStartTime, periodEnd).mult(periodEnd - nextStartTime).add(1.0);
RandomVariable onePlusInterpolatedLIBORDt = getOnePlusInterpolatedLIBORDt(timeIndex, periodStart, previousStartIndex);
return onePlusLongLIBORdt.mult(onePlusInterpolatedLIBORDt).sub(1.0).div(periodEnd - periodStart);
}
