MixedMapper¶
- class MixedMapper(mappers, hilbert_space_register_lengths, hilbert_space_register_types)[source]¶
Bases:
ABCMapper of a Mixed Operator to a Qubit Operator.
This class is to be used to map systems with particles of different nature, such as bosons and fermions.
Please note that the creation and usage of this class requires the precise definition of the composite Hilbert size corresponding to the problem. The ordering of the qubit registers associated to the different physical particles must be provided by the user through the definition of the Hilbert space registers dictionary.
This ordering corresponds to a specific way to take the tensor product of the operators.
# Consider the Hilbert spaces of a fermionic system Hf and a bosonic system Hb bos_mapper = BosonicLinearMapper(max_occupation=1) fer_mapper = JordanWignerMapper() # These mappers map to qubit simulation Hilbert spaces S(Hf) and S(Hb) mappers = {"b1": bos_mapper, "f1": fer_mapper} # This ordering of the dictionary implies that the simulation Hilbert spaces are # tensored as S(Hf).tensor(S(Hb)) # This follows the qiskit convention for stacking qubit registers from right to left. hilbert_space_register_lengths = {"b1": 1, "f1": 1} hilbert_space_register_types = {"b1": BosonicOp, "f1": FermionicOp} # One bosonic mode (yet unknown local dimension d) # One fermionic mode (qubit). mix_mapper = MixedMapper( mappers=mappers, hilbert_space_register_lengths=hilbert_space_register_lengths, hilbert_space_register_types=hilbert_space_register_types, ) # The final simulation register is composed of d+1 qubits arranged as [qf_0, qb_d, ... qb_0]
Note
This class is limited to one instance of a Fermionic Hilbert space, to ensure the anticommutation relations of the fermions.
Note
This class leaves the handling of register lengths to the mappers. Note that for the bosonic mappers, the register lengths is not directly equal to the qubit register length but to the number of modes. See the documentation of the class :class:
~.BosonicLinearMapper.The following attributes can be read and updated once the
MixedMapperobject has been constructed.- mappers¶
Dictionary of mappers corresponding to “local” Hilbert spaces of the global problem.
- hilbert_space_register_lengths¶
Ordered dictionary of local registers sizes.
- hilbert_space_register_types¶
Ordered dictionary of local registers types.
- Parameters:
mappers (dict[str, QubitMapper]) – Dictionary of mappers corresponding to the “local” Hilbert spaces.
hilbert_space_register_lengths (dict[str, int]) – Ordered dictionary of local registers sizes.
hilbert_space_register_types (dict[str, type[SparseLabelOp]]) – Ordered dictionary of local register types.
Methods
- map(mixed_ops, *, register_length=None)[source]¶
Maps a second quantized operator or a list, dict of second quantized operators based on the current mapper.
- Parameters:
- 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]