Skip to content

ppvm_traits::prelude

prelude

ppvm_traits::prelude

classPaulisource

ppvm_traits::prelude::Pauli

Bases: Debug, Clone, Copy, StructuralPartialEq, PartialEq, Eq, Display

Rust enum. A single-qubit Pauli symbol.

pub enum Pauli

Variants

NameTypeDescription
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.

``` 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”); ```

source

classConfigsource

ppvm_traits::prelude::Config

Rust trait. Compile-time configuration bundle for a `PauliSum`.

pub trait Config: Clone

Associated items

NameTypeDescription
Storagetype Storage: PauliStorageassociated type. Backing storage for an individual Pauli word — typically a `[u8; N]` where `N` is the number of bytes packed.
Coefftype Coeff: Coefficientassociated type. Numeric coefficient type (e.g. `f64`, `Complex<f64>`).
Strategytype Strategy: Strategyassociated type. Truncation strategy applied when `PauliSum::truncate` runs.
BuildHashertype BuildHasher: BuildHasher + Clone + Default + HashFinalizeassociated 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`].
PauliWordTypetype PauliWordType: PauliWordTraitassociated type. Concrete [`PauliWordTrait`] implementation used as map keys.
Maptype Map: ACMap&lt;&lt;Self as &gt;::Storage, &lt;Self as &gt;::Coeff, &lt;Self as &gt;::BuildHasher, &lt;Self as &gt;::PauliWordType&gt;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