Opened 9 years ago
Last modified 8 years ago
#15349 needs_info enhancement
values() method for lazy families
Reported by: | Darij Grinberg | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.4 |
Component: | categories | Keywords: | family, lazy family, free module |
Cc: | Florent Hivert, Nicolas M. Thiéry, Sage Combinat CC user, Travis Scrimshaw | Merged in: | |
Authors: | Darij Grinberg | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
The attached patch provides a values()
method for lazy families. While not very useful in the infinite case, it helps avoiding things like this:
sage: SymmetricGroupAlgebra(QQ, 4).gens() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-3-14b6bd4b0e1d> in <module>() ----> 1 SymmetricGroupAlgebra(QQ, Integer(4)).gens() /home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/combinat/free_module.pyc in gens(self) 1616 (B['a'], B['b'], B['c']) 1617 """ -> 1618 return tuple(self.basis().values()) 1619 1620 def set_order(self, order): /home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6823)() /home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/structure/misc.so in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1606)() AttributeError: 'LazyFamily_with_category' object has no attribute 'values'
(The gens
method on combinatorial free modules was introduced in #13214, and returns tuple(self.basis().values())
, so the error appears every time a basis is a lazy family rather than a regular finite family, even if the lazy family is finite!) Of course, the symmetric group algebra has a more economical generating set than this, but I assume other combinatorial free modules still profit from this.
(That said, I never understood how to tell from inside code whether gens()
returns an algebra generating set or a module generating set... Can anyone enlighten me on that?)
Someone please assure me whether the keys of a lazy(!) family can be assumed ordered. They seem to be stored as a set
, which I never fully understood. If their order is system-dependent, that should probably be said in the doc of the values()
method.
The patch also removes some warnings which were made over 4 years ago (#5538).
Attachments (1)
Change History (11)
Changed 9 years ago by
Attachment: | trac_15349-lazy-family-values-dg.patch added |
---|
comment:1 Changed 9 years ago by
Status: | new → needs_review |
---|
comment:2 Changed 9 years ago by
Authors: | Darij GRinberg → Darij Grinberg |
---|
comment:3 Changed 9 years ago by
comment:4 Changed 9 years ago by
OK; I'll rather leave this to you people. But are the changes I've done here any good?
comment:5 Changed 9 years ago by
Hi Darij!
Unless we later find a compelling use case, I'd say for now it's just a temporary workaround; so keep it around for yourself, or even push it in the "queue" (or whatever will happen to it); but for now I would not get this change in Sage unless it's really needed for some other ticket.
Cheers,
Nicolas
comment:6 Changed 9 years ago by
Hi Nicolas,
thanks for looking into it. I'll change status to "new" then.
I probably am not going to do anything about ModulesWithBasis? myself, but I'd welcome any improvements on that class.
Best regards,
Darij
comment:7 Changed 9 years ago by
Status: | needs_review → needs_info |
---|
comment:8 Changed 9 years ago by
Milestone: | sage-6.1 → sage-6.2 |
---|
comment:9 Changed 9 years ago by
Milestone: | sage-6.2 → sage-6.3 |
---|
comment:10 Changed 8 years ago by
Milestone: | sage-6.3 → sage-6.4 |
---|
I think it's CombinatorialFreeModule? that should be fixed to not use
.values()
but insteadBy the way, this gens method would fit better in the ModulesWithBasis? category (with a sanity check that it's not infinite dimensional), or better in ModulesWithBasis?.FiniteDimensional? (note: check for potential conflicts with #11111).