예제 #1
0
 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)
예제 #2
0
def ham1():
    evecs = rand_uni(5)
    evals = np.array([-5, -3, 0.1, 2, 4])
    return dot(evecs, ldmul(evals, evecs.H))
예제 #3
0
 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
예제 #4
0
 def norm(t, pt):
     return qu.dot(pt.T, pt)
예제 #5
0
 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)