custom_findloc_complex_dp Function

private pure function custom_findloc_complex_dp(arr, val, back) result(loc)

Arguments

Type IntentOptional Attributes Name
complex(kind=dp), intent(in) :: arr(:)
complex(kind=dp), intent(in) :: val
logical, intent(in), optional :: back

Return Value integer


Contents


Source Code

    pure function custom_findloc_complex_dp(arr, val, back) result(loc)
        complex(dp), intent(in) :: arr(:)
        complex(dp), intent(in) :: val
        logical, intent(in), optional :: back
        integer :: loc

        integer :: i, first, last, step
        logical :: back_

        def_default(back_, back, .false.)

        if(back_) then
            first = size(arr)
            last = 1
            step = -1
        else
            first = 1
            last = size(arr)
            step = 1
        end if

        loc = 0
        do i = first, last, step
            if(arr(i) .isclose. val) then
                loc = i
                return
            endif
        end do
    end function custom_findloc_complex_dp