ppvm_pauli_sum::strategy
strategy¶
ppvm_pauli_sum::strategy
classCoefficientThreshold¶source
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 CoefficientThresholdFields
| Name | Type | Description |
|---|---|---|
0 | f64 |
Examples
Section titled “Examples”``` 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 ```
sourceclassCombinedStrategy¶source
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
| Name | Type | Description |
|---|---|---|
0 | S1 | |
1 | S2 |
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”.
sourceclassMaxLossWeight¶source
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).
classMaxPauliWeight¶source
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 MaxPauliWeightFields
| Name | Type | Description |
|---|---|---|
0 | usize |
Examples
Section titled “Examples”``` 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); ```
sourcemethodmax_weight¶source
ppvm_pauli_sum::strategy::MaxPauliWeight::max_weight