Code Monkey home page Code Monkey logo

symmetria's Introduction

Anurag's GitHub stats

symmetria's People

Contributors

thraraujo avatar vascosch92 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

symmetria's Issues

[FEATURE] Add a method that returns if two permutations are conjugate

Add a method that returns if two permutations are conjugate.

Two permutations $\sigma, \tau \in S_n$ are conjugate if there is $\delta \in S_n$ such that $\delta \sigma \delta^{-1} = \tau$.
Note that two permutations are conjugate if and only if they have the same cycle type. Therefore, this issue is dependent from #6

Possible API

>>> Permutation(1, 2, 3).is_conjugate(Permutation(2, 1, 3))
False

[ENHANCEMENT] Improve how we compute `sgn` for the class `Permutation`

For instance, when we want to compute the sign of an Permutation object, we convert it to a CycleDecomposition and then
we compute the sign.

Perhaps is better to compute the sign directly by counting the number of inversions, i.e., using the base definition of sign.

To implement that we need #25 .

[MAINTENANCE] Rework meta tests

Rework meta tests to change the order of the methods like the following:

  • the init
  • all the magic methods in alphabetical order
  • all the others methods in alphabetical order

The old order was not so intuitive, and in this way we respect the order of the docs.

[FEATURE] Add a method `.describe()`

Add method .describe() to all the subclasses of _Element.

The method return a string representing a table with all the important information about the element.

Should we insert the method in _Element, or every class should have a different .describe() method?

[FEATURE] Implement CLI

The package should have a more complet CLI than the one now present.

We should be able to give a permutation/cycle/cycle decomposition in a particular notation (TBD) and to retrieve information about it.

For example

symmetria (1, 2, 3) --order

and it will print the order of the permutation (1, 2, 3)

Similar

symmetria (1 2)(3 4)(5 6 8 7) --order

will print the order of the cycle decomposition (1 2)(3 4)(5 6 8 7)

[MAINTENANCE] tests for order methods

We plan to add a lot of methods for the classes: Permutation, Cycle and CycleDecomposition. This means that the classes will grow in complexity. To make it easier for developer to work with them we should implement tests to check that the methods follow the same order in every class.

Order proposed:

  • __init__
  • Magic methods in alphabetical order
  • properties in alphabetic order
  • All others methods in alphabetical order

The tests should ideally be in test_meta.test_order

Method .map()

Add a method .map(), which return a dictionary describing the map defined by an element.

Expose this method in the class _ELEMENT.

[FEATURE] Implement a method to check if a permutation is regular

Implement a method to check if a permutation is regular.

Recall that a permutation :math:\sigma is regular if either has no fixed-points and it is the product of disjoint cycles of the same length or it is the identity.

Proposed API

def is_regular(self) -> bool:
    ...

[FEATURE] Introduce the magic method __pow__

Introduce the magic method __pow__ for all the subclasses of _Element.

The power of a permutation can be defined just for integer (positive and negative).

To define a negative power of a permutation, we need to be able to compute its inverse. See issue #4 .

Note that a $\sigma^0=\sigma$ for every permutation $\sigma$ in $S_n$ and every $n \in \mathbb{N}$

[FEATURE] Add the method `sgn`

Add the method sgn (sign) to the classes Permutation, Cycle and CycleDecomposition.

Fact: the sign of a cycle is -1 if the cycle has even length.

Include a reference of the above fact in the PR.

[FEATURE] Implement a method which return the inversions

Implement a method which return a list of 2-tuple which represents the indices of the inversions in the permutation.

Recall that an inversion of a permutation $\sigma$ is a pair (i, j) of positions where the entries of a permutation are in the opposite order: i<j and $\sigma$(i) > $\sigma$(j).

[MAINTENANCE] Develop CI/CD

Checklist:

  • Automate testing
  • Automate formatting and linting
  • Check PR title workflow
  • Automatic release/publish of package
  • Automatic release/publish of docs
  • Automatic DOCS testing

[FEATURE] Implement `exceedances` method.

implement exceedances method.

An exceedance of a permutation $\sigma$ is an index j such that $\sigma(j)$ > j. If the inequality is not strict, then j is called a weak exceedance.

[FEATURE] Add degree of a permutation

The degree of a permutation is the number of elements in the set. This is actually the length of the permutation.
Therefore, this should be the implementation

def degree(self) -> int:
# docstring
    return len(self)

[FEATURE] Implement generation of random permutation

Implement the infrastructure to generate random permutation following a given algorithm.

Proposed API

import symmetria

random_permutations = symmetria.random(algorithm="entry-by-entry", degree=3)

for permutation in random_permutations:
   permutation

The first step is:

It follows a list of algorithm of permutations we want to implement:

  • Entry-by-entry
  • Fisher-Yates shuffles
  • Sattolo
  • Sorting method

Reference:

[FEATURE] Implement infrastructure to generate permutation

Implement the infrastructure to generate permutation following a specific algorithm.

Proposed API

from symmetria import generate
...
for permutation in generate(algorithm="lexicographic", degree=4):
    print(permutation)

The first step is:

It follows a list of algorithm of permutations we want to implement:

  • #90
  • #105
  • #97
  • #94
  • Ehrlich's star-transposition algorithm;
  • #106
  • Sawada-Williams' algorithm;
  • Corbett's algorithm;
  • Single-track ordering;
  • Single-track Gray code;
  • Nested swaps generating algorithm;

Reference: https://en.wikipedia.org/wiki/Permutation#Numbering_permutations

[MAINTENANCE] Workflow to check version

Develop a workflow which is triggered when a new release is published.

The workflow should check that the version number in pyproject.toml, the one in the __init__,py and the tag for the release are the same.

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.