New package Combinat

This is to announce a package I just registered, Combinat.jl.
Here is the README

This module is a Julia port of some GAP combinatorics and basic number theory. The only dependency is the package Primes.

The list of functions it exports are:

Classical enumerations:

combinations, arrangements, partitions, partition_tuples, compositions, multisets

functions to count them without computing them:

ncombinations, narrangements, npartitions, npartition_tuples, ncompositions, nmultisets

some functions on partitions and permutations:

lcm_partitions, gcd_partitions, conjugate_partition, dominates, tableaux, robinson_schensted

counting functions:

bell, stirling1, stirling2, catalan

number theory

divisors, prime_residues, primitiveroot, bernoulli

some structural manipulations not yet in Julia:

groupby, tally, tally_sorted, collectby, unique_sorted!

matrix blocks:

blocks, diagblocks

Have a look at the individual docstrings and enjoy (any feedback is welcome).

After writing most of this module I became aware of the package Combinatorics which has a considerable overlap. However there are some fundamental disagreements between these two packages which makes Combinatorics not easily usable for me:

  • often I use sorting in algorithms when Combinatorics use hashing. Thus the algorithms cannot be applied to the same objects (and sorting is often faster). I provide optionally a hashing variant of some algorithms.
  • Combinatorics.combinations does not include the empty set.
  • I use lower case for functions and Camel case for structs (Iterators). Combinatorics does not have functions for classical enumerations but only (lowercase) iterators.

Some less fundamental disagreements is disagreement on names. However I would welcome discussions with the authors of Combinatorics to see if both packages could be made more compatible.

5 Likes