44#ifndef TPETRA_DETAILS_HASH_HPP
45#define TPETRA_DETAILS_HASH_HPP
47#include "Tpetra_ConfigDefs.hpp"
48#ifdef TPETRA_USE_MURMUR_HASH
49# include <Kokkos_Functional.hpp>
59int getRecommendedSizeInt (
const int size);
71template<
class KeyType,
73 class OffsetType =
typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type,
74 class ResultType =
int>
97 static_assert (! std::is_same<result_type, int>::value,
98 "Not yet implemented for ResultType != int");
113 static_assert (! std::is_same<result_type, int>::value,
114 "Not yet implemented for ResultType != int");
131template<
class KeyType,
class DeviceType,
class OffsetType>
132struct Hash<KeyType, DeviceType, OffsetType, int> {
155#ifdef TPETRA_USE_MURMUR_HASH
156 Kokkos::pod_hash<argument_type> hash;
157 const uint32_t k = hash (key);
165 const unsigned int seed = (2654435761U);
166 const int intkey = (int) ((key & 0x000000007fffffffLL) +
167 ((key & 0x7fffffff80000000LL) >> 31));
168 return static_cast<result_type> ((seed ^ intkey) %
static_cast<int> (size));
180 return Impl::getRecommendedSizeInt (
static_cast<int> (size));
Implementation details of Tpetra.
Namespace Tpetra contains the class and methods constituting the Tpetra library.
OffsetType offset_type
Type of offsets into the hash table's array of (key,value) pairs.
static KOKKOS_INLINE_FUNCTION result_type hashFunc(const argument_type &key, const offset_type &size)
The hash function.
static result_type getRecommendedSize(const offset_type size)
Number of "buckets" that the constructor of FixedHashTable should allocate.
int result_type
Type of the return value of the hash function.
KeyType argument_type
Type of the hash function's input.
The hash function for FixedHashTable.
ResultType result_type
Type of the return value of the hash function.
KeyType argument_type
Type of the hash function's input.
static KOKKOS_INLINE_FUNCTION result_type hashFunc(const argument_type &key, const offset_type &size)
The hash function.
OffsetType offset_type
Type of offsets into the hash table's array of (key,value) pairs.
static result_type getRecommendedSize(const offset_type size)
Number of "buckets" that the constructor of FixedHashTable should allocate.