Beispiel #1
0
 def test_spin_half_double_space(self, sz):
     prj = zspin_projector(5, sz)
     h = ham_heis(5)
     h0 = prj @ h @ prj.H
     v0s = eigvecs(h0)
     for v0 in v0s.T:
         vf = prj.H @ v0.T
         prjv = vf @ vf.H
         # Check reconstructed full eigenvectors commute with full ham
         assert_allclose(prjv @ h, h @ prjv, atol=1e-13)
     if sz == 0:
         # Groundstate must be in most symmetric subspace
         gs = groundstate(h)
         gs0 = prj .H @ v0s[:, 0]
         assert_allclose(expec(gs, gs0), 1.0)
         assert_allclose(expec(h, gs0), expec(h, gs))
Beispiel #2
0
 def test_eigvecs(self, mat_herm_dense, bkd):
     u, a = mat_herm_dense
     v = eigvecs(a, backend=bkd)
     for i, j in zip([3, 0, 1, 2], range(4)):
         o = u[:, i].H @ v[:, j]
         assert_allclose(abs(o), 1.)
Beispiel #3
0
def orthog_ks():
    p = rand_rho(3)
    v = eigvecs(p)
    return (v[:, 0], v[:, 1], v[:, 2])
Beispiel #4
0
 def test_dense_true(self):
     a = rand_herm(10)
     v = eigvecs(a)
     for i in range(10):
         assert is_eigenvector(v[:, i], a)