ParityMapper#

class ParityMapper(num_particles=None)[ソース]#

ベースクラス: FermionicMapper

The Parity fermion-to-qubit mapping.

When using this mapper, num_particles can optionally be used to apply an additional step of reduction after the mapping to pauli operators. The two-qubit reduction tapers two qubits (middle and last qubit) because the spin orbitals are ordered in two spin sectors (block spin order). Based on the provided number of particles this allows the automatic selection of the correct symmetry sector.

警告

Combing this additional two-qubit reduction with the InterleavedQubitMapper will not yield the intended result. While the code will work, the hard-coded indices of the qubits which are removed will alter the Hamiltonian in a non-physical way, resulting in a physically incorrect answer. In such a case you should rely on the TaperedQubitMapper, instead.

パラメータ:

num_particles (tuple[int, int] | None) – the number of particles. For more details refer to the class docstring.

Attributes

num_particles#

Get number of particles.

Methods

map(second_q_ops, *, register_length=None)#

Maps a second quantized operator or a list, dict of second quantized operators based on the current mapper.

パラメータ:
  • second_q_ops (FermionicOp | List[FermionicOp | None] | Dict[str, FermionicOp]) – A second quantized operator, or list thereof.

  • register_length (int | None) – when provided, this will be used to overwrite the register_length attribute of the SparseLabelOp being mapped. This is possible because the register_length is considered a lower bound in a SparseLabelOp.

戻り値:

A qubit operator in the form of a SparsePauliOp, or list (resp. dict) thereof if a list (resp. dict) of second quantized operators was supplied.

戻り値の型:

SparsePauliOp | List[SparsePauliOp | None] | Dict[str, SparsePauliOp]

classmethod mode_based_mapping(second_q_op, register_length=None)#

Utility method to map a SparseLabelOp to a qubit operator using a pauli table.

パラメータ:
  • second_q_op (SparseLabelOp) – the SparseLabelOp to be mapped.

  • register_length (int | None) – when provided, this will be used to overwrite the register_length attribute of the operator being mapped. This is possible because the register_length is considered a lower bound.

戻り値:

The qubit operator corresponding to the problem-Hamiltonian in the qubit space.

例外:

QiskitNatureError – If number length of pauli table does not match the number of operator modes, or if the operator has unexpected label content

戻り値の型:

SparsePauliOp

classmethod pauli_table(register_length)[ソース]#

Generates a Pauli-lookup table mapping from modes to pauli pairs.

The generated table is processed by QubitMapper.sparse_pauli_operators().

パラメータ:

register_length (int) – the register length for which to generate the table.

戻り値:

A list of tuples in which the first and second Pauli operator the real and imaginary Pauli strings, respectively.

戻り値の型:

list[tuple[qiskit.quantum_info.operators.symplectic.pauli.Pauli, qiskit.quantum_info.operators.symplectic.pauli.Pauli]]

classmethod sparse_pauli_operators(register_length)#

Generates the cached SparsePauliOp terms.

This uses QubitMapper.pauli_table() to construct a list of operators used to translate the second-quantization symbols into qubit operators.

パラメータ:

register_length (int) – the register length for which to generate the operators.

戻り値:

Two lists stored in a tuple, consisting of the creation and annihilation operators, applied on the individual modes.

戻り値の型:

tuple[list[qiskit.quantum_info.operators.symplectic.sparse_pauli_op.SparsePauliOp], list[qiskit.quantum_info.operators.symplectic.sparse_pauli_op.SparsePauliOp]]