Statevector Simulator

Module for simulating circuits and Measurement Patterns.

This module provides:

class graphqomb.simulator.SimulatorBackend[source]

Bases: Enum

Enum class for circuit simulator backend.

Available backends are: - StateVector - DensityMatrix

class graphqomb.simulator.CircuitSimulator[source]

Bases: object

Class for simulating circuits.

state

The quantum state of the simulator.

Type:

BaseFullStateSimulator

gate_instructions

The list of gate instructions to be applied.

Type:

list[Gate]

__init__(mbqc_circuit, backend)[source]
apply_gate(gate)[source]

Apply a gate to the circuit.

Parameters:

gate (Gate) – The gate to apply.

Raises:

TypeError – If the gate type is not supported.

simulate()[source]

Simulate the circuit.

class graphqomb.simulator.PatternSimulator[source]

Bases: object

Class for simulating Measurement Patterns.

state

The quantum state of the simulator.

Type:

BaseFullStateSimulator

node_indices

The list of node indices in the pattern.

Type:

list[int]

results

The measurement results for each node.

Type:

dict[int, bool]

calc_prob

Whether to calculate probabilities.

Type:

bool

__init__(pattern, backend, *, calc_prob=False)[source]
apply_cmd(cmd, *, rng)[source]
apply_cmd(cmd, *, rng)
apply_cmd(cmd, *, rng)
apply_cmd(cmd, *, rng)
apply_cmd(cmd, *, rng)
apply_cmd(cmd, *, rng)
apply_cmd(cmd, *, rng)

Apply a command to the state.

Parameters:
simulate(rng=None)[source]

Simulate the pattern.

Parameters:

rng (numpy.random.Generator | None, optional) – Random number generator to use for measurement outcomes. If None, a new generator will be created using the default random source. Default is None.