tqec.circuit.circuit.generate_circuit

generate_circuit(template: Template, plaquettes: Plaquettes) Circuit[source]

Generate a quantum circuit from a template and its plaquettes.

This is one of the core methods of the tqec package. It generates a quantum circuit from the description of the template that should be implemented as well as the plaquettes that should be used to instantiate the provided template.

This function requires that a few pre-conditions on the inputs are met: 1. the number of plaquettes provided should match the number of plaquettes required by the provided template. 2. all the provided plaquettes should be implemented on cirq.GridQubit instances only.

If any of the above pre-conditions is not met, the inputs are considered invalid, in which case this function might raise an error.

Parameters:
  • template – spatial description of the quantum error correction experiment we want to implement.

  • plaquettes – description of the computation that should happen at different time-slices of the quantum error correction experiment (or at least part of it). If provided as a dictionary, plaquettes should be 1-indexed (i.e., 0 not in plaquettes should be True).

Returns:

a cirq.Circuit instance implementing the (part of) quantum error correction experiment represented by the provided inputs.

Raises:

TQECException – if len(plaquettes) != template.expected_plaquettes_number or if plaquettes is provided as a dictionary and 0 in plaquettes.