def _two_qubit_matrix_to_cz_operations( self, q0: 'cirq.Qid', q1: 'cirq.Qid', mat: np.ndarray, ) -> Sequence['cirq.Operation']: """Decomposes the merged two-qubit gate unitary into the minimum number of SQRT_ISWAP gates. Args: q0: The first qubit being operated on. q1: The other qubit being operated on. mat: Defines the operation to apply to the pair of qubits. Returns: A list of operations implementing the matrix. """ return two_qubit_to_sqrt_iswap.two_qubit_matrix_to_sqrt_iswap_operations( q0, q1, mat, required_sqrt_iswap_count=self.required_sqrt_iswap_count, use_sqrt_iswap_inv=self.use_sqrt_iswap_inv, atol=self.tolerance, check_preconditions=False, )
def _decompose_two_qubit_operation(self, op: 'cirq.Operation', _) -> DecomposeResult: if protocols.has_unitary(op): return two_qubit_to_sqrt_iswap.two_qubit_matrix_to_sqrt_iswap_operations( op.qubits[0], op.qubits[1], protocols.unitary(op), required_sqrt_iswap_count=self.required_sqrt_iswap_count, use_sqrt_iswap_inv=self.use_sqrt_iswap_inv, atol=self.atol, check_preconditions=False, clean_operations=True, ) if protocols.is_parameterized(op): return two_qubit_to_sqrt_iswap.parameterized_2q_op_to_sqrt_iswap_operations( op, use_sqrt_iswap_inv=self.use_sqrt_iswap_inv ) return NotImplemented