qib.operator.gates.Gate

class qib.operator.gates.Gate[source]

Bases: AbstractOperator

Parent class for quantum gates.

A quantum gate represents the corresponding unitary operation, and can store the qubits (or in general quantum particles) it acts on.

Methods

as_circuit_matrix

Generate the sparse matrix representation of the gate as element of a quantum circuit.

as_matrix

Generate the (sparse) matrix representation of the operator.

as_qasm

Generate a Qobj OpenQASM representation of the gate.

as_tensornet

Generate a tensor network representation of the gate, using an individual tensor axis for each wire.

fields

Return the list of fields hosting the quantum particles which the gate acts on.

inverse

Return the inverse operator.

is_hermitian

Whether the operator is Hermitian.

is_unitary

A quantum gate is unitary by definition.

particles

Return the list of quantum particles the gate acts on.

Attributes

num_wires

The number of "wires" (or quantum particles) this gate acts on.

abstract as_circuit_matrix(fields: Sequence[Field])[source]

Generate the sparse matrix representation of the gate as element of a quantum circuit.

abstract as_matrix()[source]

Generate the (sparse) matrix representation of the operator.

as_qasm()[source]

Generate a Qobj OpenQASM representation of the gate.

abstract as_tensornet()[source]

Generate a tensor network representation of the gate, using an individual tensor axis for each wire.

abstract fields()[source]

Return the list of fields hosting the quantum particles which the gate acts on.

abstract inverse()[source]

Return the inverse operator.

abstract is_hermitian()[source]

Whether the operator is Hermitian.

is_unitary()[source]

A quantum gate is unitary by definition.

abstract property num_wires

The number of “wires” (or quantum particles) this gate acts on.

abstract particles()[source]

Return the list of quantum particles the gate acts on.