German
Sprachen
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.quantum_info.SparsePauliOp.from_list

static SparsePauliOp.from_list(obj, dtype=<class 'complex'>)[Quellcode]

Construct from a list of Pauli strings and coefficients.

For example, the 5-qubit Hamiltonian

\[H = Z_1 X_4 + 2 Y_0 Y_3\]

can be constructed as

# via tuples and the full Pauli string
op = SparsePauliOp.from_list([("XIIZI", 1), ("IYIIY", 2)])
Parameter
  • obj (Iterable[Tuple[str, complex]]) – The list of 2-tuples specifying the Pauli terms.

  • dtype (type) – The dtype of coeffs (Default complex).

Rückgabe

The SparsePauliOp representation of the Pauli terms.

Rückgabetyp

SparsePauliOp

Verursacht

QiskitError – If the list of Paulis is empty.