Skip to content

ppvm_traits::traits

traits

ppvm_traits::traits

classNoStrategysource

ppvm_traits::traits::NoStrategy

Bases: Debug, Clone, Default, Copy, StructuralPartialEq, PartialEq, Eq, PartialOrd, Ord, Hash, Strategy

Rust struct. Strategy that never truncates — exact simulation, all entries kept.

pub struct NoStrategy
source

classACMapsource

ppvm_traits::traits::ACMap

Rust trait. Aggregate trait combining every operation a backing map must support to be usable as the storage for a `PauliSum`.

Signature
pub trait ACMap<S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait>: Clone + ACMapBase + ACMapAddAssign<S, V, H, W> + ACMapMulAssign<V, H> + ACMapInsert<S, V, H, W> + ACMapContains<S, V, H, W> + ACMapScale<S, V, H, W> + ACMapRetain<S, V, H, W> + ACMapConsume

You don’t normally implement `ACMap` directly: the blanket impl below covers any type that implements all the constituent traits.

A new backing map (a GPU-resident map, a sharded map, anything beyond the existing `HashMap` / `IndexMap` / `AHashMap` / `DashMap` backends) needs these to satisfy the `ACMap` bound itself:

Satisfying `ACMap` is necessary but not sufficient: `ppvm-pauli-sum` bounds individual operations on further traits, so a backend that skips them only fails to compile at those call sites. In practice you also want:

  • ACMapIter — borrowing iteration over `(key, value)`; needed by `PauliSum::iter`, `Display`, and the approximate-comparison helpers.
  • Trace — needed by `PauliSum::trace`.
  • `Extend<(Word, Coeff)>` — needed by the arithmetic operators.
  • `PartialEq` — needed by `PauliSum`‘s approximate comparisons.

Of these, `map_insert_vec`, `map_insert_multiple`, `scale`, `mul_assign`, `retain`, and `consume` are whole-collection batch entry points: a concurrent or GPU backend can dispatch each of them as one parallel pass over every entry. `add_assign` is the exception — it operates on a single key at a time, so a thread-pool backend typically only parallelizes its batch sibling, `map_add_assign`. See the `DashMap` impl in `crates/ppvm-traits/src/map/dashmap.rs` for a working concurrent precedent: `map_add_assign`, `mul_assign`, `map_insert_vec`, `map_insert_multiple`, `scale`, `consume`, and `trace` all go through rayon `par_iter`. `retain` is the one that does not — its `FnMut` predicate is not shareable across threads, so `DashMap` forwards to the sequential `DashMap::retain`.

source

classACMapAddAssignsource

ppvm_traits::traits::ACMapAddAssign

Rust trait. `+=` semantics for an `ACMap`: insert a new entry or accumulate into the existing one with the same key.

Signature
pub trait ACMapAddAssign<S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait>
source

methodadd_assignsource

ppvm_traits::traits::ACMapAddAssign::add_assign

fn add_assign(&mut self, key: W, value: V)

Parameters

NameTypeDescription
keyW
valueV

Add `value` into the entry at `key`, creating the entry if absent.

source

methodmap_add_assignsource

ppvm_traits::traits::ACMapAddAssign::map_add_assign

fn map_add_assign<F>(&self, dest: &mut Self, f: F)

Parameters

NameTypeDescription
dest&amp;mut Self
fF

For every entry, compute `f(key, value)` and add the result into `dest` with add_assign.

source

classACMapBasesource

ppvm_traits::traits::ACMapBase

Rust trait. Minimal interface for any "associative coefficient map" backing a `PauliSum` — construction, length, and clear.

pub trait ACMapBase

Implementations exist for `HashMap`, `IndexMap`, and `DashMap`; pick one via a Config.

source

methodclearsource

ppvm_traits::traits::ACMapBase::clear

fn clear(&mut self)

Remove every entry, retaining allocated capacity.

source

methodis_emptysource

ppvm_traits::traits::ACMapBase::is_empty

fn is_empty(&self) -> bool

Returns

bool

`true` if the map is empty.

source

methodlensource

ppvm_traits::traits::ACMapBase::len

fn len(&self) -> usize

Returns

usize

Number of stored `(key, value)` pairs.

source

methodwith_capacitysource

ppvm_traits::traits::ACMapBase::with_capacity

fn with_capacity(capacity: usize) -> Self

Parameters

NameTypeDescription
capacityusize

Returns

Self

Construct an empty map with at least `capacity` slots reserved.

source

classACMapConsumesource

ppvm_traits::traits::ACMapConsume

Rust trait. Merge two maps with accumulation: drain `dest` into `self`, summing values that share a key.

pub trait ACMapConsume
source

methodconsumesource

ppvm_traits::traits::ACMapConsume::consume

fn consume(&mut self, dest: &mut Self)

Parameters

NameTypeDescription
dest&amp;mut Self

Drain `dest` into `self`, accumulating values on key collision.

source

classACMapContainssource

ppvm_traits::traits::ACMapContains

Rust trait. Membership queries — `(key, value)` exact match or with a custom predicate on the value.

Signature
pub trait ACMapContains<S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait>
source

methodcontainssource

ppvm_traits::traits::ACMapContains::contains

fn contains(&self, key: &W, value: &V) -> bool

Parameters

NameTypeDescription
key&amp;W
value&amp;V

Returns

bool

`true` if an entry with this exact `(key, value)` is present.

source

methodcontains_withsource

ppvm_traits::traits::ACMapContains::contains_with

fn contains_with<F>(&self, key: &W, f: F) -> bool

Parameters

NameTypeDescription
key&amp;W
fF

Returns

bool

`true` if an entry for `key` exists whose value satisfies `f`.

source

classACMapInsertsource

ppvm_traits::traits::ACMapInsert

Rust trait. In-place modify + insert pattern used to express branching gates (where one input entry can produce zero, one, or several output entries).

Signature
pub trait ACMapInsert<S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait>
source

methodmap_insert_multiplesource

ppvm_traits::traits::ACMapInsert::map_insert_multiple

fn map_insert_multiple<F>(&mut self, dest: &mut Self, f: F)

Parameters

NameTypeDescription
dest&amp;mut Self
fF

Like map_insert_vec but `f` may return a `Vec` of new entries per existing entry, inserted directly into the destination map `dest`.

