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)
andBase.^(::Integer, ::AbstractPermutation)
,
and two conventions:
AbstractPermutations
are finitely supported bijections ofN
(the positive integers)AbstractPermutations
act onN
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:
PermutationGroups.jl
PermGroups.jl
(to be confirmed).
Note that
Permutations.jl
do not implement theAbstractPermutations.jl
interface due to the fact that they act on integers on the left. See these comments.
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