Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

values() method for lazy families #15349

Open
darijgr opened this issue Nov 3, 2013 · 6 comments
Open

values() method for lazy families #15349

darijgr opened this issue Nov 3, 2013 · 6 comments

Comments

@darijgr
Copy link
Contributor

darijgr commented Nov 3, 2013

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).

CC: @hivert @nthiery @sagetrac-sage-combinat @tscrim

Component: categories

Keywords: family, lazy family, free module

Author: Darij Grinberg

Issue created by migration from https://trac.sagemath.org/ticket/15349

@darijgr darijgr added this to the sage-6.1 milestone Nov 3, 2013
@darijgr
Copy link
Contributor Author

darijgr commented Nov 3, 2013

Attachment: trac_15349-lazy-family-values-dg.patch.gz

@darijgr
Copy link
Contributor Author

darijgr commented Nov 3, 2013

Changed author from Darij GRinberg to Darij Grinberg

@nthiery
Copy link
Contributor

nthiery commented Nov 3, 2013

comment:3

I think it's CombinatorialFreeModule that should be fixed to not use .values() but instead

    return tuple(self.basis())

By 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).

@darijgr
Copy link
Contributor Author

darijgr commented Nov 3, 2013

comment:4

OK; I'll rather leave this to you people. But are the changes I've done here any good?

@nthiery
Copy link
Contributor

nthiery commented Nov 3, 2013

comment:5

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

@darijgr
Copy link
Contributor Author

darijgr commented Nov 4, 2013

comment:6

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

@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.1, sage-6.2 Jan 30, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.2, sage-6.3 May 6, 2014
@sagetrac-vbraun-spam sagetrac-vbraun-spam mannequin modified the milestones: sage-6.3, sage-6.4 Aug 10, 2014
@mkoeppe mkoeppe removed this from the sage-6.4 milestone Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants