tqec.circuit.schedule.ScheduledCircuit

class ScheduledCircuit(circuit: Circuit, schedule: list[int] | int = 0)[source]
__init__(circuit: Circuit, schedule: list[int] | int = 0) None[source]

Represent a quantum circuit with scheduled moments.

This class aims at representing a Circuit instance that has all its moments scheduled, i.e., associated with a time slice.

Virtual moments (i.e., Moment instances that only contains Gate instances with the cirq.VirtualTag() tag) should not be included in the given schedule and will be scheduled with the special value VIRTUAL_MOMENT_SCHEDULE.

Internally, this class only schedules the non-virtual Moment instances, but all its interfaces insert a schedule of VIRTUAL_MOMENT_SCHEDULE when the Moment instance is virtual.

Parameters:
  • circuit – the instance of Circuit that is scheduled.

  • schedule – a sorted list of time slices indices or an integer. If a list is given, it should contain as many indices as there are non-virtual moments in the provided Circuit instance. If an integer is provided, each non-virtual moment of the provided Circuit is scheduled sequentially, starting by the provided schedule: list(range(schedule, schedule + self._number_of_non_virtual_moments)).

Raises:

ScheduleError – if the provided schedule is invalid.

Methods

__init__(circuit[, schedule])

Represent a quantum circuit with scheduled moments.

add_to_schedule_index(schedule, moment)

Add the operations contained in the provided moment at the provided schedule.

append_new_moment(moment)

Schedule the provided Moment instance at the end of the circuit.

from_multi_qubit_moment_schedule(circuit, ...)

Construct a ScheduledCircuit from scheduled multi-qubit gates.

map_to_qubits(qubit_map[, inplace])

Map the qubits the ScheduledCircuit instance is applied on.

moment_at_schedule(schedule)

Get the Moment instance scheduled at the provided schedule.

Attributes

VIRTUAL_MOMENT_SCHEDULE

detectors

Return the list of all the detectors in the circuit.

mappable_qubits

Return the set of qubits involved in the circuit that can be mapped, which is the union of the qubits of all the operations performed on and the origin of all the detectors.

moments

number_of_non_virtual_moments

qubits

raw_circuit

schedule

scheduled_moments

Yields Moment instances with their computed schedule.