DoubleVector df1 = evaluateCost.getGradient();
i = i + (length < 0 ? 1 : 0);
// search direction is steepest
DoubleVector s = df1.multiply(-1.0d);
double d1 = s.multiply(-1.0d).dot(s); // this is the slope
double z1 = red / (1.0 - d1); // initial step is red/(|s|+1)
while (i < Math.abs(length)) {// while not finished
i = i + (length > 0 ? 1 : 0);// count iterations?!
// make a copy of current values