qib.operator.control_instructions.MeasureInstruction

class qib.operator.control_instructions.MeasureInstruction(qubits: Sequence[Qubit] | None = None, clbits: Sequence[int] | None = None)[source]

Bases: ControlInstruction

A measurement instruction for a quantum circuit.

The measurement instruction in quantum computing converts the quantum information of a qubit into classical information by collapsing the qubit’s state to one of the basis states, typically |0> or |1>, according to the probabilities defined by its quantum state.

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

Return the list of fields hosting the quantum particles which the instruction is applied on.

is_hermitian

A control instruction is never Hermitian.

is_unitary

A control instruction is never unitary.

memory

Return the list of memory slots the instruction will store the results in.

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]

Return the list of fields hosting the quantum particles which the instruction is applied on.

is_hermitian()[source]

A control instruction is never Hermitian.

is_unitary()[source]

A control instruction is never unitary.

memory()[source]

Return the list of memory slots the instruction will store the results in.

property num_wires

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

on(qubits: Sequence[Qubit], clbits: Sequence[int] | None = None)[source]

Apply the instruction on the specified qubits.

particles()[source]

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