TernaryTreeMapper¶
- class TernaryTreeMapper(pauli_priority='ZXY')[source]¶
Bases:
MajoranaMapper,ModeBasedMapperTernary Tree fermion-to-qubit mapping.
As described by Jiang, Kalev, Mruczkiewicz, and Neven, Quantum 4, 276 (2020), preprint at arXiv:1910.10746.
This is a mapper for
MajoranaOp. For mappingFermionicOpconvert to a Majorana operator first:from qiskit_nature.second_q.operators import FermionicOp, MajoranaOp from qiskit_nature.second_q.mappers import TernaryTreeMapper fermionic_op = FermionicOp(...) majorana_op = MajoranaOp.from_fermionic_op(fermionic_op) majorana_op = majorana_op.index_order().simplify() pauli_op = TernaryTreeMapper().map(majorana_op)
Use the Pauli priority argument (one of XYZ, XZY, YXZ, YZX, ZXY, ZYX) to influence which Pauli operators appear most frequently in the Pauli strings. The default is ‘ZXY’, due to the fact that the Z gate is usually the most directly supported gate.
- Parameters:
pauli_priority (str) – Priority with which Pauli operators are assigned.
- Raises:
ValueError – if pauli_priority is not one of XYZ, XZY, YXZ, YZX, ZXY, ZYX
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.
- Parameters:
second_q_ops (MajoranaOp | List[MajoranaOp | None] | Dict[str, MajoranaOp]) – A second quantized operator, or list thereof.
register_length (int | None) – when provided, this will be used to overwrite the
register_lengthattribute of theSparseLabelOpbeing mapped. This is possible because theregister_lengthis considered a lower bound in aSparseLabelOp.
- Returns:
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.- Return type:
SparsePauliOp | List[SparsePauliOp | None] | Dict[str, SparsePauliOp]
- mode_based_mapping(second_q_op, register_length=None)¶
Utility method to map a
SparseLabelOpto a qubit operator using a pauli table.- Parameters:
second_q_op (SparseLabelOp) – the SparseLabelOp to be mapped.
register_length (int | None) – when provided, this will be used to overwrite the
register_lengthattribute of the operator being mapped. This is possible because theregister_lengthis considered a lower bound.
- Returns:
The qubit operator corresponding to the problem-Hamiltonian in the qubit space.
- Raises:
QiskitNatureError – If number length of pauli table does not match the number of operator modes, or if the operator has unexpected label content
- Return type:
- pauli_table(register_length)[source]¶
This method is implemented for
TernaryTreeMapperonly for compatibility.TernaryTreeMapper.maponly uses thesparse_pauli_operatorsmethod which overrides the corresponding method in ModeBasedMapper.
- sparse_pauli_operators(register_length)[source]¶
Generates the
SparsePauliOpterms.This uses
pauli_table()to construct a list of operators used to translate the second-quantization symbols into qubit operators.- Parameters:
register_length (int) – the register length for which to generate the operators.
- Returns:
Two lists stored in a tuple, consisting of the creation and annihilation operators, applied on the individual modes.
- Return type: