Spanish
Idiomas
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

qiskit.quantum_info.SparsePauliOp.from_list

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

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)])
Parámetros
  • obj (Iterable[Tuple[str, complex]]) – The list of 2-tuples specifying the Pauli terms.

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

Devuelve

The SparsePauliOp representation of the Pauli terms.

Tipo del valor devuelto

SparsePauliOp

Muestra

QiskitError – If the list of Paulis is empty.