Circuit(*contents: cirq.OP_TREE, strategy: cirq.InsertStrategy = cirq.InsertStrategy.EARLIEST, device: cirq.Device = cirq.UNCONSTRAINED_DEVICE)¶
A mutable list of groups of operations to apply to some qubits.Methods returning information about the circuit:next_moment_operating_onprev_moment_operating_onnext_moments_operating_onoperation_atall_qubitsall_operationsfindall_operationsfindall_operations_betweenfindall_operations_until_blockedfindall_operations_with_gate_typereachable_frontier_fromhas_measurementsare_all_matches_terminalare_all_measurements_terminalunitaryfinal_wavefunctionto_text_diagramto_text_diagram_drawerMethods for mutation:insertappendinsert_into_rangeclear_operations_touchingbatch_insertbatch_removebatch_insert_intoinsert_at_frontierCircuits can also be iterated over,for moment in circuit:…and sliced,circuit[1:3] is a new Circuit made up of two moments, the first beingcircuit and the second being circuit;and concatenated,circuit1 + circuit2 is a new Circuit made up of the moments in circuit1followed by the moments in circuit2;and multiplied by an integer,circuit * k is a new Circuit made up of the moments in circuit repeatedk times.and mutated,circuit[1:7] = [Moment(…)]
__init__(*contents: cirq.OP_TREE, strategy: cirq.InsertStrategy = cirq.InsertStrategy.EARLIEST, device: cirq.Device = cirq.UNCONSTRAINED_DEVICE) → None¶
Initializes a circuit.
contents – The initial list of moments and operations defining the circuit. You can also pass in operations, lists of operations, or generally anything meeting the cirq.OP_TREE contract. Non-moment entries will be inserted according to the specified insertion strategy.
strategy – When initializing the circuit with operations and moments from contents, this determines how the operations are packed together. This option does not affect later insertions into the circuit.
device – Hardware that the circuit should be able to run on.