/src/main/java/net/finmath/montecarlo/interestrate/products/CMSOption.java
RandomVariable valueFloatLeg = new RandomVariableFromDoubleArray( paymentDates[paymentDates.length-1], -1.0) ;final RandomVariable payoff = new RandomVariableFromDoubleArray( paymentDate, 1.0 * periodLength) ;
final RandomVariable payoff = new RandomVariableFromDoubleArray ( paymentDate, 1.0 * periodLength ) ;
for(int period=fixingDates.length-1; period>=0; period--) { final double fixingDate = fixingDates[period]; final double paymentDate = paymentDates[period]; final double periodLength = periodLengths != null ? periodLengths[period] : paymentDate - fixingDate; final RandomVariable libor = model.getForwardRate(exerciseDate, fixingDate, paymentDate); <extra_id_0> valueFixLeg = valueFixLeg.add(payoff); valueFloatLeg = valueFloatLeg.discount(libor, periodLength); valueFixLeg = valueFixLeg.discount(libor, periodLength); } valueFloatLeg = valueFloatLeg.add(1.0); final RandomVariable parSwapRate = valueFloatLeg.div(valueFixLeg);