shared_rht_lookup Subroutine

public subroutine shared_rht_lookup(core_ht, ilut, nI, tgt_space, i, core_state)

Lookup a value in a shared-read-only hashtable. Returns the position of a given ilut in the target space used for setting up this hash table @param[in] core_ht hashtable used for the lookup @param[in] ilut the ilut for which we want to get the position in tgt_space @param[in] nI decoded determinant corresponding to ilut (usually already available, so no need to decode again @param[in] tgt_space ilut_list used to initialise core_ht, this is where we want to search for the given ilut @param[out] i on return, position of ilut in tgt_space if found, 0 else @param[out] core_state on return, true if ilut is found, false else

Arguments

Type IntentOptional Attributes Name
type(shared_rhash_t), intent(in) :: core_ht
integer(kind=n_int), intent(in) :: ilut(0:NIfTot)
integer, intent(in) :: nI(:)
integer(kind=int64), intent(in) :: tgt_space(0:,1:)
integer, intent(out) :: i
logical, intent(out) :: core_state

Contents

Source Code


Source Code

    subroutine shared_rht_lookup(core_ht, ilut, nI, tgt_space, i, core_state)
        use hash, only: FindWalkerHash
        use bit_rep_data, only: NIfTot, nifd
        type(shared_rhash_t), intent(in) :: core_ht
        integer(n_int), intent(in) :: ilut(0:NIfTot)
        integer, intent(in) :: nI(:)
        integer(int64), intent(in) :: tgt_space(0:, 1:)

        integer, intent(out) :: i
        logical, intent(out) :: core_state
        integer(int64) :: hash_val, i_tmp

        hash_val = FindWalkerHash(nI, int(core_ht%val_range()))

        call core_ht%callback_lookup(hash_val, i_tmp, core_state, loc_verify)
        ! cast down to int32
        i = int(i_tmp)

    contains

        function loc_verify(ind) result(match)
            integer(int64), intent(in) :: ind
            logical :: match

            match = all(ilut(0:nifd) == tgt_space(0:nifd, ind))
        end function loc_verify

    end subroutine shared_rht_lookup