ppvm_pauli_sum/config/
indexmap.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,
15 St: Strategy = NoStrategy,
16 W: PauliWordTrait = PauliWord<[u8; N], fxhash::FxBuildHasher>,
17>(PhantomData<(C, St, W)>);
18
19impl<const N: usize, C: Coefficient, St: Strategy, W: PauliWordTrait> Config
20 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 = indexmap::IndexMap<Self::PauliWordType, Self::Coeff, Self::BuildHasher>;
27 type Strategy = St;
28}
29
30#[cfg(all(
35 feature = "gxhash",
36 target_feature = "aes",
37 any(target_arch = "x86_64", target_arch = "aarch64")
38))]
39#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
40pub struct ByteGxHash<
41 const N: usize,
42 C: Coefficient,
43 St: Strategy = NoStrategy,
44 W: PauliWordTrait = PauliWord<[u8; N], gxhash::GxBuildHasher>,
45>(PhantomData<(C, St, W)>);
46
47#[cfg(all(
48 feature = "gxhash",
49 target_feature = "aes",
50 any(target_arch = "x86_64", target_arch = "aarch64")
51))]
52impl<const N: usize, C: Coefficient, St: Strategy, W: PauliWordTrait> Config
53 for ByteGxHash<N, C, St, W>
54{
55 type Storage = [u8; N];
56 type Coeff = C;
57 type BuildHasher = gxhash::GxBuildHasher;
58 type PauliWordType = W;
59 type Map = indexmap::IndexMap<W, Self::Coeff, Self::BuildHasher>;
60 type Strategy = St;
61}
62
63pub type ByteFxHashF64<
65 const N: usize,
66 St = NoStrategy,
67 Wd = PauliWord<[u8; N], fxhash::FxBuildHasher>,
68> = ByteFxHash<N, f64, St, Wd>;
69#[cfg(all(
71 feature = "gxhash",
72 target_feature = "aes",
73 any(target_arch = "x86_64", target_arch = "aarch64")
74))]
75pub type ByteGxHashF64<
76 const N: usize,
77 St = NoStrategy,
78 Wd = PauliWord<[u8; N], gxhash::GxBuildHasher>,
79> = ByteGxHash<N, f64, St, Wd>;