(self)
return indices
Get a list of indices, creating new tensor indices to complete dummy indices.
Get a list of indices, creating new tensor indices to complete dummy indices.
Get a list of indices creating new tensor indices to complete dummy indices .
def to_indices(self):
        """
        Get a list of indices, creating new tensor indices to complete dummy indices.
        """
        component_indices = []
        for i in self.components:
            component_indices.append([None]*i.rank)

        for i in self.free:
            component_indices[i[2]][i[1]] = i[0]

        for i, dummy_pos in enumerate(self.dum):
            tensor_index_type = self.components[dummy_pos[2]].args[1].args[0][0]
            dummy_index = TensorIndex('dummy_index_{0}'.format(i), tensor_index_type)
            component_indices[dummy_pos[2]][dummy_pos[0]] = dummy_index
            component_indices[dummy_pos[3]][dummy_pos[1]] = -dummy_index

        indices = []
        for i in component_indices:
            indices.extend(i)

        return indices
def to_indices ( self ) : component_indices = [ ] for i in self . components : component_indices . append ( [ None ] * i . rank ) for i in self . free : component_indices [ i [ 2 ] ] [ i [ 1 ] ] = i [ 0 ] for i , dummy_pos in enumerate ( self . dum ) : tensor_index_type = self . components [ dummy_pos [ 2 ] ] . args [ 1 ] . args [ 0 ] [ 0 ] dummy_index = TensorIndex ( 'dummy_index_{0}' . format ( i ) , tensor_index_type ) component_indices [ dummy_pos [ 2 ] ] [ dummy_pos [ 0 ] ] = dummy_index component_indices [ dummy_pos [ 3 ] ] [ dummy_pos [ 1 ] ] = - dummy_index indices = [ ] for i in component_indices : indices . extend ( i ) return indices