trueloc Function

public pure function trueloc(array, lbound) result(loc)

Return the positions of the true elements in array. Specification

Arguments

Type IntentOptional Attributes Name
logical, intent(in) :: array(:)

Mask of logicals

integer, intent(in), optional :: lbound

Lower bound of array to index

Return Value integer, (count(array))

Locations of true elements


Source Code

  pure function trueloc(array, lbound) result(loc)
    !> Mask of logicals
    logical, intent(in) :: array(:)
    !> Lower bound of array to index
    integer, intent(in), optional :: lbound
    !> Locations of true elements
    integer :: loc(count(array))

    call logicalloc(loc, array, .true., lbound)
  end function trueloc