(data, indices, free, dum, inverse=False)
return data
Utility function to correct the values inside the components data
        ndarray according to whether indices are covariant or contravariant.

        It uses the metric matrix to lower values of covariant indices.
Utility function to correct the values inside the components data
        ndarray according to whether indices are covariant or contravariant.
Utility function to correct the values inside the components data ndarray according to whether indices are covariant or contravariant .
def _correct_signature_from_indices(data, indices, free, dum, inverse=False):
        """
        Utility function to correct the values inside the components data
        ndarray according to whether indices are covariant or contravariant.

        It uses the metric matrix to lower values of covariant indices.
        """
        numpy = import_module('numpy')
        # change the ndarray values according covariantness/contravariantness of the indices
        # use the metric
        for i, indx in enumerate(indices):
            if not indx.is_up and not inverse:
                data = _TensorDataLazyEvaluator._flip_index_by_metric(data, indx._tensortype.data, i)
            elif not indx.is_up and inverse:
                data = _TensorDataLazyEvaluator._flip_index_by_metric(
                    data,
                    _TensorDataLazyEvaluator.inverse_matrix(indx._tensortype.data),
                    i
                )

        if len(dum) > 0:
            ### perform contractions ###
            axes1 = []
            axes2 = []
            for i, indx1 in enumerate(indices):
                try:
                    nd = indices[:i].index(-indx1)
                except ValueError:
                    continue
                axes1.append(nd)
                axes2.append(i)

            for ax1, ax2 in zip(axes1, axes2):
                data = numpy.trace(data, axis1=ax1, axis2=ax2)
        return data
def _correct_signature_from_indices ( data , indices , free , dum , inverse = False ) : numpy = import_module ( 'numpy' ) # change the ndarray values according covariantness/contravariantness of the indices # use the metric for i , indx in enumerate ( indices ) : if not indx . is_up and not inverse : data = _TensorDataLazyEvaluator . _flip_index_by_metric ( data , indx . _tensortype . data , i ) elif not indx . is_up and inverse : data = _TensorDataLazyEvaluator . _flip_index_by_metric ( data , _TensorDataLazyEvaluator . inverse_matrix ( indx . _tensortype . data ) , i ) if len ( dum ) > 0 : ### perform contractions ### axes1 = [ ] axes2 = [ ] for i , indx1 in enumerate ( indices ) : try : nd = indices [ : i ] . index ( - indx1 ) except ValueError : continue axes1 . append ( nd ) axes2 . append ( i ) for ax1 , ax2 in zip ( axes1 , axes2 ) : data = numpy . trace ( data , axis1 = ax1 , axis2 = ax2 ) return data