(self, t)
return res
trace of a single line of gamma matrices

        Examples
        ========

        >>> from sympy.physics.hep.gamma_matrices import GammaMatrix as G
        >>> from sympy.tensor.tensor import tensor_indices, tensorhead
        >>> p, q = tensorhead('p, q', [G.LorentzIndex], [[1]])
        >>> i0,i1,i2,i3,i4,i5 = tensor_indices('i0:6', G.LorentzIndex)
        >>> ps = p(i0)*G(-i0)
        >>> qs = q(i0)*G(-i0)
        >>> G.gamma_trace(G(i0)*G(i1))
        4*metric(i0, i1)
        >>> G.gamma_trace(ps*ps) - 4*p(i0)*p(-i0)
        0
        >>> G.gamma_trace(ps*qs + ps*ps) - 4*p(i0)*p(-i0) - 4*p(i0)*q(-i0)
        0
trace of a single line of gamma matrices
trace of a single line of gamma matrices
def gamma_trace(self, t):
        """
        trace of a single line of gamma matrices

        Examples
        ========

        >>> from sympy.physics.hep.gamma_matrices import GammaMatrix as G
        >>> from sympy.tensor.tensor import tensor_indices, tensorhead
        >>> p, q = tensorhead('p, q', [G.LorentzIndex], [[1]])
        >>> i0,i1,i2,i3,i4,i5 = tensor_indices('i0:6', G.LorentzIndex)
        >>> ps = p(i0)*G(-i0)
        >>> qs = q(i0)*G(-i0)
        >>> G.gamma_trace(G(i0)*G(i1))
        4*metric(i0, i1)
        >>> G.gamma_trace(ps*ps) - 4*p(i0)*p(-i0)
        0
        >>> G.gamma_trace(ps*qs + ps*ps) - 4*p(i0)*p(-i0) - 4*p(i0)*q(-i0)
        0

        """
        #assert any(x == DiracSpinorIndex.auto_right for x, p, c, in t._tids.free)
        if isinstance(t, TensAdd):
            res = TensAdd(*[self._trace_single_line(x) for x in t.args])
            return res
        t = self._simplify_single_line(t)
        res = self._trace_single_line(t)
        return res
def gamma_trace ( self , t ) : #assert any(x == DiracSpinorIndex.auto_right for x, p, c, in t._tids.free) if isinstance ( t , TensAdd ) : res = TensAdd ( * [ self . _trace_single_line ( x ) for x in t . args ] ) return res t = self . _simplify_single_line ( t ) res = self . _trace_single_line ( t ) return res