def test_evecs(self, ham1, which, k, sigma): lk, vk = seigsys_numpy(ham1, k=k, which=which, return_vecs=True, sigma=sigma, sort=False) assert isinstance(vk, np.matrix) assert_allclose(dot(vk, ldmul(lk, vk.H)), ham1)
def ham1(): evecs = rand_uni(5) evals = np.array([-5, -3, 0.1, 2, 4]) return dot(evecs, ldmul(evals, evecs.H))
def gs_overlap(t, pt, H): evals, evecs = eigs_scipy(H(t), k=1, which='SA') return np.abs(qu.dot(pt.T, qu.qu(evecs[:, 0])))**2
def norm(t, pt): return qu.dot(pt.T, pt)
def test_evecs(self, ham1, which, k, sigma): lk, vk = eigs_numpy(ham1, k=k, which=which, return_vecs=True, sigma=sigma, sort=False) assert isinstance(vk, qu.qarray) assert_allclose(qu.dot(vk, qu.ldmul(lk, vk.H)), ham1)