from_sparse_list

*static* PauliOperator.from_sparse_list(sparse_list, qubit_count, dtype=<class 'complex'>)

Construct from a list of local Pauli strings and coefficients.

Parameters

  • sparse_list (list [ tuple [ str , list [ int ] , complex ] ]) – List of tuples containing the Pauli string, indices of non-trivial Paulis, and coefficients.
  • qubit_count (int) – Number of qubits in the system.
  • dtype (type , optional) – Data type for the coefficients. Defaults to complex.

Returns

PauliOperator – The constructed Pauli operator.

Raises

QctrlArgumentsValueError – If the input indices are duplicated or if the qubit_count is smaller than a given Pauli index.

Return type

PauliOperator

Was this useful?