Simulator

List of simulation methods in the Simulator

method name

parameters

output

prob_amplitude

input_state: BasicState or StateVector, output_state: BasicState

prob. amplitude (complex)

probability

input_state: BasicState or StateVector, output_state: BasicState

probability (float [0;1])

probs

input_state: BasicState or StateVector

prob. distribution (BSD)

probs_svd

input_dist: SVDistribution

Python dictionary

evolve

input_state: BasicState or StateVector

evolved StateVector

class perceval.simulators.Simulator(backend)

A simulator class relying on a probability amplitude capable backend to simulate the output of a unitary non-polarized circuit given an BasicState, StateVector or SVDistribution input. The simulator is able to evolve or simulate the sampling a states with annotated photons.

Parameters:

backend (AProbAmpliBackend) – A probability amplitude capable backend object

clear_postselection()

Clear the post-selection function

evolve(input_state)

Evolve a state through the circuit

Parameters:

input_state (Union[FockState, StateVector]) – The input fock state or state vector

Return type:

StateVector

Returns:

The output state vector

probs_svd(input_dist, progress_callback=None)

Compute the probability distribution from a SVDistribution input and as well as performance scores

Parameters:
  • input_dist (SVDistribution) – A state vector distribution describing the input to simulate

  • progress_callback (Optional[Callable]) – A function with the signature func(progress: float, message: str)

Returns:

A dictionary of the form { “results”: BSDistribution, “physical_perf”: float, “logical_perf”: float }

  • results is the post-selected output state distribution

  • physical_perf is the performance computed from the detected photon filter

  • logical_perf is the performance computed from the post-selection

set_circuit(circuit)

Set a circuit for simulation.

Parameters:

circuit (ACircuit) – a unitary circuit without polarized components

set_min_detected_photon_filter(value)

Set a minimum number of detected photons in the output distributions

Parameters:

value (int) – The minimum photon count

set_postselection(postselect)

Set a post-selection function

Parameters:

postselect (PostSelect) – a PostSelect object