tqec.circuit.circuit.generate_circuit_from_instantiation

generate_circuit_from_instantiation(plaquette_array: ndarray[Any, dtype[int64]], plaquettes: Plaquettes, increments: Displacement) Circuit[source]

Generate a quantum circuit from an array of plaquette indices and the associated plaquettes.

This is one of the core methods of the tqec package. It generates a quantum circuit from a spatial description of where the plaquettes should be located as well as the actual plaquettes used.

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:
  • plaquette_array – an array of indices referencing Plaquette instances in the plaquettes argument.

  • 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).

  • increments – the displacement between each plaquette origin.

Returns:

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

Raises:

TQECException – if any index in plaquette_array is not correctly associated to a plaquette in plaquettes or if plaquettes is provided as a dictionary and 0 in plaquettes.