Skip to content

Commit b8582b5

Browse files
committed
Fix calculation of L-BFGS
1 parent 7141617 commit b8582b5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

varipeps/optimization/optimizer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def first_loop(q, x):
172172
(pho_arr[:, jnp.newaxis] * s_arr, y_arr),
173173
)
174174

175-
gamma = jnp.sum(s_arr[0] * y_arr[0]) / jnp.sum(y_arr[0] * y_arr[0])
175+
gamma = jnp.sum(s_arr[-1] * y_arr[-1]) / jnp.sum(y_arr[-1] * y_arr[-1])
176176

177177
z_result = gamma * q
178178

@@ -185,6 +185,7 @@ def second_loop(z, x):
185185
second_loop,
186186
z_result,
187187
(pho_arr[:, jnp.newaxis] * y_arr, s_arr, alpha_arr),
188+
reverse=True,
188189
)
189190

190191
z_result = -z_result

0 commit comments

Comments
 (0)