Opened 2 years ago
Closed 2 years ago
#19631 closed defect (fixed)
reduced_word breaks for automatic_monoids if not initialised
Reported by: | hivert | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.10 |
Component: | combinatorics | Keywords: | submonoids, reduced word |
Cc: | nthiery, virmaux | Merged in: | |
Authors: | Florent Hivert | Reviewers: | Travis Scrimshaw |
Report Upstream: | N/A | Work issues: | |
Branch: | 2b85922 (Commits) | Commit: | 2b8592222d38dbc60f2f74280be68c648df1d4e6 |
Dependencies: | Stopgaps: |
Description
The following should work:
sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup sage: R = IntegerModRing(101) sage: M = AutomaticSemigroup(Family({1: R(3), 2: R(5)}), one=R.one()) sage: sage: sage: e = M.from_reduced_word([1, 1, 1, 2, 2, 2]) sage: e.reduced_word() --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) [...] AttributeError: 'AutomaticMonoid_with_category.element_class' object has no attribute 'construct'
I'm uploading a fix.
Change History (8)
comment:1 Changed 2 years ago by
- Cc nthiery virmaux added
comment:2 Changed 2 years ago by
- Branch set to u/hivert/reduced_word_breaks_for_automatic_monoids_if_not_initialised
comment:3 Changed 2 years ago by
- Commit set to 2b8592222d38dbc60f2f74280be68c648df1d4e6
comment:4 Changed 2 years ago by
- Status changed from new to needs_review
comment:5 follow-up: ↓ 7 Changed 2 years ago by
- Reviewers set to Travis Scrimshaw
LGTM (although I would have from_reduced_word
set the _reduced_word
attribute of the element, but that's for a different ticket).
comment:6 Changed 2 years ago by
- Status changed from needs_review to positive_review
comment:7 in reply to: ↑ 5 Changed 2 years ago by
Replying to tscrim:
LGTM (although I would have
from_reduced_word
set the_reduced_word
attribute of the element, but that's for a different ticket).
This is done by the call to self.parent().construct(up_to=self)
:
sage: sage: from sage.monoids.automatic_semigroup import AutomaticSemigroup sage: sage: R = IntegerModRing(101) sage: sage: M = AutomaticSemigroup(Family({1: R(3), 2: R(5)}), one=R.one()) sage: sage: e = M.from_reduced_word([1, 1, 1, 2, 2, 2]) sage: e 42 sage: e.__dict__ {'_reduced_word': None} sage: e.reduced_word() [1, 1, 1, 2, 2, 2] sage: e.__dict__ {'_cache__transition': {}, '_reduced_word': [1, 1, 1, 2, 2, 2], 'transition': Cached version of <function transition at 0x7f91a1a87a28>}
comment:8 Changed 2 years ago by
- Branch changed from u/hivert/reduced_word_breaks_for_automatic_monoids_if_not_initialised to 2b8592222d38dbc60f2f74280be68c648df1d4e6
- Resolution set to fixed
- Status changed from positive_review to closed
Note: See
TracTickets for help on using
tickets.
New commits:
Method construct is implemented in the parent