Пример #1
0
 def jozsafid(self, idealrho=None):
     self.check_idealrho(idealrho)
     tmp = qtls.sqrtm_dm(self.exprho)
     self.jozsafidelity = real(
         trace(qtls.sqrtm_dm(dot(dot(tmp, self.idealrho),
                                 tmp)))**2).tolist()
     return self.jozsafidelity
Пример #2
0
def tracedist(rho1, rho2):
    ''' trace distance. Can be calculated for either populations or densmats - decide based on dimensions of input.'''
    if len(np.shape(rho1))==2 and len(np.shape(rho2))==2:
        tmp = rho1-rho2
        return 1-np.real(np.trace(qtls.sqrtm_dm(np.dot(tmp.conjugate().transpose(),tmp))))/2
    else:
        return 1-0.5*np.sum(np.abs(rho1-rho2))
Пример #3
0
 def trdistance(self, idealrho=None):
     self.check_idealrho(idealrho)
     tmp = self.idealrho - self.exprho
     self.tracedistance = np.real(
         np.trace(qtls.sqrtm_dm(np.dot(tmp.conjugate().transpose(),
                                       tmp)))) / 2
     return self.tracedistance
Пример #4
0
def tracedist(rho1, rho2):
    ''' trace distance. Can be calculated for either populations or densmats - decide based on dimensions of input.'''
    if len(np.shape(rho1)) == 2 and len(np.shape(rho2)) == 2:
        tmp = rho1 - rho2
        return 1 - np.real(
            np.trace(qtls.sqrtm_dm(np.dot(tmp.conjugate().transpose(),
                                          tmp)))) / 2
    else:
        return 1 - 0.5 * np.sum(np.abs(rho1 - rho2))
Пример #5
0
def jozsafid(rho1, rho2):
    ''' jozsa fidelity '''
    tmp = qtls.sqrtm_dm(rho2)
    return np.real(np.trace(qtls.sqrtm_dm(np.dot(np.dot(tmp,rho1),tmp)))**2)
Пример #6
0
def jozsafid(rho1, rho2):
    ''' jozsa fidelity '''
    tmp = qtls.sqrtm_dm(rho2)
    return np.real(np.trace(qtls.sqrtm_dm(np.dot(np.dot(tmp, rho1), tmp)))**2)
Пример #7
0
 def trdistance(self,idealrho=None):
   self.check_idealrho(idealrho)
   tmp=self.idealrho-self.exprho
   self.tracedistance=np.real(np.trace(qtls.sqrtm_dm(np.dot(tmp.conjugate().transpose(),tmp))))/2
   return self.tracedistance
Пример #8
0
 def jozsafid(self,idealrho=None):
   self.check_idealrho(idealrho)
   tmp=qtls.sqrtm_dm(self.exprho)
   self.jozsafidelity=real(trace(qtls.sqrtm_dm(dot(dot(tmp,self.idealrho),tmp)))**2).tolist()
   return self.jozsafidelity