/src/main/java/net/finmath/optimizer/StochasticLevenbergMarquardtAD.java
derivatives[parameterIndex][valueIndex] = gradient.get( ( ( RandomVariableDifferentiable) parameters[parameterIndex]).getID( ) ) ; for ( int parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) {
for ( int parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++ ) { derivatives[parameterIndex][valueIndex] = gradient.get ( ( ( RandomVariableDifferentiable ) parameters[parameterIndex] ) .getID ( ) ) ;
} })); } for (int valueIndex = 0; valueIndex < values.length; valueIndex++) { if(values[valueIndex] instanceof RandomVariableDifferentiable) { final Map<Long, RandomVariable> gradient = gradients != null ? gradients.get(valueIndex) : ((RandomVariableDifferentiable)values[valueIndex]).getGradient(); <extra_id_0> if(derivatives[parameterIndex][valueIndex] != null) { derivatives[parameterIndex][valueIndex] = derivatives[parameterIndex][valueIndex].average(); } } } }