NtHasher

Struct NtHasher 

Source
pub struct NtHasher<const CANONICAL: bool = true, const R: u32 = 7> { /* private fields */ }
Expand description

u32 variant of NtHash.

CANONICAL by default by summing forward and reverse-complement hash values. Instead of the classical 1-bit rotation, this rotates by R=7 bits by default, to reduce correlation between high bits of consecutive hashes.

Implementations§

Source§

impl<const CANONICAL: bool, const R: u32> NtHasher<CANONICAL, R>

Source

pub fn new(k: usize) -> Self

Source

pub fn new_with_seed(k: usize, seed: u32) -> Self

Trait Implementations§

Source§

impl<const CANONICAL: bool, const R: u32> Clone for NtHasher<CANONICAL, R>

Source§

fn clone(&self) -> NtHasher<CANONICAL, R>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<const CANONICAL: bool, const R: u32> Freeze for NtHasher<CANONICAL, R>

§

impl<const CANONICAL: bool, const R: u32> RefUnwindSafe for NtHasher<CANONICAL, R>

§

impl<const CANONICAL: bool, const R: u32> Send for NtHasher<CANONICAL, R>

§

impl<const CANONICAL: bool, const R: u32> Sync for NtHasher<CANONICAL, R>

§

impl<const CANONICAL: bool, const R: u32> Unpin for NtHasher<CANONICAL, R>

§

impl<const CANONICAL: bool, const R: u32> UnwindSafe for NtHasher<CANONICAL, R>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<CH> KmerHasher for CH
where CH: CharHasher,

Source§

const CANONICAL: bool = const CANONICAL: bool = CH::CANONICAL;

True when the hash function is invariant under reverse-complement.
Source§

fn new(k: usize) -> CH

Source§

fn k(&self) -> usize

The value of k for this hasher.
Source§

fn in_out_mapper_scalar<'s>(&self, seq: impl Seq<'s>) -> impl FnMut((u8, u8))

A scalar mapper function that should be called with each (in, out) base. Read more
Source§

fn in_out_mapper_simd<'s>( &self, seq: impl Seq<'s>, ) -> impl FnMut((u32x8, u32x8))

A SIMD mapper function that should be called with a (in, out) base per lane. Read more
Source§

fn mapper<'s>(&self, seq: impl Seq<'s>) -> impl FnMut(u8)

Hash a sequence one character at a time. Ignores k. Read more
Source§

fn is_canonical(&self) -> bool

Helper function returning Self::CANONICAL.
Source§

fn delay(&self) -> Delay

The delay of the ‘out’ character passed to the in_out_mapper functions. Defaults to k-1.
Source§

fn in_out_mapper_ambiguous_scalar<'s>( &self, nseq: PackedNSeq<'s>, ) -> impl FnMut((u8, u8)) -> u32

Source§

fn in_out_mapper_ambiguous_simd<'s>( &self, nseq: PackedNSeq<'s>, context: usize, ) -> impl FnMut((u32x8, u32x8)) -> u32x8

Source§

fn hash_kmers_scalar<'s>( &self, seq: impl Seq<'s>, ) -> impl ExactSizeIterator<Item = u32>

A scalar iterator over all k-mer hashes in seq.
Source§

fn hash_kmers_simd<'s>( &self, seq: impl Seq<'s>, context: usize, ) -> PaddedIt<impl ChunkIt<u32x8>>

A SIMD-parallel iterator over all k-mer hashes in seq.
Source§

fn hash_valid_kmers_scalar<'s>( &self, nseq: PackedNSeq<'s>, ) -> impl ExactSizeIterator<Item = u32>

An iterator over all k-mer hashes in seq. Ambiguous kmers get hash u32::MAX.
Source§

fn hash_valid_kmers_simd<'s, 't>( &'t self, nseq: PackedNSeq<'s>, context: usize, ) -> PaddedIt<impl ChunkIt<u32x8> + use<'s, 't, Self>>

A SIMD-parallel iterator over all k-mer hashes in seq. Ambiguous kmers get hash u32::MAX.
Source§

fn hash_seq<'s>(&self, seq: impl Seq<'s>) -> u32

Hash the given sequence. Ignores k. Read more
Source§

fn hash_prefixes<'s>( &self, seq: impl Seq<'s>, ) -> impl ExactSizeIterator<Item = u32>

Hash all non-empty prefixes of the given sequence. Ignores k.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V