Source code for cirq.ion.ion_gates

# Copyright 2018 The Cirq Developers
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Operations native to iontrap systems."""

import numpy as np

from cirq import ops


[docs]def MS(rads: float) -> ops.XXPowGate: """The Mølmer–Sørensen gate, a native two-qubit operation in ion traps. A rotation around the XX axis in the two-qubit bloch sphere. The gate implements the following unitary: exp(-i t XX) = [ cos(t) 0 0 -isin(t)] [ 0 cos(t) -isin(t) 0 ] [ 0 -isin(t) cos(t) 0 ] [-isin(t) 0 0 cos(t) ] Args: rads: The rotation angle in radians. Returns: Mølmer–Sørensen gate rotating by the desired amount. """ return ops.XXPowGate(exponent=rads*2/np.pi, global_shift=-0.5)