(self, metric, data)
Assign data to the ``metric`` tensor. The metric tensor behaves in an
        anomalous way when raising and lowering indices.

        A fully covariant metric is the inverse transpose of the fully
        contravariant metric (it is meant matrix inverse). If the metric is
        symmetric, the transpose is not necessary and mixed
        covariant/contravariant metrics are Kronecker deltas.
Assign data to the ``metric`` tensor. The metric tensor behaves in an
        anomalous way when raising and lowering indices.
Assign data to the metric tensor . The metric tensor behaves in an anomalous way when raising and lowering indices .
def add_metric_data(self, metric, data):
        """
        Assign data to the ``metric`` tensor. The metric tensor behaves in an
        anomalous way when raising and lowering indices.

        A fully covariant metric is the inverse transpose of the fully
        contravariant metric (it is meant matrix inverse). If the metric is
        symmetric, the transpose is not necessary and mixed
        covariant/contravariant metrics are Kronecker deltas.
        """
        # hard assignment, data should not be added to `TensorHead` for metric:
        # the problem with `TensorHead` is that the metric is anomalous, i.e.
        # raising and lowering the index means considering the metric or its
        # inverse, this is not the case for other tensors.
        self._substitutions_dict_tensmul[metric, True, True] = data
        inverse_transpose = self.inverse_transpose_matrix(data)
        # in symmetric spaces, the traspose is the same as the original matrix,
        # the full covariant metric tensor is the inverse transpose, so this
        # code will be able to handle non-symmetric metrics.
        self._substitutions_dict_tensmul[metric, False, False] = inverse_transpose
        # now mixed cases, these are identical to the unit matrix if the metric
        # is symmetric.
        m = Matrix(data)
        invt = Matrix(inverse_transpose)
        self._substitutions_dict_tensmul[metric, True, False] = m * invt
        self._substitutions_dict_tensmul[metric, False, True] = invt * m
def add_metric_data ( self , metric , data ) : # hard assignment, data should not be added to `TensorHead` for metric: # the problem with `TensorHead` is that the metric is anomalous, i.e. # raising and lowering the index means considering the metric or its # inverse, this is not the case for other tensors. self . _substitutions_dict_tensmul [ metric , True , True ] = data inverse_transpose = self . inverse_transpose_matrix ( data ) # in symmetric spaces, the traspose is the same as the original matrix, # the full covariant metric tensor is the inverse transpose, so this # code will be able to handle non-symmetric metrics. self . _substitutions_dict_tensmul [ metric , False , False ] = inverse_transpose # now mixed cases, these are identical to the unit matrix if the metric # is symmetric. m = Matrix ( data ) invt = Matrix ( inverse_transpose ) self . _substitutions_dict_tensmul [ metric , True , False ] = m * invt self . _substitutions_dict_tensmul [ metric , False , True ] = invt * m