Korean
언어
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

# qiskit.quantum_info.SparsePauliOp.from_sparse_list¶

static SparsePauliOp.from_sparse_list(obj, num_qubits, do_checks=True, dtype=<class 'complex'>)[소스]

Construct from a list of local Pauli strings and coefficients.

Each list element is a 3-tuple of a local Pauli string, indices where to apply it, and a coefficient.

For example, the 5-qubit Hamiltonian

$H = Z_1 X_4 + 2 Y_0 Y_3$

can be constructed as

# via triples and local Paulis with indices
op = SparsePauliOp.from_sparse_list([("ZX", [1, 4], 1), ("YY", [0, 3], 2)], num_qubits=5)

# equals the following construction from "dense" Paulis
op = SparsePauliOp.from_list([("XIIZI", 1), ("IYIIY", 2)])

매개변수
• obj (Iterable[Tuple[str, List[int], complex]]) – The list 3-tuples specifying the Paulis.

• num_qubits (int) – The number of qubits of the operator.

• do_checks (bool) – The flag of checking if the input indices are not duplicated.

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

반환

The SparsePauliOp representation of the Pauli terms.

반환 형식

SparsePauliOp

예외 발생
• QiskitError – If the list of Paulis is empty.

• QiskitError – If the number of qubits is incompatible with the indices of the Pauli terms.

• QiskitError – If the designated qubit is already assigned.