Skip to content

Commit

Permalink
fixed issue with sparse direction;
Browse files Browse the repository at this point in the history
was overwriting a vector (Python is thinly disguised
C)
  • Loading branch information
enzbus committed Jun 4, 2024
1 parent 22a6a75 commit 9c4b1d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions project_euromir/tests/lbfgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def lbfgs_multiply(
rhos[i] = 1. / np.dot(past_steps[i], past_grad_diffs[i])

# using paper notation
q = current_gradient
q = np.copy(current_gradient)

# right part, backward iteration
alphas = np.empty(memory, dtype=float)
Expand Down Expand Up @@ -218,7 +218,7 @@ def minimize_lbfgs(
scale = np.dot(past_steps[-1], past_grad_diffs[-1]) / np.dot(
past_grad_diffs[-1], past_grad_diffs[-1])

direction[:] = - _lbfgs_multiply_dense(
direction[:] = - lbfgs_multiply(
current_gradient=current_gradient,
past_steps=past_steps[memory-i:],
past_grad_diffs=past_grad_diffs[memory-i:],
Expand Down

0 comments on commit 9c4b1d9

Please sign in to comment.