Opened 2 years ago

Closed 2 months ago

#30229 closed defect (fixed)

Submodules of TensorFreeModule defined by the symmetries of a Components object

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.8
Component: linear algebra Keywords:
Cc: Eric Gourgoulhon, Travis Scrimshaw, Michael Jung, Samuel Lelièvre, Hongli (Bob) Zhao Merged in:
Authors: Matthias Koeppe Reviewers: Eric Gourgoulhon
Report Upstream: N/A Work issues:
Branch: fc66ad1 (Commits, GitHub, GitLab) Commit: fc66ad14915c1b2d02d72db4114fbab48e7b601f
Dependencies: #30300, #34424, #34451, #34474 Stopgaps:

Status badges

Description (last modified by Matthias Köppe)

We generalize FiniteRankFreeModule.tensor_module by giving it optional arguments sym, antisym; if given, a submodule of the tensor module spanned by the tensors with these prescribed symmetries is created.

The new methods symmetric_power and dual_symmetric_power provide two important special cases.

The implementation makes the standard bases of tensor modules (and of their new submodules) explicit objects. The basis method now works for tensor modules, not just the base module, and returns an instance of the new class TensorFreeSubmoduleBasis_sym, which represents the standard basis corresponding to an instance of the Components class (or one of its subclasses).

Follow-ups:

  • #34427 TensorFreeModule.isomorphism_with_fixed_basis
  • #30242 Make ExtPowerFreeModule a quotient of TensorFreeModule
  • #30307 Refactor Components into parent (a ModuleWithBasis) & element

Change History (128)

comment:1 Changed 2 years ago by Matthias Köppe

Summary: ExtPowerFreeModule and TensorFreeModule cannot create a basisExtPowerFreeModule, ExtPowerDualFreeModule, TensorFreeModule cannot create a basis

comment:2 Changed 2 years ago by Eric Gourgoulhon

The current design of ExtPowerFreeModule, ExtPowerDualFreeModule and TensorFreeModule is such that they cannot have their own bases, although they are mathematically free modules and they inherit from FiniteRankFreeModule. This is because all the basis management is performed at the level of the base module. Indeed, any choice of basis in the base module gives birth uniquely to a basis in each of the tensor modules and exterior power modules. For instance:

sage: M = FiniteRankFreeModule(ZZ, 2, name='M')
sage: e = M.basis('e')
sage: t = M.tensor((1, 1), name='t'); t
Type-(1,1) tensor t on the Rank-2 free module M over the Integer Ring

The components are set and displayed with respect to the basis e = (e_0, e_1) of the base module M and its dual basis (e^0, e^1):

sage: t[e, :] = [[1, 0], [-2, 0]]
sage: t.display(e)  # equivalent to t.display()
t = e_0*e^0 - 2 e_1*e^0
sage: t.components(e)
2-indices components w.r.t. Basis (e_0,e_1) on the Rank-2 free module M 
 over the Integer Ring

The same feature holds for ExtPowerDualFreeModule elements:

sage: a = M.alternating_form(2, name='a')
sage: a.parent()
2nd exterior power of the dual of the Rank-2 free module M over the Integer Ring
sage: a[e, 0, 1] = 3
sage: a.display(e)  # equivalent to a.display()
a = 3 e^0/\e^1
sage: a.components(e)
Fully antisymmetric 2-indices components w.r.t. Basis (e_0,e_1) on the Rank-2 
 free module M over the Integer Ring

If we introduce proper bases for the derived modules ExtPowerFreeModule, ExtPowerDualFreeModule and TensorFreeModule, then t.display() would become ambiguous: shall we want a display w.r.t. to the default basis of M or to the default basis of t.parent()? Moreover, the storage of components is currently performed with respect to bases of the base module. Introducing bases in the tensor modules shall of course not lead to duplicate storage.

If we keep this design (which I would favor at this stage), then, for the sake of clarity,

sage: A = M.exterior_power(2)
sage: A.basis('w')

shall return a NotImplementedError and not a TypeError, with a message like only bases on the base module are implemented.

Last edited 2 years ago by Eric Gourgoulhon (previous) (diff)

comment:3 Changed 2 years ago by Samuel Lelièvre

Cc: Samuel Lelièvre added
Description: modified (diff)

comment:4 Changed 2 years ago by Matthias Köppe

Thanks a lot for the explanation.

Yes, a NotImplementedError with a clear message would be an improvement.

It could also be considered whether these three classes should really be subclasses of FiniteRankFreeModule, or perhaps rather a new common baseclass.

comment:5 Changed 2 years ago by Matthias Köppe

Description: modified (diff)

comment:6 in reply to:  4 ; Changed 2 years ago by Eric Gourgoulhon

Description: modified (diff)

Replying to mkoeppe:

It could also be considered whether these three classes should really be subclasses of FiniteRankFreeModule, or perhaps rather a new common baseclass.

Yes, indeed!

comment:7 in reply to:  2 Changed 2 years ago by Matthias Köppe

Replying to egourgoulhon:

all the basis management is performed at the level of the base module. Indeed, any choice of basis in the base module gives birth uniquely to a basis in each of the tensor modules and exterior power modules.

Given this, I am also wondering whether perhaps there should be a subclass of Basis_abstract that would make these bases explicit.

comment:8 Changed 2 years ago by Matthias Köppe

Branch: u/mkoeppe/extpowerfreemodule__extpowerdualfreemodule__tensorfreemodule_cannot_create_a_basis

comment:9 Changed 2 years ago by Matthias Köppe

Commit: 862aca828ac0228f11afee91a4388b54d4834c74
Description: modified (diff)

Preliminary branch


New commits:

862aca8WIP: Implement TensorFreeModule.basis with new class FreeModuleCompTensorBasis

comment:10 Changed 2 years ago by git

Commit: 862aca828ac0228f11afee91a4388b54d4834c743bd0a8a8004df62ad2e332d198e3f0529afe1f9d

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

3bd0a8aTensorFreeSubmodule_comp, TensorFreeSubmoduleBasis_comp: New

comment:11 Changed 2 years ago by Matthias Köppe

