def eigenbasis(self, nb, phi=0):
"""
Calculates the generalized eigen-energies along with
the left and right eigen-basis.
Parameters
----------
nb : int
Number of bosons
phi : float
Phase factor for the relevant photonic state
"""
phi = 0 if self.local else phi
ckey = '{}-{}'.format(nb, phi)
if ckey not in self._cache['eigen']:
# generate number sector
ns1 = self.model.numbersector(nb)
# get the size of the basis
ns1size = ns1.basis.len # length of the number sector basis
# G1i = xrange(ns1size) # our Greens function?
# self energy
sigma = self.sigma(nb, phi)
# Effective Hamiltonian
H1n = ns1.hamiltonian + sigma
# Complete diagonalization
E1, psi1r = linalg.eig(H1n.toarray(), left=False)
psi1l = np.conj(np.linalg.inv(psi1r)).T
# check for dark states (throw a warning if one shows up)
# if (nb > 0):
# Setup.check_for_dark_states(nb, E1)
self._cache['eigen'][ckey] = (E1, psi1l, psi1r)
return self._cache['eigen'][ckey]
评论列表
文章目录