예제 #1
0
 def test_null(self):
     i = Idx(0, "occ")
     j = Idx(1, "occ")
     a = Idx(0, "vir")
     b = Idx(1, "vir")
     L1 = Tensor([i, j, a, b], "L")
     J1 = Tensor([j, b], "J")
     S1j = Sigma(j)
     S1b = Sigma(b)
     T1 = ATerm(scalar=1, sums=[S1j, S1b], tensors=[L1, J1])
     T2 = ATerm(scalar=1, sums=[S1j, S1b], tensors=[L1, J1])
     self.assertTrue(T1.match(T2))
     self.assertTrue(T2.match(T1))
예제 #2
0
    def test_term_map(self):
        s = 1
        i = Idx(0, "occ")
        j = Idx(1, "occ")
        sums = [Sigma(i), Sigma(j)]
        tensors = [Tensor([i, j], 'f')]
        t1 = ATerm(s, sums, tensors)
        sums = [Sigma(i), Sigma(j)]
        tensors = [Tensor([j, i], 'f')]
        t2 = ATerm(s, sums, tensors)
        sums = [Sigma(j), Sigma(i)]
        tensors = [Tensor([i, j], 'f')]
        t3 = ATerm(s, sums, tensors)

        self.assertTrue(t1.match(t2))
        self.assertTrue(t1.match(t3))
        self.assertTrue(t2.match(t3))
예제 #3
0
    def test_term_map3(self):
        s = 1
        i = Idx(0, "occ")
        a = Idx(0, "vir")
        sums = [Sigma(i), Sigma(a)]
        tensors = [Tensor([i, a], 'f'), Tensor([a, i], 't')]
        t1 = ATerm(s, sums, tensors)

        sums = [Sigma(i)]
        t2 = ATerm(s, sums, tensors)

        self.assertFalse(t1.match(t2))