English
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

Operator

class Operator(data, input_dims=None, output_dims=None)[source]

Bases: qiskit.quantum_info.operators.linear_op.LinearOp

Matrix operator class

This represents a matrix operator \(M\) that will evolve() a Statevector \(|\psi\rangle\) by matrix-vector multiplication

\[|\psi\rangle \mapsto M|\psi\rangle,\]

and will evolve() a DensityMatrix \(\rho\) by left and right multiplication

\[\rho \mapsto M \rho M^\dagger.\]

Initialize an operator object.

Parameters
  • data (QuantumCircuit or Operation or BaseOperator or matrix) – data to initialize operator.

  • input_dims (tuple) – the input subsystem dimensions. [Default: None]

  • output_dims (tuple) – the output subsystem dimensions. [Default: None]

Raises

QiskitError – if input data cannot be initialized as an operator.

Additional Information:

If the input or output dimensions are None, they will be automatically determined from the input data. If the input data is a Numpy array of shape (2**N, 2**N) qubit systems will be used. If the input operator is not an N-qubit operator, it will assign a single subsystem with dimension specified by the shape of the input.

Methods

adjoint

Return the adjoint of the Operator.

compose

Return the operator composition with another Operator.

conjugate

Return the conjugate of the Operator.

copy

Make a deep copy of current operator.

dot

Return the right multiplied operator self * other.

equiv

Return True if operators are equivalent up to global phase.

expand

Return the reverse-order tensor product with another Operator.

from_circuit

Create a new Operator object from a QuantumCircuit

from_label

Return a tensor product of single-qubit operators.

input_dims

Return tuple of input dimension for specified subsystems.

is_unitary

Return True if operator is a unitary matrix.

output_dims

Return tuple of output dimension for specified subsystems.

power

Return the matrix power of the operator.

reshape

Return a shallow copy with reshaped input and output subsystem dimensions.

reverse_qargs

Return an Operator with reversed subsystem ordering.

tensor

Return the tensor product with another Operator.

to_instruction

Convert to a UnitaryGate instruction.

to_matrix

Convert operator to NumPy matrix.

to_operator

Convert operator to matrix operator class

transpose

Return the transpose of the Operator.

Attributes

atol = 1e-08
data

Return data.

dim

Return tuple (input_shape, output_shape).

num_qubits

Return the number of qubits if a N-qubit operator or None otherwise.

qargs

Return the qargs for the operator.

rtol = 1e-05
settings

Return operator settings.