given as input the integer i and the vector h of logical, compute the the maximum integer il such that il<i and h(il) is true.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer, | intent(in) | :: | n |
length of the vector h |
||
logical, | intent(in) | :: | h(n) |
vector of logical |
||
integer, | intent(in) | :: | i |
integer |
||
integer, | intent(out) | :: | il |
maximum integer such that il<i, h(il)=.true. |
subroutine left(n, h, i, il) !! given as input the integer i and the vector h of logical, compute the !! the maximum integer il such that il<i and h(il) is true. implicit none integer,intent(in) :: n !! length of the vector h integer,intent(in) :: i !! integer logical,intent(in) :: h(n) !! vector of logical integer,intent(out) :: il !! maximum integer such that il<i, h(il)=.true. do il = i - 1, 0, -1 if (h(il)) return end do end subroutine left