Binary search of a sorted array. (assumed to be in ascending order)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int32), | intent(in) | :: | val |
value to match in |
||
| integer(kind=int32), | intent(in), | dimension(:) | :: | vec |
array to search (it is assumed to be sorted) |
the first matched index in vec
(if not found, 0 is returned)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer(kind=int64), | intent(in) | :: | val |
value to match in |
||
| integer(kind=int64), | intent(in), | dimension(:) | :: | vec |
array to search (it is assumed to be sorted) |
the first matched index in vec
(if not found, 0 is returned)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real64), | intent(in) | :: | val |
value to match in |
||
| real(kind=real64), | intent(in), | dimension(:) | :: | vec |
array to search (it is assumed to be sorted) |
the first matched index in vec
(if not found, 0 is returned)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=real32), | intent(in) | :: | val |
value to match in |
||
| real(kind=real32), | intent(in), | dimension(:) | :: | vec |
array to search (it is assumed to be sorted) |
the first matched index in vec
(if not found, 0 is returned)