QubitMapper#
- class QubitMapper[fuente]#
Bases:
ABC
The interface for implementing methods which map from a
SparseLabelOp
to a qubit operator in the form of aSparsePauliOp
.Methods
- map(second_q_ops, *, register_length=None)[fuente]#
Maps a second quantized operator or a list, dict of second quantized operators based on the current mapper.
- Parámetros:
second_q_ops (SparseLabelOp | List[SparseLabelOp | None] | Dict[str, SparseLabelOp]) – A second quantized operator, or list thereof.
register_length (int | None) – when provided, this will be used to overwrite the
register_length
attribute of theSparseLabelOp
being mapped. This is possible because theregister_length
is considered a lower bound in aSparseLabelOp
.
- Devuelve:
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.- Tipo del valor devuelto:
SparsePauliOp | List[SparsePauliOp | None] | Dict[str, SparsePauliOp]
- classmethod mode_based_mapping(second_q_op, register_length=None)[fuente]#
Utility method to map a
SparseLabelOp
to a qubit operator using a pauli table.- Parámetros:
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 theregister_length
is considered a lower bound.
- Devuelve:
The qubit operator corresponding to the problem-Hamiltonian in the qubit space.
- Muestra:
QiskitNatureError – If number length of pauli table does not match the number of operator modes, or if the operator has unexpected label content
- Tipo del valor devuelto:
- classmethod pauli_table(register_length)[fuente]#
Generates a Pauli-lookup table mapping from modes to pauli pairs.
The generated table is processed by
QubitMapper.sparse_pauli_operators()
.- Parámetros:
register_length (int) – the register length for which to generate the table.
- Devuelve:
A list of tuples in which the first and second Pauli operator the real and imaginary Pauli strings, respectively.
- Tipo del valor devuelto:
list[tuple[qiskit.quantum_info.operators.symplectic.pauli.Pauli, qiskit.quantum_info.operators.symplectic.pauli.Pauli]]
- classmethod sparse_pauli_operators(register_length)[fuente]#
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.- Parámetros:
register_length (int) – the register length for which to generate the operators.
- Devuelve:
Two lists stored in a tuple, consisting of the creation and annihilation operators, applied on the individual modes.
- Tipo del valor devuelto:
tuple[list[qiskit.quantum_info.operators.symplectic.sparse_pauli_op.SparsePauliOp], list[qiskit.quantum_info.operators.symplectic.sparse_pauli_op.SparsePauliOp]]