equal_within_tol Function

public pure function equal_within_tol(vals, tol) result(equal)

Returns true if the values in the array are the same (to within the specified absolute tolerance).

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(:) :: vals

a set of values

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

a positive tolerance value

Return Value logical

true if they are equal within the tolerance


Called by

proc~~equal_within_tol~~CalledByGraph proc~equal_within_tol numdiff_utilities_module::equal_within_tol proc~compute_sparsity_random numerical_differentiation_module::compute_sparsity_random proc~compute_sparsity_random->proc~equal_within_tol proc~compute_sparsity_random_2 numerical_differentiation_module::compute_sparsity_random_2 proc~compute_sparsity_random_2->proc~equal_within_tol

Source Code

    pure function equal_within_tol(vals,tol) result (equal)

    implicit none

    real(wp),dimension(:),intent(in) :: vals  !! a set of values
    real(wp),intent(in)              :: tol   !! a positive tolerance value
    logical                          :: equal !! true if they are equal
                                              !! within the tolerance

    equal = all ( abs(vals - vals(1)) <= abs(tol) )

    end function equal_within_tol