Removed unused local variable.
@@ -32,8 +32,6 @@ public class LIBORVolatilityModelPiecewiseConstant extends LIBORVolatilityModel
private RandomVariable[] volatility;
private final boolean isCalibrateable;
- private final RandomVariable[][] volatilityRandomVariables;
-
public LIBORVolatilityModelPiecewiseConstant(TimeDiscretization timeDiscretization, TimeDiscretization liborPeriodDiscretization, TimeDiscretization simulationTimeDiscretization, TimeDiscretization timeToMaturityDiscretization, RandomVariable[] volatility, boolean isCalibrateable) {
super(timeDiscretization, liborPeriodDiscretization);
@@ -73,7 +71,6 @@ public class LIBORVolatilityModelPiecewiseConstant extends LIBORVolatilityModel
this.simulationTimeDiscretization = simulationTimeDiscretization;
this.timeToMaturityDiscretization = timeToMaturityDiscretization;
this.isCalibrateable = isCalibrateable;
- this.volatilityRandomVariables = new RandomVariable[simulationTimeDiscretization.getNumberOfTimes()][timeToMaturityDiscretization.getNumberOfTimes()];
}
@@ -110,7 +107,6 @@ public class LIBORVolatilityModelPiecewiseConstant extends LIBORVolatilityModel
this.simulationTimeDiscretization = simulationTimeDiscretization;
this.timeToMaturityDiscretization = timeToMaturityDiscretization;
this.isCalibrateable = isCalibrateable;
- this.volatilityRandomVariables = new RandomVariable[simulationTimeDiscretization.getNumberOfTimes()][timeToMaturityDiscretization.getNumberOfTimes()];
}
public LIBORVolatilityModelPiecewiseConstant(AbstractRandomVariableFactory randomVariableFactory, TimeDiscretization timeDiscretization, TimeDiscretization liborPeriodDiscretization, TimeDiscretization simulationTimeDiscretization, TimeDiscretization timeToMaturityDiscretization, double[] volatility, boolean isCalibrateable) {
@@ -153,8 +149,6 @@ public class LIBORVolatilityModelPiecewiseConstant extends LIBORVolatilityModel
this.simulationTimeDiscretization = simulationTimeDiscretization;
this.timeToMaturityDiscretization = timeToMaturityDiscretization;
this.isCalibrateable = isCalibrateable;
- this.volatilityRandomVariables = new RandomVariable[simulationTimeDiscretization.getNumberOfTimes()][timeToMaturityDiscretization.getNumberOfTimes()];
-
}
public LIBORVolatilityModelPiecewiseConstant(TimeDiscretization timeDiscretization, TimeDiscretization liborPeriodDiscretization, TimeDiscretization simulationTimeDiscretization, TimeDiscretization timeToMaturityDiscretization, double[] volatility, boolean isCalibrateable) {
@@ -210,10 +204,7 @@ public class LIBORVolatilityModelPiecewiseConstant extends LIBORVolatilityModel
}
else
{
- int timeIndexSimulationTime = simulationTimeDiscretization.getTimeIndex(time);
- if(timeIndexSimulationTime < 0) {
- timeIndexSimulationTime = -timeIndexSimulationTime-1-1;
- }
+ int timeIndexSimulationTime = simulationTimeDiscretization.getTimeIndexNearestLessOrEqual(time);
if(timeIndexSimulationTime < 0) {
timeIndexSimulationTime = 0;
}
@@ -221,10 +212,7 @@ public class LIBORVolatilityModelPiecewiseConstant extends LIBORVolatilityModel
timeIndexSimulationTime--;
}
- int timeIndexTimeToMaturity = timeToMaturityDiscretization.getTimeIndex(timeToMaturity);
- if(timeIndexTimeToMaturity < 0) {
- timeIndexTimeToMaturity = -timeIndexTimeToMaturity-1-1;
- }
+ int timeIndexTimeToMaturity = timeToMaturityDiscretization.getTimeIndexNearestLessOrEqual(timeToMaturity);
if(timeIndexTimeToMaturity < 0) {
timeIndexTimeToMaturity = 0;
}
