Repository navigation
Conversation
With a property as input, auto_bisc keeps every good and every bad permutation up to its current length as lists of Perm objects. At length 10 the bad ones are nearly all of S_10, about 0.9 GB as a list, and runs on sets that need length 10 grew past 8 GB. LabelledPerms keeps the labels as one bitmap per length, in the order of Perm.of_length (S_10 is 454 KB), made from a property, given as bitmaps, or both. Its views good and bad stand in for auto_bisc's dictionaries of lists: auto_bisc only iterates over a length, counts it, and asks whether it is there, and the views do that from the bitmaps, generating a length's permutations again when it is read, in the same order. - auto_bisc(LabelledPerms(...)) and bisc(LabelledPerms(...)) are new inputs; with given bitmaps and no property, auto_bisc stops when it needs a length it was not given, as for a tuple of dictionaries. - auto_bisc(prop, labels="bitmaps") wraps a property in LabelledPerms; labels="lists", the default, is the previous behaviour, unchanged. The existing inputs are untouched. On stack-sortable and West-2-stack- sortable permutations every route gives the same basis as before (tests/bisc/test_labelled_perms.py); auto_bisc's printed output is also identical on Av(231), Av(321), Av(2-31) and Av(132, 4321). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When auto_bisc needs a length it was not given, a LabelledPerms with a property labels it, and one with bitmaps alone stops. Derangements in Av(213, 231, 312), with one member at each even length, reach that step in a fraction of a second: with bitmaps up to length 8 and no property auto_bisc stops and says so; with a property, stopped at the first permutation of length 9, the lists and the bitmaps have printed the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README's BiSC section starts with `from permuta.bisc import *`, which did not bring in LabelledPerms. It is now exported, and the section says that bisc and auto_bisc also accept a LabelledPerms, and how auto_bisc's labels="bitmaps" keeps a property's labels in less memory, with an example that runs as a doctest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Bit i of length n is the label of Perm.unrank(i, n), so a permutation of length n is at its rank() less the number of shorter permutations. This is the order Perm.of_length(n) yields, which the views still use to iterate: it is the same order and about three times faster than unranking each index. A test pins the order to Perm.unrank and Perm.rank. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows using a bitmap instead of a list of perms as input to BiSC, to save memory.