vector_djb_hash Function

private pure function vector_djb_hash(r) result(hash)

DJB hash algorithm for a real(wp) vector.

See also

  • J. Shahbazian, Fortran hashing algorithm, July 6, 2013 Fortran Dev

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(:) :: r

the vector

Return Value integer(kind=ip)

the hash value


Called by

proc~~vector_djb_hash~~CalledByGraph proc~vector_djb_hash numdiff_cache_module::vector_djb_hash proc~get_from_cache numdiff_cache_module::function_cache%get_from_cache proc~get_from_cache->proc~vector_djb_hash proc~compute_function_with_cache numerical_differentiation_module::compute_function_with_cache proc~compute_function_with_cache->proc~get_from_cache

Source Code

    pure function vector_djb_hash(r) result(hash)

    real(wp),dimension(:),intent(in) :: r     !! the vector
    integer(ip)                      :: hash  !! the hash value

    integer :: i !! counter

    hash = 5381_ip

    do i=1,size(r)
        hash = ishft(hash,5_ip) + hash + transfer(r(i),1_ip)
    end do

    end function vector_djb_hash