/src/main/java/net/finmath/montecarlo/BrownianMotionWithControlVariate.java
final double scaling = scalings.computeIfAbsent( mapIndex, index -> { return Math.sqrt( brownianMotion.getTimeDiscretization( ).getTimeStep( mapIndex) ) / brownianIncrement.getStandardDeviation( ) ;}) ;
final double scaling = scalings.computeIfAbsent ( mapIndex, index -> { return Math.sqrt ( brownianMotion.getTimeDiscretization ( ) .getTimeStep ( timeIndex ) ) / brownianIncrement.getStandardDeviation ( ) ;} ) ;
} @Override public RandomVariable getBrownianIncrement(final int timeIndex, final int factorIndex) { final RandomVariable brownianIncrement = brownianMotion.getBrownianIncrement(timeIndex, factorIndex); final int mapIndex = timeIndex * brownianMotion.getNumberOfFactors() + factorIndex; final double average = averages.computeIfAbsent(mapIndex, index -> { return brownianIncrement.getAverage();}); <extra_id_0> RandomVariable brownianIncrementControlled = brownianIncrement; if(average != 0.0) { brownianIncrementControlled = brownianIncrementControlled.sub(average); } if(Double.isFinite(scaling) && scaling != 1.0) { brownianIncrementControlled = brownianIncrementControlled.mult(scaling);