(self, g, canon_bp=False)
return TIDS(components, free, dum)
Returns a ``TIDS`` instance corresponding to the permutation ``g``

        ``g``  permutation corresponding to the tensor in the representation
        used in canonicalization

        ``canon_bp``   if True, then ``g`` is the permutation
        corresponding to the canonical form of the tensor
Returns a ``TIDS`` instance corresponding to the permutation ``g``
Returns a TIDS instance corresponding to the permutation g
def perm2tensor(self, g, canon_bp=False):
        """
        Returns a ``TIDS`` instance corresponding to the permutation ``g``

        ``g``  permutation corresponding to the tensor in the representation
        used in canonicalization

        ``canon_bp``   if True, then ``g`` is the permutation
        corresponding to the canonical form of the tensor
        """
        vpos = []
        components = self.components
        pos = 0
        for t in components:
            vpos.append(pos)
            pos += t._rank
        sorted_free = [x[0] for x in self.free]
        sorted_free.sort()
        nfree = len(sorted_free)
        rank = self._ext_rank
        dum = [[None]*4 for i in range((rank - nfree)//2)]
        free = []
        icomp = -1
        for i in range(rank):
            if i in vpos:
                icomp += vpos.count(i)
                pos0 = i
            ipos = i - pos0
            gi = g[i]
            if gi < nfree:
                ind = sorted_free[gi]
                free.append((ind, ipos, icomp))
            else:
                j = gi - nfree
                idum, cov = divmod(j, 2)
                if cov:
                    dum[idum][1] = ipos
                    dum[idum][3] = icomp
                else:
                    dum[idum][0] = ipos
                    dum[idum][2] = icomp
        dum = [tuple(x) for x in dum]

        return TIDS(components, free, dum)
def perm2tensor ( self , g , canon_bp = False ) : vpos = [ ] components = self . components pos = 0 for t in components : vpos . append ( pos ) pos += t . _rank sorted_free = [ x [ 0 ] for x in self . free ] sorted_free . sort ( ) nfree = len ( sorted_free ) rank = self . _ext_rank dum = [ [ None ] * 4 for i in range ( ( rank - nfree ) // 2 ) ] free = [ ] icomp = - 1 for i in range ( rank ) : if i in vpos : icomp += vpos . count ( i ) pos0 = i ipos = i - pos0 gi = g [ i ] if gi < nfree : ind = sorted_free [ gi ] free . append ( ( ind , ipos , icomp ) ) else : j = gi - nfree idum , cov = divmod ( j , 2 ) if cov : dum [ idum ] [ 1 ] = ipos dum [ idum ] [ 3 ] = icomp else : dum [ idum ] [ 0 ] = ipos dum [ idum ] [ 2 ] = icomp dum = [ tuple ( x ) for x in dum ] return TIDS ( components , free , dum )