qml.binary_mapping¶
- binary_mapping(bose_operator, n_states=2, ps=False, wire_map=None, tol=None)[source]¶
Convert a bosonic operator to a qubit operator using the standard-binary mapping.
The mapping procedure is described in equations \(27-29\) in arXiv:1507.03271.
- 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
PauliSentenceinstead 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.binary_mapping(w, n_states=4) ( 0.6830127018922193 * X(0) + -0.1830127018922193 * (X(0) @ Z(1)) + -0.6830127018922193j * Y(0) + 0.1830127018922193j * (Y(0) @ Z(1)) + 0.3535533905932738 * (X(0) @ X(1)) + -0.3535533905932738j * (X(0) @ Y(1)) + 0.3535533905932738j * (Y(0) @ X(1)) + (0.3535533905932738+0j) * (Y(0) @ Y(1)) )