SparsePauliOp¶
- class SparsePauliOp(data, coeffs=None)[source]¶
Sparse N-qubit operator in a Pauli basis representation.
This is a sparse representation of an N-qubit matrix
Operator
in terms of N-qubitPauliTable
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 thetable
attribute. The coefficients are stored as a complex Numpy array vector and can be accessed using thecoeffs
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.
Attributes
The default absolute tolerance parameter for float comparisons.
Return the Pauli coefficients.
Return tuple (input_shape, output_shape).
Return the number of qubits if a N-qubit operator or None otherwise.
Return the qargs for the operator.
The relative tolerance parameter for float comparisons.
The number of Pauli of Pauli terms in the operator.
Return the the PauliTable.
Methods
SparsePauliOp.__call__
(qargs)Return a clone with qargs set
Return a view of the SparsePauliOp.
Return the size.
SparsePauliOp.__mul__
(other)SparsePauliOp.add
(other)Return the linear operator self + other.
Return the adjoint of the operator.
SparsePauliOp.compose
(other[, qargs, front])Return the composition channel self∘other.
Return the conjugate of the operator.
Make a deep copy of current operator.
SparsePauliOp.dot
(other[, qargs])Return the composition channel self∘other.
SparsePauliOp.expand
(other)Return the tensor product operator other ⊗ self.
Construct from a list [(pauli_str, coeffs)]
SparsePauliOp.from_operator
(obj[, atol, rtol])Construct from an Operator objector.
SparsePauliOp.input_dims
([qargs])Return tuple of input dimension for specified subsystems.
SparsePauliOp.is_unitary
([atol, rtol])Return True if operator is a unitary matrix.
Return a label representation iterator.
SparsePauliOp.matrix_iter
([sparse])Return a matrix representation iterator.
SparsePauliOp.multiply
(other)Return the linear operator other * self.
SparsePauliOp.output_dims
([qargs])Return tuple of output dimension for specified subsystems.
Return the compose of a operator with itself n times.
SparsePauliOp.reshape
([input_dims, output_dims])Return a shallow copy with reshaped input and output subsystem dimensions.
SparsePauliOp.set_atol
(value)Set the class default absolute tolerance parameter for float comparisons.
SparsePauliOp.set_rtol
(value)Set the class default relative tolerance parameter for float comparisons.
SparsePauliOp.simplify
([atol, rtol])Simplify PauliTable by combining duplicaties and removing zeros.
SparsePauliOp.subtract
(other)Return the linear operator self - other.
SparsePauliOp.tensor
(other)Return the tensor product operator self ⊗ other.
SparsePauliOp.to_list
([array])Convert to a list Pauli string labels and coefficients.
SparsePauliOp.to_matrix
([sparse])Convert to a dense or sparse matrix.
Convert to a matrix Operator object
Return the transpose of the operator.
SparsePauliOp.__call__
(qargs)Return a clone with qargs set
SparsePauliOp.__mul__
(other)