(self, key, value)
Set the components data of a tensor object/expression.

        Components data are transformed to the all-contravariant form and stored
        with the corresponding ``TensorHead`` object. If a ``TensorHead`` object
        cannot be uniquely identified, it will raise an error.
Set the components data of a tensor object/expression.
Set the components data of a tensor object / expression .
def __setitem__(self, key, value):
        """
        Set the components data of a tensor object/expression.

        Components data are transformed to the all-contravariant form and stored
        with the corresponding ``TensorHead`` object. If a ``TensorHead`` object
        cannot be uniquely identified, it will raise an error.
        """
        data = _TensorDataLazyEvaluator.parse_data(value)

        # TensorHead and TensorIndexType can be assigned data directly, while
        # TensMul must first convert data to a fully contravariant form, and
        # assign it to its corresponding TensorHead single component.
        if not isinstance(key, (TensorHead, TensorIndexType)):
            key, data = self._assign_data_to_tensor_expr(key, data)

        if isinstance(key, TensorHead):
            for dim, indextype in zip(data.shape, key.index_types):
                if indextype.data is None:
                    raise ValueError("index type {} has no components data"\
                    " associated (needed to raise/lower index)".format(indextype))
                if indextype.dim is None:
                    continue
                if dim != indextype.dim:
                    raise ValueError("wrong dimension of ndarray")
        self._substitutions_dict[key] = data
def __setitem__ ( self , key , value ) : data = _TensorDataLazyEvaluator . parse_data ( value ) # TensorHead and TensorIndexType can be assigned data directly, while # TensMul must first convert data to a fully contravariant form, and # assign it to its corresponding TensorHead single component. if not isinstance ( key , ( TensorHead , TensorIndexType ) ) : key , data = self . _assign_data_to_tensor_expr ( key , data ) if isinstance ( key , TensorHead ) : for dim , indextype in zip ( data . shape , key . index_types ) : if indextype . data is None : raise ValueError ( "index type {} has no components data" " associated (needed to raise/lower index)" . format ( indextype ) ) if indextype . dim is None : continue if dim != indextype . dim : raise ValueError ( "wrong dimension of ndarray" ) self . _substitutions_dict [ key ] = data