Description: modified (diff)
Summary: ExtPowerFreeModule, ExtPowerDualFreeModule, TensorFreeModule cannot create a basisSubmodules of TensorFreeModule defined by the symmetries of a Components object

comment:12 Changed 2 years ago by git

Commit: 3bd0a8a8004df62ad2e332d198e3f0529afe1f9dc4d8d07ec2f8846b0607b46d1afd7840bf606c48

Branch pushed to git repo; I updated commit sha1. New commits:

c4d8d07Move basis method to TensorFreeModule

comment:13 Changed 2 years ago by Matthias Köppe

Here's an early draft, comments welcome

comment:14 in reply to:  13 Changed 2 years ago by Eric Gourgoulhon

Replying to mkoeppe:

Here's an early draft, comments welcome

Thanks. It seems that the file tensor_free_submodule_basis.py is missing in the ticket branch.

comment:15 Changed 2 years ago by git

Commit: c4d8d07ec2f8846b0607b46d1afd7840bf606c48270ebb309defd1ed9c8e701c7b45cfe1d39ed45c

Branch pushed to git repo; I updated commit sha1. New commits:

270ebb3Add missing file

comment:16 Changed 2 years ago by Matthias Köppe

Sorry, here you go.

comment:17 Changed 2 years ago by git

Commit: 270ebb309defd1ed9c8e701c7b45cfe1d39ed45c22bb5ac40338cb028cc14e587ae9a83db14c3deb

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

a734bf8TensorFreeSubmodule_comp, TensorFreeSubmoduleBasis_comp: New
fdd6646Move basis method to TensorFreeModule
a61f8e7Add missing file
c01a5e9FiniteRankFreeModule: Add methods is_submodule, ambient_module
1aedfa4TensorFreeModule: Remove duplicate method 'basis'
22bb5acTensorFreeSubmodule_comp.is_submodule: New

comment:18 Changed 2 years ago by git

Commit: 22bb5ac40338cb028cc14e587ae9a83db14c3deb80af815bffa9f7147adb15b65b14147558d1ea44

Branch pushed to git repo; I updated commit sha1. New commits:

6ed9e40TensorFreeSubmodule_comp.ambient_module: New
80af815Fix doctests

comment:19 Changed 2 years ago by git

Commit: 80af815bffa9f7147adb15b65b14147558d1ea448f3e41be3baa80dab17f50b1be54f4dff7904af9

Branch pushed to git repo; I updated commit sha1. New commits:

8f3e41bTensorFreeSubmodule_comp: Add alias ambient = ambient_module

comment:20 in reply to:  16 Changed 2 years ago by Eric Gourgoulhon

Replying to mkoeppe:

Sorry, here you go.

Thanks. Looks nice!

comment:21 Changed 2 years ago by Matthias Köppe

Authors: Matthias Koeppe

comment:22 Changed 2 years ago by Matthias Köppe

Dependencies: #30254, #30250

comment:23 Changed 2 years ago by git

Commit: 8f3e41be3baa80dab17f50b1be54f4dff7904af9ea1bac7b706f90d6aea1b2d568e1da28beb24543

Branch pushed to git repo; I updated commit sha1. New commits:

1da5b3dTensorFreeSubmodule_comp: Add tests
d64c8edExtPowerFreeModule._an_element_: Make sure a default basis is available
d2d7f42ExtPowerDualFreeModule._an_element_: Make sure a default basis is available
9e739e5FreeModuleLinearGroup._an_element_: Make sure a default basis is available
eec19fdTensorFreeModule._an_element_: Make sure a default basis is available
0cf7917Merge branch 't/30254/tensorfreemodule__an_element___create_a_default_basis_in_the_base_module_if_necessary' into t/30229/extpowerfreemodule__extpowerdualfreemodule__tensorfreemodule_cannot_create_a_basis
5a340d9TensorFreeModule.__init__: Remove duplicate registration of self in the base module, uniqueness check
de35db3FreeModuleBasis.__init__: Update all modules in the set fmodule._all_modules
ea1bac7Merge branch 't/30250/finiterankfreemodule__simplify_unique_representation_code_for_dependent_modules' into t/30229/extpowerfreemodule__extpowerdualfreemodule__tensorfreemodule_cannot_create_a_basis

comment:24 Changed 2 years ago by git

Commit: ea1bac7b706f90d6aea1b2d568e1da28beb24543c98bc5db7d4416b0a4510d0a94080aebee78e68e

Branch pushed to git repo; I updated commit sha1. New commits:

27aa573FiniteRankFreeModule: Accept init arg 'ambient'
c98bc5dTensorFreeSubmodule_comp: Factor out _is_symmetry_coarsening_of, add _element_constructor_

comment:25 Changed 2 years ago by git

Commit: c98bc5db7d4416b0a4510d0a94080aebee78e68ed3366933fae1f4b618952b54f39952277cb37c26

Branch pushed to git repo; I updated commit sha1. New commits:

d336693Fixup

comment:26 Changed 2 years ago by git

Commit: d3366933fae1f4b618952b54f39952277cb37c2684387d99ce0ec880d5a9ad07bc4bc01e81a07805

Branch pushed to git repo; I updated commit sha1. New commits:

ad8f6afTensorFreeModule._element_constructor_: Accept FreeModuleTensor of same tensor type and base module as input
84387d9TensorFreeSubmodule_comp: Set ambient correctly

comment:27 Changed 2 years ago by git

Commit: 84387d99ce0ec880d5a9ad07bc4bc01e81a07805b74f562ae9d611abd88221c57eec4d6e5fc2a3a7

Branch pushed to git repo; I updated commit sha1. New commits:

20266b3TensorFreeModule._coerce_map_from_: Add coercion from submodules
ec466e6TensorFreeSubmodule_comp: Fix coerce map tests
b74f562TensorFreeSubmodule_comp.lift: New

comment:28 Changed 2 years ago by git

Commit: b74f562ae9d611abd88221c57eec4d6e5fc2a3a7a5da63b8e6be948b9b5c8deaaa0ecdc6e9566a29

