anchor.diff:            
             call cost_compute_energies(fdata,prm,lambda,data_energy,regularization_energy)
   
  -          write(ulog,'(i6,1x,7f14.6)') &
  -               iter, max_err, grd_nrm, &
  -               (data_energy + regularization_energy)/float(nvars), & 
  -               data_energy/float(nvars), regularization_energy/float(nvars), elapsed, facc
  -          flush(ulog)
  -
          end if
   
          call float_bcast(size(prm),prm)
  
positive.code:              end if
            end if
            
            ! print reconstr. err. 
            max_err = sqrt(maxval((fmodel - fdata + lambda * prm)**2))
            grd_nrm = sqrt(sum((fmodel - fdata + lambda * prm)**2)/size(prm))
            
            ! compute gradient  of the cost function
            call cost_compute_gradient(fdata,fmodel,lambda,prm,grd)
  
            select case(trim(algorithm))
            case('gd')
  
negative.code:     real(kflt)                      :: tfista,tpfista,mnest
      real                            :: elapsed
      real(kflt)                      :: facc
      real(kflt),parameter            :: gamma1=0.9_kflt,gamma2=0.999_kflt
      logical                         :: fixed_gamma = .true.
      real(kflt)                      :: g1,g2
  