qml.bose.unary_mapping¶
- unary_mapping(bose_operator, n_states=2, ps=False, wire_map=None, tol=None)[source]¶
Convert a bosonic operator to a qubit operator using the unary mapping.
The mapping procedure is described in arXiv.1909.12847.
- Parameters
bose_operator (BoseWord, BoseSentence) – the bosonic operator
n_states (int) – Maximum number of allowed bosonic states. Defaults to
2
.ps (bool) – Whether to return the result as a
PauliSentence
instead of an operator. Defaults toFalse
.wire_map (dict) – A dictionary defining how to map the states of the Bose operator to qubit wires. If
None
, integers used to label the bosonic states will be used as wire labels. Defaults toNone
.tol (float) – tolerance for discarding the imaginary part of the coefficients
- Returns
a linear combination of qubit operators
- Return type
Union[PauliSentence, Operator]
Example
>>> w = qml.BoseWord({(0, 0): "+"}) >>> qml.unary_mapping(w, n_states=4) 0.25 * X(0) @ X(1) + -0.25j * X(0) @ Y(1) + 0.25j * Y(0) @ X(1) + (0.25+0j) * Y(0) @ Y(1) + 0.3535533905932738 * X(1) @ X(2) + -0.3535533905932738j * X(1) @ Y(2) + 0.3535533905932738j * Y(1) @ X(2) + (0.3535533905932738+0j) * Y(1) @ Y(2) + 0.4330127018922193 * X(2) @ X(3) + -0.4330127018922193j * X(2) @ Y(3) + 0.4330127018922193j * Y(2) @ X(3) + (0.4330127018922193+0j) * Y(2) @ Y(3)