Skip to content

Commit b5af572

Browse files
committed
Removed Murmur hash references and added elemental attribute
1. Removed references to the murmur hash from stdlib_64_bit_hash_codes.fypp 2. Described all fibonacci and universal_mult_hash procedures as elemental 2. Described fnv_1, FNV_1a, nmhash32, nmhash32x, water_hash, pengy_hash operating on character strings as elemental. [ticket: X]
1 parent f57248a commit b5af572

7 files changed

+22
-45
lines changed

src/stdlib_32_bit_fnv_hashes.fypp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ contains
6161
#:endfor
6262

6363

64-
pure module function character_fnv_1( key ) result(hash_code)
64+
elemental module function character_fnv_1( key ) result(hash_code)
6565
! A default character key wrapper for the FNV-1 algorithm.
6666
character(*), intent(in) :: key
6767
integer(int_hash) :: hash_code
@@ -112,7 +112,7 @@ contains
112112

113113
#:endfor
114114

115-
pure module function character_fnv_1a( key ) result(hash_code)
115+
elemental module function character_fnv_1a( key ) result(hash_code)
116116
! A default character key wrapper for the FNV-1 algorithm.
117117
character(*), intent(in) :: key
118118
integer(int_hash) :: hash_code

src/stdlib_32_bit_hash_codes.fypp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ module stdlib_32_bit_hash_codes
8181

8282
#:endfor
8383

84-
pure module function character_fnv_1( key ) result(hash_code)
84+
elemental module function character_fnv_1( key ) result(hash_code)
8585
!! FNV_1 hash function for default character string keys
8686
character(*), intent(in) :: key
8787
integer(int_hash) :: hash_code
@@ -100,7 +100,7 @@ module stdlib_32_bit_hash_codes
100100

101101
#:endfor
102102

103-
pure module function character_fnv_1a( key ) result(hash_value)
103+
elemental module function character_fnv_1a( key ) result(hash_value)
104104
!! FNV_1A hash function for default character string keys
105105
character(*), intent(in) :: key
106106
integer(int_hash) :: hash_value
@@ -122,7 +122,7 @@ module stdlib_32_bit_hash_codes
122122

123123
#:endfor
124124

125-
pure module function character_nmhash32( key, seed ) &
125+
elemental module function character_nmhash32( key, seed ) &
126126
result(hash_value)
127127
!! NMHASH32 hash function for default character string keys
128128
character(*), intent(in) :: key
@@ -146,7 +146,7 @@ module stdlib_32_bit_hash_codes
146146

147147
#:endfor
148148

149-
pure module function character_nmhash32x( key, seed ) &
149+
elemental module function character_nmhash32x( key, seed ) &
150150
result(hash_value)
151151
!! NMHASH32 hash function for default character string keys
152152
character(*), intent(in) :: key
@@ -169,7 +169,7 @@ module stdlib_32_bit_hash_codes
169169
end function ${k1}$_water_hash
170170
#:endfor
171171

172-
pure module function character_water_hash( key, seed ) &
172+
elemental module function character_water_hash( key, seed ) &
173173
result(hash_code)
174174
!! WATER hash function for default character string keys
175175
character(*), intent(in) :: key
@@ -205,7 +205,7 @@ module stdlib_32_bit_hash_codes
205205

206206
contains
207207

208-
pure function fibonacci_hash( key, nbits ) result( sample )
208+
elemental function fibonacci_hash( key, nbits ) result( sample )
209209
!! Maps the 32 bit integer KEY to an unsigned integer value with only NBITS
210210
!! bits where NBITS is less than 32
211211
integer(int32), intent(in) :: key
@@ -216,7 +216,7 @@ contains
216216

217217
end function fibonacci_hash
218218

219-
pure function universal_mult_hash( key, seed, nbits ) result( sample )
219+
elemental function universal_mult_hash( key, seed, nbits ) result( sample )
220220
!! Uses the "random" odd 32 bit integer SEED to map the 32 bit integer KEY to
221221
!! an unsigned integer value with only NBITS bits where NBITS is less than 32
222222
integer(int32), intent(in) :: key

src/stdlib_32_bit_nmhashes.fypp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ contains
724724

725725
#:endfor
726726

727-
pure module function character_nmhash32( key, seed ) result(hash_code)
727+
elemental module function character_nmhash32( key, seed ) result(hash_code)
728728
!! NMHASH32 hash function for default character keys
729729
character(*), intent(in) :: key
730730
integer(int32), intent(in) :: seed
@@ -749,7 +749,7 @@ contains
749749

750750
#:endfor
751751

752-
pure module function character_nmhash32x( key, seed ) result(hash_code)
752+
elemental module function character_nmhash32x( key, seed ) result(hash_code)
753753
!! NMHASH32X hash function for default character keys
754754
character(*), intent(in) :: key
755755
integer(int32), intent(in) :: seed

