pub struct SimulateProgram<'p, SeedState> { /* private fields */ }Expand description
Builder for running a DynamicProgram, the counterpart of
Simulate for programs with runtime control flow.
Implementations§
Source§impl<'p, SeedState> SimulateProgram<'p, SeedState>
impl<'p, SeedState> SimulateProgram<'p, SeedState>
pub fn backend(self, kind: BackendKind) -> Self
Sourcepub fn max_steps(self, max_steps: u64) -> Self
pub fn max_steps(self, max_steps: u64) -> Self
Blocks one shot may run before it stops with
PrismError::StepLimit, one million by default. Every block entered
counts, the empty test at the head of a loop included.
Source§impl<'p> SimulateProgram<'p, Unseeded>
impl<'p> SimulateProgram<'p, Unseeded>
pub fn seed(self, seed: u64) -> SimulateProgram<'p, Seeded>
Source§impl SimulateProgram<'_, Seeded>
impl SimulateProgram<'_, Seeded>
Sourcepub fn shots(self, num_shots: usize) -> Result<ShotsResult>
pub fn shots(self, num_shots: usize) -> Result<ShotsResult>
Run num_shots shots and collect each one’s classical bits.
§Errors
PrismError::StepLimit when a shot runs past the step bound,
PrismError::IncompatibleBackend for a backend that cannot walk the
graph or hold the program’s gates, and anything a block’s execution
raises.
Sourcepub fn sample_counts(self, num_shots: usize) -> Result<CountsResult>
pub fn sample_counts(self, num_shots: usize) -> Result<CountsResult>
Run num_shots shots and count each distinct outcome.
§Errors
Same conditions as SimulateProgram::shots.
Auto Trait Implementations§
impl<'p, SeedState> !RefUnwindSafe for SimulateProgram<'p, SeedState>
impl<'p, SeedState> !UnwindSafe for SimulateProgram<'p, SeedState>
impl<'p, SeedState> Freeze for SimulateProgram<'p, SeedState>where
SeedState: Freeze,
impl<'p, SeedState> Send for SimulateProgram<'p, SeedState>where
SeedState: Send,
impl<'p, SeedState> Sync for SimulateProgram<'p, SeedState>where
SeedState: Sync,
impl<'p, SeedState> Unpin for SimulateProgram<'p, SeedState>where
SeedState: Unpin,
impl<'p, SeedState> UnsafeUnpin for SimulateProgram<'p, SeedState>where
SeedState: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T, U> Imply<T> for U
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 more