qib.circuit.circuit.Circuit¶
- class qib.circuit.circuit.Circuit(gates: Sequence[Gate | ControlInstruction] | None = None)[source]¶
Bases:
objectA quantum circuit consists of a list of quantum gates and control instructions (e.g. measure, barrier, delay, etc.).
We follow the convention that the first gate in the list is applied first.
Methods
Append the gates from another quantum circuit to the current circuit.
Append a quantum gate or a control instruction.
Generate the sparse matrix representation of the circuit.
Generate a list of Qobj OpenQASM instructions representation of the circuit.
Generate a tensor network representation of the circuit.
Set of all classical bits appearing in the circuit.
List of all fields appearing in the circuit.
Construct the "inverse" circuit: reversed list of adjoint gates.
Set of all quantum particles appearing in the circuit.
Prepend the gates from another quantum circuit to the current circuit.
Prepend a quantum gate or a control instruction.
- append_circuit(other)[source]¶
Append the gates from another quantum circuit to the current circuit.
- append_gate(gate: Gate | ControlInstruction)[source]¶
Append a quantum gate or a control instruction.
- as_matrix(fields: Sequence[Field])[source]¶
Generate the sparse matrix representation of the circuit.
- prepend_circuit(other)[source]¶
Prepend the gates from another quantum circuit to the current circuit.
- prepend_gate(gate: Gate | ControlInstruction)[source]¶
Prepend a quantum gate or a control instruction.