Opened 4 years ago

Last modified 18 months ago

#22184 new defect

map_reduce failing on IntegerVectorsModPermutationGroup

Reported by: nthiery Owned by:
Priority: major Milestone: sage-wishlist
Component: combinatorics Keywords:
Cc: hivert, nborie, slabbe, slelievre Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by slelievre)

IntegerVectorsModPermutationGroup elements are generated recursively along a search tree. Alas, the map_reduce feature of RecursivelyEnumeratedSets/SearchForest is broken:

sage: G = CyclicPermutationGroup(5)
sage: V = IntegerVectorsModPermutationGroup(G)
sage: V.map_reduce(lambda x: 1, operator.add, 0)
...
AttributeError: 'IntegerVectorsModPermutationGroup_All_with_category'
object has no attribute '_roots'

That seems to be because the SearchForest structure in V is not fully initialized, or alternatively SearchForest and RESetMapReduce don't quite agree on the API to recover the roots: f.roots() or f._roots.

Let's fix that for now:

sage: V._roots = V.roots()

Still does not work:

sage: V.map_reduce(lambda x: 1, operator.add, 0)
Process RESetMapReduceWorker-4:
Traceback (most recent call last):
...
assert max(self) <= self.parent()._max_part,
'Entries of %s must be inferiors to %s'%(self, self.parent()._max_part)
...

Plausibly that's because the postprocessing is not initialized properly; so internal nodes in the trees get converted into end results when they should not.

Change History (2)

comment:1 Changed 4 years ago by slabbe

  • Cc slabbe added

comment:2 Changed 18 months ago by slelievre

  • Cc slelievre added
  • Description modified (diff)
  • Milestone changed from sage-7.6 to sage-wishlist
Note: See TracTickets for help on using tickets.