qlazy/DensOp.py
def probability(self, kraus=[], povm=[], qid=[]):
        """
        get the probabilities for measuring operators. 
        (Kraus or POVM operators).

        Parameters
        ----------
        kraus : list of list of comprex
            Kraus operators.
        povm : list of list of comprex
            POVM operators.
        qid : list
            qubit id's list to measure.

        Returns
        -------
        prob : list of float
            probabilities for measuring operators.

        Notes
        -----
        Either 'kraus' or 'povm' must be set. If 'qid' is not set, all
        of the qubits are measured, the dimention of Kraus or POVM
        operator must be equal to the dimension of density
        operator. If 'qid' is set, the part of qubits are measured,
        the dimension of Kraus or POVM operator must be equal to the 2
        power of 'qid' length. This method does not change the
        original density operator.

        """
        if kraus != []:
            N = len(kraus)
            prob = [0.0]*N
            for i in range(N):
                 prob[i] = densop_probability(self, matrix=kraus[i], qid=qid,
                                             matrix_type='kraus')
                 if abs(prob[i]) < EPS:
                     prob[i] = 0.0
        elif povm != []:
            N = len(povm)
            prob = [0.0]*N
            for i in range(N):
                prob[i] = densop_probability(self, matrix=povm[i], qid=qid,
                                             matrix_type='povm')
                if abs(prob[i]) < EPS:
                    prob[i] = 0.0
        else:
            raise DensOp_Error_Probability()
                
        return prob

        get the probabilities for measuring operators. 
        (Kraus or POVM operators).

        Parameters
        ----------
        kraus : list of list of comprex
            Kraus operators.
        povm : list of list of comprex
            POVM operators.
        qid : list
            qubit id's list to measure.

        Returns
        -------
        prob : list of float
            probabilities for measuring operators.

        Notes
        -----
        Either 'kraus' or 'povm' must be set. If 'qid' is not set, all
        of the qubits are measured, the dimention of Kraus or POVM
        operator must be equal to the dimension of density
        operator. If 'qid' is set, the part of qubits are measured,
        the dimension of Kraus or POVM operator must be equal to the 2
        power of 'qid' length. This method does not change the
        original density operator.

        
get the probabilities for measuring operators.
(Kraus or POVM operators).

Parameters

kraus : list of list of comprex
Kraus operators.
povm : list of list of comprex
POVM operators.
qid : list
qubit id's list to measure.

Returns

prob : list of float
probabilities for measuring operators.

Notes

Either 'kraus' or 'povm' must be set. If 'qid' is not set, all
of the qubits are measured, the dimention of Kraus or POVM
operator must be equal to the dimension of density
operator. If 'qid' is set, the part of qubits are measured,
the dimension of Kraus or POVM operator must be equal to the 2
power of 'qid' length. This method does not change the
original density operator.
get the probabilities for measuring operators . ( Kraus or POVM operators ) . Parameters kraus : list of list of comprex Kraus operators . povm : list of list of comprex POVM operators . qid : list qubit id ' s list to measure . Returns prob : list of float probabilities for measuring operators . Notes Either ' kraus ' or ' povm ' must be set . If ' qid ' is not set all of the qubits are measured the dimention of Kraus or POVM operator must be equal to the dimension of density operator . If ' qid ' is set the part of qubits are measured the dimension of Kraus or POVM operator must be equal to the 2 power of ' qid ' length . This method does not change the original density operator .
def probability(self, kraus=[], povm=[], qid=[]):
        if kraus != []:
            N = len(kraus)
            prob = [0.0]*N
            for i in range(N):
                 prob[i] = densop_probability(self, matrix=kraus[i], qid=qid,
                                             matrix_type='kraus')
                 if abs(prob[i]) < EPS:
                     prob[i] = 0.0
        elif povm != []:
            N = len(povm)
            prob = [0.0]*N
            for i in range(N):
                prob[i] = densop_probability(self, matrix=povm[i], qid=qid,
                                             matrix_type='povm')
                if abs(prob[i]) < EPS:
                    prob[i] = 0.0
        else:
            raise DensOp_Error_Probability()
        return prob
def probability ( self , kraus = [ ] , povm = [ ] , qid = [ ] ) : if kraus != [ ] : N = len ( kraus ) prob = [ 0.0 ] * N for i in range ( N ) : prob [ i ] = densop_probability ( self , matrix = kraus [ i ] , qid = qid , matrix_type = 'kraus' ) if abs ( prob [ i ] ) < EPS : prob [ i ] = 0.0 elif povm != [ ] : N = len ( povm ) prob = [ 0.0 ] * N for i in range ( N ) : prob [ i ] = densop_probability ( self , matrix = povm [ i ] , qid = qid , matrix_type = 'povm' ) if abs ( prob [ i ] ) < EPS : prob [ i ] = 0.0 else : raise DensOp_Error_Probability ( ) return prob
get the probabilities for measuring operators.
get the probabilities for measuring operators .
"""
        get the probabilities for measuring operators. 
        (Kraus or POVM operators).

        Parameters
        ----------
        kraus : list of list of comprex
            Kraus operators.
        povm : list of list of comprex
            POVM operators.
        qid : list
            qubit id's list to measure.

        Returns
        -------
        prob : list of float
            probabilities for measuring operators.

        Notes
        -----
        Either 'kraus' or 'povm' must be set. If 'qid' is not set, all
        of the qubits are measured, the dimention of Kraus or POVM
        operator must be equal to the dimension of density
        operator. If 'qid' is set, the part of qubits are measured,
        the dimension of Kraus or POVM operator must be equal to the 2
        power of 'qid' length. This method does not change the
        original density operator.

        """
self
kraus
povm
qid