qlazy/DensOp.py
def mix(cls, densop=[], prob=[]):
        """
        linear sum of the density operators.

        Parameters
        ----------
        densop : list of instances of DensOp
            densitiy operators.
        prob : list of float
            probabilities (coefficients of the linear sum).

        """
        N = len(densop)
        
        if sum(prob) != 1.0:
            s = sum(prob)
            prob = [p/s for p in prob]
         
        de_out = densop[0].clone()
        de_out.mul(factor=prob[0])
        for i in range(1,len(densop)):
            de_tmp = densop[i].clone()
            de_tmp.mul(factor=prob[i])
            de_out.add(densop=de_tmp)

        return de_out

        linear sum of the density operators.

        Parameters
        ----------
        densop : list of instances of DensOp
            densitiy operators.
        prob : list of float
            probabilities (coefficients of the linear sum).

        
linear sum of the density operators.
Parameters

densop : list of instances of DensOp
densitiy operators.
prob : list of float
probabilities (coefficients of the linear sum).
linear sum of the density operators . Parameters densop : list of instances of DensOp densitiy operators . prob : list of float probabilities ( coefficients of the linear sum ) .
def mix(cls, densop=[], prob=[]):
        N = len(densop)
        if sum(prob) != 1.0:
            s = sum(prob)
            prob = [p/s for p in prob]
        de_out = densop[0].clone()
        de_out.mul(factor=prob[0])
        for i in range(1,len(densop)):
            de_tmp = densop[i].clone()
            de_tmp.mul(factor=prob[i])
            de_out.add(densop=de_tmp)
        return de_out
def mix ( cls , densop = [ ] , prob = [ ] ) : N = len ( densop ) if sum ( prob ) != 1.0 : s = sum ( prob ) prob = [ p / s for p in prob ] de_out = densop [ 0 ] . clone ( ) de_out . mul ( factor = prob [ 0 ] ) for i in range ( 1 , len ( densop ) ) : de_tmp = densop [ i ] . clone ( ) de_tmp . mul ( factor = prob [ i ] ) de_out . add ( densop = de_tmp ) return de_out
linear sum of the density operators.
linear sum of the density operators .
"""
        linear sum of the density operators.

        Parameters
        ----------
        densop : list of instances of DensOp
            densitiy operators.
        prob : list of float
            probabilities (coefficients of the linear sum).

        """
cls
densop
prob