pygsti.forwardsims.chpforwardsim

Defines the CHPForwardSimulator calculator class

Module Contents

Classes

CHPForwardSimulator

A WeakForwardSimulator returning probabilities with Scott Aaronson's CHP code

class pygsti.forwardsims.chpforwardsim.CHPForwardSimulator(chpexe, shots, model=None)

Bases: pygsti.forwardsims.weakforwardsim.WeakForwardSimulator

A WeakForwardSimulator returning probabilities with Scott Aaronson’s CHP code

_compute_circuit_outcome_for_shot(self, circuit, resource_alloc, time=None)

Compute outcome for a single shot of a circuit.

Parameters
  • spc_circuit (SeparatePOVMCircuit) – A tuple-like object of simplified gates (e.g. may include instrument elements like ‘Imyinst_0’) generated by Circuit.expand_instruments_and_separate_povm()

  • resource_alloc (ResourceAlloc) – Currently not used

  • time (float, optional) – The start time at which circuit is evaluated.

Returns

outcome_label (tuple) – An outcome label for the single shot sampled

_process_state(self, rho, file_handle)

Helper function to process state prep for CHP circuits.

Recursively handles TensorProd > Composed > Computational SPAMVec objects (e.g. those created by create_crosstalk_free_model).

Parameters
  • rho (State) – State vector to process

  • file_handle (TextIOWrapper) – Open file handle for dumping CHP strings

_process_povm(self, povm, povm_label, file_handle)

Helper function to process measurement for CHP circuits.

Recursively handles TensorProd > Composed > ComputationalBasis POVM objects (e.g. those created by create_crosstalk_free_model).

Parameters
  • povm (POVM) – Unmarginalized POVM to process

  • povm_label (Label) – POVM label, which may include StateSpaceLabels that result in POVM marginalization

  • file_handle (TextIOWrapper) – Open file handle for dumping CHP strings