Opened 18 months ago

Last modified 3 months ago

#32029 new enhancement

Action of a sympy TensorSymmetry

Reported by: Matthias Köppe Owned by:
Priority: major Milestone: sage-9.8
Component: linear algebra Keywords:
Cc: Travis Scrimshaw, Eric Gourgoulhon, Dima Pasechnik, Hongli (Bob) Zhao, Marius Gerbershagen Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: u/mkoeppe/action_of_a_sympy_tensorsymmetry (Commits, GitHub, GitLab) Commit: 3629386df9d59012cafa4382a4878d5b7fb944f0
Dependencies: Stopgaps:

Status badges

Description (last modified by Matthias Köppe)

SymPy's TensorSymmetry (https://docs.sympy.org/latest/modules/tensor/tensor.html) uses a trick to represent (monoterm) tensor symmetries and antisymmetries as permutation groups: Two extra elements (in the example below, 3 and 4) keep track of the sign

sage: TensorSymmetry.fully_symmetric(3)                                                                                               
TensorSymmetry((0, 1), ((4)(0 1), (4)(1 2)))
sage: TensorSymmetry.fully_symmetric(-3)    # fully antisymmetric 3 indices                                                                                      
TensorSymmetry((0, 1), ((0 1)(3 4), (1 2)(3 4)))

The 2-cycle (3 4) represents the antisymmetry. What is displayed there is the "base and strong generating system".

This trick can of course be generalized to Mathematica's "phased permutation groups" (#30276) by using longer cycles.

We define a class TensorSymmetryGroup

  • which can be initialized from sage.tensor sym and antisym lists
  • can convert to/from sympy.tensor.tensor.TensorSymmetry
  • defines _get_action_ for acting on tensor modules / components

Change History (17)

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

Description: modified (diff)

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

Cc: Hongli (Bob) Zhao added
Description: modified (diff)

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

I'm thinking of putting this in sage.groups.tensor.monoterm_symmetry

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

Branch: u/mkoeppe/action_of_a_sympy_tensorsymmetry

comment:5 Changed 18 months ago by Dima Pasechnik

Commit: ad4f3f11796f33b3cae87aba9cfdecb1cb1ab061

the symmetry group there is an arbitrary permutation group, no? So sympy has an algorithm to find the autmorphism group of a weighted hypergraph?


New commits:

ad4f3f1src/sage/groups/tensor/monoterm_symmetry.py: New

comment:6 in reply to:  5 Changed 18 months ago by Matthias Köppe

Replying to dimpase:

the symmetry group there is an arbitrary permutation group, no? So sympy has an algorithm to find the autmorphism group of a weighted hypergraph?

The automorphism group is the input, not the output. This code is for defining spaces of tensors with prescribed symmetries.

comment:7 Changed 18 months ago by Dima Pasechnik

Your input is a bunch of permutations, not a group. Why do you force the user to figure them out?

I'd rather see it as a group, and yes, it's perfectly possible in Sage to compute a strong generating set and a base, given a permutation group. E.g. one can use the corresponding GAP functionality via libgap.

comment:8 in reply to:  7 Changed 18 months ago by Matthias Köppe

Replying to dimpase:

Your input is a bunch of permutations, not a group. Why do you force the user to figure them out?

Sorry, what are you referring to?

The example lines on the ticket description using SymPy show the output of SymPy's TensorSymmetry constructor, which happens to show the BSGS.

In the branch attached here, the input is a symmetry specification in the style of sage.tensor.

comment:9 Changed 18 months ago by Dima Pasechnik

All I can see is an example with sym=(1, 2) - it's totally unclear what kind of input is expected, due to lack of any documentation.

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

OK. I will adapt documentation from sage.tensor.modules.comp, where this input is documented.

comment:11 Changed 18 months ago by git

Commit: ad4f3f11796f33b3cae87aba9cfdecb1cb1ab0613629386df9d59012cafa4382a4878d5b7fb944f0

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

3629386TensorSymmetryGroup: Adapt some documentation from sage.tensor.modules.comp

comment:12 Changed 18 months ago by Dima Pasechnik

+        * ``sym = [(0,2), (1,3,4)]`` for a symmetry between the 1st and 3rd
+          indices and a symmetry between the 2nd, 4th and 5th indices.

is ambiguous. E.g. sym = [(0,2), (1,3)] might either mean one order 2 symmetry (i.e. group of symmetries of order 2), or a list of generators for a group of order 4. In the former can one should say something like a symmetry which acts as a permutation (13)(24). In the latter, say they generate a group...

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

Milestone: sage-9.4sage-9.5

comment:14 Changed 16 months ago by Matthias Köppe

Cc: Marius Gerbershagen added

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

Milestone: sage-9.5sage-9.6

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

Milestone: sage-9.6sage-9.7

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

Milestone: sage-9.7sage-9.8
Note: See TracTickets for help on using tickets.