Octopus
iihash_oct_m Module Reference

This module implements a simple hash table for non-negative integer keys and integer values. More...

Detailed Description

This module implements a simple hash table for non-negative integer keys and integer values.

The collision resolution used is separate chaining (cf. Knuth, 1973, vol. 3) using associative lists. The reason to use separate chaining is that we look up a lot of keys not in the table and, e.g., open addressing is very slow in that case. The hash function is simply (key mod size) but size is taken to be a prime number, i.e. the table is usually slightly larger than the user requests.

Data Types

type  iihash_t
 
type  lihash_t
 

Functions/Subroutines

subroutine, public iihash_init (h)
 Initialize a hash table h. More...
 
subroutine, public iihash_end (h)
 Free a hash table. More...
 
subroutine, public iihash_insert (h, key, val)
 Insert a (key, val) pair into the hash table h. More...
 
integer function, public iihash_lookup (h, key, found)
 Look up a value in the hash table h. If found is present, it indicates if key could be found in the table. If found = .false., the return value of iihash_lookup is meaningless (and essentially undefined). More...
 
subroutine, public lihash_init (h)
 Initialize a hash table h. More...
 
subroutine, public lihash_end (h)
 Free a hash table. More...
 
subroutine, public lihash_insert (h, key, val)
 Insert a (key, val) pair into the hash table h. More...
 
integer function, public lihash_lookup (h, key, found)
 Look up a value in the hash table h. If found is present, it indicates if key could be found in the table. If found = .false., the return value of lihash_lookup is meaningless (and essentially undefined). More...
 

Function/Subroutine Documentation

◆ iihash_init()

subroutine, public iihash_oct_m::iihash_init ( type(iihash_t), intent(out)  h)

Initialize a hash table h.

Definition at line 160 of file iihash.F90.

◆ iihash_end()

subroutine, public iihash_oct_m::iihash_end ( type(iihash_t), intent(inout)  h)

Free a hash table.

Definition at line 183 of file iihash.F90.

◆ iihash_insert()

subroutine, public iihash_oct_m::iihash_insert ( type(iihash_t), intent(inout)  h,
integer, intent(in)  key,
integer, intent(in)  val 
)

Insert a (key, val) pair into the hash table h.

Definition at line 205 of file iihash.F90.

◆ iihash_lookup()

integer function, public iihash_oct_m::iihash_lookup ( type(iihash_t), intent(in)  h,
integer, intent(in)  key,
logical, intent(out), optional  found 
)

Look up a value in the hash table h. If found is present, it indicates if key could be found in the table. If found = .false., the return value of iihash_lookup is meaningless (and essentially undefined).

Definition at line 230 of file iihash.F90.

◆ lihash_init()

subroutine, public iihash_oct_m::lihash_init ( type(lihash_t), intent(out)  h)

Initialize a hash table h.

Definition at line 262 of file iihash.F90.

◆ lihash_end()

subroutine, public iihash_oct_m::lihash_end ( type(lihash_t), intent(inout)  h)

Free a hash table.

Definition at line 285 of file iihash.F90.

◆ lihash_insert()

subroutine, public iihash_oct_m::lihash_insert ( type(lihash_t), intent(inout)  h,
integer(int64), intent(in)  key,
integer, intent(in)  val 
)

Insert a (key, val) pair into the hash table h.

Definition at line 307 of file iihash.F90.

◆ lihash_lookup()

integer function, public iihash_oct_m::lihash_lookup ( type(lihash_t), intent(in)  h,
integer(int64), intent(in)  key,
logical, intent(out), optional  found 
)

Look up a value in the hash table h. If found is present, it indicates if key could be found in the table. If found = .false., the return value of lihash_lookup is meaningless (and essentially undefined).

Definition at line 333 of file iihash.F90.