c get new function and projected gradient following a step
c
ncalls = ncalls + 1
+c 3/14/2020 Adam Liwo: added the condition to prevent from infinite
+c iteration loop
+ if (ncalls.gt.200) then
+ do i = 1, nvar
+ x(i) = x_0(i)
+ end do
+ f_b=f_a
+ deallocate (x_0)
+ deallocate (s)
+ return
+ endif
f_b = fgvalue (x,g)
+c write (2,*) "ncalls",ncalls," f_a",f_a," f_b",f_b," sg_a",sg_a
sg_b = 0.0d0
do i = 1, nvar
sg_b = sg_b + s(i)*g(i)