ppvm_traits (crate)
ppvm_traits¶
ppvm_traits
Foundational trait system, `Config` trait, single-qubit `Pauli` alphabet, and the `ACMap`/`Trace` map implementations shared across ppvm crates.
Modules
classPauli¶source
ppvm_traits::Pauli
Bases: Debug, Clone, Copy, StructuralPartialEq, PartialEq, Eq, Display
Rust enum. A single-qubit Pauli symbol.
pub enum PauliVariants
| Name | Type | Description |
|---|---|---|
I | — | Identity `I`. |
X | — | Pauli `X`. |
Z | — | Pauli `Z`. |
Y | — | Pauli `Y`. |
L | — | Loss marker — the qubit has been lost and no longer participates. |
The four standard Paulis are encoded so that the low two bits identify the operator (`I = 0b00`, `X = 0b01`, `Z = 0b10`, `Y = 0b11`), which is the same encoding stabilizer-formalism tools commonly use. The extra variant Pauli::L marks a qubit as lost, used by the loss-aware portions of the runtime.
Examples
Section titled “Examples”``` use ppvm_traits::char::Pauli;
assert_eq!(Pauli::I.to_string(), “I”); assert_eq!(Pauli::X.to_string(), “X”); assert_eq!(Pauli::Y.to_string(), “Y”); assert_eq!(Pauli::Z.to_string(), “Z”); assert_eq!(Pauli::L.to_string(), “L”); ```
sourceclassConfig¶source
ppvm_traits::Config
Rust trait. Compile-time configuration bundle for a `PauliSum`.
pub trait Config: CloneAssociated items
| Name | Type | Description |
|---|---|---|
Storage | type Storage: PauliStorage | associated type. Backing storage for an individual Pauli word — typically a `[u8; N]` where `N` is the number of bytes packed. |
Coeff | type Coeff: Coefficient | associated type. Numeric coefficient type (e.g. `f64`, `Complex<f64>`). |
Strategy | type Strategy: Strategy | associated type. Truncation strategy applied when `PauliSum::truncate` runs. |
BuildHasher | type BuildHasher: BuildHasher + Clone + Default + HashFinalize | associated type. Hasher used by the underlying map. It is also the hasher of the [`PauliWordType`](Self::PauliWordType) keys, so it must declare its cached-hash finalization via [`HashFinalize`]. |
PauliWordType | type PauliWordType: PauliWordTrait | associated type. Concrete [`PauliWordTrait`] implementation used as map keys. |
Map | type Map: ACMap<<Self as >::Storage, <Self as >::Coeff, <Self as >::BuildHasher, <Self as >::PauliWordType> | associated type. Concrete map type satisfying [`ACMap`] over the chosen storage / coefficient / hasher / word combination. |
`Config` is a zero-cost generic dispatch mechanism: it pins down the storage backing (`Storage`), coefficient type (`Coeff`), truncation strategy (`Strategy`), hasher (`BuildHasher`), Pauli-word representation (`PauliWordType`), and concrete map (`Map`) used by a single `PauliSum` instantiation. Pre-built bundles live in the submodules (`fxhash`, `indexmap`, …); user code may define its own.
source