cached methods in symmetric_group_representations

83 views
Skip to first unread message

Jackson Walters

unread,
Dec 11, 2024, 2:58:22 PM12/11/24
to sage-devel
Hi all,

I am attempting to move some code from symmetric_group_algebra to symmetric_group_representations. We are constructing a unitary DFT for S_n over F_{q^2} and number fields, and an intermediate step was constructing unitary rep'ns. There's an alternate way to construct the unitary DFT which bypasses creating unitary rep'ns, but I think it makes sense to move the code to symmetric_group_representations. 


I'd like to create a class called UnitaryRepresentation which extends SymmetricGroupRepresentation_generic_class which does two things:

1. returns the orthogonal rep'n in the characteristic zero case since these rep'ns are real, so they are also unitary
2. conjugates the 'specht' rep'n by the appropriate change-of-basis matrix A

The tests are currently failing, and it seems to have something to do with caching. I'm not entire sure how this works, and just copied the format from SpechtRepresentation. It may even make more sense to extend one of these classes.

Error: Failed example:: Exception raised:
Traceback (most recent call last):
File "sage/misc/cachefunc.pyx", line 1953, in sage.misc.cachefunc.CachedMethodCaller.__call__
return cache[k]
KeyError: (([3, 2, 1, 4],), ())

Any help would be greatly appreciated. 

Thanks,
Jackson

Nils Bruin

unread,
Dec 11, 2024, 7:37:17 PM12/11/24
to sage-devel
Read on for the other failures. If you look up line 1953, you'll see it's inside a try/except. You're triggering the KeyError, so it's the outer one for you. That's the code that's trying to fill the cache, but it fails. The rest of the traceback is of THAT error (it is saying "During handling of the above exception, another exception occurred:" which refers to the fact that you're in a try/except). There you get exactly the same error as for "_representation_matrix_uncached", which is not caching at all.

In general, if you get a traceback of which you don't understand the first few lines, read on a bit and/or look up some of the source code referenced. It'll often give you a clue how to get a better understanding of what failed. Python tracebacks contain lots of information. It takes a bit of training to find something helpful in there (but it's often there!)

Jackson Walters

unread,
Dec 20, 2024, 4:25:39 PM12/20/24
to sage-...@googlegroups.com
Thanks for the tips. Some changes have been made and now (almost) all tests are passing.

--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/sage-devel/4a0624f0-6b3a-41ba-b06d-8123932c0faen%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages