Giter VIP home page Giter VIP logo

permuta's People

Contributors

alfurb avatar bjk17 avatar christianbean avatar enadeau avatar gitter-badger avatar jaypantone avatar jonsteinn avatar murrayt avatar quintant avatar ragnarardal avatar requires avatar suprdewd avatar tomkenmag avatar ulfarsson avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

permuta's Issues

No ordering of mesh patts

Mesh patterns should order according to

  1. their underlying patterns (using Perm ordering)
  2. their shading (based on their "smallest" shaded square)

Currently 1) is implemented but not 2). Example:

>>> from permuta import *
>>> p = Perm((0, 1, 2))
>>> q = Perm((1, 0, 2))
>>> p < q
True
>>> MeshPatt(p, [(1, 1)]) < MeshPatt(q, [(2, 2)])
True
>>> mp1 = MeshPatt(p, [(1, 1)])
>>> mp2 = MeshPatt(p, [(2, 2)])
>>> mp1 < mp2
False
>>> mp2 >= mp1
False

Cache getting to big

If you want to compute the permutation in a lot of classes. The cache get too big and fill the memory. A workaround is to use the above code snippet to clear the cache.

from permuta._perm_set.unbounded.described.avoiding.avoiding import AvoidingGeneric
AvoidingGeneric._AvoidingGeneric__CLASS_CACHE = {}

Of course something better should be implemented.

Using pip to install

Should we not add a description on how to use pip to install this?
That's how I run it in my virtualenv.

Show and export permutations

I'd like to be able to use p.show() to show the permutation p on screen (ascii style), possibly with options to show it in a browser, plot window or whatever.

Additionally p.export(format=svg), p.export(format=tikz) etc. for exporting permutations to use in other contexts.

Implement insertion index and Kuszmaul methods

I just realized that our generic Avoidance Class is very basic at the moment; just inserting a new maximum in every possible place and checking for avoidance. We should be remembering viable insertion indices. And maybe we could use Kuszmaul's methods to speed us up some. Implementing these should be very simple, and shouldn't take but a day, with some performance considerations.

Old BibTeX link

The BibTeX link at the bottom of the readme does not link to the newest version of the library.

Basis can't be a mix of Perms and MeshPatts

Because Perms and MeshPatts can't be compared in sorting, a basis cannot consist of a mix of both object types. See below for example:

>>> from permuta import *
>>> Av({Perm((0, 1)), MeshPatt(Perm((1, 0)), [])})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/bjarni/.venvs/CombCov/lib/python3.7/site-packages/permuta/permset.py", line 99, in __new__
    return PermSet.avoiding(basis)
  File "/Users/bjarni/.venvs/CombCov/lib/python3.7/site-packages/permuta/permset.py", line 75, in avoiding
    return cls(BasisCls(basis))
  File "/Users/bjarni/.venvs/CombCov/lib/python3.7/site-packages/permuta/descriptors/basis.py", line 19, in __new__
    return tuple.__new__(cls).union(patts, cls.ALLOWED_BASIS_ELEMENT_TYPES)
  File "/Users/bjarni/.venvs/CombCov/lib/python3.7/site-packages/permuta/descriptors/basis.py", line 42, in union
    patts = sorted(patts)  # Necessarily non-empty
  File "/Users/bjarni/.venvs/CombCov/lib/python3.7/site-packages/permuta/perm.py", line 2215, in __lt__
    return (len(self), tuple(self)) < (len(other), tuple(other))
TypeError: object of type 'int' has no len()

Possible fixes includes
(1) implementing the comparator on the level of the abstract interface Patt so that Perms and MeshPatts can be compared or
(2) convert Perms to MeshPatts in the basis if at least one of the elements is a MeshPatt.

Problem with `sum_indecomposable_sequence`

If you run this code

from permuta import Perm

p = Perm((0,1,2))
p.sum_indecomposable_sequence()

You get

Traceback (most recent call last):
  File "bug.py", line 4, in <module>
    p.sum_indecomposable_sequence()
  File "/home/enadeau/repos/Permuta/permuta/perm.py", line 1744, in sum_indecomposable_sequence
    S = self.downset()
AttributeError: 'Perm' object has no attribute 'downset'

I'm not sure what this function is supposed to do, but we should fix that.

Images in readme don't work

I tried adding images to the readme when I added the demo branch, and it simply didn't work. AND for some reason the Travis CI badge doesn't even show up anymore either!

__debug__ for performance

I just found out about the debug constant in python which is apparently used to optimize away things away. So for example, the loop in

for n in range(10000):
    if __debug__:
        print(n)

will be completely removed from the code if compiled with the optimize flag.
We could use this for our Perm constructor and whatnot. That is, only do the expensive sanity checks on the input to the constructor if debug is True.

Sources:
A StackOverflow question
Another one
I haven't gone throught the docs properly yet, but word on the SO-street is that it is da bomb

Manifest.in

The json files for the bisc algorithm aren't included with the package on pypi.

Problem with caching of avoiders

This code

from permuta import *

p = Perm((0,1,2,3))

enum = [len(Av(p).of_length(n)) for n in range(8)]

E = MeshPatt(Perm((0,1,2)), [(0,0), (0,1), (1,0)])
F = MeshPatt(Perm((0,1,2)), [(3,3), (3,2), (2,3)])
print(E.ascii_plot())
print(F.ascii_plot())

for n in range(8):
    c = 0
    for p in Av(p).of_length(n):
        print(p)
        if not E.contained_in(p) and not F.contained_in(p):
            c += 1
    print(c)

print(enum)

Print that

 | | | 
-+-+-●-
 | | | 
-+-●-+-
▒| | | 
-●-+-+-
▒|▒| | 
 | |▒|▒
-+-+-●-
 | | |▒
-+-●-+-
 | | | 
-●-+-+-
 | | | 
ε
1
0
0
0
0
0
0
0
[1, 1, 2, 6, 23, 103, 513, 2761]

Need to fix that

BiSC in `cli.py`

Separate logic and "interface" (output) in BiSC and move the latter to cli.py.

Dependency on sympy

The file permuta/bisc/permsets/perm_properties.py import some stuff from sympy but sympy is not listed as a dependency in the setup.py. For the next release we need to either add sympy as dependency of remove it from perm_properties.py.

Link the enumerations strategies to the cli

It would be helpful to link up all of our enumeration strategies to the cli so that permtools can be our first go to when enumerating classes. Currently, it only checks for regular insertion encodings.

Add a generic Avoiders class

Add an Avoiders class to permuta.permutation_sets. It should take in a pattern (or a set of patterns) and some length (or a lower and an upper bound), and iterating through that class should give all permutations of the given length that avoid the specified patterns.

This should either replace the PermutationsAvoiding* classes in permuta.permutation_sets, or they should be merged into the Avoiders class as faster methods for specific patterns.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.