10#ifndef TPETRA_DETAILS_HASH_HPP
11#define TPETRA_DETAILS_HASH_HPP
13#include "Tpetra_ConfigDefs.hpp"
14#ifdef TPETRA_USE_MURMUR_HASH
15# include <Kokkos_Functional.hpp>
25int getRecommendedSizeInt (
const int size);
37template<
class KeyType,
39 class OffsetType =
typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type,
40 class ResultType =
int>
63 static_assert (! std::is_same<result_type, int>::value,
64 "Not yet implemented for ResultType != int");
79 static_assert (! std::is_same<result_type, int>::value,
80 "Not yet implemented for ResultType != int");
97template<
class KeyType,
class DeviceType,
class OffsetType>
98struct Hash<KeyType, DeviceType, OffsetType, int> {
121#ifdef TPETRA_USE_MURMUR_HASH
122 Kokkos::pod_hash<argument_type> hash;
123 const uint32_t k = hash (key);
131 const unsigned int seed = (2654435761U);
132 const int intkey = (int) ((key & 0x000000007fffffffLL) +
133 ((key & 0x7fffffff80000000LL) >> 31));
134 return static_cast<result_type> ((seed ^ intkey) %
static_cast<int> (size));
146 return Impl::getRecommendedSizeInt (
static_cast<int> (size));
Nonmember function that computes a residual Computes R = B - A * X.
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.
static KOKKOS_INLINE_FUNCTION result_type hashFunc(const argument_type &, const offset_type &)
The hash function.
typename std::make_signed< typename Kokkos::View< KeyType *, device_type >::size_type >::type offset_type
static result_type getRecommendedSize(const offset_type)
Number of "buckets" that the constructor of FixedHashTable should allocate.