source

methodmap_insert_vecsource

ppvm_traits::traits::ACMapInsert::map_insert_vec

fn map_insert_vec<F>(&mut self, dest: &mut Vec<(W, V)>, f: F)

Parameters

NameTypeDescription
dest&amp;mut Vec&lt;(W, V)&gt;
fF

Modify each existing entry in place; if `f` returns `Some((k’, v’))`, append that new entry into `dest`, a plain `Vec` (a push per entry, no hashing). This is the primary hot-path entry point: the caller merges the buffer into the destination map afterwards, avoiding a second hashmap probe per produced entry.

source

classACMapItersource

ppvm_traits::traits::ACMapIter

Rust trait. Borrowing iteration over an `ACMap`. Lives in its own trait so that implementations may pick their own item / iterator types.

pub trait ACMapIter<'a>

Associated items

NameTypeDescription
Itemtype Itemassociated type. Yielded item type.
Itertype Iter: Iteratorassociated type. Iterator type.
source

methoditersource

ppvm_traits::traits::ACMapIter::iter

fn iter(&'a self) -> <Self as >::Iter

Returns

<Self as >::Iter

Iterate over `(key, value)` pairs (or their representation).

source

classACMapMulAssignsource

ppvm_traits::traits::ACMapMulAssign

Rust trait. Scalar `*=` semantics for an `ACMap`: multiply every value by a constant.

Signature
pub trait ACMapMulAssign<V: Coefficient, H: BuildHasher + Clone + Default>
source

methodmul_assignsource

ppvm_traits::traits::ACMapMulAssign::mul_assign

fn mul_assign(&mut self, value: V)

Parameters

NameTypeDescription
valueV

Scale every value in place.

source

classACMapRetainsource

ppvm_traits::traits::ACMapRetain

Rust trait. Drop entries that don't satisfy a predicate — used by truncation strategies.

Signature
pub trait ACMapRetain<S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait>
source

methodretainsource

ppvm_traits::traits::ACMapRetain::retain

fn retain<F>(&mut self, f: F)

Parameters

NameTypeDescription
fF

Keep only entries for which `f(key, value)` returns `true`.

source

classACMapScalesource

ppvm_traits::traits::ACMapScale

Rust trait. In-place per-entry transformation of values.

Signature
pub trait ACMapScale<S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait>
source

methodscalesource

ppvm_traits::traits::ACMapScale::scale

fn scale<F>(&mut self, f: F)

Parameters

NameTypeDescription
fF

Apply `f(key, value)` to every entry; only the value is mutable.

source

classAmplitudeDampingsource

ppvm_traits::traits::AmplitudeDamping

Rust trait. Amplitude-damping channel (single qubit).

pub trait AmplitudeDamping<T: Config>
source

methodamplitude_dampingsource

ppvm_traits::traits::AmplitudeDamping::amplitude_damping

fn amplitude_damping(&mut self, addr0: usize, gamma: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
gamma&lt;T as &gt;::Coeff

Apply amplitude damping with damping parameter `gamma`.

source

classAsymmetricLossChannelsource

ppvm_traits::traits::AsymmetricLossChannel

Rust trait. State-dependent ("asymmetric") single-qubit loss channel: a qubit is lost from `|0⟩` with probability `p0` and from `|1⟩` with probability `p1`. Unlike [`LossChannel`], the total loss probability depends on the qubit's populations, so the channel reads the current `⟨Z⟩`.

pub trait AsymmetricLossChannel<T: Config>
source

methodasymmetric_loss_channelsource

ppvm_traits::traits::AsymmetricLossChannel::asymmetric_loss_channel

Signature
fn asymmetric_loss_channel(&mut self, addr0: usize, p0: <T as >::Coeff, p1: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
p0&lt;T as &gt;::Coeff
p1&lt;T as &gt;::Coeff

Apply asymmetric loss to qubit `addr0`, with `p0` / `p1` the loss probabilities from `|0⟩` / `|1⟩`. See the backend impl for the trajectory approximation used (the survival back-action is omitted).

source

classCRxsource

ppvm_traits::traits::CRx

Rust trait. Controlled `RX` rotation.

pub trait CRx<T: Config>
source

methodcrxsource

ppvm_traits::traits::CRx::crx

fn crx(&mut self, control: usize, target: usize, theta: <T as >::Coeff)

Parameters

NameTypeDescription
controlusize
targetusize
theta&lt;T as &gt;::Coeff

Apply `CRX(θ)` with the given control and target.

source

classCliffordsource

ppvm_traits::traits::Clifford

Rust trait. The minimal Clifford gate set: the single-qubit Paulis (`X`, `Y`, `Z`), Hadamard (`H`), phase gate (`S`), and the two entangling Cliffords `CNOT` and `CZ`.

pub trait Clifford

Implemented by `PauliSum`, by every tableau type, and — via the blanket impl in this module — by every PauliWordTrait implementor.

Build the GHZ-preparation circuit on a `PauliSum` (Heisenberg picture, so gates are applied in reverse). `PauliSum` lives in the downstream `ppvm-pauli-sum` crate, so this example is `ignore`d here:

```ignore use ppvm_pauli_sum::prelude::*;

let mut state: PauliSum<config::indexmap::ByteFxHashF64<1>> = PauliSum::builder().n_qubits(2).build(); state += (“ZZ”, 1.0); state.cnot(0, 1); state.h(0); assert_eq!(state.len(), 1); ```

source

methodcnotsource

ppvm_traits::traits::Clifford::cnot

fn cnot(&mut self, control: usize, target: usize)

Parameters

NameTypeDescription
controlusize
targetusize

Apply `CNOT` to one `(control, target)` pair.

source

methodcxsource

ppvm_traits::traits::Clifford::cx

fn cx(&mut self, control: usize, target: usize)

Parameters

NameTypeDescription
controlusize
targetusize

stim alias for cnot.

source

methodczsource

ppvm_traits::traits::Clifford::cz

fn cz(&mut self, addr0: usize, addr1: usize)

Parameters

NameTypeDescription
addr0usize
addr1usize

Apply `CZ` to one qubit pair.

source

methodhsource

ppvm_traits::traits::Clifford::h

fn h(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply Hadamard `H` to one qubit.

source

methodssource

ppvm_traits::traits::Clifford::s

fn s(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply phase gate `S` to one qubit.

source

methodxsource

ppvm_traits::traits::Clifford::x

fn x(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply Pauli `X` to one qubit.

source

methodysource

ppvm_traits::traits::Clifford::y

fn y(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply Pauli `Y` to one qubit.

source

methodzsource

ppvm_traits::traits::Clifford::z

fn z(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply Pauli `Z` to one qubit.

source

methodzcxsource

ppvm_traits::traits::Clifford::zcx

fn zcx(&mut self, control: usize, target: usize)

Parameters

NameTypeDescription
controlusize
targetusize

stim alias for cnot.

source

methodzczsource

ppvm_traits::traits::Clifford::zcz

fn zcz(&mut self, addr0: usize, addr1: usize)

Parameters

NameTypeDescription
addr0usize
addr1usize

stim alias for cz.

source

classCliffordBatchsource

ppvm_traits::traits::CliffordBatch

Rust trait. Batched Clifford gates: apply the same gate to many qubits in one call.

pub trait CliffordBatch: Clifford

Default implementations loop over the corresponding single-qubit (or single-pair) method on Clifford. Types like the stabilizer `Tableau` override these methods with a fused inner-loop or bitmask implementation. Types that don’t need specialization can implement this trait with an empty `impl` to use the defaults.

source

methodcnot_manysource

ppvm_traits::traits::CliffordBatch::cnot_many

fn cnot_many(&mut self, pairs: &[(usize, usize)])

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]

Apply `CNOT` to every `(control, target)` pair.

source

methodcz_manysource

ppvm_traits::traits::CliffordBatch::cz_many

fn cz_many(&mut self, pairs: &[(usize, usize)])

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]

Apply `CZ` to every `(control, target)` pair.

source

methodh_manysource

ppvm_traits::traits::CliffordBatch::h_many

fn h_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply Hadamard `H` to every qubit in `indices`.

source

methods_manysource

ppvm_traits::traits::CliffordBatch::s_many

fn s_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply phase gate `S` to every qubit in `indices`.

source

methodx_manysource

ppvm_traits::traits::CliffordBatch::x_many

fn x_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply Pauli `X` to every qubit in `indices`.

source

methody_manysource

ppvm_traits::traits::CliffordBatch::y_many

fn y_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply Pauli `Y` to every qubit in `indices`.

source

methodz_manysource

ppvm_traits::traits::CliffordBatch::z_many

fn z_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply Pauli `Z` to every qubit in `indices`.

source

classCliffordExtensionssource

ppvm_traits::traits::CliffordExtensions

Rust trait. Additional Clifford gates beyond the minimal set: `S†`, `√X`, `√X†`, `√Y`, `√Y†`, and `CY`.

pub trait CliffordExtensions: Clifford
source

methodcysource

ppvm_traits::traits::CliffordExtensions::cy

fn cy(&mut self, control: usize, target: usize)

Parameters

NameTypeDescription
controlusize
targetusize

Apply `CY` to one `(control, target)` pair.

source

methods_dagsource

ppvm_traits::traits::CliffordExtensions::s_dag

fn s_dag(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply `S†` to one qubit.

source

methodsqrt_xsource

ppvm_traits::traits::CliffordExtensions::sqrt_x

fn sqrt_x(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply `√X` to one qubit.

source

methodsqrt_x_dagsource

ppvm_traits::traits::CliffordExtensions::sqrt_x_dag

fn sqrt_x_dag(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply `(√X)†` to one qubit.

source

methodsqrt_ysource

ppvm_traits::traits::CliffordExtensions::sqrt_y

fn sqrt_y(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply `√Y` to one qubit.

source

methodsqrt_y_dagsource

ppvm_traits::traits::CliffordExtensions::sqrt_y_dag

fn sqrt_y_dag(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply `(√Y)†` to one qubit.

source

methodzcysource

ppvm_traits::traits::CliffordExtensions::zcy

fn zcy(&mut self, control: usize, target: usize)

Parameters

NameTypeDescription
controlusize
targetusize

stim alias for cy.

source

classCliffordExtensionsBatchsource

ppvm_traits::traits::CliffordExtensionsBatch

Rust trait. Batched form of [`CliffordExtensions`].

pub trait CliffordExtensionsBatch: CliffordExtensions + CliffordBatch
source

methodcy_manysource

ppvm_traits::traits::CliffordExtensionsBatch::cy_many

fn cy_many(&mut self, pairs: &[(usize, usize)])

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]

Apply `CY` to every `(control, target)` pair.

source

methods_dag_manysource

ppvm_traits::traits::CliffordExtensionsBatch::s_dag_many

fn s_dag_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply `S†` to every qubit in `indices`.

source

methodsqrt_x_dag_manysource

ppvm_traits::traits::CliffordExtensionsBatch::sqrt_x_dag_many

fn sqrt_x_dag_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply `(√X)†` to every qubit in `indices`.

source

methodsqrt_x_manysource

ppvm_traits::traits::CliffordExtensionsBatch::sqrt_x_many

fn sqrt_x_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply `√X` to every qubit in `indices`.

source

methodsqrt_y_dag_manysource

ppvm_traits::traits::CliffordExtensionsBatch::sqrt_y_dag_many

fn sqrt_y_dag_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply `(√Y)†` to every qubit in `indices`.

source

methodsqrt_y_manysource

ppvm_traits::traits::CliffordExtensionsBatch::sqrt_y_many

fn sqrt_y_many(&mut self, indices: &[usize])

Parameters

NameTypeDescription
indices&amp;[usize]

Apply `√Y` to every qubit in `indices`.

source

classCoefficientsource

ppvm_traits::traits::Coefficient

Rust trait. Numeric coefficient type usable inside a `PauliSum`.

Signature
pub trait Coefficient: PartialEq + Clone + Zero + From<f64> + Neg + Add<f64> + Add<Self> + Sub<f64> + Sub<Self> + Mul<f64> + Mul<Self> + AddAssign<f64> + AddAssign<Self> + MulAssign<f64> + MulAssign<Self> + Sum + Sync + Send

`Coefficient` bundles every arithmetic operation a Pauli-propagation step needs — addition, multiplication, signed multiplication, half, sin/cos, and a `cutoff` predicate used by truncation strategies. The built-in `f64` impl covers the common case; `Complex<f64>` is available when phase tracking is required.

source

methodcutoffsource

ppvm_traits::traits::Coefficient::cutoff

fn cutoff(&self, threshold: f64) -> bool

Parameters

NameTypeDescription
thresholdf64

Returns

bool

Determine whether this coefficient should be cutoff Returns `true`, if the coefficient should be cut, and `false` else.

source

methodhalfsource

ppvm_traits::traits::Coefficient::half

fn half(&self) -> Self

Returns

Self

Divide by two.

source

methodmul_signsource

ppvm_traits::traits::Coefficient::mul_sign

fn mul_sign(&self, sign: i8) -> Self

Parameters

NameTypeDescription
signi8

Returns

Self

Multiply by `sign ∈ {-1, +1}` (encoded as `i8`).

source

methodsin_cossource

ppvm_traits::traits::Coefficient::sin_cos

fn sin_cos(&self) -> (Self, Self)

Returns

(Self, Self)

Return `(sin θ, cos θ)`.

source

classComplexCoefficientsource

ppvm_traits::traits::ComplexCoefficient

Rust trait. A [`Coefficient`] extended with multiplication by a fourth-root-of-unity phase. Used by `PhasedPauliWord`.

pub trait ComplexCoefficient: Coefficient
source

methodmul_phasesource

ppvm_traits::traits::ComplexCoefficient::mul_phase

fn mul_phase(&self, phase: u8) -> Self

Parameters

NameTypeDescription
phaseu8

Returns

Self

multiply by phase encoded as:

signimag
+100
+i01
-110
-i11
source

classCorrelatedLossChannelsource

ppvm_traits::traits::CorrelatedLossChannel

Rust trait. Correlated two-qubit loss channel.

pub trait CorrelatedLossChannel<T: Config>

This is the one place the parameterization is defined; every backend (`ppvm-pauli-sum`, `ppvm-tableau`‘s trajectory, `ppvm-tableau-sum`‘s mixture) and every binding cites it rather than restating it. In the paper’s notation `p = [p_LL, p_LQ, p_LN]`, and `p[1] = p_LQ` is the probability that a named one of the two atoms is lost while the other survives. The two single-loss events are disjoint, so

  • the probability of losing exactly one atom is `2·p[1]`, and
  • the probability that both remain in the qubit subspace — the factor a fully in-subspace observable is scaled by — is `1 − 2·p[1] − p[0]`.

The channel is completely positive exactly on `p[0], p[1] >= 0`, `p[0] + 2·p[1] <= 1`, `p[2] ∈ [0, 1]`; the tableau backends `debug_assert` that region.

source

methodcorrelated_loss_channelsource

ppvm_traits::traits::CorrelatedLossChannel::correlated_loss_channel

Signature
fn correlated_loss_channel(&mut self, addr0: usize, addr1: usize, p: [<T as >::Coeff; 3])

Parameters

NameTypeDescription
addr0usize
addr1usize
p[&lt;T as &gt;::Coeff; 3]

Apply a correlated loss channel to qubits at `addr0` and `addr1`.

The three probabilities are:

  • `p[0]`: The probability of losing both qubits simultaneously when both of them are in the qubit subspace.
  • `p[1]`: The probability of losing a named one of the two qubits when both of them are in the qubit subspace, so losing exactly one has probability `2·p[1]` and the both-present survivor is scaled by `1 − 2·p[1] − p[0]` (which qubit is lost is 50/50).
  • `p[2]`: The probability of losing one qubit when the other one has already been lost prior to the channel.
source

classDepolarizingsource

ppvm_traits::traits::Depolarizing

Rust trait. Single-qubit depolarizing channel.

pub trait Depolarizing<T: Config>
source

methoddepolarize1source

ppvm_traits::traits::Depolarizing::depolarize1

fn depolarize1(&mut self, addr0: usize, p: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
p&lt;T as &gt;::Coeff

Depolarize one qubit with probability `p`.

source

methoddepolarize1_manysource

ppvm_traits::traits::Depolarizing::depolarize1_many

fn depolarize1_many(&mut self, targets: &[usize], p: <T as >::Coeff)

Parameters

NameTypeDescription
targets&amp;[usize]
p&lt;T as &gt;::Coeff

Explicit batched single-qubit depolarizing channel.

source

classDepolarizing2source

ppvm_traits::traits::Depolarizing2

Rust trait. Two-qubit depolarizing channel.

pub trait Depolarizing2<T: Config>
source

methoddepolarize2source

ppvm_traits::traits::Depolarizing2::depolarize2

fn depolarize2(&mut self, addr0: usize, addr1: usize, p: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
addr1usize
p&lt;T as &gt;::Coeff

Depolarize one qubit pair with probability `p`.

source

methoddepolarize2_manysource

ppvm_traits::traits::Depolarizing2::depolarize2_many

Signature
fn depolarize2_many(&mut self, pairs: &[(usize, usize)], p: <T as >::Coeff)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
p&lt;T as &gt;::Coeff

Explicit batched two-qubit depolarizing channel.

source

classHashFinalizesource

ppvm_traits::traits::HashFinalize

Rust trait. Post-processing that a `PauliWord`'s hasher applies to its raw 64-bit digest before it is cached as the map-key hash.

pub trait HashFinalize

The cached value is what `hashbrown` ultimately splits into a bucket index (low bits) and a control-byte tag (top 7 bits). Whether the raw digest is good enough for that split is a property of the hasher, not of the Pauli word: an AES-based hasher such as `gxhash` avalanches well even for an 8-byte key, whereas `FxHasher` — a couple of multiply-rotate rounds — leaves the low bits of a short key highly correlated and needs a fold to fix them.

Keeping this on the hasher is what makes the abstraction correct. An earlier version folded based on storage width alone, which conflated “narrow storage” with “weak hasher” and so wrongly folded `gxhash` too. Here each hasher declares how (if at all) its output must be adjusted, and `PauliWord::rehash` just defers to it. The default is the identity — the right choice for any hasher that already distributes its low bits well — so a custom hasher opts in with a bare `impl HashFinalize for MyHasher {}`.

source

methodfinalize_hashsource

ppvm_traits::traits::HashFinalize::finalize_hash

fn finalize_hash(raw: u64, storage_bytes: usize) -> u64

Parameters

NameTypeDescription
rawu64
storage_bytesusize

Returns

u64

Finalize `raw` (the value returned by `Hasher::finish`) for a key whose backing storage is `storage_bytes` wide per bit-array.

The width is supplied so a hasher can fold only for the short keys that actually need it and pass wider keys through. It is a compile-time constant at every call site (`size_of` of the storage), so any branch on it is monomorphized away.

source

classLossChannelsource

ppvm_traits::traits::LossChannel

Rust trait. Single-qubit loss channel — with probability `p`, mark the qubit as lost (`Pauli::L`).

pub trait LossChannel<T: Config>
source

methodloss_channelsource

ppvm_traits::traits::LossChannel::loss_channel

fn loss_channel(&mut self, addr0: usize, p: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
p&lt;T as &gt;::Coeff

Apply a loss channel to qubit `addr0` with loss probability `p`.

source

classLossyMeasuresource

ppvm_traits::traits::LossyMeasure

Rust trait. Loss-aware Z-basis measurement.

pub trait LossyMeasure
source

methodmeasuresource

ppvm_traits::traits::LossyMeasure::measure

fn measure(&mut self, addr0: usize) -> Option<bool>

Parameters

NameTypeDescription
addr0usize

Returns

Option<bool>

Measure qubit `addr0`. Returns `Some(bit)` for an in-subspace outcome, or `None` if the qubit has been lost.

source

methodmeasure_manysource

ppvm_traits::traits::LossyMeasure::measure_many

fn measure_many(&mut self, targets: &[usize]) -> Vec<Option<bool>>

Parameters

NameTypeDescription
targets&amp;[usize]

Returns

Vec<Option<bool>>

Explicit batched measurement: measure each target in order, returning one result per target.

source

classMeasuresource

ppvm_traits::traits::Measure

Rust trait. Projective Z-basis measurement returning a bare boolean outcome.

pub trait Measure
source

methodmeasuresource

ppvm_traits::traits::Measure::measure

fn measure(&mut self, addr0: usize) -> bool

Parameters

NameTypeDescription
addr0usize

Returns

bool

Measure qubit `addr0` in the computational basis. Returns `true` for outcome `|1⟩`, `false` for `|0⟩`.

source

classPauliErrorsource

ppvm_traits::traits::PauliError

Rust trait. Single-qubit Pauli error channel — apply `X`, `Y`, or `Z` with the three given probabilities.

pub trait PauliError<T: Config>
source

methodpauli_errorsource

ppvm_traits::traits::PauliError::pauli_error

fn pauli_error(&mut self, addr0: usize, p: [<T as >::Coeff; 3])

Parameters

NameTypeDescription
addr0usize
p[&lt;T as &gt;::Coeff; 3]

Apply a Pauli-error channel `[p_x, p_y, p_z]` to one qubit.

source

methodpauli_error_manysource

ppvm_traits::traits::PauliError::pauli_error_many

Signature
fn pauli_error_many(&mut self, targets: &[usize], p: [<T as >::Coeff; 3])

Parameters

NameTypeDescription
targets&amp;[usize]
p[&lt;T as &gt;::Coeff; 3]

Explicit batched Pauli-error channel.

source

methodx_errorsource

ppvm_traits::traits::PauliError::x_error

fn x_error(&mut self, addr0: usize, p: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
p&lt;T as &gt;::Coeff

stim `X_ERROR(p)` — apply X with probability `p` to one qubit.

source

methodx_error_manysource

ppvm_traits::traits::PauliError::x_error_many

fn x_error_many(&mut self, targets: &[usize], p: <T as >::Coeff)

Parameters

NameTypeDescription
targets&amp;[usize]
p&lt;T as &gt;::Coeff

Explicit batched `X_ERROR(p)`.

source

methody_errorsource

ppvm_traits::traits::PauliError::y_error

fn y_error(&mut self, addr0: usize, p: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
p&lt;T as &gt;::Coeff

stim `Y_ERROR(p)` — apply Y with probability `p` to one qubit.

source

methody_error_manysource

ppvm_traits::traits::PauliError::y_error_many

fn y_error_many(&mut self, targets: &[usize], p: <T as >::Coeff)

Parameters

NameTypeDescription
targets&amp;[usize]
p&lt;T as &gt;::Coeff

Explicit batched `Y_ERROR(p)`.

source

methodz_errorsource

ppvm_traits::traits::PauliError::z_error

fn z_error(&mut self, addr0: usize, p: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
p&lt;T as &gt;::Coeff

stim `Z_ERROR(p)` — apply Z with probability `p` to one qubit.

source

methodz_error_manysource

ppvm_traits::traits::PauliError::z_error_many

fn z_error_many(&mut self, targets: &[usize], p: <T as >::Coeff)

Parameters

NameTypeDescription
targets&amp;[usize]
p&lt;T as &gt;::Coeff

Explicit batched `Z_ERROR(p)`.

source

classPauliItersource

ppvm_traits::traits::PauliIter

Rust trait. Iterate over a Pauli word slot-by-slot.

pub trait PauliIter
source

methoditersource

ppvm_traits::traits::PauliIter::iter

fn iter(&self) -> impl Iterator

Returns

impl Iterator

Yield the Pauli symbol at each qubit position, in order.

source

classPauliStoragesource

ppvm_traits::traits::PauliStorage

Rust trait. Backing storage for a `PauliWord` — a fixed-size, `Copy`-able block of bits (typically `[u8; N]` or `[u64; N]`).

Signature
pub trait PauliStorage: BitViewSized + Clone + Copy + Hash + Eq + PartialEq + Send + Sync + Debug + Ord + PartialOrd + Pod

The bytemuck::Pod bound guarantees the storage is a plain-old-data type with no padding and all bit patterns valid, which lets `PauliWord::rehash` view it as a `&[u8]` for fast byte-slice hashing without `unsafe`. Every concrete storage used here (`[u8; N]`, `[u64; N]`) is already `Pod`.

source

classPauliWordTraitsource

ppvm_traits::traits::PauliWordTrait

Rust trait. Word-level Pauli operations. Types implementing this trait automatically gain [`crate::traits::Clifford`] and [`crate::traits::CliffordExtensions`] behavior via blanket impls in the `crate::traits::clifford` module, using `get_lbit` / `get_xbit` / `set_xbit` / `set_zbit` / `rehash` to transform Pauli words.

Signature
pub trait PauliWordTrait: Clone + Hash + Eq + PauliIter + From<String> + Display

The blanket `Clifford` impl applies gates at the bit level of a single Pauli word. X / Y / Z are bit-level no-ops on a Pauli word — they affect phase, not the X/Z bits — so `word.x(i)`, `word.y(i)`, `word.z(i)` are deliberately silent. Phase is tracked separately by `PhasedPauliWord`, which implements `Clifford` manually.

If you need a word representation whose gate behavior is not pure bit manipulation (phase tracking, fused multi-qubit updates, alternative loss semantics), do not implement `PauliWordTrait` on it — define a specialized `Clifford` impl instead, the way `PhasedPauliWord` does. Implementing both `PauliWordTrait` and a custom `impl Clifford for …` for the same type will not compile: the blanket impl overlaps with your custom impl (coherence error), not silently shadows it.

source

methodanticommutes_atsource

ppvm_traits::traits::PauliWordTrait::anticommutes_at

fn anticommutes_at(&self, addr0: usize, pauli: (bool, bool)) -> bool

Parameters

NameTypeDescription
addr0usize
pauli(bool, bool)

Returns

bool

Check if this word anticommutes with a single-qubit Pauli at `addr0`, where `pauli = (xbit, zbit)`.

source

methodgetsource

ppvm_traits::traits::PauliWordTrait::get

fn get(&self, index: usize) -> Pauli

Parameters

NameTypeDescription
indexusize

Returns

Pauli

Pauli symbol at `index`.

source

methodget_lbitsource

ppvm_traits::traits::PauliWordTrait::get_lbit

fn get_lbit(&self, index: usize) -> bool

Parameters

NameTypeDescription
indexusize

Returns

bool

Loss bit at `index` (always `false` for non-lossy implementations).

source

methodget_xbitsource

ppvm_traits::traits::PauliWordTrait::get_xbit

fn get_xbit(&self, index: usize) -> bool

Parameters

NameTypeDescription
indexusize

Returns

bool

X bit at `index`.

source

methodget_zbitsource

ppvm_traits::traits::PauliWordTrait::get_zbit

fn get_zbit(&self, index: usize) -> bool

Parameters

NameTypeDescription
indexusize

Returns

bool

Z bit at `index`.

source

methodissource

ppvm_traits::traits::PauliWordTrait::is

fn is(&self, index: usize, pauli: Pauli) -> bool

Parameters

NameTypeDescription
indexusize
pauliPauli

Returns

bool

Quick check: is the slot at `index` equal to `pauli`?

source

methodloss_weightsource

ppvm_traits::traits::PauliWordTrait::loss_weight

fn loss_weight(&self) -> usize

Returns

usize

Number of slots marked as lost; always `0` for non-lossy variants.

source

methodn_qubitssource

ppvm_traits::traits::PauliWordTrait::n_qubits

fn n_qubits(&self) -> usize

Returns

usize

Number of qubits.

source

methodnewsource

ppvm_traits::traits::PauliWordTrait::new

fn new(nqubits: usize) -> Self

Parameters

NameTypeDescription
nqubitsusize

Returns

Self

Construct an identity word over `nqubits` qubits.

source

methodrehashsource

ppvm_traits::traits::PauliWordTrait::rehash

fn rehash(&mut self)

Recompute the cached hash. Call after batch mutations.

source

methodsetsource

ppvm_traits::traits::PauliWordTrait::set

fn set(&mut self, index: usize, pauli: Pauli) -> &mut Self

Parameters

NameTypeDescription
indexusize
pauliPauli

Returns

&mut Self

Set the slot at `index` to `pauli`, in place. Returns `&mut self` for chaining.

source

methodset_newsource

ppvm_traits::traits::PauliWordTrait::set_new

fn set_new(&self, index: usize, pauli: Pauli) -> Self

Parameters

NameTypeDescription
indexusize
pauliPauli

Returns

Self

Return a clone with the slot at `index` set to `pauli`.

source

methodset_xbitsource

ppvm_traits::traits::PauliWordTrait::set_xbit

fn set_xbit(&mut self, index: usize, value: bool)

Parameters

NameTypeDescription
indexusize
valuebool

Set the X bit at `index`.

source

methodset_zbitsource

ppvm_traits::traits::PauliWordTrait::set_zbit

fn set_zbit(&mut self, index: usize, value: bool)

Parameters

NameTypeDescription
indexusize
valuebool

Set the Z bit at `index`.

source

methodweightsource

ppvm_traits::traits::PauliWordTrait::weight

fn weight(&self) -> usize

Returns

usize

Number of non-identity slots (counts `X`, `Y`, `Z`, and — for lossy variants — `L`).

source

classProjectionsource

ppvm_traits::traits::Projection

Rust trait. Projective Z-basis projectors `|0⟩⟨0|` and `|1⟩⟨1|`.

pub trait Projection
source

methodp0source

ppvm_traits::traits::Projection::p0

fn p0(&mut self, pos: usize)

Parameters

NameTypeDescription
posusize

Project qubit `pos` onto `|0⟩`.

source

methodp1source

ppvm_traits::traits::Projection::p1

fn p1(&mut self, pos: usize)

Parameters

NameTypeDescription
posusize

Project qubit `pos` onto `|1⟩`.

source

classResetsource

ppvm_traits::traits::Reset

Rust trait. Reset one qubit to a computational/Pauli basis state.

pub trait Reset: Clifford + CliffordExtensions
source

methodresetsource

ppvm_traits::traits::Reset::reset

fn reset(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Reset one qubit to `|0⟩` (stim `R`/`RZ`).

source

methodreset_manysource

ppvm_traits::traits::Reset::reset_many

fn reset_many(&mut self, targets: &[usize])

Parameters

NameTypeDescription
targets&amp;[usize]

Explicit batched reset to `|0⟩`.

source

methodreset_xsource

ppvm_traits::traits::Reset::reset_x

fn reset_x(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

stim `RX` — reset to `|+⟩`.

source

methodreset_x_manysource

ppvm_traits::traits::Reset::reset_x_many

fn reset_x_many(&mut self, targets: &[usize])

Parameters

NameTypeDescription
targets&amp;[usize]

Explicit batched `RX`.

source

methodreset_ysource

ppvm_traits::traits::Reset::reset_y

fn reset_y(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

stim `RY` — reset to `|i⟩`.

source

methodreset_y_manysource

ppvm_traits::traits::Reset::reset_y_many

fn reset_y_many(&mut self, targets: &[usize])

Parameters

NameTypeDescription
targets&amp;[usize]

Explicit batched `RY`.

source

methodreset_zsource

ppvm_traits::traits::Reset::reset_z

fn reset_z(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

stim `RZ` alias — reset to `|0⟩`.

source

methodreset_z_manysource

ppvm_traits::traits::Reset::reset_z_many

fn reset_z_many(&mut self, targets: &[usize])

Parameters

NameTypeDescription
targets&amp;[usize]

Explicit batched `RZ` alias.

source

classResetLossChannelsource

ppvm_traits::traits::ResetLossChannel

Rust trait. Reset the loss bit on a qubit — used to model a re-cooling / re-loading event that brings a previously-lost atom back.

pub trait ResetLossChannel<T: Config>
source

methodreset_loss_channelsource

ppvm_traits::traits::ResetLossChannel::reset_loss_channel

fn reset_loss_channel(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Clear the loss bit at `addr0`.

source

classRotXYsource

ppvm_traits::traits::RotXY

Rust trait. Rotation about an axis in the x/y plane: `R(axis_angle, θ) = exp(-i θ/2 · (cos(axis_angle)·X + sin(axis_angle)·Y))`.

pub trait RotXY<T: Config>

The in-plane axis is `X` rotated about `Z` by `axis_angle`, so `R(axis_angle, θ) = RZ(axis_angle)·RX(θ)·RZ(−axis_angle)`.

source

methodrsource

ppvm_traits::traits::RotXY::r

Signature
fn r(&mut self, addr0: usize, axis_angle: <T as >::Coeff, theta: <T as >::Coeff)

Parameters

NameTypeDescription
addr0usize
axis_angle&lt;T as &gt;::Coeff
theta&lt;T as &gt;::Coeff

`R(axis_angle, θ)` on qubit `addr0`.

source

classRotationOnesource

ppvm_traits::traits::RotationOne

Rust trait. Single-qubit Pauli rotations `exp(-i θ/2 · P)`.

pub trait RotationOne<T: Config>
source

methodrotate_1source

ppvm_traits::traits::RotationOne::rotate_1

fn rotate_1(&mut self, axis: Pauli, addr0: usize, theta: <T as >::Coeff)

Parameters

NameTypeDescription
axisPauli
addr0usize
theta&lt;T as &gt;::Coeff

Rotate about `axis` (one of `X`, `Y`, `Z`) by angle `theta`.

source

methodrxsource

ppvm_traits::traits::RotationOne::rx

fn rx(&mut self, addr0: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
addr0usize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`RX(θ)` on one qubit.

source

methodrx_manysource

ppvm_traits::traits::RotationOne::rx_many

Signature
fn rx_many(&mut self, targets: &[usize], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
targets&amp;[usize]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched `RX(θ)`.

source

methodrysource

ppvm_traits::traits::RotationOne::ry

fn ry(&mut self, addr0: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
addr0usize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`RY(θ)` on one qubit.

source

methodry_manysource

ppvm_traits::traits::RotationOne::ry_many

Signature
fn ry_many(&mut self, targets: &[usize], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
targets&amp;[usize]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched `RY(θ)`.

source

methodrzsource

ppvm_traits::traits::RotationOne::rz

fn rz(&mut self, addr0: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
addr0usize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`RZ(θ)` on one qubit.

source

methodrz_manysource

ppvm_traits::traits::RotationOne::rz_many

Signature
fn rz_many(&mut self, targets: &[usize], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
targets&amp;[usize]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched `RZ(θ)`.

source

classRotationTwosource

ppvm_traits::traits::RotationTwo

Rust trait. Two-qubit Pauli rotations, generated by `P_a ⊗ P_b` for any pair of non-identity Paulis. Provides the named convenience methods `rxx`, `rxy`, …, `rzz` on top of the generic [`rotate_2`].

pub trait RotationTwo<T: Config>
source

methodrotate_2source

ppvm_traits::traits::RotationTwo::rotate_2

Signature
fn rotate_2(&mut self, axis_a: [u8; 2], axis_b: [u8; 2], a: usize, b: usize, theta: <T as >::Coeff)

Parameters

NameTypeDescription
axis_a[u8; 2]
axis_b[u8; 2]
ausize
busize
theta&lt;T as &gt;::Coeff

Two-qubit Pauli rotation: `exp(-i * theta/2 * P_a ⊗ P_b)`.

Each axis is encoded as `[x, z]` bits: `[0,0]` = I, `[1,0]` = X, `[0,1]` = Z, `[1,1]` = Y.

source

methodrxxsource

ppvm_traits::traits::RotationTwo::rxx

fn rxx(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · X_a X_b)`.

source

methodrxx_manysource

ppvm_traits::traits::RotationTwo::rxx_many

Signature
fn rxx_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`rxx`].

source

methodrxysource

ppvm_traits::traits::RotationTwo::rxy

fn rxy(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · X_a Y_b)`.

source

methodrxy_manysource

ppvm_traits::traits::RotationTwo::rxy_many

Signature
fn rxy_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`rxy`].

source

methodrxzsource

ppvm_traits::traits::RotationTwo::rxz

fn rxz(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · X_a Z_b)`.

source

methodrxz_manysource

ppvm_traits::traits::RotationTwo::rxz_many

Signature
fn rxz_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`rxz`].

source

methodryxsource

ppvm_traits::traits::RotationTwo::ryx

fn ryx(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · Y_a X_b)`.

source

methodryx_manysource

ppvm_traits::traits::RotationTwo::ryx_many

Signature
fn ryx_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`ryx`].

source

methodryysource

ppvm_traits::traits::RotationTwo::ryy

fn ryy(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · Y_a Y_b)`.

source

methodryy_manysource

ppvm_traits::traits::RotationTwo::ryy_many

Signature
fn ryy_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`ryy`].

source

methodryzsource

ppvm_traits::traits::RotationTwo::ryz

fn ryz(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · Y_a Z_b)`.

source

methodryz_manysource

ppvm_traits::traits::RotationTwo::ryz_many

Signature
fn ryz_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`ryz`].

source

methodrzxsource

ppvm_traits::traits::RotationTwo::rzx

fn rzx(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · Z_a X_b)`.

source

methodrzx_manysource

ppvm_traits::traits::RotationTwo::rzx_many

Signature
fn rzx_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`rzx`].

source

methodrzysource

ppvm_traits::traits::RotationTwo::rzy

fn rzy(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · Z_a Y_b)`.

source

methodrzy_manysource

ppvm_traits::traits::RotationTwo::rzy_many

Signature
fn rzy_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`rzy`].

source

methodrzzsource

ppvm_traits::traits::RotationTwo::rzz

fn rzz(&mut self, a: usize, b: usize, theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
ausize
busize
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

`exp(-i θ/2 · Z_a Z_b)`.

source

methodrzz_manysource

ppvm_traits::traits::RotationTwo::rzz_many

Signature
fn rzz_many(&mut self, pairs: &[(usize, usize)], theta: impl Into<<T as >::Coeff>)

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
thetaimpl Into&lt;&lt;T as &gt;::Coeff&gt;

Explicit batched form of [`rzz`].

source

classStrategysource

ppvm_traits::traits::Strategy

Rust trait. A truncation policy applied to a `PauliSum` during Pauli propagation.

pub trait Strategy: Default + Clone + Copy

The strategy controls two things: the initial capacity allocated for the underlying map (estimating how many Pauli paths the simulation is expected to generate) and the cut applied when truncate is called explicitly. Implementations include NoStrategy, the coefficient-magnitude threshold, the max-Pauli-weight bound, etc.

source

methodcapacitysource

ppvm_traits::traits::Strategy::capacity

fn capacity(&self, n_qubits: usize) -> usize

Parameters

NameTypeDescription
n_qubitsusize

Returns

usize

Given the number of qubits, predict the initial capacity of the map. Ideally this is about guessing the maximum Pauli paths will be generated during the computation, the more precise the better.

source

methodtruncatesource

ppvm_traits::traits::Strategy::truncate

fn truncate<S, V, H, M, W>(&self, map: &mut M)

Parameters

NameTypeDescription
map&amp;mut M

Drop entries from `map` that fall outside this strategy’s policy.

source

classTGatesource

ppvm_traits::traits::TGate

Rust trait. The non-Clifford `T` gate and its adjoint.

pub trait TGate<T: Config>

`T = diag(1, e^{iπ/4})`. Implemented by the simulator backends; see the example in `ppvm_tableau`.

source

methodtsource

ppvm_traits::traits::TGate::t

fn t(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply `T` (`diag(1, e^{iπ/4})`) to one qubit.

source

methodt_dagsource

ppvm_traits::traits::TGate::t_dag

fn t_dag(&mut self, addr0: usize)

Parameters

NameTypeDescription
addr0usize

Apply `T†` to one qubit.

source

methodt_dag_manysource

ppvm_traits::traits::TGate::t_dag_many

fn t_dag_many(&mut self, targets: &[usize])

Parameters

NameTypeDescription
targets&amp;[usize]

Explicit batched `T†`.

source

methodt_manysource

ppvm_traits::traits::TGate::t_many

fn t_many(&mut self, targets: &[usize])

Parameters

NameTypeDescription
targets&amp;[usize]

Explicit batched `T`.

source

classTracesource

ppvm_traits::traits::Trace

Rust trait. Trait for computing `trace(self * RHS)`.

pub trait Trace<'a, RHS: 'a>

Associated items

NameTypeDescription
Outputtype Outputassociated type. Numeric output of the trace.

If a type implements `Trace`, a corresponding `TraceBy` implementation is also provided automatically.

source

methodtracesource

ppvm_traits::traits::Trace::trace

fn trace(&'a self, value: &'a RHS) -> <Self as >::Output

Parameters

NameTypeDescription
value&amp;'a RHS

Returns

<Self as >::Output

Compute `tr(self · value)`.

source

classTwoQubitPauliErrorsource

ppvm_traits::traits::TwoQubitPauliError

Rust trait. Two-qubit Pauli error channel.

pub trait TwoQubitPauliError<T: Config>
source

methodtwo_qubit_pauli_errorsource

ppvm_traits::traits::TwoQubitPauliError::two_qubit_pauli_error

Signature
fn two_qubit_pauli_error(&mut self, addr0: usize, addr1: usize, p: [<T as >::Coeff; 15])

Parameters

NameTypeDescription
addr0usize
addr1usize
p[&lt;T as &gt;::Coeff; 15]

Apply a two-qubit Pauli-error channel to one pair. Probabilities are given in the order: `{IX, IY, IZ, XI, XX, XY, XZ, YI, YX, YY, YZ, ZI, ZX, ZY, ZZ}`.

source

methodtwo_qubit_pauli_error_manysource

ppvm_traits::traits::TwoQubitPauliError::two_qubit_pauli_error_many

Signature
fn two_qubit_pauli_error_many(&mut self, pairs: &[(usize, usize)], p: [<T as >::Coeff; 15])

Parameters

NameTypeDescription
pairs&amp;[(usize, usize)]
p[&lt;T as &gt;::Coeff; 15]

Explicit batched two-qubit Pauli-error channel.

source

classU3Gatesource

ppvm_traits::traits::U3Gate

Rust trait. The general single-qubit `U3(θ, φ, λ)` gate.

pub trait U3Gate<T: Config>
source

methodu3source

ppvm_traits::traits::U3Gate::u3

Signature
fn u3(&mut self, addr: usize, theta: <T as >::Coeff, phi: <T as >::Coeff, lambda: <T as >::Coeff)

Parameters

NameTypeDescription
addrusize
theta&lt;T as &gt;::Coeff
phi&lt;T as &gt;::Coeff
lambda&lt;T as &gt;::Coeff

Apply `U3(θ, φ, λ)` to qubit `addr`.

source