pub struct Tab64Mixed { /* private fields */ }Expand description
A hash function for 64-bit integers using mixed tabulation.
see paper:Dahlgaard, S., Knudsen, M. and Thorup, M., 2017. Practical hash functions for similarity estimation and dimensionality reduction. Advances in neural information processing systems, 30.
The first stage uses eight input-byte lookups to produce a 64-bit intermediate
hash value and eight derived bytes. Eight more lookups hash the derived bytes.
This implementation uses c = d = 8, where c is the number of input
characters and d is the number of derived characters.
Usage:
use tab_hash::Tab64Mixed;
let keys = vec![0, 8, 15, 47, 11];
let mixed = Tab64Mixed::new();
for k in keys {
println!("{}", mixed.hash(k));
}Implementations§
Source§impl Tab64Mixed
impl Tab64Mixed
Sourcepub fn to_vec(&self) -> (Vec<Vec<u128>>, Vec<Vec<u64>>)
pub fn to_vec(&self) -> (Vec<Vec<u128>>, Vec<Vec<u64>>)
Convert the two tables to nested vectors.
Sourcepub fn from_vec(
first_table_data: Vec<Vec<u128>>,
second_table_data: Vec<Vec<u64>>,
) -> Self
pub fn from_vec( first_table_data: Vec<Vec<u128>>, second_table_data: Vec<Vec<u64>>, ) -> Self
Create a mixed tabulation hash function from nested-vector table data.
Sourcepub fn with_table(
first_table: [[u128; 256]; 8],
second_table: [[u64; 256]; 8],
) -> Self
pub fn with_table( first_table: [[u128; 256]; 8], second_table: [[u64; 256]; 8], ) -> Self
Create a mixed tabulation hash function with the given tables.
Trait Implementations§
Source§impl Clone for Tab64Mixed
impl Clone for Tab64Mixed
Source§fn clone(&self) -> Tab64Mixed
fn clone(&self) -> Tab64Mixed
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'de> Deserialize<'de> for Tab64Mixed
impl<'de> Deserialize<'de> for Tab64Mixed
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Tab64Mixed
impl RefUnwindSafe for Tab64Mixed
impl Send for Tab64Mixed
impl Sync for Tab64Mixed
impl Unpin for Tab64Mixed
impl UnsafeUnpin for Tab64Mixed
impl UnwindSafe for Tab64Mixed
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more