/src/main/java/net/finmath/montecarlo/interestrate/products/FlexiCap.java
RandomVariable indicator = payoff.choose( RandomVariable indicator = payoff.choose( new RandomVariableFromDoubleArray( 0.0) , new RandomVariableFromDoubleArray( 0.0) ) ;
RandomVariable indicator = payoff.choose ( new RandomVariableFromDoubleArray ( 1.0 ) , new RandomVariableFromDoubleArray ( 0.0 ) ) ;
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)); RandomVariable payoff = libor.sub(strike).mult(periodLength); <extra_id_0> indicator = numberOfExcercises.choose(indicator, new Scalar(0.0)); payoff = payoff.div(numeraire).mult(monteCarloProbabilities); values = values.addProduct(indicator, payoff); numberOfExcercises = numberOfExcercises.sub(indicator); } final RandomVariable numeraireAtEvaluationTime = model.getNumeraire(evaluationTime);