ppvm_pauli_sum/config/
dashmap.rs1use std::marker::PhantomData;
5
6use ppvm_pauli_word::word::PauliWord;
7use ppvm_traits::config::Config;
8use ppvm_traits::traits::{Coefficient, NoStrategy, PauliWordTrait, Strategy};
9
10#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
12pub struct ByteFxHash<
13 const N: usize,
14 C: Coefficient + Sync + Send,
15 St: Strategy = NoStrategy,
16 W: PauliWordTrait = PauliWord<[u8; N], fxhash::FxBuildHasher>,
17>(PhantomData<(C, St, W)>);
18
19impl<const N: usize, C: Coefficient + Sync + Send, St: Strategy, W: PauliWordTrait + Sync + Send>
20 Config for ByteFxHash<N, C, St, W>
21{
22 type Storage = [u8; N];
23 type Coeff = C;
24 type BuildHasher = fxhash::FxBuildHasher;
25 type PauliWordType = W;
26 type Map = dashmap::DashMap<W, C, Self::BuildHasher>;
27 type Strategy = St;
28}
29
30#[cfg(all(
32 feature = "gxhash",
33 target_feature = "aes",
34 any(target_arch = "x86_64", target_arch = "aarch64")
35))]
36#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
37pub struct ByteGxHash<
38 const N: usize,
39 C: Coefficient + Sync + Send,
40 St: Strategy = NoStrategy,
41 W: PauliWordTrait + Sync + Send = PauliWord<[u8; N], gxhash::GxBuildHasher>,
42>(PhantomData<(C, St, W)>);
43
44#[cfg(all(
45 feature = "gxhash",
46 target_feature = "aes",
47 any(target_arch = "x86_64", target_arch = "aarch64")
48))]
49impl<const N: usize, C: Coefficient + Sync + Send, St: Strategy, W: PauliWordTrait + Sync + Send>
50 Config for ByteGxHash<N, C, St, W>
51{
52 type Storage = [u8; N];
53 type Coeff = C;
54 type BuildHasher = gxhash::GxBuildHasher;
55 type PauliWordType = W;
56 type Map = dashmap::DashMap<W, C, Self::BuildHasher>;
57 type Strategy = St;
58}
59
60pub type ByteFxHashF64<const N: usize, St = NoStrategy> = ByteFxHash<N, f64, St>;
62#[cfg(all(
64 feature = "gxhash",
65 target_feature = "aes",
66 any(target_arch = "x86_64", target_arch = "aarch64")
67))]
68pub type ByteGxHashF64<const N: usize, St = NoStrategy> = ByteGxHash<N, f64, St>;