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

Symmetric group algebra creating algebra generators using _element_constructor_ #15309

Closed
tscrim opened this issue Oct 20, 2013 · 12 comments
Closed

Comments

@tscrim
Copy link
Collaborator

tscrim commented Oct 20, 2013

When calling the algebra_generators(), SymmetricGroupAlgebra ends up setting the _coercions_used flag to True. This prevents us from creating coercions dynamically.

For example:

sage: S3 = SymmetricGroupAlgebra(QQ, 3)
sage: S3._coercions_used
False
sage: S3.algebra_generators()
[[2, 1, 3], [2, 3, 1]]
sage: S3._coercions_used
True

Apply: attachment: trac_15309-sga_alg_gens_fix-ts.patch​

CC: @sagetrac-sage-combinat @simon-king-jena @nthiery

Component: coercion

Author: Travis Scrimshaw

Reviewer: Darij Grinberg

Merged: sage-5.13.beta2

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

@tscrim
Copy link
Collaborator Author

tscrim commented Oct 20, 2013

comment:1

This may not be the only instance of something like this happening, but it's one I found. In some respect, this is just a stopgap for https://groups.google.com/forum/?fromgroups=#!topic/sage-devel/pH-97DE41wA.

@darijgr
Copy link
Contributor

darijgr commented Oct 25, 2013

comment:3

Did you miss some dependency or export the wrong phase?

darij@travis-virtualbox:~/sage-5.13.beta0$ ./sage -bt devel/sage-main/sage/combinat/symmetric_group_algebra.py 

----------------------------------------------------------
sage: Building and installing modified Sage library files.


Installing c_lib
scons: `install' is up to date.
Updating Cython code....
Finished compiling Cython code (time = 4.18366098404 seconds)
running install
running build
running build_py
copying sage/combinat/symmetric_group_algebra.py -> build/lib.linux-i686-2.7/sage/combinat
running build_ext
Executing 0 commands (using 1 thread)
Time to execute 0 commands: 0.00317311286926 seconds
Total time spent compiling C/C++ extensions:  0.187358856201 seconds.
running install_lib
copying build/lib.linux-i686-2.7/sage/combinat/symmetric_group_algebra.py -> /home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/combinat
byte-compiling /home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/combinat/symmetric_group_algebra.py to symmetric_group_algebra.pyc
running install_egg_info
Removing /home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage-0.0.0-py2.7.egg-info
Writing /home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage-0.0.0-py2.7.egg-info
Running doctests with ID 2013-10-24-19-33-22-3ec85cf5.
Doctesting 1 file.
sage -t devel/sage-main/sage/combinat/symmetric_group_algebra.py
**********************************************************************
File "devel/sage-main/sage/combinat/symmetric_group_algebra.py", line 447, in sage.combinat.symmetric_group_algebra.SymmetricGroupAlgebra_n.algebra_generators
Failed example:
    SymmetricGroupAlgebra(ZZ,5).algebra_generators()
Exception raised:
    Traceback (most recent call last):
      File "/home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 479, in _run
        self.execute(example, compiled, test.globs)
      File "/home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 838, in execute
        exec compiled in globs
      File "<doctest sage.combinat.symmetric_group_algebra.SymmetricGroupAlgebra_n.algebra_generators[0]>", line 1, in <module>
        SymmetricGroupAlgebra(ZZ,Integer(5)).algebra_generators()
      File "/home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/combinat/symmetric_group_algebra.py", line 474, in algebra_generators
        return [self.monomial(self._indices(a)), self.monomial(self._indices(b))]
      File "parent.pyx", line 761, in sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6823)
      File "misc.pyx", line 251, in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1606)
    AttributeError: 'SymmetricGroupAlgebra_n_with_category' object has no attribute '_indices'
**********************************************************************
File "devel/sage-main/sage/combinat/symmetric_group_algebra.py", line 461, in sage.combinat.symmetric_group_algebra.SymmetricGroupAlgebra_n.algebra_generators
Failed example:
    S3.algebra_generators()
Exception raised:
    Traceback (most recent call last):
      File "/home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 479, in _run
        self.execute(example, compiled, test.globs)
      File "/home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/doctest/forker.py", line 838, in execute
        exec compiled in globs
      File "<doctest sage.combinat.symmetric_group_algebra.SymmetricGroupAlgebra_n.algebra_generators[4]>", line 1, in <module>
        S3.algebra_generators()
      File "/home/darij/sage-5.13.beta0/local/lib/python2.7/site-packages/sage/combinat/symmetric_group_algebra.py", line 474, in algebra_generators
        return [self.monomial(self._indices(a)), self.monomial(self._indices(b))]
      File "parent.pyx", line 761, in sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6823)
      File "misc.pyx", line 251, in sage.structure.misc.getattr_from_other_class (sage/structure/misc.c:1606)
    AttributeError: 'SymmetricGroupAlgebra_n_with_category' object has no attribute '_indices'
**********************************************************************
1 item had failures:
   2 of   9 in sage.combinat.symmetric_group_algebra.SymmetricGroupAlgebra_n.algebra_generators
    [222 tests, 2 failures, 5.22 s]
----------------------------------------------------------------------
sage -t devel/sage-main/sage/combinat/symmetric_group_algebra.py  # 2 doctests failed
----------------------------------------------------------------------
Total time for all tests: 5.3 seconds
    cpu time: 3.2 seconds
    cumulative wall time: 5.2 seconds

@tscrim
Copy link
Collaborator Author

tscrim commented Oct 25, 2013

comment:4

Hey Darij,

I forgot the dependency on #15305, but with the new version I've commuted this past it.

Best,

Travis

@darijgr
Copy link
Contributor

darijgr commented Oct 25, 2013

Attachment: trac_15309-more-dg.patch.gz

changes in a similar vein for (minor?) speedup

@darijgr
Copy link
Contributor

darijgr commented Oct 25, 2013

comment:5

Nice change (doubles the speed beyound fixing the bug). What do you say about the similar changes I suggest? (If they don't apply, please let me know -- I'm working on top of #15174.)

@tscrim
Copy link
Collaborator Author

tscrim commented Oct 27, 2013

Attachment: trac_15309-sga_alg_gens_fix-ts.patch.gz

@tscrim

This comment has been minimized.

@tscrim
Copy link
Collaborator Author

tscrim commented Oct 27, 2013

comment:6

Hey Darij,

I'm somewhat surprised I get a 2x speedup; that's good to know for future reference.

I've folded in your review patch (it applied with some fuzz 2), but made one change. Instead of return self.monomial(self._one), I changed it to return self.one(). If you're happy with the patch, then it's positive review.

Best,

Travis

For patchbot:

Apply: trac_15309-sga_alg_gens_fix-ts.patch​

@darijgr
Copy link
Contributor

darijgr commented Oct 27, 2013

comment:7

Hi Travis,

Positive review then!
The fuzz was probably due to #15174, which I'll now rebase over this.

Best regards,

Darij

@tscrim
Copy link
Collaborator Author

tscrim commented Oct 27, 2013

comment:8

Thanks Darij.

@tscrim
Copy link
Collaborator Author

tscrim commented Oct 27, 2013

Reviewer: Darij Grinberg

@jdemeyer
Copy link
Contributor

Merged: sage-5.13.beta2

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