impure subroutine newton_rel_T1(this, F, dFdx, x0, x_sol)
interface
impure function Fun2(x) result(res)
import rk
real(rk), dimension(:), intent(in) :: x
real(rk), dimension(:), allocatable :: res
end function Fun2
impure function dFun2(x) result(res)
import rk
real(rk), dimension(:), intent(in) :: x
real(rk), dimension(:,:), allocatable :: res
end function dFun2
end interface
procedure(Fun2) :: F
procedure(dFun2), optional :: dFdx
class(nlsolver), intent(inout) :: this
real(rk), dimension(:), intent(in) :: x0
real(rk), dimension(size(x0)), intent(out) :: x_sol
integer :: i
if (this%verbosity == 1) then
print '(a)', '-----------------------------------------------'
print '(a)', 'maxit tol'
print '(g0, 10x, e12.4)', this%maxit, this%TolFun
print '(a)', '-----------------------------------------------'
print '(a)', 'start newton'
print '(a)', '-----------------------------------------------'
print '(a)', 'it ||F||'
end if
select case (this%nl_method)
case ('newton')
call newton_method_T1(this, F, dFdx, x0, x_sol)
case ('newton-modified')
call modified_newton_method_T1(this, F, dFdx, x0, x_sol)
case ('newton-quasi-fd')
call quasi_fd_newton_method_T1(this, F, x0, x_sol)
case ('newton-quasi-fd-modified')
call modified_quasi_fd_newton_method_T1(this, F, x0, x_sol)
! case ('newton-quasi-bfgs')
! call quasi_bfgs_newton_method_T1(this, F, x0, x_sol)
! case ('newton-quasi-bfgs-modified')
! call modified_quasi_bfgs_newton_method_T1(this, F, x0, x_sol)
end select
if (this%verbosity == 1) then
print '(a)', '-----------------------------------------------'
print '(a)', 'end newton'
print '(a)', '-----------------------------------------------'
do i = 1,size(x_sol)
print '(a, g0)', 'x_sol = ', x_sol(i)
end do
end if
end subroutine newton_rel_T1