AbstractPermutations.jl

Defining interface for permutations in julia
Author kalmarek
Popularity
0 Stars
Updated Last
5 Months Ago
Started In
November 2023

AbstractPermutations

Stable Dev CI Coverage

This julia package provide a basis for inteoperability between different implementations of permutations in julia. The interface is based on four preconditions:

  • subtyping AbstractPermutations.AbstractPermutation, and
  • implementing a constructor from vector of images, and
  • implementing methods for
    • AbstractPermutations.degree(::AbstractPermutation) and
    • Base.^(::Integer, ::AbstractPermutation),

and two conventions:

  • AbstractPermutations are finitely supported bijections of N (the positive integers)
  • AbstractPermutations act on N from the right (and therefore (1,2)·(1,2,3) == (1,3)).

With implementing the interface one receives not only consistent arithmetic across different implementations of the interface but also the possibility to run permutation groups algorithms from package following the interface

The packages following AbstractPermutation interface:

Note that Permutations.jl do not implement the AbstractPermutations.jl interface due to the fact that they act on integers on the left. See these comments.

Testing of the interface

We provide test suite for the interface. Example implementations ExamplePerms.Perm can be tested via the following.

julia> using AbstractPermutations

julia> include(joinpath(pkgdir(AbstractPermutations), "test", "abstract_perm_API.jl"))
abstract_perm_interface_test (generic function with 1 method)

julia> include(joinpath(pkgdir(AbstractPermutations), "test", "perms_by_images.jl")) # include your own implementation
Main.ExamplePerms

julia> import .ExamplePerms

julia> abstract_perm_interface_test(ExamplePerms.Perm{UInt16});
Test Summary:                                        | Pass  Total  Time
AbstractPermutation API test: Main.ExamplePerms.Perm |   95     95  0.3s

Required Packages