Skip to main content

Strategy

Trait Strategy 

Source
pub trait Strategy:
    Default
    + Clone
    + Copy {
    // Required methods
    fn capacity(&self, n_qubits: usize) -> usize;
    fn truncate<S, V, H, M, W>(&self, map: &mut M)
       where S: PauliStorage,
             V: Coefficient,
             H: BuildHasher + Clone + Default,
             W: PauliWordTrait,
             M: ACMap<S, V, H, W>;
}
Expand description

A truncation policy applied to a PauliSum during Pauli propagation.

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.

Required Methods§

Source

fn capacity(&self, n_qubits: usize) -> 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

fn truncate<S, V, H, M, W>(&self, map: &mut M)
where S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait, M: ACMap<S, V, H, W>,

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Strategy for CoefficientThreshold

Source§

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

Source§

fn truncate<S, V, H, M, W>(&self, map: &mut M)
where S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait, M: ACMap<S, V, H, W>,

Source§

impl Strategy for MaxLossWeight

Source§

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

Source§

fn truncate<S, V, H, M, W>(&self, map: &mut M)
where S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, M: ACMap<S, V, H, W>, W: PauliWordTrait,

Source§

impl Strategy for MaxPauliWeight

Source§

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

Source§

fn truncate<S, V, H, M, W>(&self, map: &mut M)
where S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait, M: ACMap<S, V, H, W>,

Source§

impl<S1, S2> Strategy for CombinedStrategy<S1, S2>
where S1: Strategy, S2: Strategy,

Source§

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

Source§

fn truncate<S, V, H, M, W>(&self, map: &mut M)
where S: PauliStorage, V: Coefficient, H: BuildHasher + Clone + Default, W: PauliWordTrait, M: ACMap<S, V, H, W>,

Implementors§