Branch pushed to git repo; I updated commit sha1. New commits:

6078437FiniteRankFreeModule: Add _test_basis method
95713feFiniteRankFreeModule._test_basis: Test indices and containment
a5da63bTensorFreeSubmoduleBasis_comp: Add keys, __getitem__; compute symmetrized elements

comment:29 Changed 2 years ago by git

Commit: a5da63b8e6be948b9b5c8deaaa0ecdc6e9566a2919915c1a8b547069a5afc7e4f65c8f3700615ef2

Branch pushed to git repo; I updated commit sha1. New commits:

19915c1FiniteRankFreeModule._test_basis: Run the test suite of the basis object

comment:30 Changed 2 years ago by Matthias Köppe

Milestone: sage-9.2sage-9.3

comment:31 Changed 22 months ago by Michael Jung

That's a really nice addition! Especially the in this ticket introduced ambient_module is useful in view of #31276. What's the status of this ticket?

comment:32 Changed 22 months ago by Matthias Köppe

A comment in the file says:

+# Todo: Make it a Family
+#       dual basis
+#       add test for dual
+# lift/reduce/retract

I think I wanted to go through #30307 to simplify the code.

Unfortunately I won't have a chance to work on any of this before spring this year

comment:33 Changed 22 months ago by Matthias Köppe

Please feel free to take any parts of the branch that are useful already

comment:34 Changed 22 months ago by Michael Jung

What shall be the purpose of reduce and retract?

comment:35 in reply to:  34 Changed 22 months ago by Matthias Köppe

Replying to gh-mjungmath:

What shall be the purpose of reduce and retract?

