pub struct DetectorSampler { /* private fields */ }Expand description
Detector sampler for efficient batch sampling
Implementations§
Source§impl DetectorSampler
impl DetectorSampler
Sourcepub fn new(compiled: CompiledStimCircuit) -> Self
pub fn new(compiled: CompiledStimCircuit) -> Self
Create a new detector sampler from a compiled circuit
Sourcepub fn compile(circuit: &StimCircuit) -> Result<Self>
pub fn compile(circuit: &StimCircuit) -> Result<Self>
Compile and create a sampler from a circuit
Sourcepub fn compile_with_dem(circuit: &StimCircuit) -> Result<Self>
pub fn compile_with_dem(circuit: &StimCircuit) -> Result<Self>
Compile with DEM for faster sampling
Sourcepub fn sample(&self) -> Result<ExecutionResult>
pub fn sample(&self) -> Result<ExecutionResult>
Sample once, returning full execution result
Sourcepub fn sample_detectors(&self) -> Result<Vec<bool>>
pub fn sample_detectors(&self) -> Result<Vec<bool>>
Sample once, returning only detector values
Sourcepub fn sample_measurements(&self) -> Result<Vec<bool>>
pub fn sample_measurements(&self) -> Result<Vec<bool>>
Sample once, returning only measurement values
Sourcepub fn sample_batch(&self, num_shots: usize) -> Result<Vec<ExecutionResult>>
pub fn sample_batch(&self, num_shots: usize) -> Result<Vec<ExecutionResult>>
Sample batch with full results
Sourcepub fn sample_batch_detectors(&self, num_shots: usize) -> Result<Vec<Vec<bool>>>
pub fn sample_batch_detectors(&self, num_shots: usize) -> Result<Vec<Vec<bool>>>
Sample batch, returning only detector values
Sourcepub fn sample_batch_detectors_packed(
&self,
num_shots: usize,
) -> Result<Vec<Vec<u8>>>
pub fn sample_batch_detectors_packed( &self, num_shots: usize, ) -> Result<Vec<Vec<u8>>>
Sample batch, returning bit-packed detector values
Sourcepub fn sample_batch_measurements_packed(
&self,
num_shots: usize,
) -> Result<Vec<Vec<u8>>>
pub fn sample_batch_measurements_packed( &self, num_shots: usize, ) -> Result<Vec<Vec<u8>>>
Sample batch, returning bit-packed measurement values
Sourcepub fn sample_statistics(&self, num_shots: usize) -> Result<SampleStatistics>
pub fn sample_statistics(&self, num_shots: usize) -> Result<SampleStatistics>
Get statistics from samples
Sourcepub fn num_detectors(&self) -> usize
pub fn num_detectors(&self) -> usize
Get number of detectors
Sourcepub fn num_measurements(&self) -> usize
pub fn num_measurements(&self) -> usize
Get number of measurements
Sourcepub fn num_qubits(&self) -> usize
pub fn num_qubits(&self) -> usize
Get number of qubits
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DetectorSampler
impl RefUnwindSafe for DetectorSampler
impl Send for DetectorSampler
impl Sync for DetectorSampler
impl Unpin for DetectorSampler
impl UnwindSafe for DetectorSampler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.