Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Zero treatment for FreeModules
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Jung committed Oct 7, 2019
1 parent 892050e commit 1b96587
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/sage/tensor/modules/free_module_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,18 @@ class :class:`~sage.tensor.modules.comp.Components`; if such
[Basis (e_0,e_1,e_2) on the Rank-3 free module M over the Integer Ring,
Basis (f_0,f_1,f_2) on the Rank-3 free module M over the Integer Ring]
Since zero is a special element, its components cannot be changed::
sage: z = M.tensor_module(1, 1).zero()
sage: z.set_comp(f)[0,1] = 4
Traceback (most recent call last):
...
AssertionError: the components of the zero element cannot be changed
"""
if self is self.parent().zero():
raise AssertionError("the components of the zero element cannot be "
"changed")
if basis is None:
basis = self._fmodule._def_basis
if basis not in self._components:
Expand Down Expand Up @@ -1314,7 +1325,18 @@ class :class:`~sage.tensor.modules.comp.Components`;
sage: t.display(e)
t = -3 e_0*e^1 + 2 e_1*e^2
Since zero is a special element, its components cannot be changed::
sage: z = M.tensor_module(1, 1).zero()
sage: z.add_comp(f)[0,1] = 4
Traceback (most recent call last):
...
AssertionError: the components of the zero element cannot be changed
"""
if self is self.parent().zero():
raise AssertionError("the components of the zero element cannot be "
"changed")
if basis is None:
basis = self._fmodule._def_basis
if basis not in self._components:
Expand Down

0 comments on commit 1b96587

Please sign in to comment.