BosonicLogarithmicMapper¶
- class BosonicLogarithmicMapper(max_occupation)[source]¶
Bases:
BosonicMapperThe Logarithmic boson-to-qubit Mapper.
This mapper generates a logarithmic encoding of the Bosonic operator \(b_k^\dagger, b_k\) to qubit operators (linear combinations of pauli strings). In this logarithmic encoding the number of qubits necessary to represent a bosonic mode is determined by the max occupation \(n_k^{max}\) of the mode (meaning the number of states used in the expansion of the mode, or equivalently the state at which the maximum excitation can take place). The number of qubits is given by: \(\lceil\log_2(n_k^{max} + 1)\rceil\).
Note
A consequence of the rounding up for determining the number of required qubits is that the actual max occupation is often larger than the one selected by the user. For example, if the user selects \(n_k^{max} = 2\), then the number of required qubits is \(\lceil\log_2(3)\rceil = 2\). If we now compute the max occupation for 2 qubits, we get \(2^2 - 1 = 3\), which is larger than the user-selected max occupation. The user should expect that the actual max occupation is always larger than or equal to the one selected. If the code changes the max occupation, a warning will appear in the logs.
The mode \(|k\rangle\) is then mapped to the occupation number vector \(|0_{n_k^{max}}, 0_{n_k^{max} - 1},..., 0_{n_k + 1}, 1_{n_k}, 0_{n_k - 1},..., 0_{0_k}\rangle\)
This class implements the equation (34) and (35) of Reference [1].
\[ \begin{align}\begin{aligned}b_k^\dagger = \sum_{n_k = 0}^{2^{N_q}-2}\left(\sqrt{n_k + 1}|n+1\rangle\langle n|\right)\\b_k = \sum_{n_k = 1}^{2^{N_q}-1}\left(\sqrt{n_k}|n-1\rangle\langle n|\right)\end{aligned}\end{align} \]where \(N_q\) is the number of qubits used to represent each mode (given by \(\lceil\log_2(n_k^{max} + 1)\rceil\)). This implementation first computes each \(|n+1\rangle\langle n|\) and \(|n-1\rangle\langle n|\) in a binary representation and then uses equation (37) from Reference [1] to map to the Pauli operators.
The length of the qubit register is:
BosonicOp.num_modes * math.ceil(numpy.log2(BosonicLogarithmicMapper.max_occupation + 1))
Below is an example of how one can use this mapper:
from qiskit_nature.second_q.mappers import BosonicLogarithmicMapper from qiskit_nature.second_q.operators import BosonicOp mapper = BosonicLogarithmicMapper(max_occupation=2) qubit_op = mapper.map(BosonicOp({'+_0 -_0': 1}, num_modes=1))
Note
Since this mapper truncates the maximum occupation of a bosonic state as represented in the qubit register, the commutation relations after the mapping differ from the standard ones. Please refer to Section 4, equation 22 of Reference [2] for more details.
References
[1] Bo Peng et al., Quantum Simulation of Boson-Related Hamiltonians: Techniques, Effective Hamiltonian Construction, and Error Analysis, Arxiv https://doi.org/10.48550/arXiv.2307.06580
[2] R. Somma et al., Quantum Simulations of Physics Problems, Arxiv https://doi.org/10.48550/arXiv.quant-ph/0304063
- Parameters:
max_occupation (int) – defines the excitation space of the k-th bosonic state. Together with the number of modes required to represent the bosonic operator, it defines the minimum length of the qubit register. The minimum value is 1.
Attributes
- max_occupation¶
The maximum occupation of any bosonic state.
- number_of_qubits_per_mode: int¶
The minimum number of qubits required to represent a bosonic mode given a max occupation.
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 (BosonicOp | List[BosonicOp | None] | Dict[str, BosonicOp]) – 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]