/src/main/java/net/finmath/montecarlo/interestrate/models/funding/FundingCapacityWithMemory.java
final double providedLevel = Math.max( previousProvidedLevel,0) + ( survivalProbability-Math.max( previousFundingLevel,0) ) * fundingLevel;
final double providedLevel = Math.max ( previousProvidedLevel,0 ) + ( fundingLevel-Math.max ( previousFundingLevel,0 ) ) * survivalProbability;
RandomVariable integratedDefaultCompensation = new Scalar(0.0); double previousFundingLevel = -Double.MAX_VALUE; double previousProvidedLevel = -Double.MAX_VALUE; for(final Map.Entry<Double, Double> entry : instantaneousSurvivalProbability.entrySet()) { final double fundingLevel = entry.getKey(); final double survivalProbability = entry.getValue(); <extra_id_0> integratedDefaultCompensation = integratedDefaultCompensation.add( fundingIntervalRight.cap(providedLevel) .sub(fundingIntervalLeft.floor(previousProvidedLevel)) .floor(0.0) .div(survivalProbability)); integratedSurvivalProbability = integratedSurvivalProbability.add(