| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public double eval(final double s) { |
| 56 | VEval fx = cache.get(s); |
| 57 | if(null==fx) { |
| 58 | final double[] newX = newX(x0,dir,s,boxBound); |
| 59 | fx = f.eval(newX,false,false); |
| 60 | if((!Double.isInfinite(fx.fx))&&(!Double.isNaN(fx.fx))) { |
| 61 | if((min==null)||(fx.fx<min.fx)) { |
| 62 | min = fx; |
| 63 | } |
| 64 | if((max==null)||(fx.fx>max.fx)) { |
| 65 | max = fx; |
| 66 | } |
| 67 | } |
| 68 | cache.put(s,fx); |
| 69 | } |
| 70 | return fx.fx; |
| 71 | } |
| 72 | |
| 73 | static double[] newX(final double[] oldX, final double[] delta, final double scale, final double boxBound) { |
| 74 | final int dim = oldX.length; |