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
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))
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
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))
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)
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)
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
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