fuseIndex_int64 Function

private pure function fuseIndex_int64(x, y) result(xy)

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: x
integer(kind=int64), intent(in) :: y

Return Value integer(kind=int64)


Contents

Source Code


Source Code

    pure function fuseIndex_int64(x, y) result(xy)
        ! create a composite index out of two indices, assuming they are unordered
        ! i.e. their ordering does not matter
        ! Input: p,q - 2d-array indices
        ! Output: ind - 1d-array index assuming the array is symmetric w.r. p<->q
        integer(int64), intent(in) :: x, y
        integer(int64) :: xy

        if(x < y) then
            xy = x + y * (y - 1) / 2
        else
            xy = y + x * (x - 1) / 2
        endif
    end function fuseIndex_int64