pub struct FaultScopeSimulator { /* private fields */ }Expand description
Compiled forward bit-packed simulator.
This is the Rust core counterpart of the Python
FaultScopeSimulator API. It owns the canonical compact sampler program and
can run batches without depending on PyO3 or Python callback objects. Custom
decoder and loss callback integration remains in the Python binding crate.
Implementations§
Source§impl FaultScopeSimulator
impl FaultScopeSimulator
Sourcepub fn new(
circuit: Circuit,
observables: Vec<LogicalObservable>,
) -> NpResult<Self>
pub fn new( circuit: Circuit, observables: Vec<LogicalObservable>, ) -> NpResult<Self>
Compile a typed circuit into the bit-packed forward simulator.
Sourcepub fn from_circuit_ref(
circuit: &Circuit,
observables: Vec<LogicalObservable>,
) -> NpResult<Self>
pub fn from_circuit_ref( circuit: &Circuit, observables: Vec<LogicalObservable>, ) -> NpResult<Self>
Compile a borrowed typed circuit without cloning its operation tree.
Sourcepub fn program(&self) -> &SamplerProgram
pub fn program(&self) -> &SamplerProgram
Return the immutable compiled sampler program.
Sourcepub fn run_batch(
&self,
shots: usize,
seed: Option<u64>,
record_events: bool,
) -> NpResult<RuntimeState>
pub fn run_batch( &self, shots: usize, seed: Option<u64>, record_events: bool, ) -> NpResult<RuntimeState>
Run a batch of forward trajectories.
Set record_events when hotspot estimation needs per-location event
masks. seed=None uses the core default deterministic seed.
Sourcepub fn estimate_from_loss(
&self,
state: &RuntimeState,
loss_mask: &Mask,
baseline: Option<f64>,
top_k: usize,
) -> NpResult<HotspotEstimate>
pub fn estimate_from_loss( &self, state: &RuntimeState, loss_mask: &Mask, baseline: Option<f64>, top_k: usize, ) -> NpResult<HotspotEstimate>
Estimate hotspot scores from an externally supplied loss mask.
This method is useful when a decoder or loss function is implemented outside of the core crate. The returned estimate is fully aggregated in Rust. The state must come from this compiled program (or one of its clones) and must have event recording enabled.