Skip to content

Commit

Permalink
optimize/functions: fix BrownBadlyScaled for BFGS and LBFGS tests
Browse files Browse the repository at this point in the history
With the fused operation, f3 is calculated to -9e-17 rather than zero,
allowing another iteration, which fails to progress due to underflow.
  • Loading branch information
kortschak committed Feb 21, 2020
1 parent 16e319c commit be8b044
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion optimize/functions/functions.go
Expand Up @@ -553,7 +553,7 @@ func (BrownBadlyScaled) Grad(grad, x []float64) {

f1 := x[0] - 1e6
f2 := x[1] - 2e-6
f3 := x[0]*x[1] - 2
f3 := float64(x[0]*x[1]) - 2 // Prevent fused multiply subtract.
grad[0] = 2*f1 + 2*f3*x[1]
grad[1] = 2*f2 + 2*f3*x[0]
}
Expand Down

0 comments on commit be8b044

Please sign in to comment.