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

Commit

Permalink
TensorFreeModule._element_constructor_: Pass parent=self to element_c…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
Matthias Koeppe committed Aug 27, 2022
1 parent 17137cf commit 993b343
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/sage/tensor/modules/tensor_free_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,8 @@ def _element_constructor_(self, comp=[], basis=None, name=None,
self._fmodule is endo.domain():
resu = self.element_class(self._fmodule, (1,1),
name=endo._name,
latex_name=endo._latex_name)
latex_name=endo._latex_name,
parent=self)
for basis, mat in endo._matrices.items():
resu.add_comp(basis[0])[:] = mat
else:
Expand All @@ -450,7 +451,8 @@ def _element_constructor_(self, comp=[], basis=None, name=None,
resu = self.element_class(self._fmodule, (p,0),
name=tensor._name,
latex_name=tensor._latex_name,
antisym=asym)
antisym=asym,
parent=self)
for basis, comp in tensor._components.items():
resu._components[basis] = comp.copy()
elif isinstance(comp, FreeModuleAltForm):
Expand All @@ -467,7 +469,8 @@ def _element_constructor_(self, comp=[], basis=None, name=None,
asym = range(p)
resu = self.element_class(self._fmodule, (0,p), name=form._name,
latex_name=form._latex_name,
antisym=asym)
antisym=asym,
parent=self)
for basis, comp in form._components.items():
resu._components[basis] = comp.copy()
elif isinstance(comp, FreeModuleAutomorphism):
Expand All @@ -478,7 +481,8 @@ def _element_constructor_(self, comp=[], basis=None, name=None,
raise TypeError("cannot coerce the {}".format(autom) +
" to an element of {}".format(self))
resu = self.element_class(self._fmodule, (1,1), name=autom._name,
latex_name=autom._latex_name)
latex_name=autom._latex_name,
parent=self)
for basis, comp in autom._components.items():
resu._components[basis] = comp.copy()
elif isinstance(comp, FreeModuleTensor):
Expand All @@ -489,14 +493,15 @@ def _element_constructor_(self, comp=[], basis=None, name=None,
" to an element of {}".format(self))
resu = self.element_class(self._fmodule, self._tensor_type,
name=name, latex_name=latex_name,
sym=sym, antisym=antisym)
sym=sym, antisym=antisym,
parent=self)
for basis, comp in tensor._components.items():
resu._components[basis] = comp.copy()
else:
# Standard construction:
resu = self.element_class(self._fmodule, self._tensor_type,
name=name, latex_name=latex_name,
sym=sym, antisym=antisym)
sym=sym, antisym=antisym, parent=self)
if comp:
resu.set_comp(basis)[:] = comp
return resu
Expand Down

0 comments on commit 993b343

Please sign in to comment.