diff --git a/doc/source/api-reference/qibo.rst b/doc/source/api-reference/qibo.rst index 6a5e4c3c5b..f0ebc0f7ff 100644 --- a/doc/source/api-reference/qibo.rst +++ b/doc/source/api-reference/qibo.rst @@ -654,10 +654,10 @@ Parametric ZX interaction (RZX) :members: :member-order: bysource -Parametric XX-YY interaction (RXY) +Parametric XX-YY interaction (RXXYY) """""""""""""""""""""""""""""""""" -.. autoclass:: qibo.gates.RXY +.. autoclass:: qibo.gates.RXXYY :members: :member-order: bysource diff --git a/src/qibo/backends/npmatrices.py b/src/qibo/backends/npmatrices.py index ece8721018..de0f7103f0 100644 --- a/src/qibo/backends/npmatrices.py +++ b/src/qibo/backends/npmatrices.py @@ -281,7 +281,7 @@ def RZX(self, theta): dtype=self.dtype, ) - def RXY(self, theta): + def RXXYY(self, theta): cos, sin = self.np.cos(theta / 2), self.np.sin(theta / 2) return self.np.array( [ diff --git a/src/qibo/gates/gates.py b/src/qibo/gates/gates.py index da72791fed..7c3a9f08fb 100644 --- a/src/qibo/gates/gates.py +++ b/src/qibo/gates/gates.py @@ -1499,7 +1499,7 @@ class SYC(Gate): Corresponding to the following unitary matrix .. math:: - \\text{fSim}(\\pi / 2, \\, \\pi / 6) = \\beging{pmatrix} + \\text{fSim}(\\pi / 2, \\, \\pi / 6) = \\begin{pmatrix} 1 & 0 & 0 & 0 \\\\ 0 & 0 & -i & 0 \\\\ 0 & -i & 0 & 0 \\\\ @@ -1746,7 +1746,7 @@ def decompose(self, *free, use_toffolis: bool = True) -> List[Gate]: return [H(q1), CNOT(q0, q1), RZ(q1, theta), CNOT(q0, q1), H(q1)] -class RXY(_Rnn_): +class RXXYY(_Rnn_): """Parametric 2-qubit :math:`XX + YY` interaction, or rotation about :math:`XX + YY`-axis. Corresponds to the following unitary matrix @@ -1771,11 +1771,11 @@ class RXY(_Rnn_): def __init__(self, q0, q1, theta, trainable=True): super().__init__(q0, q1, theta, trainable) - self.name = "rxy" - self.draw_label = "RXY" + self.name = "rxxyy" + self.draw_label = "RXXYY" def decompose(self, *free, use_toffolis: bool = True) -> List[Gate]: - """Decomposition of :math:`\\text{R_{XY}}` up to global phase. + """Decomposition of :math:`\\text{R_{XX-YY}}` up to global phase. This decomposition has a global phase difference with respect to the original gate due to a phase difference in :math:`\\left(\\sqrt{X}\\right)^{\\dagger}`. diff --git a/tests/test_gates_gates.py b/tests/test_gates_gates.py index 08b230c90f..c441fea22e 100644 --- a/tests/test_gates_gates.py +++ b/tests/test_gates_gates.py @@ -854,20 +854,20 @@ def test_rzx(backend): assert gates.RZX(0, 1, theta).unitary -def test_rxy(backend): +def test_rxxyy(backend): theta = 0.1234 nqubits = 2 initial_state = random_statevector(2**nqubits, backend=backend) final_state = apply_gates( backend, - [gates.RXY(0, 1, theta)], + [gates.RXXYY(0, 1, theta)], nqubits=nqubits, initial_state=initial_state, ) # test decomposition final_state_decompose = apply_gates( backend, - gates.RXY(0, 1, theta).decompose(), + gates.RXXYY(0, 1, theta).decompose(), nqubits=nqubits, initial_state=initial_state, ) @@ -897,10 +897,10 @@ def test_rxy(backend): ) with pytest.raises(NotImplementedError): - gates.RXY(0, 1, theta).qasm_label + gates.RXXYY(0, 1, theta).qasm_label - assert not gates.RXY(0, 1, theta).clifford - assert gates.RXY(0, 1, theta).unitary + assert not gates.RXXYY(0, 1, theta).clifford + assert gates.RXXYY(0, 1, theta).unitary def test_ms(backend): @@ -1423,7 +1423,7 @@ def test_controlled_unitary_matrix(backend): ("RYY", (0, 1, 0.2)), ("RZZ", (0, 1, 0.3)), ("RZX", (0, 1, 0.4)), - ("RXY", (0, 1, 0.5)), + ("RXXYY", (0, 1, 0.5)), ("MS", (0, 1, 0.1, 0.2, 0.3)), ("GIVENS", (0, 1, 0.1)), ("RBS", (0, 1, 0.2)),