SimHash

Struct SimHash 

Source
pub struct SimHash<H, S, const L: usize>
where H: SimHasher<T = S>, S: SimHashBits,
{ /* private fields */ }

Implementations§

Source§

impl<H, S, const L: usize> SimHash<H, S, L>
where H: SimHasher<T = S>, S: SimHashBits,

Source

pub fn new(hasher: H) -> Self

Source

pub fn create_signature<T, U>(&self, iter: T) -> S
where T: Iterator<Item = U>, U: Hash,

Source

pub fn create_signature_weighted<T, U, W>(&self, iter: T) -> S
where T: IntoIterator<Item = (U, W)>, U: Hash, W: Into<f32> + Copy,

Weighted SimHash: each feature contributes ±w instead of ±1. If the i-th hash bit is 1, add -w; if 0, add +w. Final bit = sign(count).

Source

pub fn create_centroid<T>(&self, signatures: T) -> S
where T: Iterator<Item = S>,

Auto Trait Implementations§

§

impl<H, S, const L: usize> Freeze for SimHash<H, S, L>
where H: Freeze,

§

impl<H, S, const L: usize> RefUnwindSafe for SimHash<H, S, L>

§

impl<H, S, const L: usize> Send for SimHash<H, S, L>
where H: Send, S: Send,

§

impl<H, S, const L: usize> Sync for SimHash<H, S, L>
where H: Sync, S: Sync,

§

impl<H, S, const L: usize> Unpin for SimHash<H, S, L>
where H: Unpin, S: Unpin,

§

impl<H, S, const L: usize> UnwindSafe for SimHash<H, S, L>
where H: UnwindSafe, S: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.