compute_next_step Subroutine

private subroutine compute_next_step(me, xold, search_direction, alpha, modified, xnew)

Compute the next step.

Type Bound

nlesolver_type

Arguments

Type IntentOptional Attributes Name
class(nlesolver_type), intent(inout) :: me
real(kind=wp), intent(in), dimension(me%n) :: xold

initial x

real(kind=wp), intent(in), dimension(me%n) :: search_direction

search direction vector

real(kind=wp), intent(in) :: alpha

step length to take in the search direction

logical, intent(in), dimension(me%n) :: modified

indicates the elements of p that were modified because they violated the bounds. Output of adjust_search_direction.

real(kind=wp), intent(out), dimension(me%n) :: xnew

final x


Called by

proc~~compute_next_step~~CalledByGraph proc~compute_next_step nlesolver_type%compute_next_step proc~backtracking_linesearch backtracking_linesearch proc~backtracking_linesearch->proc~compute_next_step proc~exact_linesearch exact_linesearch proc~exact_linesearch->proc~compute_next_step proc~fixed_point_linesearch fixed_point_linesearch proc~fixed_point_linesearch->proc~compute_next_step proc~simple_step simple_step proc~simple_step->proc~compute_next_step

Source Code

    subroutine compute_next_step(me, xold, search_direction, alpha, modified, xnew)

    class(nlesolver_type),intent(inout)  :: me
    real(wp),dimension(me%n),intent(in)  :: xold  !! initial `x`
    real(wp),dimension(me%n),intent(in)  :: search_direction  !! search direction vector
    real(wp),intent(in)                  :: alpha !! step length to take in the search direction
    logical,dimension(me%n),intent(in)   :: modified  !! indicates the elements of `p` that were
                                                      !! modified because they violated the bounds.
                                                      !! Output of [[adjust_search_direction]].
    real(wp),dimension(me%n),intent(out) :: xnew  !! final `x`

    if (me%bounds_mode == NLESOLVER_WALL_BOUNDS) then
        ! for the 'wall' mode, the modified variables are held fixed during the step
        where (modified)
            xnew = xold
        else where
            xnew = xold + search_direction * alpha
        end where
    else
        ! all other modes just use the computed search direction
        xnew = xold + search_direction * alpha
    end if

    end subroutine compute_next_step