Zoltan Developer's Guide | Next | Previous

## Hash Function

Zoltan provides a hash function for global and local IDs. The hash function computes a non-negative integer value in a certain range from an ID.

> Zoltan_Hash : hash a global or local ID into non-negative integers

unsigned int Zoltan_Hash( ZOLTAN_ID_PTR key, int num_id_entries, unsigned int n);

Zoltan_Hash computes a hash value for a global or local ID. Note that this hash function has been optimized for 32-bit integer systems, but should work on any machine. The current implementation uses a simple multiplicative hash function based on Don Knuth's golden ratio method; see The Art of Computer Programming, vol. 3.

Arguments: |
key | A pointer to the ID to be hashed.
num_id_entries | The length of the ID (as given by NUM_GID_ENTRIES or NUM_LID_ENTRIES).
n | The computed hash value will be between 0 and n-1.
Return Value: |
unsigned int | The hash value (between 0 and n-1).

[Table of Contents | Next: Timing Routines | Previous: Object List Function | Privacy and Security]