InterleavedQubitMapper#

class InterleavedQubitMapper(mapper)[source]#

Bases: FermionicMapper

A FermionicMapper wrapper returning interleaved-ordered operators.

This class is intended to be used with fermionic systems. Furthermore, it is designed to work with FermionicMapper classes which map fermionic operators to the qubit space by site (unlike for example the BravyiKitaevSuperFastMapper which maps by interactions).

সতর্কতা

The mapper will _not_ perform any assertions on the wrapped FermionicMapper. Thus, wrapping a BravyiKitaevSuperFastMapper is valid code which will indeed produce qubit operators for you. You will just not be able to interpret the order of the qubits in the same way.

সতর্কতা

The builtin two-qubit reduction of the ParityMapper will also not provide correct results when combined with this mapper. Again, this is not asserted so be aware of this pitfall. Thus, if you would like to reduce the number of qubits, you should instead look towards the TaperedQubitMapper which removes qubits based on all Z2-symmetries it detects in the operator.

For site-based mappers, Qiskit Nature always arranges the qubits corresponding to the alpha-spin and beta-spin components in a blocked fashion. I.e. the first half of the qubit register corresponds to the alpha-spin components, and the second half to the beta-spin one, like so:

a1, a2, ..., aN, b1, b2, ..., bN

This class allows you to wrap such a FermionicMapper to produce qubit operators which have an interleaved order of qubits, instead. Taking the example from before, the outcome will be the following:

a1, b1, a2, b2, ..., aN, bN

নোট

This reordering is intended for an even total number of spin orbitals (i.e. the alpha-spin and beta-spin components should be identical in length; which they usually are). However, this is not asserted, so reordering a qubit operator label of odd length will still happen.

Here is a very simple usage example:

from qiskit_nature.second_q.mappers import JordanWignerMapper, InterleavedQubitMapper
from qiskit_nature.second_q.operators import FermionicOp

blocked_mapper = JordanWignerMapper()
interleaved_mapper = InterleavedQubitMapper(blocked_mapper)

ferm_op = FermionicOp({"+_0 -_1": 1}, num_spin_orbitals=4)

blocked_op = blocked_mapper.map(ferm_op)
# SparsePauliOp(['IIXY', 'IIYY', 'IIXX', 'IIYX'], coeffs=[-0.25j, 0.25, 0.25, 0.25j])

print(interleaved_mapper.map(ferm_op))
# SparsePauliOp(['IXIY', 'IYIY', 'IXIX', 'IYIX'], coeffs=[-0.25j, 0.25, 0.25, 0.25j])

The following attributes can be set via the initializer but can also be read and updated once the InterleavedQubitMapper object has been constructed.

mapper#

the actual mapper for mapping from FermionicOp to qubit operators.

Type:

FermionicMapper

প্যারামিটার:

mapper (FermionicMapper) -- the actual FermionicMapper mapping FermionicOp to qubit operators.

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]]