/src/main/java/net/finmath/montecarlo/interestrate/products/components/Option.java
RandomVariable filter = exerciseTrigger.sub( strikePrice).choose( one, zero) .mult( exerciseTriggerMean)
RandomVariable filter = exerciseTrigger.sub ( exerciseTriggerFloor ) .choose ( one, zero ) .mult ( exerciseTrigger.sub ( exerciseTriggerCap ) .mult ( -1.0 ) .choose ( one, zero ) ) ;
final RandomVariable filterNaN = exerciseTrigger.isNaN().sub(1.0).mult(-1.0); final RandomVariable exerciseTriggerFiltered = exerciseTrigger.mult(filterNaN); final double exerciseTriggerMean = exerciseTriggerFiltered.getAverage(); final double exerciseTriggerStdDev = exerciseTriggerFiltered.getStandardDeviation(); final double exerciseTriggerFloor = exerciseTriggerMean*(1.0-Math.signum(exerciseTriggerMean)*1E-5)-3.0*exerciseTriggerStdDev; final double exerciseTriggerCap = exerciseTriggerMean*(1.0+Math.signum(exerciseTriggerMean)*1E-5)+3.0*exerciseTriggerStdDev; <extra_id_0> filter = filter.mult(filterNaN); exerciseTrigger = exerciseTrigger.mult(filter); final RandomVariable[] regressionBasisFunctions = regressionBasisFunctionsProvider != null ? regressionBasisFunctionsProvider.getBasisFunctions(evaluationTime, model) : getBasisFunctions(exerciseDate, model); final RandomVariable[] filteredRegressionBasisFunctions = new RandomVariable[regressionBasisFunctions.length]; for(int i=0; i<regressionBasisFunctions.length; i++) { filteredRegressionBasisFunctions[i] = regressionBasisFunctions[i].mult(filter);