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
Fixed problems related to bad translation from C to Fortran and differences in arrays
  • Loading branch information
daminton committed May 14, 2021
1 parent c841b1c commit cb64464
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/util/util_minimize_bfgs.f90
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@ function quadfit(f, x0, S, N, lo, hi, eps) result(fnum)
row_2 = [1.0_DP, a2, a2**2]
row_3 = [1.0_DP, a3, a3**2]
rhs = [f1, f2, f3]
lhs(:, 1) = row_1
lhs(:, 2) = row_2
lhs(:, 3) = row_3
lhs(1, :) = row_1
lhs(2, :) = row_2
lhs(3, :) = row_3
! Solve system of equations
soln(:) = util_solve_linear_system(lhs, rhs, 3, lerr)
if (lerr) then
Expand All @@ -504,8 +504,8 @@ function quadfit(f, x0, S, N, lo, hi, eps) result(fnum)
return
end if
aold = astar
if (abs(soln(2)) < small) soln(2) = small
astar = -soln(1) / (2 * soln(2))
if (abs(soln(3)) < small) soln(3) = small
astar = -soln(2) / (2 * soln(3))
fstar = n2one(f, x0, S, N, astar)
fnum = fnum + 1
! keep the three closest a values to astar and discard the fourth
Expand Down

0 comments on commit cb64464

Please sign in to comment.