enforce_bounds Subroutine

private subroutine enforce_bounds(x, xl, xu, infbnd)

enforce the bound constraints on x.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(inout), dimension(:) :: x

optimization variable vector

real(kind=wp), intent(in), dimension(:) :: xl

lower bounds (must be same dimension as x)

real(kind=wp), intent(in), dimension(:) :: xu

upper bounds (must be same dimension as x)

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

"infinity" for the upper and lower bounds. Note that NaN may also be used to indicate no bound.


Called by

proc~~enforce_bounds~~CalledByGraph proc~enforce_bounds slsqp_core::enforce_bounds proc~lsq slsqp_core::lsq proc~lsq->proc~enforce_bounds proc~slsqpb slsqp_core::slsqpb proc~slsqpb->proc~enforce_bounds proc~slsqpb->proc~lsq proc~slsqp slsqp_core::slsqp proc~slsqp->proc~slsqpb proc~slsqp_wrapper slsqp_module::slsqp_solver%slsqp_wrapper proc~slsqp_wrapper->proc~slsqp

Source Code

    subroutine enforce_bounds(x,xl,xu,infbnd)

    implicit none

    real(wp),dimension(:),intent(inout) :: x   !! optimization variable vector
    real(wp),dimension(:),intent(in)    :: xl  !! lower bounds (must be same dimension as `x`)
    real(wp),dimension(:),intent(in)    :: xu  !! upper bounds (must be same dimension as `x`)
    real(wp),intent(in) :: infbnd !! "infinity" for the upper and lower bounds.
                                  !! Note that `NaN` may also be used to indicate no bound.

    where (x<xl .and. xl>-infbnd .and. .not. ieee_is_nan(xl))
        x = xl
    elsewhere (x>xu .and. xu<infbnd .and. .not. ieee_is_nan(xu))
        x = xu
    end where

    end subroutine enforce_bounds