qib.operator.control_instructions.BarrierInstruction

class qib.operator.control_instructions.BarrierInstruction(qubits: Sequence[Qubit] = [])[source]

Bases: ControlInstruction

A barrier instruction for a quantum circuit.

The barrier instruction prevents the quantum processor from executing any further instructions until all qubits have reached the barrier.

Methods

as_matrix

Instructions in quantum circuits do not have a sparse matrix representation, because they are not quantum operations that act on the state of qubits.

as_qasm

Generate a Qobj OpenQASM representation of the instruction.

fields

List of all fields appearing in the instruction.

is_hermitian

A control instruction is never Hermitian.

is_unitary

A control instruction is never unitary.

on

Apply the instruction on the specified qubits.

particles

Return the list of quantum particles the instruction is applied on.

Attributes

num_wires

The number of "wires" (or quantum particles) this instruction is applied on.

as_matrix()[source]

Instructions in quantum circuits do not have a sparse matrix representation, because they are not quantum operations that act on the state of qubits. Instead, these instructions serve as control directives within a quantum circuit.

as_qasm()[source]

Generate a Qobj OpenQASM representation of the instruction.

fields()[source]

List of all fields appearing in the instruction. If empty, all fields of the circuit appears in the instruction.

is_hermitian()[source]

A control instruction is never Hermitian.

is_unitary()[source]

A control instruction is never unitary.

property num_wires

The number of “wires” (or quantum particles) this instruction is applied on. If 0, the barrier is applied on all “wires” of the circuit.

on(qubits: Sequence[Qubit] = [])[source]

Apply the instruction on the specified qubits. If left empty, the instruction is applied on all qubits of the circuit.

particles()[source]

Return the list of quantum particles the instruction is applied on. If empty, the barrier is applied on all particles of the circuit.