Opened 7 years ago
Closed 7 years ago
#15309 closed defect (fixed)
Symmetric group algebra creating algebra generators using _element_constructor_
Reported by: | tscrim | Owned by: | sage-combinat |
---|---|---|---|
Priority: | major | Milestone: | sage-5.13 |
Component: | coercion | Keywords: | |
Cc: | sage-combinat, SimonKing, nthiery | Merged in: | sage-5.13.beta2 |
Authors: | Travis Scrimshaw | Reviewers: | Darij Grinberg |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description (last modified by )
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
Attachments (2)
Change History (12)
comment:1 Changed 7 years ago by
comment:2 Changed 7 years ago by
- Status changed from new to needs_review
comment:3 Changed 7 years ago by
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
comment:4 Changed 7 years ago by
Hey Darij,
I forgot the dependency on #15305, but with the new version I've commuted this past it.
Best,
Travis
comment:5 Changed 7 years ago by
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.)
Changed 7 years ago by
comment:6 Changed 7 years ago by
- Description modified (diff)
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
comment:7 Changed 7 years ago by
- Status changed from needs_review to positive_review
Hi Travis,
Positive review then! The fuzz was probably due to #15174, which I'll now rebase over this.
Best regards,
Darij
comment:8 Changed 7 years ago by
Thanks Darij.
comment:9 Changed 7 years ago by
- Reviewers set to Darij Grinberg
comment:10 Changed 7 years ago by
- Merged in set to sage-5.13.beta2
- Resolution set to fixed
- Status changed from positive_review to closed
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.