# Operator¶

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

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
• (QuantumCircuit or (data) – Instruction 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.

 Operator.atol The default absolute tolerance parameter for float comparisons. Operator.data Return data. Operator.dim Return tuple (input_shape, output_shape). Operator.num_qubits Return the number of qubits if a N-qubit operator or None otherwise. Operator.qargs Return the qargs for the operator. Operator.rtol The relative tolerance parameter for float comparisons.
 Operator.__call__(qargs) Return a clone with qargs set Operator.__mul__(other) Operator.add(other) Return the linear operator self + other. Return the adjoint of the operator. Operator.compose(other[, qargs, front]) Return the composed operator. Return the conjugate of the operator. Make a deep copy of current operator. Operator.dot(other[, qargs]) Return the right multiplied operator self * other. Operator.equiv(other[, rtol, atol]) Return True if operators are equivalent up to global phase. Operator.expand(other) Return the tensor product operator other ⊗ self. Return a tensor product of single-qubit operators. Operator.input_dims([qargs]) Return tuple of input dimension for specified subsystems. Operator.is_unitary([atol, rtol]) Return True if operator is a unitary matrix. Operator.multiply(other) Return the linear operator other * self. Operator.output_dims([qargs]) Return tuple of output dimension for specified subsystems. Return the matrix power of the operator. Operator.reshape([input_dims, output_dims]) Return a shallow copy with reshaped input and output subsystem dimensions. Operator.set_atol(value) Set the class default absolute tolerance parameter for float comparisons. Operator.set_rtol(value) Set the class default relative tolerance parameter for float comparisons. Operator.subtract(other) Return the linear operator self - other. Operator.tensor(other) Return the tensor product operator self ⊗ other. Convert to a UnitaryGate instruction. Convert operator to matrix operator class Return the transpose of the operator. Operator.__call__(qargs) Return a clone with qargs set Operator.__mul__(other)