def right_H_all(self): r""" Multiplies on the right by a Hadamard gate on each qubit. See :meth:`left_H` for more details. """ u.array_swap(self.zc, self.xc) return self
def right_H(self,j): r""" Multiplies on the right by a Hadamard gate on the :math:`j^{\text{th}}` qubit. See :meth:`left_H` for more details. """ u.array_swap(self.zc[:, j], self.xc[:, j]) return self
def right_SWAP(self,j,k): r""" Multiplies on the right by a SWAP gate between the :math:`j^{\text{th}}` and :math:`k^{\text{th}}` qubits. See :meth:`left_SWAP` for more details. """ u.array_swap(self.xc[:, j], self.xc[:, k]) u.array_swap(self.zc[:, j], self.zc[:, k]) return self
def left_H(self,j): r""" Multiplies on the left by a Hadamard gate on the :math:`j^{\text{th}}` qubit. This method acts in-place, as opposed to acting on a copy of the binary symplectic matrix. In order to preserve the original matrix, use the :meth:`copy` method: >>> new_bsm = bsm.copy().left_H(idx) # doctest: +SKIP """ u.array_swap(self.zr[j, :], self.xr[j, :]) return self
def left_SWAP(self,j,k): r""" Multiplies on the left by a SWAP gate between the :math:`j^{\text{th}}` and :math:`k^{\text{th}}` qubits. This method acts in-place, as opposed to acting on a copy of the binary symplectic matrix. In order to preserve the original matrix, use the :meth:`copy` method: >>> new_bsm = bsm.copy().left_SWAP(j, k) # doctest: +SKIP """ u.array_swap(self.xr[j, :], self.xr[k, :]) u.array_swap(self.zr[j, :], self.zr[k, :]) return self