Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
Went back to original loop code until I can troubleshoot the vectorized version better.
  • Loading branch information
daminton committed May 13, 2021
1 parent b7e645c commit 9d8bc1a
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/util/util_minimize_bfgs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,15 @@ function gradf(f, N, x1, grad, dx) result(fnum)

fnum = 0
do i = 1, N
xp(:) = [((x1(j), j=1, k-1), x1(j) + dx, (x1(j), j=k+1, N), k=1, N)]
xm(:) = [((x1(j), j=1, k-1), x1(j) - dx, (x1(j), j=k+1, N), k=1, N)]
do j = 1, N
if (j == i) then
xp(j) = x1(j) + dx
xm(j) = x1(j) - dx
else
xp(j) = x1(j)
xm(j) = x1(j)
end if
end do
grad(i) = (f%eval(xp) - f%eval(xm)) / (2 * dx)
fnum = fnum + 2
end do
Expand Down

0 comments on commit 9d8bc1a

Please sign in to comment.