{ "info": { "author": "Permuta Triangle", "author_email": "permutatriangle@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Education", "Intended Audience :: Science/Research", "License :: OSI Approved :: BSD License", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Education", "Topic :: Scientific/Engineering :: Mathematics" ], "description": "#######\npermuta\n#######\n\n.. image:: https://travis-ci.org/PermutaTriangle/Permuta.svg?branch=master\n :alt: Travis\n :target: https://travis-ci.org/PermutaTriangle/Permuta\n.. image:: https://coveralls.io/repos/github/PermutaTriangle/Permuta/badge.svg?branch=master\n :alt: Coveralls\n :target: https://coveralls.io/github/PermutaTriangle/Permuta?branch=master\n.. image:: https://img.shields.io/pypi/v/Permuta.svg\n :alt: PyPI\n :target: https://pypi.python.org/pypi/Permuta\n.. image:: https://img.shields.io/pypi/l/Permuta.svg\n :target: https://pypi.python.org/pypi/Permuta\n.. image:: https://img.shields.io/pypi/pyversions/Permuta.svg\n :target: https://pypi.python.org/pypi/Permuta\n.. image:: http://img.shields.io/badge/readme-tested-brightgreen.svg\n :alt: Travis\n :target: https://travis-ci.org/PermutaTriangle/Permuta\n.. image:: https://requires.io/github/PermutaTriangle/Permuta/requirements.svg?branch=master\n :target: https://requires.io/github/PermutaTriangle/Permuta/requirements/?branch=master\n :alt: Requirements Status\n\nPermuta is a Python library for working with perms (short for permutations),\npatterns, and mesh patterns.\n\nInstalling\n==========\n\nTo install Permuta on your system, run:\n\n.. code-block:: bash\n\n pip install permuta\n\nIt is also possible to install Permuta in development mode to work on the\nsource code, in which case you run the following after cloning the repository:\n\n.. code-block:: bash\n\n ./setup.py develop\n\nTo run the unit tests:\n\n.. code-block:: bash\n\n pip install -r test_requirements.txt\n ./setup.py test\n\nUsing Permuta\n#############\n\nOnce you've installed Permuta, it can be imported by a Python script or an\ninteractive Python session, just like any other Python library:\n\n.. code-block:: python\n\n >>> from permuta import *\n\nImporting ``*`` from it supplies you with the 'Perm' and 'PermSet'\nclasses along with the 'AvoidanceClass' class (with alias 'Av') for generating\nperms avoiding a set of patterns. It also gives you the 'MeshPatt' class\nand some other submodules which we will not discuss in this readme.\n\nCreating a single perm\n######################\n\nPermutations are zero-based in Permuta and can be created using any iterable.\n\n.. code-block:: python\n\n >>> Perm() # Empty perm\n Perm(())\n >>> Perm([]) # Another empty perm\n Perm(())\n >>> Perm((0, 1, 2, 3)) # The zero-based version of 1234\n Perm((0, 1, 2, 3))\n >>> Perm((2, 1, 3)) # Warning: it will initialise with any iterable\n Perm((2, 1, 3))\n >>> Perm((2, 1, 3), check=True) # If you are unsure, you can check\n Traceback (most recent call last):\n ...\n ValueError: Element out of range: 3\n >>> Perm((4, 2, 3, 0, 0), check=True)\n Traceback (most recent call last):\n ...\n ValueError: Duplicate element: 0\n >>> Perm(\"123\", check=True)\n Traceback (most recent call last):\n ...\n TypeError: ''1'' object is not an integer\n\nPermutations can also be created using some specific class methods.\n\n.. code-block:: python\n\n >>> Perm.from_string(\"201\") # strings\n Perm((2, 0, 1))\n >>> Perm.one_based((1, 3, 2, 4)) # one-based iterable of integers\n Perm((0, 2, 1, 3))\n >>> Perm.to_standard(\"a2gsv3\") # standardising any iterable using '<'\n Perm((2, 0, 3, 4, 5, 1))\n >>> Perm.from_integer(210) # an integer between 0 and 9876543210\n Perm((2, 1, 0))\n >>> Perm.from_integer(321) # any integer given is standardised\n Perm((2, 1, 0))\n >>> Perm.from_integer(201)\n Perm((2, 0, 1))\n\nPrinting perms gives zero-based strings.\n\n.. code-block:: python\n\n >>> print(Perm(()))\n \u03b5\n >>> print(Perm((2, 1, 0)))\n 210\n >>> print(Perm((6, 2, 10, 9, 3, 8, 0, 1, 5, 11, 4, 7)))\n 62(10)938015(11)47\n\nThe avoids, contains, and occurrence methods enable working with patterns:\n\n.. code-block:: python\n\n >>> p = Perm((0,2,1,3))\n >>> p.contains(Perm((2, 1, 0)))\n False\n >>> p.avoids(Perm((0, 1)))\n False\n >>> list(p.occurrences_of(Perm((1, 0))))\n [(1, 2)]\n >>> list(Perm((0, 1)).occurrences_in(p))\n [(0, 1), (0, 2), (0, 3), (1, 3), (2, 3)]\n\nThe basic symmetries are implemented:\n\n.. code-block:: python\n\n >>> [p.reverse(), p.complement(), p.inverse()]\n [Perm((3, 1, 2, 0)), Perm((3, 1, 2, 0)), Perm((0, 2, 1, 3))]\n\nTo take direct sums and skew sums we use ``+`` and ``-``:\n\n.. code-block:: python\n\n >>> q = Perm((0, 1, 2, 3, 4))\n >>> p + q\n Perm((0, 2, 1, 3, 4, 5, 6, 7, 8))\n >>> p - q\n Perm((5, 7, 6, 8, 0, 1, 2, 3, 4))\n\nThere are numerous practical methods available:\n\n.. code-block:: python\n\n >>> list(p.fixed_points())\n [0, 3]\n >>> list(p.ascents())\n [0, 2]\n >>> list(p.descents())\n [1]\n >>> list(p.inversions())\n [(1, 2)]\n >>> p.major_index()\n 2\n\nCreating a perm class\n#####################\n\nYou might want the set of all perms:\n\n.. code-block:: python\n\n >>> all_perms = PermSet()\n >>> print(all_perms)\n \n\nPerm classes can be specified with a basis:\n\n.. code-block:: python\n\n >>> basis = [Perm((1, 0, 2)), Perm((1, 2, 0))]\n >>> basis\n [Perm((1, 0, 2)), Perm((1, 2, 0))]\n >>> perm_class = Av(basis)\n >>> perm_class\n Av((Perm((1, 0, 2)), Perm((1, 2, 0))))\n\nWhen a basis consists of a single element you can pass it directly to `Av`:\n\n.. code-block:: python\n\n >>> q = Perm((1,0))\n >>> len(Av(q).of_length(100))\n 1\n\nYou can ask whether a perm belongs to the perm class:\n\n.. code-block:: python\n\n >>> Perm((3, 2, 1, 0)) in perm_class\n True\n >>> Perm((0, 2, 1, 3)) in perm_class\n False\n\nYou can get the n-th perm of the class or iterate:\n\n.. code-block:: python\n\n >>> sorted([perm_class[n] for n in range(8)])\n [Perm(()), Perm((0,)), Perm((0, 1)), Perm((1, 0)), Perm((0, 1, 2)), Perm((0, 2, 1)), Perm((2, 0, 1)), Perm((2, 1, 0))]\n >>> perm_class_iter = iter(perm_class)\n >>> sorted([next(perm_class_iter) for _ in range(8)])\n [Perm(()), Perm((0,)), Perm((0, 1)), Perm((1, 0)), Perm((0, 1, 2)), Perm((0, 2, 1)), Perm((2, 0, 1)), Perm((2, 1, 0))]\n\n(BEWARE: Lexicographic order is not guaranteed at the moment!)\n\nThe subset of a perm class where the perms are a specific length\n################################################################\n\nYou can define a subset of perms of a specific length in the perm class:\n\n.. code-block:: python\n\n >>> perm_class_14 = perm_class.of_length(14)\n >>> perm_class_14\n Av((Perm((1, 0, 2)), Perm((1, 2, 0)))).of_length(14)\n\nYou can ask for the size of the subset because it is guaranteed to be finite:\n\n.. code-block:: python\n\n >>> len(perm_class_14)\n 8192\n\nThe iterating and containment functionality is the same as with `perm_class`,\nbut indexing has yet to be implemented:\n\n.. code-block:: python\n\n >>> Perm((2, 1, 0)) in perm_class_14\n False\n >>> Perm((0, 13, 1, 12, 2, 3, 4, 11, 5, 10, 6, 7, 8, 9)) in perm_class_14\n True\n >>> Perm(range(10)) - Perm(range(4)) in perm_class_14\n False\n >>> next(iter(perm_class_14)) in perm_class_14\n True\n\nLicense\n#######\n\nBSD-3: see the `LICENSE `_ file.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/PermutaTriangle/Permuta", "keywords": "permutation perm mesh pattern patt avoid contain occurrencestatistic", "license": "BSD-3", "maintainer": "", "maintainer_email": "", "name": "permuta", "package_url": "https://pypi.org/project/permuta/", "platform": "", "project_url": "https://pypi.org/project/permuta/", "project_urls": { "Homepage": "https://github.com/PermutaTriangle/Permuta", "Source": "https://github.com/PermutaTriangle/Permuta", "Tracker": "https://github.com/PermutaTriangle/Permuta/issues" }, "release_url": "https://pypi.org/project/permuta/1.2.1/", "requires_dist": null, "requires_python": ">=3.5", "summary": "A comprehensive high performance permutation library.", "version": "1.2.1" }, "last_serial": 5808376, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "cc4177ffadc5e54a586e9dd5635b8f1b", "sha256": "65be04e9e306875a4b7238b0e23e8c057cbc9490d71502bca7e97b79ca2c6df4" }, "downloads": -1, "filename": "permuta-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "cc4177ffadc5e54a586e9dd5635b8f1b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 159251, "upload_time": "2018-03-05T16:27:41", "url": "https://files.pythonhosted.org/packages/59/78/3fd51751e4f246e42a69162b8b8d07bb076f795cd07d328ff25c43740806/permuta-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "cca0c78992ca5c42abcb4f6f80b6dddb", "sha256": "aa0fae2427b871e3822dfb3ddf7bad4ef0c462a83ee4e2568e6c2694f7c6fe52" }, "downloads": -1, "filename": "permuta-0.1.0.tar.gz", "has_sig": false, "md5_digest": "cca0c78992ca5c42abcb4f6f80b6dddb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 62806, "upload_time": "2018-03-05T14:42:56", "url": "https://files.pythonhosted.org/packages/f5/c4/e855dca0b57f4473dae16b177f67b351f7f998a85f9dfaad20583cc2af79/permuta-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "43eb8fdad41fc0c5a01e7cf088ba2c07", "sha256": "ea5d6300949ec6b62c100d35fefd07ad75fcff44ebe3775c5697fba0ea57a4fe" }, "downloads": -1, "filename": "permuta-0.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "43eb8fdad41fc0c5a01e7cf088ba2c07", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.4", "size": 159256, "upload_time": "2018-03-05T17:15:32", "url": "https://files.pythonhosted.org/packages/b3/37/4acc86083e9f9dc7e0ae0b3a51aaed79813aac8930766cb00c176f61b883/permuta-0.1.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "191bd6875eeed7a84cf8f98ff1f056ec", "sha256": "2a3a63adc1b3b07a2d753d4bbffd7d4b6b471fd565884e40570ac5f6ee675e01" }, "downloads": -1, "filename": "permuta-0.1.1.tar.gz", "has_sig": false, "md5_digest": "191bd6875eeed7a84cf8f98ff1f056ec", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.4", "size": 63883, "upload_time": "2018-03-05T17:15:34", "url": "https://files.pythonhosted.org/packages/0f/28/6b62e4ed6ff8d25ce587f6814dfbdfd7a5d038dc2eb9cc7a392c8878b8be/permuta-0.1.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "9446afdbf9114d4db7b89840f0b4518c", "sha256": "19c48fc501a27649953827fbbbd9594d22cde408416f257fa038ffe666dfb0b5" }, "downloads": -1, "filename": "permuta-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9446afdbf9114d4db7b89840f0b4518c", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 58476, "upload_time": "2019-04-15T19:03:17", "url": "https://files.pythonhosted.org/packages/88/d7/5a7599800f0103b24c555eef7b07679e213fe4fef54d07e433adf85fa946/permuta-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "19db5fd2b118505a8bf7a3e8d6f53308", "sha256": "17a225b2ec1fccf066068da6d718e168691d3ae06bde59c18d0e33ed16986c16" }, "downloads": -1, "filename": "permuta-1.1.0.tar.gz", "has_sig": false, "md5_digest": "19db5fd2b118505a8bf7a3e8d6f53308", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 60871, "upload_time": "2019-08-26T12:21:07", "url": "https://files.pythonhosted.org/packages/eb/bd/7f3ed129ecbaf046b4ca3d38e0984d4f39b35fe825bd5601a44c2922378a/permuta-1.1.0.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "e68e5ef7fdf1f2a4d93bea667a4833eb", "sha256": "4fbbd80fbd92faa7c39288f259e3404d868069b3d8ec41b33375c854e6582216" }, "downloads": -1, "filename": "permuta-1.2.0.tar.gz", "has_sig": false, "md5_digest": "e68e5ef7fdf1f2a4d93bea667a4833eb", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 60945, "upload_time": "2019-09-05T18:41:03", "url": "https://files.pythonhosted.org/packages/d2/0a/5588b754accb87f6985d1dbb4fb56f2fe28bfd9fa5c6ad964900d8cc3753/permuta-1.2.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "433054fd17ec9ab78603f943f4a68896", "sha256": "87d9296f4188d6c411c60d8ca76c00bc3fb6cb6ac24f5c5d9305e32009ae9bdf" }, "downloads": -1, "filename": "permuta-1.2.1.tar.gz", "has_sig": false, "md5_digest": "433054fd17ec9ab78603f943f4a68896", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 61158, "upload_time": "2019-09-10T11:26:12", "url": "https://files.pythonhosted.org/packages/a1/4b/25b1bfce43e962a0a987a4ffde8e1c4703ff74112da99186984c937aa8f4/permuta-1.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "433054fd17ec9ab78603f943f4a68896", "sha256": "87d9296f4188d6c411c60d8ca76c00bc3fb6cb6ac24f5c5d9305e32009ae9bdf" }, "downloads": -1, "filename": "permuta-1.2.1.tar.gz", "has_sig": false, "md5_digest": "433054fd17ec9ab78603f943f4a68896", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.5", "size": 61158, "upload_time": "2019-09-10T11:26:12", "url": "https://files.pythonhosted.org/packages/a1/4b/25b1bfce43e962a0a987a4ffde8e1c4703ff74112da99186984c937aa8f4/permuta-1.2.1.tar.gz" } ] }