pub struct MulHasher<const CANONICAL: bool = true, const R: u32 = 7> { /* private fields */ }Expand description
MulHasher multiplies each character by a constant and xor’s them together under rotations.
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§
Trait Implementations§
Auto Trait Implementations§
impl<const CANONICAL: bool, const R: u32> Freeze for MulHasher<CANONICAL, R>
impl<const CANONICAL: bool, const R: u32> RefUnwindSafe for MulHasher<CANONICAL, R>
impl<const CANONICAL: bool, const R: u32> Send for MulHasher<CANONICAL, R>
impl<const CANONICAL: bool, const R: u32> Sync for MulHasher<CANONICAL, R>
impl<const CANONICAL: bool, const R: u32> Unpin for MulHasher<CANONICAL, R>
impl<const CANONICAL: bool, const R: u32> UnwindSafe for MulHasher<CANONICAL, R>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<CH> KmerHasher for CHwhere
CH: CharHasher,
impl<CH> KmerHasher for CHwhere
CH: CharHasher,
Source§const CANONICAL: bool = const CANONICAL: bool = CH::CANONICAL;
const CANONICAL: bool = const CANONICAL: bool = CH::CANONICAL;
True when the hash function is invariant under reverse-complement.
fn new(k: usize) -> CH
Source§fn in_out_mapper_scalar<'s>(&self, seq: impl Seq<'s>) -> impl FnMut((u8, u8))
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 moreSource§fn in_out_mapper_simd<'s>(
&self,
seq: impl Seq<'s>,
) -> impl FnMut((u32x8, u32x8))
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 moreSource§fn mapper<'s>(&self, seq: impl Seq<'s>) -> impl FnMut(u8)
fn mapper<'s>(&self, seq: impl Seq<'s>) -> impl FnMut(u8)
Hash a sequence one character at a time. Ignores
k. Read moreSource§fn is_canonical(&self) -> bool
fn is_canonical(&self) -> bool
Helper function returning
Self::CANONICAL.Source§fn delay(&self) -> Delay
fn delay(&self) -> Delay
The delay of the ‘out’ character passed to the
in_out_mapper functions.
Defaults to k-1.fn in_out_mapper_ambiguous_scalar<'s>( &self, nseq: PackedNSeq<'s>, ) -> impl FnMut((u8, u8)) -> u32
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>
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>>
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>
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>>
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
fn hash_seq<'s>(&self, seq: impl Seq<'s>) -> u32
Hash the given sequence. Ignores
k. Read moreSource§fn hash_prefixes<'s>(
&self,
seq: impl Seq<'s>,
) -> impl ExactSizeIterator<Item = u32>
fn hash_prefixes<'s>( &self, seq: impl Seq<'s>, ) -> impl ExactSizeIterator<Item = u32>
Hash all non-empty prefixes of the given sequence. Ignores
k.