Skip to content

ppvm_pauli_sum::strategy

strategy

ppvm_pauli_sum::strategy

classCoefficientThresholdsource

ppvm_pauli_sum::strategy::CoefficientThreshold

Bases: Debug, Clone, Copy, StructuralPartialEq, PartialEq, Default, Strategy

Rust struct. Drop terms whose coefficient magnitude falls below the given threshold. Defaults to `1e-12`.

pub struct CoefficientThreshold

Fields

NameTypeDescription
0f64

``` use ppvm_pauli_sum::prelude::*; use ppvm_pauli_sum::strategy::CoefficientThreshold;

let strict = CoefficientThreshold(1e-6); let mut state: PauliSum<config::indexmap::ByteFxHashF64<1, CoefficientThreshold>> = PauliSum::builder().n_qubits(2).strategy(strict).build(); state += (“ZZ”, 1.0); state += (“XX”, 1e-9); // below threshold state.truncate(); assert_eq!(state.len(), 1); // the XX term was dropped ```

source

classCombinedStrategysource

ppvm_pauli_sum::strategy::CombinedStrategy

Bases: Debug, Clone, Copy, StructuralPartialEq, PartialEq, Default, Strategy

Rust struct. Two strategies run in sequence: `S1` then `S2`.

pub struct CombinedStrategy<S1: Strategy, S2: Strategy>

Fields

NameTypeDescription
0S1
1S2

The capacity hint is the smaller of the two; truncation applies both policies in order, so use this when you want, e.g., “drop by coefficient threshold and cap maximum Pauli weight”.

source

classMaxLossWeightsource

ppvm_pauli_sum::strategy::MaxLossWeight

Bases: Debug, Clone, Copy, StructuralPartialEq, PartialEq, Eq, Default, Strategy

Rust struct. Drop terms whose loss weight (number of lost qubits) exceeds the given bound. Only meaningful for [`LossyPauliWord`](ppvm_pauli_word::loss::LossyPauliWord).

pub struct MaxLossWeight

Fields

NameTypeDescription
0usize
source

classMaxPauliWeightsource

ppvm_pauli_sum::strategy::MaxPauliWeight

Bases: Debug, Clone, Copy, StructuralPartialEq, PartialEq, Eq, Default, Strategy

Rust struct. Drop terms whose Pauli weight (number of non-identity slots) exceeds the given bound.

pub struct MaxPauliWeight

Fields

NameTypeDescription
0usize

``` use ppvm_pauli_sum::prelude::*; use ppvm_pauli_sum::strategy::MaxPauliWeight;

// Keep only weight-1 terms. let strat = MaxPauliWeight(1); let mut state: PauliSum<config::indexmap::ByteFxHashF64<1, MaxPauliWeight>> = PauliSum::builder().n_qubits(3).strategy(strat).build(); state += (“XII”, 1.0); // weight 1, kept state += (“XYI”, 1.0); // weight 2, dropped state.truncate(); assert_eq!(state.len(), 1); ```

source

methodmax_weightsource

ppvm_pauli_sum::strategy::MaxPauliWeight::max_weight

pub fn max_weight(&self) -> usize

Returns

usize

Maximum Pauli weight retained.

source