trueloc 函数

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

返回数组中真元素的位置。 规范

参数

类型 意图可选 属性 名称
逻辑型, intent(in) :: array(:)

逻辑型掩码

整型, intent(in), 可选 :: lbound

数组索引的下界

返回值 整型,(count(array))

真元素的位置


源代码

  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