src/stdlib_32_bit_water_hashes.fypp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ contains
250250

251251
#:endfor
252252

253-
pure module function character_water_hash( key, seed ) result(hash_code)
253+
elemental module function character_water_hash( key, seed ) &
254+
result(hash_code)
254255
character(*), intent(in) :: key
255256
integer(int64), intent(in) :: seed
256257
integer(int_hash) :: hash_code

src/stdlib_64_bit_fnv_hashes.fypp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ contains
6262

6363
#:endfor
6464

65-
pure module function character_fnv_1( key ) result(hash_code)
65+
elemental module function character_fnv_1( key ) result(hash_code)
6666
character(*), intent(in) :: key
6767
integer(int_hash) :: hash_code
6868

@@ -112,7 +112,7 @@ contains
112112

113113
#:endfor
114114

115-
pure module function character_fnv_1a( key ) result(hash_code)
115+
elemental module function character_fnv_1a( key ) result(hash_code)
116116
character(*), intent(in) :: key
117117
integer(int_hash) :: hash_code
118118

src/stdlib_64_bit_hash_codes.fypp

Lines changed: 5 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ module stdlib_64_bit_hash_codes
9999
end function ${k1}$_fnv_1
100100
#:endfor
101101

102-
pure module function character_fnv_1( key ) result(hash_code)
102+
elemental module function character_fnv_1( key ) result(hash_code)
103103
!! FNV_1 hash function for character strings
104104
character(*), intent(in) :: key
105105
integer(int_hash) :: hash_code
@@ -118,39 +118,14 @@ module stdlib_64_bit_hash_codes
118118
end function ${k1}$_fnv_1a
119119
#:endfor
120120

121-
pure module function character_fnv_1a( key ) result(hash_code)
121+
elemental module function character_fnv_1a( key ) result(hash_code)
122122
!! FNV_1A hash function for character strings
123123
character(*), intent(in) :: key
124124
integer(int_hash) :: hash_code
125125
end function character_fnv_1a
126126

127127
end interface fnv_1a_hash
128128

129-
130-
interface murmur2_hash
131-
!! MURMUR2_HASHES interfaces
132-
133-
#:for k1 in INT_KINDS
134-
pure module function ${k1}$_murmur2_hash( key, seed ) &
135-
result(hash_code)
136-
!! MURMUR2 hash function for rank 1 arrays of kind ${k1}$
137-
integer(${k1}$), intent(in) :: key(0:)
138-
integer(int_hash), intent(in) :: seed
139-
integer(int_hash) :: hash_code
140-
end function ${k1}$_murmur2_hash
141-
#:endfor
142-
143-
pure module function character_murmur2_hash( key, seed ) &
144-
result(hash_code)
145-
!! MURMUR2 hash function for character strings
146-
character(*), intent(in) :: key
147-
integer(int_hash), intent(in) :: seed
148-
integer(int_hash) :: hash_code
149-
end function character_murmur2_hash
150-
151-
end interface murmur2_hash
152-
153-
154129
interface spooky_hash
155130
!! SPOOKY_HASH interfaces
156131

@@ -234,7 +209,7 @@ interface
234209
end function ${k1}$_pengy_hash
235210
#:endfor
236211

237-
pure module function character_pengy_hash( key, seed ) &
212+
elemental module function character_pengy_hash( key, seed ) &
238213
result(hash_code)
239214
!! MIR HASH STRICT function for character strings
240215
character(*), intent(in) :: key
@@ -255,7 +230,7 @@ interface
255230

256231
contains
257232

258-
pure function fibonacci_hash( key, nbits ) result( sample )
233+
elemental function fibonacci_hash( key, nbits ) result( sample )
259234
!! Maps the 64 bit integer KEY to an unsigned integer value with only NBITS
260235
!! bits where NBITS is less than 64
261236
integer(int64), intent(in) :: key
@@ -266,7 +241,7 @@ contains
266241

267242
end function fibonacci_hash
268243

269-
pure function universal_mult_hash( key, seed, nbits ) result( sample )
244+
elemental function universal_mult_hash( key, seed, nbits ) result( sample )
270245
!! Uses the "random" odd 64 bit integer SEED to map the 64 bit integer KEY to
271246
!! an unsigned integer value with only NBITS bits where NBITS is less than 64.
272247
integer(int64), intent(in) :: key

src/stdlib_64_bit_pengy_hashes.fypp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ contains
118118

119119
#:endfor
120120

121-
pure module function character_pengy_hash( key, seed ) result(hash_code)
121+
elemental module function character_pengy_hash( key, seed ) &
122+
result(hash_code)
122123
!! PENGY_HASH hash function for default character keys
123124
character(*), intent(in) :: key
124125
integer(int32), intent(in) :: seed

0 commit comments

Comments
 (0)