Skip to main content

ReplayEngine

Struct ReplayEngine 

Source
pub struct ReplayEngine { /* private fields */ }
Expand description

Engine that records execution parameters and replays simulations for reproducibility verification.

Implementations§

Source§

impl ReplayEngine

Source

pub fn new() -> Self

Create a new ReplayEngine using the crate version from Cargo.toml.

Source

pub fn record_execution( &self, circuit: &QuantumCircuit, config: &SimConfig, shots: u32, ) -> ExecutionRecord

Capture all parameters needed to deterministically replay a simulation.

The returned ExecutionRecord is self-contained: given the same circuit, the record holds enough information to reproduce the exact measurement outcomes.

Source

pub fn replay(&self, record: &ExecutionRecord, circuit: &QuantumCircuit) -> bool

Replay a simulation using the parameters in record and verify that the measurement outcomes match a fresh run.

Returns true when the replayed results are identical to a reference run seeded with the same parameters. Both runs use the exact same seed so the RNG sequences must agree.

Source

pub fn circuit_hash(circuit: &QuantumCircuit) -> [u8; 32]

Compute a deterministic 32-byte hash of a circuit’s structure.

The hash captures, for every gate: its type discriminant, the qubit indices it acts on, and any continuous parameters (rotation angles). Two circuits with the same gate sequence produce the same hash.

Uses DefaultHasher (SipHash-based) run twice with different seeds to fill 32 bytes.

Trait Implementations§

Source§

impl Default for ReplayEngine

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V