qlazy/QState.py
def operate(self, pp=None, ctrl=None):
        """
        operate unitary operator to quantum state.

        Parameters
        ----------
        pp : instance of PauliProduct
            pauli product to operate
        ctrl : int
            contoroll qubit id for controlled pauli product

        Returns
        -------
        self : instance of QState
            quantum state after operation

        """
        pauli_list = pp.pauli_list
        qid = pp.qid
    
        if ctrl is None:
            for q, pauli in zip(qid, pauli_list):
                if pauli == 'X':
                    self.x(q)
                elif pauli == 'Y':
                    self.y(q)
                elif pauli == 'Z':
                    self.z(q)
                else:
                    continue
        else:
            if ctrl in qid:
                raise ValueError("controll and target qubit id conflict")
        
            for q, pauli in zip(qid, pauli_list):
                if pauli == 'X':
                    self.cx(ctrl, q)
                elif pauli == 'Y':
                    self.cy(ctrl, q)
                elif pauli == 'Z':
                    self.cz(ctrl, q)
                else:
                    continue
    
        return self

        operate unitary operator to quantum state.

        Parameters
        ----------
        pp : instance of PauliProduct
            pauli product to operate
        ctrl : int
            contoroll qubit id for controlled pauli product

        Returns
        -------
        self : instance of QState
            quantum state after operation

        
operate unitary operator to quantum state.
Parameters

pp : instance of PauliProduct
pauli product to operate
ctrl : int
contoroll qubit id for controlled pauli product

Returns

self : instance of QState
quantum state after operation
operate unitary operator to quantum state . Parameters pp : instance of PauliProduct pauli product to operate ctrl : int contoroll qubit id for controlled pauli product Returns self : instance of QState quantum state after operation
def operate(self, pp=None, ctrl=None):
        pauli_list = pp.pauli_list
        qid = pp.qid
        if ctrl is None:
            for q, pauli in zip(qid, pauli_list):
                if pauli == 'X':
                    self.x(q)
                elif pauli == 'Y':
                    self.y(q)
                elif pauli == 'Z':
                    self.z(q)
                else:
                    continue
        else:
            if ctrl in qid:
                raise ValueError("controll and target qubit id conflict")
            for q, pauli in zip(qid, pauli_list):
                if pauli == 'X':
                    self.cx(ctrl, q)
                elif pauli == 'Y':
                    self.cy(ctrl, q)
                elif pauli == 'Z':
                    self.cz(ctrl, q)
                else:
                    continue
        return self
def operate ( self , pp = None , ctrl = None ) : pauli_list = pp . pauli_list qid = pp . qid if ctrl is None : for q , pauli in zip ( qid , pauli_list ) : if pauli == 'X' : self . x ( q ) elif pauli == 'Y' : self . y ( q ) elif pauli == 'Z' : self . z ( q ) else : continue else : if ctrl in qid : raise ValueError ( "controll and target qubit id conflict" ) for q , pauli in zip ( qid , pauli_list ) : if pauli == 'X' : self . cx ( ctrl , q ) elif pauli == 'Y' : self . cy ( ctrl , q ) elif pauli == 'Z' : self . cz ( ctrl , q ) else : continue return self
operate unitary operator to quantum state.
operate unitary operator to quantum state .
"""
        operate unitary operator to quantum state.

        Parameters
        ----------
        pp : instance of PauliProduct
            pauli product to operate
        ctrl : int
            contoroll qubit id for controlled pauli product

        Returns
        -------
        self : instance of QState
            quantum state after operation

        """
self
pp
ctrl