(self, key)
return None
Retrieve ``data`` associated with ``key``.

        This algorithm looks into ``self._substitutions_dict`` for all
        ``TensorHead`` in the ``TensExpr`` (or just ``TensorHead`` if key is a
        TensorHead instance). It reconstructs the components data that the
        tensor expression should have by performing on components data the
        operations that correspond to the abstract tensor operations applied.

        Metric tensor is handled in a different manner: it is pre-computed in
        ``self._substitutions_dict_tensmul``.
Retrieve ``data`` associated with ``key``.
Retrieve data associated with key .
def _get(self, key):
        """
        Retrieve ``data`` associated with ``key``.

        This algorithm looks into ``self._substitutions_dict`` for all
        ``TensorHead`` in the ``TensExpr`` (or just ``TensorHead`` if key is a
        TensorHead instance). It reconstructs the components data that the
        tensor expression should have by performing on components data the
        operations that correspond to the abstract tensor operations applied.

        Metric tensor is handled in a different manner: it is pre-computed in
        ``self._substitutions_dict_tensmul``.
        """
        if key in self._substitutions_dict:
            return self._substitutions_dict[key]

        if isinstance(key, TensorHead):
            return None

        if isinstance(key, TensMul):
            tensmul_list = key.split()
            if len(tensmul_list) == 1 and len(tensmul_list[0].components) == 1:
                # special case to handle metrics. Metric tensors cannot be
                # constructed through contraction by the metric, their
                # components show if they are a matrix or its inverse.
                signature = tuple([i.is_up for i in tensmul_list[0].get_indices()])
                srch = (tensmul_list[0].components[0],) + signature
                if srch in self._substitutions_dict_tensmul:
                    return self._substitutions_dict_tensmul[srch]
            data_list = [self.data_tensmul_from_tensorhead(i, i.components[0]) for i in tensmul_list]
            if all([i is None for i in data_list]):
                return None
            if any([i is None for i in data_list]):
                raise ValueError("Mixing tensors with associated components "\
                                 "data with tensors without components data")
            data_result, tensmul_result = self.data_product_tensors(data_list, tensmul_list)
            return data_result

        if isinstance(key, TensAdd):
            sumvar = S.Zero
            data_list = [i.data for i in key.args]
            if all([i is None for i in data_list]):
                return None
            if any([i is None for i in data_list]):
                raise ValueError("Mixing tensors with associated components "\
                                 "data with tensors without components data")
            for i in data_list:
                sumvar += i
            return sumvar

        return None
def _get ( self , key ) : if key in self . _substitutions_dict : return self . _substitutions_dict [ key ] if isinstance ( key , TensorHead ) : return None if isinstance ( key , TensMul ) : tensmul_list = key . split ( ) if len ( tensmul_list ) == 1 and len ( tensmul_list [ 0 ] . components ) == 1 : # special case to handle metrics. Metric tensors cannot be # constructed through contraction by the metric, their # components show if they are a matrix or its inverse. signature = tuple ( [ i . is_up for i in tensmul_list [ 0 ] . get_indices ( ) ] ) srch = ( tensmul_list [ 0 ] . components [ 0 ] , ) + signature if srch in self . _substitutions_dict_tensmul : return self . _substitutions_dict_tensmul [ srch ] data_list = [ self . data_tensmul_from_tensorhead ( i , i . components [ 0 ] ) for i in tensmul_list ] if all ( [ i is None for i in data_list ] ) : return None if any ( [ i is None for i in data_list ] ) : raise ValueError ( "Mixing tensors with associated components " "data with tensors without components data" ) data_result , tensmul_result = self . data_product_tensors ( data_list , tensmul_list ) return data_result if isinstance ( key , TensAdd ) : sumvar = S . Zero data_list = [ i . data for i in key . args ] if all ( [ i is None for i in data_list ] ) : return None if any ( [ i is None for i in data_list ] ) : raise ValueError ( "Mixing tensors with associated components " "data with tensors without components data" ) for i in data_list : sumvar += i return sumvar return None