Example #1
0
def coh_re(d,rho):
  from numpy import zeros;  pv = zeros(d)
  for j in range(0,d):
    pv[j] = rho[j][j].real
  from entropy import shannon, neumann;  coh = shannon(d,pv) - neumann(d,rho)
  return coh
#-----------------------------------------------------------------------------------------------------------------------------------
Example #2
0
def coh_re(rho):
    d = rho.shape[0]
    pv = np.zeros(d)
    for j in range(0, d):
        pv[j] = rho[j][j].real
    from entropy import shannon, von_neumann
    coh = shannon(pv) - von_neumann(rho)
    return coh / math.log(d, 2)
Example #3
0
  def __init__(self,pkt):
	self.src = pkt.src 
	self.dst = pkt.dst
	self.time = pkt.time
	self.proto = pkt.proto
	self.pkt_count = 1
        self.shannon_pkt = [shannon(self.get_payload(pkt))]
        self.payload_sizes = [len(self.get_payload(pkt))]
Example #4
0
def EoF(rho):
    pv = np.zeros(2)
    Ec = concurrence(rho)
    pv[0] = (1.0 + np.sqrt(1.0 - Ec**2.0)) / 2.0
    pv[1] = 1.0 - pv[0]
    from entropy import shannon
    EF = shannon(2, pv)
    return EF
Example #5
0
def Svn(d, bv):
    nbv = np.zeros(d**2-1)
    for j in range(0, d-1):
        nbv[j] = bv[j]
    for j in range(d-1, d**2-1):
        nbv[j] = 0
    dm = gm.rho(d, nbv)
    pd = np.zeros(d)
    for j in range(0, d):
        pd[j] = dm[j, j].real
    return entropy.shannon(pd)
Example #6
0
def SvnHe(d, bvsr, trsr):
    nbv = np.zeros(d**2-1)
    for j in range(0, d-1):
        nbv[j] = bvsr[j]
    for j in range(d-1, d**2-1):
        nbv[j] = 0
    dm = gm.rho(d, nbv)
    pd = np.zeros(d)
    for j in range(0, d):
        pd[j] = dm[j, j].real
    svn = entropy.shannon(d, pd) + trsr*(trsr-1)
    return svn
Example #7
0
 def shannon(self):
     return round(shannon(self.payload),4)
Example #8
0
	def shannon(self):
		return round(shannon(self.payload),4)
Example #9
0
  def add(self,pkt):
	self.pkt_count += 1
	self.shannon_pkt.append(shannon(self.get_payload(pkt)))
	self.payload_sizes.append(len(self.get_payload(pkt)))