# SparsePauliOp¶

class SparsePauliOp(data, coeffs=None)[source]

Bases: qiskit.quantum_info.operators.linear_op.LinearOp

Sparse N-qubit operator in a Pauli basis representation.

This is a sparse representation of an N-qubit matrix Operator in terms of N-qubit PauliTable and complex coefficients.

It can be used for performing operator arithmetic for hundred of qubits if the number of non-zero Pauli basis terms is sufficiently small.

The Pauli basis components are stored as a PauliTable object and can be accessed using the table attribute. The coefficients are stored as a complex Numpy array vector and can be accessed using the coeffs attribute.

Initialize an operator object.

Parameters
• data (PauliTable) -- Pauli table of terms.

• coeffs (np.ndarray) -- complex coefficients for Pauli terms.

Raises

QiskitError -- If the input data or coeffs are invalid.

Methods

 adjoint Return the adjoint of the Operator. compose Return the operator composition with another SparsePauliOp. conjugate Return the conjugate of the SparsePauliOp. copy Make a deep copy of current operator. dot Return the right multiplied operator self * other. expand Return the reverse-order tensor product with another SparsePauliOp. from_list Construct from a list [(pauli_str, coeffs)] from_operator Construct from an Operator objector. input_dims Return tuple of input dimension for specified subsystems. is_unitary Return True if operator is a unitary matrix. label_iter Return a label representation iterator. matrix_iter Return a matrix representation iterator. output_dims Return tuple of output dimension for specified subsystems. power Return the compose of a operator with itself n times. reshape Return a shallow copy with reshaped input and output subsystem dimensions. simplify Simplify PauliTable by combining duplicates and removing zeros. tensor Return the tensor product with another SparsePauliOp. to_list Convert to a list Pauli string labels and coefficients. to_matrix Convert to a dense or sparse matrix. to_operator Convert to a matrix Operator object transpose Return the transpose of the SparsePauliOp.

Attributes

atol = 1e-08
coeffs

Return the Pauli coefficients.

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 settings.

Return type

Dict

size

The number of Pauli of Pauli terms in the operator.

table

Return the the PauliTable.