Exemple #1
0
    def __xor__(A, B):
        C = A * B
        C = C.Alt_or_Sym(1)

        k = A.order()
        l = B.order()
        p = C.product_of_dims()
        r = k + l
        n = len(C.elements[0])
        scale = fact_m.fact(k + l) / (1.0 * fact_m.fact(k) * fact_m.fact(l))

        for i in range(0, p):
            I = multidx(i, r, n)
            C[I] *= scale

        return C
Exemple #2
0
	def __xor__(A, B):
		C = A * B
		C = C.Alt_or_Sym(1)

		k = A.order()
		l = B.order()
		p = C.product_of_dims()
		r = k + l
		n = len(C.elements[0])
		scale = fact_m.fact(k+l) / (1.0 * fact_m.fact(k) * fact_m.fact(l))

		for i in range(0, p):
			I = multidx(i, r, n)
			C[I] *= scale

		return C
Exemple #3
0
 def Alt_or_Sym(self, want_Alt):
     # xxx what if scalar?
     r = self.order()
     n = len(self.elements[0])
     p = self.product_of_dims()
     C = make_zero_simple_tensor(r, n)
     Sr = sni_gm.get_elements_str(r)
     for sigma in Sr:
         if (want_Alt and sigma.sgn() == -1):
             sign = -1
         else:
             sign = 1
         for i in range(0, p):
             I = multidx(i, r, n)
             J = sigma.of(I)
             C[I] += sign * self[J]
     scale = 1.0 / fact_m.fact(r)
     for i in range(0, p):
         I = multidx(i, r, n)
         C[I] *= scale
     return C
Exemple #4
0
	def Alt_or_Sym(self, want_Alt):
		# xxx what if scalar?
		r = self.order()
		n = len(self.elements[0])
		p = self.product_of_dims()
		C = make_zero_simple_tensor(r,n)
		Sr = sni_gm.get_elements_str(r)
		for sigma in Sr:
			if (want_Alt and sigma.sgn() == -1):
				sign = -1
			else:
				sign = 1
			for i in range(0, p):
				I = multidx(i, r, n)
				J = sigma.of(I)
				C[I] += sign * self[J]
		scale = 1.0 / fact_m.fact(r)
		for i in range(0, p):
			I = multidx(i, r, n)
			C[I] *= scale
		return C