Skip to content

ppvm_stim::executor

executor

ppvm_stim::executor

functionexecutesource

ppvm_stim::executor::execute

Signature
pub fn execute<T, I, C>(program: &ExtendedProgram, tab: &mut GeneralizedTableau<T, I, C>) -> Result<Vec<Option<bool>>, ExecError>

Parameters

NameTypeDescription
program&amp;ExtendedProgram
tab&amp;mut GeneralizedTableau&lt;T, I, C&gt;

Returns

Result<Vec<Option<bool>>, ExecError>

Validate and execute a parsed extended Stim program against a tableau, returning the per-measurement results in circuit order.

source

functionexecute_validatedsource

ppvm_stim::executor::execute_validated

Signature
pub fn execute_validated<T, I, C>(instructions: &[ExtendedInstruction], tab: &mut GeneralizedTableau<T, I, C>, results: &mut Vec<Option<bool>>)

Parameters

NameTypeDescription
instructions&amp;[ExtendedInstruction]
tab&amp;mut GeneralizedTableau&lt;T, I, C&gt;
results&amp;mut Vec&lt;Option&lt;bool&gt;&gt;

Dispatch a slice of validated instructions onto a tableau, appending measurement bits to `results`. Skips validation — the caller is responsible for having run validate on the originating program. Used by execute / sample internally and by the Python `tab.run()` path where `StimProgram` already cached the validate step.

source

functionsamplesource

ppvm_stim::executor::sample

Signature
pub fn sample<T, I, C, F>(program: &ExtendedProgram, num_shots: usize, make_tableau: F) -> Result<Vec<Vec<Option<bool>>>, ExecError>

Parameters

NameTypeDescription
program&amp;ExtendedProgram
num_shotsusize
make_tableauF

Returns

Result<Vec<Vec<Option<bool>>>, ExecError>

Execute many shots, building a fresh tableau for shot `i` via `make_tableau(i)`.

Without the `rayon` feature execution is always serial. Enable the `rayon` feature to get a version that can dispatch to parallel execution for large batches. Use sample_serial to force serial execution regardless of the feature.

source

functionsample_serialsource

ppvm_stim::executor::sample_serial

Signature
pub fn sample_serial<T, I, C, F>(program: &ExtendedProgram, num_shots: usize, make_tableau: F) -> Result<Vec<Vec<Option<bool>>>, ExecError>

Parameters

NameTypeDescription
program&amp;ExtendedProgram
num_shotsusize
make_tableauF

Returns

Result<Vec<Vec<Option<bool>>>, ExecError>

Execute many shots serially, building a fresh tableau for shot `i` via `make_tableau(i)`.

The shot index lets callers derive a deterministic per-shot seed (e.g. `seed + i`) so results are independent of evaluation order — the same factory then yields identical results from `sample_parallel` (when the `rayon` feature is enabled).

source

functionsample_serial_validatedsource

ppvm_stim::executor::sample_serial_validated

Signature
pub fn sample_serial_validated<T, I, C, F>(instructions: &[ExtendedInstruction], measurement_count: usize, num_shots: usize, make_tableau: F) -> Vec<Vec<Option<bool>>>

Parameters

NameTypeDescription
instructions&amp;[ExtendedInstruction]
measurement_countusize
num_shotsusize
make_tableauF

Returns

Vec<Vec<Option<bool>>>

Like sample_serial but skips validation — call only when the program has already been validated (e.g. via validate).

source

functionsample_validatedsource

ppvm_stim::executor::sample_validated

Signature
pub fn sample_validated<T, I, C, F>(instructions: &[ExtendedInstruction], measurement_count: usize, num_shots: usize, make_tableau: F) -> Vec<Vec<Option<bool>>>

Parameters

NameTypeDescription
instructions&amp;[ExtendedInstruction]
measurement_countusize
num_shotsusize
make_tableauF

Returns

Vec<Vec<Option<bool>>>

Like sample but skips validation — call only when the program has already been validated (e.g. via validate). Without the `rayon` feature this always runs serially.

source