They are part of the protocol for subobjects and quotients (https://doc.sagemath.org/html/en/reference/modules/sage/modules/with_basis/subquotient.html?highlight=subquotient#module-sage.modules.with_basis.subquotient)

comment:36 Changed 22 months ago by Michael Jung

Are these common mathematical terms? I cannot find anything on Wikipedia etc. The documentation is very sparse so that I can only (educatedly) guess what that should mean.

Last edited 22 months ago by Michael Jung (previous) (diff)

comment:37 Changed 22 months ago by Matthias Köppe

sage.modules has implementations from which it should become clearer

comment:38 Changed 22 months ago by Matthias Köppe

Milestone: sage-9.3sage-9.4

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

comment:39 Changed 18 months ago by Matthias Köppe

Cc: Hongli (Bob) Zhao added
Dependencies: #30254, #30250#30307
Description: modified (diff)
Summary: Submodules of TensorFreeModule defined by the symmetries of a Components objectSubmodules of TensorFreeModule defined by the symmetries of a CompParent

comment:40 Changed 17 months ago by Matthias Köppe

Milestone: sage-9.4sage-9.5

comment:41 Changed 12 months ago by Matthias Köppe

Milestone: sage-9.5sage-9.6

comment:42 Changed 9 months ago by Matthias Köppe

Milestone: sage-9.6sage-9.7

comment:43 Changed 3 months ago by git

Commit: 19915c1a8b547069a5afc7e4f65c8f3700615ef2fbc4445c7f73cad787bffe57195d035b7d6891ae

Branch pushed to git repo; I updated commit sha1. This was a forced push. Last 10 new commits:

a6f81a6TensorFreeSubmodule_comp: Set ambient correctly
22e9e1cTensorFreeModule._coerce_map_from_: Add coercion from submodules
02927b8TensorFreeSubmodule_comp: Fix coerce map tests
4995258TensorFreeSubmodule_comp.lift: New
eca7a57FiniteRankFreeModule: Add _test_basis method
f633af8FiniteRankFreeModule._test_basis: Test indices and containment
ef3e7b7TensorFreeSubmoduleBasis_comp: Add keys, __getitem__; compute symmetrized elements
419bec6FiniteRankFreeModule._test_basis: Run the test suite of the basis object
c7649e4FiniteRankFreeModule.isomorphism_with_fixed_basis: Make basis argument optional; add test method
fbc4445WIP: _comp and irange

comment:44 Changed 3 months ago by git

Commit: fbc4445c7f73cad787bffe57195d035b7d6891ae7715f04c94acee3879fa553c7d91e1eea0bdd9c4

Branch pushed to git repo; I updated commit sha1. New commits:

7715f04Update doctest outputs

comment:45 Changed 3 months ago by Matthias Köppe

Dependencies: #30307#30300

comment:46 Changed 3 months ago by git

Commit: 7715f04c94acee3879fa553c7d91e1eea0bdd9c47caacef17846f4e5c679451ab0a46b6a1cc50e7c

Branch pushed to git repo; I updated commit sha1. New commits:

78400bcAbstractFamily.{keys,values,items}: New
d2e4466src/sage/sets/family.py: Add missing import
d15bd7dsrc/sage/tensor/modules/free_module_basis.py: Make Basis_abstract a subclass of AbstractFamily
eeba29asrc/sage/tensor/modules/free_module_basis.py: Add documentation
d084678Merge #30300
7caacefUpdate doctest outputs

comment:47 Changed 3 months ago by git

Commit: 7caacef17846f4e5c679451ab0a46b6a1cc50e7cce3ca35473f1790f7f1b88f5370578198fe7f888

Branch pushed to git repo; I updated commit sha1. New commits:

ce3ca35TensorFreeSubmodule_comp: Store sym, antisym, use it in _basis_comp

comment:48 Changed 3 months ago by git

Commit: ce3ca35473f1790f7f1b88f5370578198fe7f888a6ebabf1dc2683f1cf0e4dd54c57bcb3421b4669

Branch pushed to git repo; I updated commit sha1. New commits:

e940d0fTensorFreeSubmodule_comp._basis_comp: Fix up
a6ebabfsrc/sage/tensor/modules/tensor_free_module.py: Fix doctest output

comment:49 Changed 3 months ago by git

Commit: a6ebabf1dc2683f1cf0e4dd54c57bcb3421b46698d7879577afe8a40324adfc6d6f00262d6da8273

Branch pushed to git repo; I updated commit sha1. New commits:

8d78795TensorFreeSubmoduleBasis_comp.values: New

comment:50 Changed 3 months ago by git

Commit: 8d7879577afe8a40324adfc6d6f00262d6da8273fec6930606048747da6290ea92ec000ad26d894e

Branch pushed to git repo; I updated commit sha1. New commits:

fec6930Disable _test_basis on non-base modules

comment:51 Changed 3 months ago by git

Commit: fec6930606048747da6290ea92ec000ad26d894edc7aad2bc28cbf739aecb9c28136d6fddbedfaaf

Branch pushed to git repo; I updated commit sha1. New commits:

5936c6bsrc/sage/manifolds: Update doctest outputs
3c8c474Merge #30300
dc7aad2src/sage/tensor/modules/tensor_free_submodule_basis.py: Add doctests

comment:52 in reply to:  6 Changed 3 months ago by Matthias Köppe

Replying to egourgoulhon:

Replying to mkoeppe:

It could also be considered whether these three classes should really be subclasses of FiniteRankFreeModule, or perhaps rather a new common baseclass.

Yes, indeed!

I've opened #34424 for this

comment:53 Changed 3 months ago by Matthias Köppe

Dependencies: #30300#30300, #34424

comment:54 Changed 3 months ago by Matthias Köppe

Summary: Submodules of TensorFreeModule defined by the symmetries of a CompParentSubmodules of TensorFreeModule defined by the symmetries of a Component

comment:55 Changed 3 months ago by git

Commit: dc7aad2bc28cbf739aecb9c28136d6fddbedfaaffb1ce4270e9d9aa1511192d6097aaa7692ab8883

Branch pushed to git repo; I updated commit sha1. New commits:

e76ee2fFiniteRankFreeModule_abstract: New common base class for FiniteRankFreeModule, TensorFreeModule, ExtPower*FreeModule
ac6d465FiniteRankFreeModule_abstract: No need for _sindex
7e3ae02FiniteRankFreeModule_abstract: No need for _output_formatter
134c44fsrc/sage/tensor/modules/finite_rank_free_module.py: Better docstring for FiniteRankFreeModule_abstract
b7e5319Merge #34424
fb1ce42src/sage/tensor/modules/ext_pow_free_module.py: No need to override basis() any more

comment:56 Changed 3 months ago by git

Commit: fb1ce4270e9d9aa1511192d6097aaa7692ab888330d4eec4cdd67c9ecd037b3edc0f9c5bcbad18d6

Branch pushed to git repo; I updated commit sha1. New commits:

30d4eecTensorFreeModule.basis: Pass all args

comment:57 Changed 3 months ago by git

Commit: 30d4eec4cdd67c9ecd037b3edc0f9c5bcbad18d6d0af852f53bd5d7ccae9b561dd32df9b6a7d96bd

Branch pushed to git repo; I updated commit sha1. New commits:

d0af852TensorFreeModule.basis: Add documentation

comment:58 Changed 3 months ago by git

Commit: d0af852f53bd5d7ccae9b561dd32df9b6a7d96bdd1376fda20910920f7333303f1466969a0d165dd

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

d1376fdTensorFreeModule.basis: Add documentation

comment:59 Changed 3 months ago by git

Commit: d1376fda20910920f7333303f1466969a0d165dd6e9bec511d2b00fa1a550dd460831ae90dea9d57

Branch pushed to git repo; I updated commit sha1. New commits:

2bcfc21src/sage/tensor/modules: Use keyword order: category, ambient
6e9bec5src/sage/tensor/modules/finite_rank_free_module.py: Move ambient_module, is_submodule to FiniteRankFreeModule_abstract

comment:60 Changed 3 months ago by git

Commit: 6e9bec511d2b00fa1a550dd460831ae90dea9d57fd5ba8cf1dbcd80fd3d364f042bb1eb44aa674fe

Branch pushed to git repo; I updated commit sha1. New commits:

fd5ba8csrc/sage/tensor/modules/tensor_free_module.py: No more need for TensorFreeModule.irange

comment:61 Changed 3 months ago by Matthias Köppe

Description: modified (diff)
Summary: Submodules of TensorFreeModule defined by the symmetries of a ComponentSubmodules of TensorFreeModule defined by the symmetries of a Components object

comment:62 Changed 3 months ago by git

Commit: fd5ba8cf1dbcd80fd3d364f042bb1eb44aa674fe694e665430527083480ee4fa58c8b6857fc5acfe

Branch pushed to git repo; I updated commit sha1. New commits:

694e665TensorFreeSubmoduleBasis_comp._repr_: New

comment:63 Changed 3 months ago by Matthias Köppe

Description: modified (diff)

comment:64 Changed 3 months ago by git

Commit: 694e665430527083480ee4fa58c8b6857fc5acfea1de06499bf16d26b13fb8c0c09116700465d917

Branch pushed to git repo; I updated commit sha1. New commits:

a1de064TensorFreeSubmodule_comp: Default name, latex_name for the case Sym^n(M)

comment:65 Changed 3 months ago by git

Commit: a1de06499bf16d26b13fb8c0c09116700465d917320d00b310cc27a923662b33769fa214987ff7bc

Branch pushed to git repo; I updated commit sha1. New commits:

320d00bTensorFreeSubmodule_comp: Default name, latex_name for more cases

comment:66 Changed 3 months ago by git

Commit: 320d00b310cc27a923662b33769fa214987ff7bce8ba50907ca202f62d086f3aff7aa7b6d20acee3

Branch pushed to git repo; I updated commit sha1. New commits:

e8ba509TensorFreeSubmodule_comp: Fix default name, latex_name for indices without symmetries

comment:67 Changed 3 months ago by git

Commit: e8ba50907ca202f62d086f3aff7aa7b6d20acee30277d80c8d35e467b8e4e0faaa2b0fcec3794916

Branch pushed to git repo; I updated commit sha1. New commits:

0277d80TensorFreeSubmodule_comp: Add example for module with sym and antisym

comment:68 Changed 3 months ago by git

Commit: 0277d80c8d35e467b8e4e0faaa2b0fcec37949162c6a984691d0721e79e17ba185d78a368fcd53e8

Branch pushed to git repo; I updated commit sha1. New commits:

2c6a984FiniteRankFreeModule.tensor_module: Add parameters sym, antisym; add methods symmetric_power, dual_symmetric_power

comment:69 Changed 3 months ago by git

Commit: 2c6a984691d0721e79e17ba185d78a368fcd53e817137cf98bb41b2d1adeed0cf6d37f00117c890e

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

17137cfFiniteRankFreeModule.tensor_module: Add parameters sym, antisym; add methods symmetric_power, dual_symmetric_power

comment:70 Changed 3 months ago by Matthias Köppe

Description: modified (diff)

comment:71 Changed 3 months ago by git

Commit: 17137cf98bb41b2d1adeed0cf6d37f00117c890e5b8ccdef2e7a8b9deee937e05f03a87244ef8141

Branch pushed to git repo; I updated commit sha1. New commits:

993b343TensorFreeModule._element_constructor_: Pass parent=self to element_class
5b8ccdesrc/sage/tensor/modules/tensor_free_module.py: Update doctest output

comment:72 Changed 3 months ago by git

Commit: 5b8ccdef2e7a8b9deee937e05f03a87244ef8141b0812b12bcc0ba670a6963fd88310101fcde6f65

Branch pushed to git repo; I updated commit sha1. New commits:

b0812b1TensorFreeSubmoduleBasis_comp._element_constructor_: Full implementation

comment:73 Changed 3 months ago by git

Commit: b0812b12bcc0ba670a6963fd88310101fcde6f658cd3cc4517ab7a633f4e522052f103a61ccda708

Branch pushed to git repo; I updated commit sha1. New commits:

8cd3cc4TensorFreeSubmoduleBasis_comp._element_constructor_: Fix for zero; implement retract

comment:74 Changed 3 months ago by git

Commit: 8cd3cc4517ab7a633f4e522052f103a61ccda708ae2ff23068417561adc3c93b483b756fbc7d95c3

Branch pushed to git repo; I updated commit sha1. New commits:

ae2ff23TensorFreeSubmoduleBasis_comp.reduce: New; use it in _element_constructor_

comment:75 Changed 3 months ago by Matthias Köppe

Description: modified (diff)

comment:76 Changed 3 months ago by Matthias Köppe

Status: newneeds_review

comment:77 Changed 3 months ago by Matthias Köppe

Description: modified (diff)

comment:78 Changed 3 months ago by Matthias Köppe

Description: modified (diff)

comment:79 Changed 3 months ago by Eric Gourgoulhon

Thanks for the implementation. This looks nice! A few comments:

  • Some entrie(s) should be added to src/doc/en/reference/tensor_free_modules/index.rst, so that the documentation of the new classes TensorFreeSubmodule_comp and TensorFreeSubmoduleBasis_comp is generated
  • There are some coverage issues (cf. the patchbot report); for instance the method TensorFreeSubmodule_comp._basis_comp has no docstring.
  • The output of TensorFreeSubmodule_comp._repr_ is quite odd:
    sage: T40Sym45M = TensorFreeSubmodule_comp(M, (6, 0), sym=((4, 5))); T40Sym45M
    Free module of type-(6,0) tensors with 6-indices components w.r.t. (0, 1, 2),
     with symmetry on the index positions (4, 5)
     on the Rank-3 free module M over the Integer Ring
    
    • with 6-indices components could be suppressed for it is redundant with type-(6,0)
    • w.r.t. (0, 1, 2) is meaningless in this context

The output could be shorten to

Free module of type-(6,0) tensors with symmetry on the index 
 positions (4, 5) on the Rank-3 free module M over the Integer Ring

without any loss of information.

  • The patchbot reports 2 pyflake issues.

comment:80 Changed 3 months ago by git

Commit: ae2ff23068417561adc3c93b483b756fbc7d95c3fa6162ee88a19bfdfe4723651098c0e61919512e

Branch pushed to git repo; I updated commit sha1. New commits:

fa6162esrc/doc/en/reference/tensor_free_modules: Add tensor_free_submodule, tensor_free_submodule_basis

comment:81 Changed 3 months ago by git

Commit: fa6162ee88a19bfdfe4723651098c0e61919512e680e3f4edb33d69503add2fd81291b395a6e74e3

Branch pushed to git repo; I updated commit sha1. New commits:

680e3f4src/sage/tensor/modules/comp.py (Components._repr_): Factor out _repr_symmetry

comment:82 Changed 3 months ago by git

Commit: 680e3f4edb33d69503add2fd81291b395a6e74e3548620d491ea0d51453af69d480edc9762cb56de

Branch pushed to git repo; I updated commit sha1. New commits:

548620dTensorFreeSubmodule_comp._repr_: Use Components._repr_symmetry, update doctest outputs

comment:83 Changed 3 months ago by git

Commit: 548620d491ea0d51453af69d480edc9762cb56de2cc42fb294ebd8c7f24b3260d82c55f3338b7b1a

Branch pushed to git repo; I updated commit sha1. New commits:

2cc42fbsrc/sage/tensor/modules/tensor_free_submodule_basis.py: Update doctest output

comment:84 Changed 3 months ago by git

Commit: 2cc42fb294ebd8c7f24b3260d82c55f3338b7b1a02cce265a8a17ed35a72e1bf556c19639c716c73

Branch pushed to git repo; I updated commit sha1. New commits:

02cce26src/sage/tensor/modules/tensor_free_submodule_basis.py: Fix pyflakes unused warnings

comment:85 Changed 3 months ago by git

Commit: 02cce265a8a17ed35a72e1bf556c19639c716c73bff49e5ba567a7c73cf6cc89885c3252ec20492d

Branch pushed to git repo; I updated commit sha1. New commits:

bff49e5src/sage/tensor/modules/tensor_free_module.py: Update doctest output

comment:86 Changed 3 months ago by git

Commit: bff49e5ba567a7c73cf6cc89885c3252ec20492d89a5893fdaf7c8d26edcbd70815ecea53ef472ff

Branch pushed to git repo; I updated commit sha1. New commits:

89a5893src/sage/tensor/modules/tensor_free_[sub]module.py (_basis_comp): Add docstrings

comment:87 Changed 3 months ago by git

Commit: 89a5893fdaf7c8d26edcbd70815ecea53ef472ffc8d987723dfca75236c0a45654c86e6fb40f92a6

Branch pushed to git repo; I updated commit sha1. New commits:

c8d9877TensorFreeSubmodule_comp._is_symmetry_coarsening_of: Add docstring

comment:88 Changed 3 months ago by git

Commit: c8d987723dfca75236c0a45654c86e6fb40f92a6e7d5e77161b2b9b8d8a15d10e702c559bc60c19b

Branch pushed to git repo; I updated commit sha1. New commits:

e31bdacTensorFreeModule._an_element_: Pass parent to element class
e7d5e77TensorFreeModule._an_element_: Use element constructor

comment:89 Changed 3 months ago by git

Commit: e7d5e77161b2b9b8d8a15d10e702c559bc60c19b18d3dbee5d5d2703c2a335ea5627735fe2116a25

Branch pushed to git repo; I updated commit sha1. New commits:

18d3dbeTensorFreeSubmodule_comp._is_symmetry_coarsening_of: Update example

comment:90 Changed 3 months ago by git

Commit: 18d3dbee5d5d2703c2a335ea5627735fe2116a253f1c33d718a59e7fd6b0c06e032ca43fff9ecdb2

Branch pushed to git repo; I updated commit sha1. New commits:

3f1c33dTensorFreeSubmoduleBasis_comp.__init__: Add doctest

comment:91 Changed 3 months ago by git

Commit: 3f1c33d718a59e7fd6b0c06e032ca43fff9ecdb29378a78970b4202074d44e21f42550a9a597337f

Branch pushed to git repo; I updated commit sha1. New commits:

9378a78src/sage/tensor/modules/finite_rank_free_module.py: Update doctest output

comment:92 Changed 3 months ago by Matthias Köppe

Thanks a lot for your comments. All fixed now

comment:93 Changed 3 months ago by git

Commit: 9378a78970b4202074d44e21f42550a9a597337f877d17ec13570727cd52706a4cfe400d4a3f20e2

Branch pushed to git repo; I updated commit sha1. New commits:

66874a9src/sage/sets/family.py: Add doctest
877d17eMerge #30300

comment:94 Changed 3 months ago by Eric Gourgoulhon

Thanks for the changes.

I was wondering about the names and descriptions of the new classes TensorFreeSubmodule_comp and TensorFreeSubmoduleBasis_comp, which stress the connection with Components objects. Now, what really matters here are the tensor symmetries, which do not depend upon a basis, while a Components object is attached to a given basis. In particular the description "Class for free submodules of tensor products of free modules that are defined by the symmetries of a Components object." would better be rephrased by something like "Class for free submodules of tensor products of free modules that are defined by some monoterm symmetries". Similarly "Free module bases indexed by component indices" conveys more the output of the method keys() than the actual nature of these bases. Wouldn't something like TensorFreeSubmodule_sym or TensorFreeSubmoduleBasis_sym be better names?

Other remarks:

  • We have:
    sage: M = FiniteRankFreeModule(ZZ, 2)
    sage: M.tensor_module(2, 0, sym=(0,1)) is M.symmetric_power(2)
    False
    
    Shouldn't the answer be True?
  • In the doctests of TensorFreeSubmodule_comp and TensorFreeModule.basis, one could get rid of
    from sage.tensor.modules.tensor_free_submodule import TensorFreeSubmodule_comp
    
    and construct the submodules via M.tensor_module with the new arguments sym and antisym.
  • In the docstring of TensorFreeModule.basis, it could be instructive to illustrate the use with a basis that is not the default basis of the base module, e.g. something like
    sage: M = FiniteRankFreeModule(ZZ, 2)
    sage: e = M.basis('e')
    sage: f = M.basis('f', from_family=(-e[1], e[0]))
    sage: for b in f: b.display()
    f_0 = -e_1
    f_1 = e_0
    sage: S = M.tensor_module(2, 0, sym=(0,1))
    sage: fS = S.basis('f')
    sage: for b in fS: b.display()
    e_1⊗e_1
    -e_0⊗e_1 - e_1⊗e_0
    e_0⊗e_0
    sage: for b in fS: b.display(f)
    f_0⊗f_0
    f_0⊗f_1 + f_1⊗f_0
    f_1⊗f_1
    
  • a typo in the docstring of TensorFreeModule.basis:
    - - ``symbol``, ``indices`` -- passed to he base module's method
    + - ``symbol``, ``indices`` -- passed to the base module's method
    

comment:95 in reply to:  94 ; Changed 3 months ago by Matthias Köppe

Replying to egourgoulhon:

  • We have:
    sage: M = FiniteRankFreeModule(ZZ, 2)
    sage: M.tensor_module(2, 0, sym=(0,1)) is M.symmetric_power(2)
    False
    
    Shouldn't the answer be True?

Yes, this is one of the TODOs that you can see in the branch.

+        if sym or antisym:
+            # TODO: Canonicalize sym, antisym, make hashable
+            key = (k, l, sym, antisym)
+        else:
+            key = (k, l)

I'm not sure whether we should fix it in this ticket; I think it's better done in a refactoring ticket that takes care of how symmetries are constructed and represented.

comment:96 Changed 3 months ago by Matthias Köppe

(I have some preliminary work in this direction on the branch of #32029)

comment:97 in reply to:  94 Changed 3 months ago by Matthias Köppe

Replying to egourgoulhon:

I was wondering about the names and descriptions of the new classes TensorFreeSubmodule_comp and TensorFreeSubmoduleBasis_comp, which stress the connection with Components objects. Now, what really matters here are the tensor symmetries, which do not depend upon a basis, while a Components object is attached to a given basis. In particular the description "Class for free submodules of tensor products of free modules that are defined by the symmetries of a Components object." would better be rephrased by something like "Class for free submodules of tensor products of free modules that are defined by some monoterm symmetries". Similarly "Free module bases indexed by component indices" conveys more the output of the method keys() than the actual nature of these bases. Wouldn't something like TensorFreeSubmodule_sym or TensorFreeSubmoduleBasis_sym be better names?

I agree, I'll make these changes.

comment:98 Changed 3 months ago by git

Commit: 877d17ec13570727cd52706a4cfe400d4a3f20e266366b3c1c3f7c80fb8b341af44c874a8ab57281

Branch pushed to git repo; I updated commit sha1. New commits:

66366b3TensorFreeModule.basis: Fix typo in docstring

comment:99 Changed 3 months ago by git

Commit: 66366b3c1c3f7c80fb8b341af44c874a8ab57281bb3bae0ad9042a70ea4428af30433e4b436d9400

Branch pushed to git repo; I updated commit sha1. New commits:

bb3bae0TensorFreeSubmodule_sym, TensorFreeSubmoduleBasis_sym: Rename from ..._comp

comment:100 Changed 3 months ago by git

Commit: bb3bae0ad9042a70ea4428af30433e4b436d9400a99f5c0207d4b84b329d38dde645e7fcf69e052b

Branch pushed to git repo; I updated commit sha1. New commits:

a99f5c0src/sage/tensor/modules/tensor_free_submodule[_basis].py: Deemphasize Components in the documentation

comment:101 Changed 3 months ago by git

Commit: a99f5c0207d4b84b329d38dde645e7fcf69e052b1e7430ab22f781ed9bc133b32f8153599e4539cc

Branch pushed to git repo; I updated commit sha1. New commits:

1e7430asrc/sage/tensor: In examples, use FiniteRankFreeModule.tensor_module(..., sym=...) instead of FiniteRankFreeModule_sym

comment:102 Changed 3 months ago by git

Commit: 1e7430ab22f781ed9bc133b32f8153599e4539cc046887c65442ba9c7320b82ef0a9182f4fb77eed

Branch pushed to git repo; I updated commit sha1. New commits:

046887cTensorFreeModule.basis: Add example from egourgoulhon

comment:103 Changed 3 months ago by git

Commit: 046887c65442ba9c7320b82ef0a9182f4fb77eedb1291714bce9d42b921d6afde42be0ed7d13066e

Branch pushed to git repo; I updated commit sha1. New commits:

b129171CompWithSym._canonicalize_sym_antisym: Factor out from __init__

comment:104 in reply to:  95 Changed 3 months ago by Matthias Köppe

Replying to mkoeppe:

I'm not sure whether we should fix it in this ticket; I think it's better done in a refactoring ticket that takes care of how symmetries are constructed and represented.

Some less ambitious refactoring will also do the job. Working on it

comment:105 Changed 3 months ago by git

Commit: b1291714bce9d42b921d6afde42be0ed7d13066ed54cda4ace3893bf7c74fa2c8f4dfc9fcaaf8cb7

Branch pushed to git repo; I updated commit sha1. New commits:

784f7c6src/sage/tensor: Allow _sym, _antisym attributes to be tuples
5546e09src/sage/tensor, src/sage/manifolds: Sort _sym, _antisym, store as tuples of tuples
6445c4csrc/sage/tensor, src/sage/manifolds: Sort _sym, _antisym, store as tuples of tuples (fixup)
d54cda4src/sage/tensor: Allow _sym, _antisym attributes to be tuples (fixup)

comment:106 Changed 3 months ago by Matthias Köppe

Dependencies: #30300, #34424#30300, #34424, #34451

comment:107 Changed 3 months ago by git

Commit: d54cda4ace3893bf7c74fa2c8f4dfc9fcaaf8cb76547ab9179652d120ea6a903f9ec2737fe47c3bc

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

3a65d2dCompWithSym._canonicalize_sym_antisym: Factor out from __init__
07ab991src/sage/tensor: Allow _sym, _antisym attributes to be tuples
3619b4csrc/sage/tensor, src/sage/manifolds: Sort _sym, _antisym, store as tuples of tuples
970c6c8src/sage/tensor, src/sage/manifolds: Sort _sym, _antisym, store as tuples of tuples (fixup)
9f15e00src/sage/tensor: Allow _sym, _antisym attributes to be tuples (fixup)
6547ab9Merge #34451

comment:108 Changed 3 months ago by git

Commit: 6547ab9179652d120ea6a903f9ec2737fe47c3bc04706dd4af5955e9fa38d5c9ab49d25605d344fd

Branch pushed to git repo; I updated commit sha1. New commits:

04706ddFiniteRankFreeModule.tensor_module: Canonicalize sym, antisym

comment:109 Changed 3 months ago by Matthias Köppe

Done now

comment:110 Changed 3 months ago by Matthias Köppe

Description: modified (diff)

comment:111 Changed 3 months ago by git

Commit: 04706dd4af5955e9fa38d5c9ab49d25605d344fd726e56229dd72791dc649265b73ec45bdab46c5f

Branch pushed to git repo; I updated commit sha1. New commits:

726e562src/sage/tensor/modules/finite_rank_free_module.py: Remove unused import

comment:112 Changed 3 months ago by git

Commit: 726e56229dd72791dc649265b73ec45bdab46c5fcfbef61ceff9021ef809a51d5ab6a7df67d4a673

Branch pushed to git repo; I updated commit sha1. New commits:

d1a92e5Merge tag '9.7.rc0' into t/34451/sage_tensor__canonicalize_sym__antisym
319ecfaFiniteRankFreeModule.tensor: Use CompWithSym._canonicalize_sym_antisym
8e93626CompWithSym._canonicalize_sym_antisym: Add documentation
564be35FiniteRankFreeModule.tensor: Restore error when trivial symmetries are passed
ffea896CompWithSym._canonicalize_sym_antisym: Code optimization
fed09d5CompWithSym._canonicalize_sym_antisym: Sort earlier to validate indices faster
421c660src/sage/tensor/modules/finite_rank_free_module.py: Add doctest
a1a3f36CompWithSym.__init__: Accept keyword 'trivial_symmetries', add tests
8a2c71aVectorFieldModule.tensor, VectorFieldFreeModule.tensor: Use CompWithSym._canonicalize_sym_antisym
cfbef61Merge #34451

comment:113 Changed 3 months ago by git

Commit: cfbef61ceff9021ef809a51d5ab6a7df67d4a67339bfe8d84bcba7b8ec49b57bb9a85a5dd2b9f261

Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:

e34306bRevert "FiniteRankFreeModule.tensor: Restore error when trivial symmetries are passed"
c6b6b2esrc/sage/tensor, src/sage/manifolds: Remove parameter 'trivial_symmetries' again
39bfe8dMerge #34451

comment:114 Changed 3 months ago by Eric Gourgoulhon

Thanks for the changes. LGTM, after https://trac.sagemath.org/ticket/34451#comment:21 is fixed.

A minor typo in the doctests of FiniteRankFreeModule_abstract.is_submodule:

-            sage: N = FiniteRankFreeModule(ZZ, 4, name='M')
+            sage: N = FiniteRankFreeModule(ZZ, 4, name='N')

What about adding an AUTHOR field in the main docstring of the new files tensor_free_submodule.py and tensor_free_submodule_basis.py? Similarly, what about updating the AUTHORS field of other files, especially finite_rank_free_module.py regarding FiniteRankFreeModule_abstract?

comment:115 Changed 3 months ago by git

Commit: 39bfe8d84bcba7b8ec49b57bb9a85a5dd2b9f26164e3c1df9f7d4de8ddd3c5c074de81707385b869

Branch pushed to git repo; I updated commit sha1. New commits:

bec2f65CompWithSym._canonicalize_sym_antisym: Refactor, fix index validation, add tests
66009e7src/sage/tensor/modules/comp.py: Fix docstring
64e3c1dMerge #34451

comment:116 Changed 3 months ago by git

Commit: 64e3c1df9f7d4de8ddd3c5c074de81707385b8697474abbe05d4ab21978b268669a3cd9e205dcec2

Branch pushed to git repo; I updated commit sha1. New commits:

7474abbFiniteRankFreeModule_abstract.tensor_product: Handle submodules with symmetries

comment:117 Changed 3 months ago by git

Commit: 7474abbe05d4ab21978b268669a3cd9e205dcec2ed3c8d91bf060db1a4f38ed478fa96dabb14ae9d

Branch pushed to git repo; I updated commit sha1. New commits:

ed3c8d9src/sage/tensor/modules/finite_rank_free_module.py (FiniteRankFreeModule_abstract.is_submodule): Fix typo in doctest

comment:118 Changed 3 months ago by git

Commit: ed3c8d91bf060db1a4f38ed478fa96dabb14ae9d644933a6eadec662ebdf59fcb93add2bc4190ca6

Branch pushed to git repo; I updated commit sha1. New commits:

fd89892src/sage/tensor/modules/tensor_free_submodule[_basis].py, finite_rank_free_module.py: Update AUTHORS
644933asrc/sage/tensor/modules/finite_rank_free_module.py: Update copyright according to git blame -w --date=format:%Y FILE | sort -k2

comment:119 Changed 3 months ago by git

Commit: 644933a6eadec662ebdf59fcb93add2bc4190ca645bf6f359dba548b7749c6754ebe56b7c16db170

Branch pushed to git repo; I updated commit sha1. New commits:

45bf6f3FiniteRankFreeModule_abstract.tensor_product: Add comment

comment:120 Changed 3 months ago by Eric Gourgoulhon

Reviewers: Eric Gourgoulhon
Status: needs_reviewpositive_review

Looks good! Thanks.

comment:121 Changed 3 months ago by Matthias Köppe

Thank you!

comment:122 Changed 3 months ago by git

Commit: 45bf6f359dba548b7749c6754ebe56b7c16db170fc66ad14915c1b2d02d72db4114fbab48e7b601f
Status: positive_reviewneeds_review

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

803f7e4Make FiniteRankFreeModule.tensor_module(0, 1) return the dual (#34474)
0648daaMerge #34474
fc66ad1FiniteRankFreeModule.dual_symmetric_power: Update for changes in #34474

comment:123 Changed 3 months ago by Matthias Köppe

Dependencies: #30300, #34424, #34451#30300, #34424, #34451, #34474

I've merged #34474 to resolve a merge conflict


New commits:

803f7e4Make FiniteRankFreeModule.tensor_module(0, 1) return the dual (#34474)
0648daaMerge #34474
fc66ad1FiniteRankFreeModule.dual_symmetric_power: Update for changes in #34474

comment:124 in reply to:  123 Changed 3 months ago by Eric Gourgoulhon

Status: needs_reviewpositive_review

Replying to Matthias Köppe:

I've merged #34474 to resolve a merge conflict

OK.

At the moment, we have:

sage: M = FiniteRankFreeModule(ZZ, 2, name='M')
sage: e = M.basis('e')
sage: S = M.tensor_module(2, 0, sym=(0,1))
sage: s = M.tensor((2, 0), sym=(0,1))
sage: s[0,1] = 2
sage: s.display()
2 e_0⊗e_1 + 2 e_1⊗e_0
sage: s.parent() is S
False
sage: s.parent()
Free module of type-(2,0) tensors on the Rank-2 free module M over the Integer Ring

but I guess s.parent() being S should be for a follow-up ticket...

comment:125 Changed 3 months ago by Matthias Köppe

Yes, #34482 goes roughly into this direction.

comment:126 in reply to:  125 Changed 3 months ago by Eric Gourgoulhon

Replying to Matthias Köppe:

Yes, #34482 goes roughly into this direction.

OK very good.

comment:127 Changed 2 months ago by Matthias Köppe

Milestone: sage-9.7sage-9.8

comment:128 Changed 2 months ago by Volker Braun

Branch: u/mkoeppe/extpowerfreemodule__extpowerdualfreemodule__tensorfreemodule_cannot_create_a_basisfc66ad14915c1b2d02d72db4114fbab48e7b601f
Resolution: fixed
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.