(self)
return _af_new(g), dummies, msym, v
Returns ``(g, dummies, msym, v)``, the entries of ``canonicalize``

        see ``canonicalize`` in ``tensor_can.py``
Returns ``(g, dummies, msym, v)``, the entries of ``canonicalize``
Returns ( g dummies msym v ) the entries of canonicalize
def canon_args(self):
        """
        Returns ``(g, dummies, msym, v)``, the entries of ``canonicalize``

        see ``canonicalize`` in ``tensor_can.py``
        """
        # to be called after sorted_components
        from sympy.combinatorics.permutations import _af_new
#         types = list(set(self._types))
#         types.sort(key = lambda x: x._name)
        n = self._ext_rank
        g = [None]*n + [n, n+1]
        pos = 0
        vpos = []
        components = self.components
        for t in components:
            vpos.append(pos)
            pos += t._rank
        # ordered indices: first the free indices, ordered by types
        # then the dummy indices, ordered by types and contravariant before
        # covariant
        # g[position in tensor] = position in ordered indices
        for i, (indx, ipos, cpos) in enumerate(self.free):
            pos = vpos[cpos] + ipos
            g[pos] = i
        pos = len(self.free)
        j = len(self.free)
        dummies = []
        prev = None
        a = []
        msym = []
        for ipos1, ipos2, cpos1, cpos2 in self.dum:
            pos1 = vpos[cpos1] + ipos1
            pos2 = vpos[cpos2] + ipos2
            g[pos1] = j
            g[pos2] = j + 1
            j += 2
            typ = components[cpos1].index_types[ipos1]
            if typ != prev:
                if a:
                    dummies.append(a)
                a = [pos, pos + 1]
                prev = typ
                msym.append(typ.metric_antisym)
            else:
                a.extend([pos, pos + 1])
            pos += 2
        if a:
            dummies.append(a)
        numtyp = []
        prev = None
        for t in components:
            if t == prev:
                numtyp[-1][1] += 1
            else:
                prev = t
                numtyp.append([prev, 1])
        v = []
        for h, n in numtyp:
            if h._comm == 0 or h._comm == 1:
                comm = h._comm
            else:
                comm = TensorManager.get_comm(h._comm, h._comm)
            v.append((h._symmetry.base, h._symmetry.generators, n, comm))
        return _af_new(g), dummies, msym, v
def canon_args ( self ) : # to be called after sorted_components from sympy . combinatorics . permutations import _af_new #         types = list(set(self._types)) #         types.sort(key = lambda x: x._name) n = self . _ext_rank g = [ None ] * n + [ n , n + 1 ] pos = 0 vpos = [ ] components = self . components for t in components : vpos . append ( pos ) pos += t . _rank # ordered indices: first the free indices, ordered by types # then the dummy indices, ordered by types and contravariant before # covariant # g[position in tensor] = position in ordered indices for i , ( indx , ipos , cpos ) in enumerate ( self . free ) : pos = vpos [ cpos ] + ipos g [ pos ] = i pos = len ( self . free ) j = len ( self . free ) dummies = [ ] prev = None a = [ ] msym = [ ] for ipos1 , ipos2 , cpos1 , cpos2 in self . dum : pos1 = vpos [ cpos1 ] + ipos1 pos2 = vpos [ cpos2 ] + ipos2 g [ pos1 ] = j g [ pos2 ] = j + 1 j += 2 typ = components [ cpos1 ] . index_types [ ipos1 ] if typ != prev : if a : dummies . append ( a ) a = [ pos , pos + 1 ] prev = typ msym . append ( typ . metric_antisym ) else : a . extend ( [ pos , pos + 1 ] ) pos += 2 if a : dummies . append ( a ) numtyp = [ ] prev = None for t in components : if t == prev : numtyp [ - 1 ] [ 1 ] += 1 else : prev = t numtyp . append ( [ prev , 1 ] ) v = [ ] for h , n in numtyp : if h . _comm == 0 or h . _comm == 1 : comm = h . _comm else : comm = TensorManager . get_comm ( h . _comm , h . _comm ) v . append ( ( h . _symmetry . base , h . _symmetry . generators , n , comm ) ) return _af_new ( g ) , dummies , msym , v