Arcelyth/mqc/simulator does not have a README file

    DensityMatrix

    A quantum state represented by a complex density matrix. For a Bell pair, the wire dimensions are [2, 2]. The basis order is 00, 01, 10, 11.

    The real and imaginary arrays store entries in row-major order. The imaginary entries are all zero in this example. For a matrix of dimension d, the flat index is

    DensityMatrixState

    Mutable density-matrix execution data.

    ExecutionResult

    A backend's result for one or more experiments, in submission order.

    ExecutionStatus

    Completion of one experiment or a whole batch.

    ExperimentResult

    One execution's result.

    ResultData

    Named output data from one experiment. Only requested outputs are stored.

    SimulationStateBase

    Common data for backends that need randomness and measurement records.

    StateVector

    A quantum state represented by a complex state vector. For a Bell pair, the wire dimensions are [2, 2]. The basis order is 00, 01, 10, 11.

    The real array stores the four amplitudes shown above. The imaginary array contains zeros.

    StateVectorState

    Mutable state-vector execution data.

    Sampler

    pub(open) trait Sampler {
    fn run(Self,
    Program
    , repetitions? : Int) -> SamplerResult raise
    QError

    }

    A backend that samples a compiled program.

    SimulationState

    pub(open) trait SimulationState {
    fn dim(Self) -> Array[UInt]
    fn apply(Self,
    Instruction
    [Int]) -> Unit raise
    QError

    fn copy(Self) -> Self
    fn records(Self) ->
    Array3
    [Int]
    fn validate(Self) -> Unit raise
    QError

    }

    Mutable backend state. Copies must own independent mutable storage.

    DensityMatrixSimulator

    type DensityMatrixSimulator

    DensityMatrixSimulator::name

    DensityMatrixSimulator::new

    DensityMatrixSimulator::run

    Terminal measurements reuse one final distribution. Other circuits run once per shot.

    DensityMatrixSimulator::simulate

    Execute one trial, optionally starting from a copy of a supplied mixed state.

    ParamBinding

    type ParamBinding

    Binds parameters with values.

    ParamBinding::empty

    fn ParamBinding::empty() -> ParamBinding

    SamplerResult

    pub(all) struct SamplerResult {
    params : ParamBinding
    records :
    Array3
    [Int]
    }

    Measurement results produced by sampling a quantum program. An if_else block uses as many columns as its wider arm. Unused trailing columns in the selected arm contain -1, outside the range of basis digits.

    SamplerResult::new

    SamplerResult::output

    fn SamplerResult::output(self : SamplerResult, logger : &Logger) -> Unit

    Print the shots for each record column, with commas between columns.

    For two wires measured over five shots, println(result) might print this.

    10111, 10111

    SamplerResult::to_string

    fn SamplerResult::to_string(self : SamplerResult) -> String

    Default implementation for Show::to_string, uses a StringBuilder

    Simulator

    type Simulator[S]

    Execute programs using a backend state implementation.

    Simulator::name

    fn[S] Simulator::name(self : Simulator[S]) -> String

    Simulator::new

    fn[S] Simulator::new(name : String, initialize : (Array[UInt]) -> S raise
    QError
    ) -> Simulator[S]

    Simulator::simulate

    fn[S : SimulationState] Simulator::simulate(self : Simulator[S], program :
    Program
    , initial_state? : S) -> TrialResult[S] raise
    QError

    Simulator::simulate_batch

    Keep typed trials and errors in input order, continuing after failures.

    Simulator::simulate_steps

    fn[S : SimulationState] Simulator::simulate_steps(self : Simulator[S], program :
    Program
    , visit : (StepResult[S]) -> Unit raise
    QError
    , initial_state? : S) -> TrialResult[S] raise
    QError

    Deliver a state snapshot after each instruction without retaining all steps.

    StateVectorSimulator

    type StateVectorSimulator

    StateVectorSimulator::name

    fn StateVectorSimulator::name(self : StateVectorSimulator) -> String

    StateVectorSimulator::new

    fn StateVectorSimulator::new(seed? : UInt64) -> StateVectorSimulator

    StateVectorSimulator::run

    StepResult

    pub(all) struct StepResult[S] {
    instruction_index : Int
    state : S
    }

    A state snapshot after the instruction at zero-based instruction_index.

    TrialResult

    pub(all) struct TrialResult[S] {
    state : S
    params : ParamBinding
    records :
    Array3
    [Int]
    }

    The final backend state and actual measurement records for one execution.