def test_eigh_orthogonal(): gr = _get() # The most simple setup. sp = SparseOrbitalBZ(gr) sp[0, 0] = 0.5 sp[1, 1] = 0.5 assert np.allclose(sp.eigh(), [0.5, 0.5]) assert np.allclose(sp.eigh([0.5] * 3), [0.5, 0.5])
def test_eigh_non_orthogonal(): gr = _get() # The most simple setup. sp = SparseOrbitalBZ(gr, orthogonal=False) sp[0, 0] = 0.5 sp[1, 1] = 0.5 sp.S[0, 0] = 1. sp.S[1, 1] = 1. assert np.allclose(sp.eigh(), [0.5, 0.5])
def test_pickle_non_orthogonal(): import pickle as p gr = _get() sp = SparseOrbitalBZ(gr, orthogonal=False) sp[0, 0] = 0.5 sp[1, 1] = 0.5 sp.S[0, 0] = 1. sp.S[1, 1] = 1. s = p.dumps(sp) SP = p.loads(s) assert sp.spsame(SP) assert np.allclose(sp.eigh(), SP.eigh())