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

Commit

Permalink
src/sage/tensor: In examples, use FiniteRankFreeModule.tensor_module(…
Browse files Browse the repository at this point in the history
…..., sym=...) instead of FiniteRankFreeModule_sym
  • Loading branch information
mkoeppe committed Aug 29, 2022
1 parent a99f5c0 commit 1e7430a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 34 deletions.
3 changes: 1 addition & 2 deletions src/sage/tensor/modules/finite_rank_free_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,9 +703,8 @@ def ambient_module(self): # compatible with sage.modules.free_module.FreeModule_
sage: M.ambient_module() is M
True
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5)))
sage: T60M = M.tensor_module(6, 0)
sage: Sym0123x45M.ambient_module() is T60M
True
Expand Down
9 changes: 3 additions & 6 deletions src/sage/tensor/modules/tensor_free_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,10 @@ def _an_element_(self):
TESTS::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: T60M = M.tensor_module(6, 0)
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5)))
sage: t = Sym0123x45M._an_element_()
sage: t.parent() is Sym0123x45M
True
Expand Down Expand Up @@ -623,8 +622,7 @@ def _coerce_map_from_(self, other):
Coercion from submodules::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: Sym01M = TensorFreeSubmodule_sym(M, (2, 0), sym=((0, 1)))
sage: Sym01M = M.tensor_module(2, 0, sym=((0, 1)))
sage: M.tensor_module(2,0)._coerce_map_from_(Sym01M)
True
Expand Down Expand Up @@ -760,8 +758,7 @@ def basis(self, symbol, latex_symbol=None, from_family=None,
e_2⊗e^1
e_2⊗e^2
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: Sym2M = TensorFreeSubmodule_sym(M, (2, 0), sym=range(2))
sage: Sym2M = M.tensor_module(2, 0, sym=range(2))
sage: e_Sym2M = Sym2M.basis('e'); e_Sym2M
Standard basis on the
Free module of fully symmetric type-(2,0) tensors on the Rank-3 free module M over the Integer Ring
Expand Down
42 changes: 16 additions & 26 deletions src/sage/tensor/modules/tensor_free_submodule.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class TensorFreeSubmodule_sym(TensorFreeModule):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: T60M = M.tensor_module(6, 0); T60M
Expand All @@ -39,30 +38,30 @@ class TensorFreeSubmodule_sym(TensorFreeModule):
'T^(6, 0)(M)'
sage: latex(T60M)
T^{(6, 0)}\left(M\right)
sage: T40Sym45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((4, 5))); T40Sym45M
sage: T40Sym45M = M.tensor_module(6, 0, sym=((4, 5))); T40Sym45M
Free module of type-(6,0) tensors on the Rank-3 free module M over the Integer Ring,
with symmetry on the index positions (4, 5)
sage: T40Sym45M._name
'T^{0,1,2,3}(M)⊗Sym^{4,5}(M)'
sage: latex(T40Sym45M)
T^{\{0,1,2,3\}}(M) \otimes \mathrm{Sym}^{\{4,5\}}(M)
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5))); Sym0123x45M
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5))); Sym0123x45M
Free module of type-(6,0) tensors on the Rank-3 free module M over the Integer Ring,
with symmetry on the index positions (0, 1, 2, 3),
with symmetry on the index positions (4, 5)
sage: Sym0123x45M._name
'Sym^{0,1,2,3}(M)⊗Sym^{4,5}(M)'
sage: latex(Sym0123x45M)
\mathrm{Sym}^{\{0,1,2,3\}}(M) \otimes \mathrm{Sym}^{\{4,5\}}(M)
sage: Sym012x345M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2), (3, 4, 5))); Sym012x345M
sage: Sym012x345M = M.tensor_module(6, 0, sym=((0, 1, 2), (3, 4, 5))); Sym012x345M
Free module of type-(6,0) tensors on the Rank-3 free module M over the Integer Ring,
with symmetry on the index positions (0, 1, 2),
with symmetry on the index positions (3, 4, 5)
sage: Sym012x345M._name
'Sym^{0,1,2}(M)⊗Sym^{3,4,5}(M)'
sage: latex(Sym012x345M)
\mathrm{Sym}^{\{0,1,2\}}(M) \otimes \mathrm{Sym}^{\{3,4,5\}}(M)
sage: Sym012345M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3, 4, 5))); Sym012345M
sage: Sym012345M = M.tensor_module(6, 0, sym=((0, 1, 2, 3, 4, 5))); Sym012345M
Free module of fully symmetric type-(6,0) tensors
on the Rank-3 free module M over the Integer Ring
sage: Sym012345M._name
Expand All @@ -84,7 +83,7 @@ class TensorFreeSubmodule_sym(TensorFreeModule):
TESTS::
sage: T = TensorFreeSubmodule_sym(M, (4, 4), sym=((0, 1)), antisym=((4, 5))); T
sage: T = M.tensor_module(4, 4, sym=((0, 1)), antisym=((4, 5))); T
Free module of type-(4,4) tensors on the Rank-3 free module M over the Integer Ring,
with symmetry on the index positions (0, 1),
with antisymmetry on the index positions (4, 5)
Expand All @@ -99,10 +98,9 @@ def __init__(self, fmodule, tensor_type, name=None, latex_name=None,
r"""
TESTS::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5)))
sage: TestSuite(Sym0123x45M).run()
"""
self._fmodule = fmodule
Expand Down Expand Up @@ -186,9 +184,8 @@ def _basis_sym(self):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: Sym2M = TensorFreeSubmodule_sym(M, (2, 0), sym=range(2)); Sym2M
sage: Sym2M = M.tensor_module(2, 0, sym=range(2)); Sym2M
Free module of fully symmetric type-(2,0) tensors on the Rank-3 free module M over the Integer Ring
sage: c = Sym2M._basis_sym(); c
Fully symmetric 2-indices components w.r.t. (0, 1, 2)
Expand All @@ -205,9 +202,8 @@ def _repr_(self):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: Sym2M = TensorFreeSubmodule_sym(M, (2, 0), sym=range(2)); Sym2M
sage: Sym2M = M.tensor_module(2, 0, sym=range(2)); Sym2M
Free module of fully symmetric type-(2,0) tensors
on the Rank-3 free module M over the Integer Ring
Expand All @@ -226,11 +222,10 @@ def _is_symmetry_coarsening_of(self, coarser_comp, finer_comp):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: T60M = M.tensor_module(6, 0)
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5)))
sage: ten0123x45M = Sym0123x45M.an_element(); ten0123x45M
Type-(6,0) tensor on the Rank-3 free module M over the Integer Ring
sage: ten0123x45M.parent()
Expand All @@ -242,13 +237,13 @@ def _is_symmetry_coarsening_of(self, coarser_comp, finer_comp):
on the Rank-3 free module M over the Integer Ring,
with symmetry on the index positions (0, 1, 2, 3),
with symmetry on the index positions (4, 5)
sage: Sym012x345M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2), (3, 4, 5)))
sage: Sym012x345M = M.tensor_module(6, 0, sym=((0, 1, 2), (3, 4, 5)))
sage: com012x345M = Sym012x345M.an_element()._components[e]; com012x345M
6-indices components w.r.t. Basis (e_0,e_1,e_2)
on the Rank-3 free module M over the Integer Ring,
with symmetry on the index positions (0, 1, 2),
with symmetry on the index positions (3, 4, 5)
sage: Sym012345M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3, 4, 5)))
sage: Sym012345M = M.tensor_module(6, 0, sym=((0, 1, 2, 3, 4, 5)))
sage: com012345M = Sym012345M.an_element()._components[e]; com012345M
Fully symmetric 6-indices components w.r.t. Basis (e_0,e_1,e_2)
on the Rank-3 free module M over the Integer Ring
Expand Down Expand Up @@ -302,11 +297,10 @@ def _element_constructor_(self, comp=[], basis=None, name=None,
r"""
TESTS::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: T60M = M.tensor_module(6, 0)
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M(e[0]*e[0]*e[0]*e[0]*e[1]*e[2])
Traceback (most recent call last):
...
Expand Down Expand Up @@ -355,12 +349,11 @@ def is_submodule(self, other):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: T60M = M.tensor_module(6, 0)
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5)))
sage: Sym012x345M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2), (3, 4, 5)))
sage: Sym012345M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3, 4, 5)))
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5)))
sage: Sym012x345M = M.tensor_module(6, 0, sym=((0, 1, 2), (3, 4, 5)))
sage: Sym012345M = M.tensor_module(6, 0, sym=((0, 1, 2, 3, 4, 5)))
sage: Sym012345M.is_submodule(Sym012345M)
True
sage: Sym012345M.is_submodule(Sym0123x45M)
Expand Down Expand Up @@ -397,9 +390,8 @@ def lift(self):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: Sym0123x45M = TensorFreeSubmodule_sym(M, (6, 0), sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M = M.tensor_module(6, 0, sym=((0, 1, 2, 3), (4, 5)))
sage: Sym0123x45M.lift
Generic morphism:
From: Free module of type-(6,0) tensors on the Rank-3 free module M over the Integer Ring,
Expand All @@ -419,7 +411,6 @@ def reduce(self):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(QQ, 3, name='M')
sage: e = M.basis('e')
sage: X = M.tensor_module(6, 0)
Expand Down Expand Up @@ -491,7 +482,6 @@ def retract(self):
EXAMPLES::
sage: from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_sym
sage: M = FiniteRankFreeModule(ZZ, 3, name='M')
sage: e = M.basis('e')
sage: X = M.tensor_module(6, 0)
Expand Down

0 comments on commit 1e7430a

Please sign in to comment.