Tpetra parallel linear algebra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Static Public Member Functions | List of all members
Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, ResultType > Struct Template Reference

The hash function for FixedHashTable. More...

#include <Tpetra_Details_Hash.hpp>

Public Types

typedef KeyType argument_type
 Type of the hash function's input. More...
 
typedef ResultType result_type
 Type of the return value of the hash function. More...
 
typedef OffsetType offset_type
 Type of offsets into the hash table's array of (key,value) pairs. More...
 

Static Public Member Functions

static KOKKOS_INLINE_FUNCTION
result_type 
hashFunc (const argument_type &, const offset_type &)
 The hash function. More...
 
static result_type getRecommendedSize (const offset_type)
 Number of "buckets" that the constructor of FixedHashTable should allocate. More...
 

Detailed Description

template<class KeyType, class DeviceType, class OffsetType = typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type, class ResultType = int>
struct Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, ResultType >

The hash function for FixedHashTable.

Template Parameters
KeyTypeThe type of hash function inputs. Corresponds to Tpetra's GlobalOrdinal type.
DeviceTypeKokkos::Device specialization.
OffsetTypeType of each entry of the "buckets" (offsets) array ptr_ in FixedHashTable.
ResultTypeType of the return value of the hash function.

Definition at line 41 of file Tpetra_Details_Hash.hpp.

Member Typedef Documentation

template<class KeyType , class DeviceType , class OffsetType = typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type, class ResultType = int>
typedef KeyType Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, ResultType >::argument_type

Type of the hash function's input.

This is the same typedef as found in std::hash.

Definition at line 45 of file Tpetra_Details_Hash.hpp.

template<class KeyType , class DeviceType , class OffsetType = typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type, class ResultType = int>
typedef ResultType Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, ResultType >::result_type

Type of the return value of the hash function.

This is the same typedef as found in std::hash.

Definition at line 50 of file Tpetra_Details_Hash.hpp.

template<class KeyType , class DeviceType , class OffsetType = typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type, class ResultType = int>
typedef OffsetType Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, ResultType >::offset_type

Type of offsets into the hash table's array of (key,value) pairs.

Definition at line 53 of file Tpetra_Details_Hash.hpp.

Member Function Documentation

template<class KeyType , class DeviceType , class OffsetType = typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type, class ResultType = int>
static KOKKOS_INLINE_FUNCTION result_type Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, ResultType >::hashFunc ( const argument_type ,
const offset_type  
)
inlinestatic

The hash function.

Parameters
key[in] The key to hash.
size[in] Number of "buckets" in the hash table.

It is legal to call this function in a Kokkos parallel kernel.

Definition at line 62 of file Tpetra_Details_Hash.hpp.

template<class KeyType , class DeviceType , class OffsetType = typename std::make_signed<typename Kokkos::View<KeyType*, DeviceType>::size_type>::type, class ResultType = int>
static result_type Tpetra::Details::Hash< KeyType, DeviceType, OffsetType, ResultType >::getRecommendedSize ( const offset_type  )
inlinestatic

Number of "buckets" that the constructor of FixedHashTable should allocate.

Parameters
size[in] Number of entries in the table. (FixedHashTable fixes the number of entries in its constructor.)

This is included in Hash, because a correct and efficient implementation is a function of result_type. The point is to factor out all of the non-generic stuff into this Hash struct, which can be specialized for the types of interest.

Definition at line 78 of file Tpetra_Details_Hash.hpp.


The documentation for this struct was generated from the following file: