Linear search of sorted list for the smallest ix such that list(ix) >= val. On failure, returns size(list)+1
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in) | :: | list(:) |
Sorted list |
||
| real(kind=dp), | intent(in) | :: | val |
Value to search for |
pure function find_index_linear(list, val) result(ix) real(dp), intent(in) :: list(:) !< Sorted list real(dp), intent(in) :: val !< Value to search for integer :: ix do ix = 1, size(list) if (list(ix) >= val) exit end do end function find_index_linear