Opened 10 months ago

Last modified 2 months ago

#30897 needs_work enhancement

Class Function Partitions

Reported by: gh-tekaysquared Owned by: tkarn
Priority: minor Milestone: sage-9.5
Component: group theory Keywords: partition, symmetric group, character
Cc: slelievre Merged in:
Authors: Trevor K. Karn Reviewers:
Report Upstream: N/A Work issues:
Branch: u/tkarn/class_funcion_partitions (Commits, GitHub, GitLab) Commit: 04933454906b6e7549b9ad7a118705e7bb862dd7
Dependencies: Stopgaps:

Status badges

Description (last modified by slelievre)

The current output of SymmetricGroup(n).irreducible_characters() is a list of ClassFunction_libgap objects. It would be nice to take one of those class functions and instead of passing in a SymmetricGroup element, pass in a Partition of n since those represent the conjugacy classes.

This could be done by checking if the input to ClassFunction_libgap objects are Partitions, and if so using the default_representative of the partition.

Change History (20)

comment:1 Changed 10 months ago by gh-tekaysquared

  • Keywords character added; charachter removed

comment:2 Changed 10 months ago by tkarn

  • Branch changed from u/gh-tekaysquared/partn-class-fn-libgap to u/tkarn/partn-class-fn-libgap

comment:3 Changed 10 months ago by tkarn

  • Branch u/tkarn/partn-class-fn-libgap deleted

comment:4 Changed 10 months ago by tkarn

  • Owner changed from (none) to tkarn

comment:5 Changed 10 months ago by tkarn

  • Branch set to u/tkarn/class_funcion_partitions
  • Commit set to 05bb0a740559bca7028ae939ece638197f8c709a

New commits:

3894d03Add ability of class function to take in a partition when G is the symmetric group
71d19b2Merge branch 'develop' into partition-libgap-class-fcn
05bb0a7Re order import statements so they make sense

comment:6 Changed 10 months ago by tkarn

  • Status changed from new to needs_review

comment:7 Changed 8 months ago by slelievre

  • Cc slelievre added
  • Description modified (diff)

comment:8 Changed 7 months ago by embray

Thanks for the patch. Hopefully someone with the necessary subject-matter background will be along to review it soon.

comment:9 Changed 7 months ago by gh-darijgr

Please fix the spacing in the doctest:

+            sage: h.cycle_type()
+            [2,1]
+			sage: triv(h.cycle_type())
+			1

It looks like a space/tab mismatch that might be invisible in your editor.

comment:10 Changed 7 months ago by gh-darijgr

Also, please check the empty partition [] and [3] too, just in case (ducktyping can often be fickle around such cases).

If this works: LGTM!

comment:11 Changed 7 months ago by gh-darijgr

Oh, and one more thing: I'm not sure any more, but there might be different implementations of symmetric groups in Sage. Does your code work with all of them? I think Permutations(n) is one thing worth trying, as is the Coxeter group of type A (don't remember how it is created).

EDIT: Not saying that it should work with all of them; probably best to document rather than fix.

Last edited 7 months ago by gh-darijgr (previous) (diff)

comment:12 Changed 7 months ago by git

  • Commit changed from 05bb0a740559bca7028ae939ece638197f8c709a to 07454970cd13659d174c61ba2ba1704ddeac780f

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

0a7675dMerge branch 'develop' into partitions
0745497Fix whitespace errors, add tests, and add assertion on size of group/size of partition. Also include disclaimer about CoxeterMatrixGroups and Permutations.

comment:13 Changed 7 months ago by tkarn

It turns out that the CoxeterMatrixGroup and Permutations classes don't have .irreducible_characters() method. It might be good to implement it eventually, but for now I just want to start by supporting the SymmetricGroup class.

Last edited 7 months ago by tkarn (previous) (diff)

comment:14 Changed 6 months ago by tscrim

Welcome to Sage development. So I have a few other additional comments for you to address:

  • Add your (real) name to the author field.
  • Instead of using an assert statement to check for valid input, you should instead raise a ValueError (or more generally whichever type of error is appropriate). This is a general convention we have taken across Sage (there is still some legacy code that does not do this).
  • I think the error message would be better as f"the size of the partition {g.size()} must equal {len(self._group.domain())}" as it is more concise and direct about what is needed.
  • It would be better to move the if isinstance(self._group, SymmetricGroup): first. This makes the code more clean and slightly faster for other groups.
  • These changes:
                 sage: chi([2,1])
    -            <BLANKLINE>
                 Traceback (most recent call last):
    -                ...
    +            ...
                 TypeError: Cyclic group of order 3 as a permutation group is not a SymmetricGroup. Give an element of Cyclic group of order 3 as a permutation group.
    

comment:15 Changed 6 months ago by tkarn

  • Authors set to Trevor K. Karn

comment:16 Changed 6 months ago by git

  • Commit changed from 07454970cd13659d174c61ba2ba1704ddeac780f to e3f9cc2b111a75bf2798bb4ecb4268df2d43aae4

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

02cb2a2Change assertion to ValueError
e3f9cc2Reorder check for self._group being symmetric group. Change message on TypeError. Remove blankline so error tests pass.

comment:17 Changed 6 months ago by git

  • Commit changed from e3f9cc2b111a75bf2798bb4ecb4268df2d43aae4 to 04933454906b6e7549b9ad7a118705e7bb862dd7

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

0493345Reorder check for self._group being symmetric group. Change message on TypeError. Remove blankline so error tests pass.

comment:18 Changed 6 months ago by mkoeppe

  • Milestone changed from sage-9.3 to sage-9.4

Sage development has entered the release candidate phase for 9.3. Setting a new milestone for this ticket based on a cursory review of ticket status, priority, and last modification date.

comment:19 Changed 4 months ago by tkarn

  • Status changed from needs_review to needs_work

comment:20 Changed 2 months ago by mkoeppe

  • Milestone changed from sage-9.4 to sage-9.5

Setting a new milestone for this ticket based on a cursory review.

Note: See TracTickets for help on using tickets.