/src/main/java/net/finmath/montecarlo/interestrate/products/FlexiCap.java
RandomVariable payoff = values.sub( strike).mult( periodLength) ;
RandomVariable payoff = libor.sub ( strike ) .mult ( periodLength ) ;
} final double strike = strikes[period]; final double periodLength = paymentDate - fixingDate; final RandomVariable libor = model.getForwardRate(fixingDate, fixingDate, paymentDate); final RandomVariable numeraire = model.getNumeraire(paymentDate); final RandomVariable monteCarloProbabilities = model.getMonteCarloWeights(model.getTimeIndex(paymentDate)); <extra_id_0> RandomVariable indicator = payoff.choose(new RandomVariableFromDoubleArray(1.0), new RandomVariableFromDoubleArray(0.0)); indicator = numberOfExcercises.choose(indicator, new Scalar(0.0)); payoff = payoff.div(numeraire).mult(monteCarloProbabilities); values = values.addProduct(indicator, payoff); numberOfExcercises = numberOfExcercises.sub(indicator); }