Provides O(1) hash table for mapping monomer combinations to fragment indices Hash-based lookup table type
Hash-based lookup table for O(1) fragment index retrieval
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| logical, | public | :: | initialized | = | .false. | ||
| integer(kind=int64), | public | :: | n_entries | = | 0 | ||
| type(hash_entry_t), | public, | allocatable | :: | table(:) | |||
| integer, | public | :: | table_size | = | 0 |
| procedure, public :: destroy => fragment_lookup_destroy | |
| procedure, public :: find => fragment_lookup_find | |
| procedure, public :: init => fragment_lookup_init | |
| procedure, public :: insert => fragment_lookup_insert |
Single entry in hash table (private helper type)
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | allocatable | :: | key(:) |
Sorted monomer indices |
||
| type(hash_entry_t), | public, | pointer | :: | next | => | null() |
Chain for collisions |
| integer(kind=int64), | public | :: | value |
Fragment index |
Check if two arrays are equal
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | a(:) | |||
| integer, | intent(in) | :: | b(:) | |||
| integer, | intent(in) | :: | n |
Find fragment index for given monomer combination
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fragment_lookup_t), | intent(in) | :: | this | |||
| integer, | intent(in) | :: | monomers(:) | |||
| integer, | intent(in) | :: | n |
Find next prime number >= n (simple implementation)
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | n |
Clean up hash table and all chains
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fragment_lookup_t), | intent(inout) | :: | this |
Initialize hash table with estimated size
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fragment_lookup_t), | intent(inout) | :: | this | |||
| integer(kind=int64), | intent(in) | :: | estimated_entries |
Insert a monomer combination -> fragment index mapping
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(fragment_lookup_t), | intent(inout) | :: | this | |||
| integer, | intent(in) | :: | monomers(:) | |||
| integer, | intent(in) | :: | n | |||
| integer(kind=int64), | intent(in) | :: | fragment_idx | |||
| type(error_t), | intent(out), | optional | :: | error |