Short survey of modules for combinations and permutations
This is a short look at some modules for generating combinations and permutations. There are likely more modules that aren't listed. RosettaCode has examples of writing the combinations and permutations functions by hand.
Module | Impl | Comb | Perm | Comb w/rep | Perm w/rep | Derange | Speed | Order | Comments |
---|---|---|---|---|---|---|---|---|---|
Algorithm::Combinatorics | XS | yes | yes | yes | yes | yes | + | Lexico | Fast iterator or array |
ntheory | XS | yes | yes | no | no | no | ++ | Lexico | Fast block call |
Math::Combinatorics | Perl | yes | yes | no | no | yes | - - | Impl | Iterator or array |
Algorithm::FastPermute | XS | no | yes | no | no | no | +++ | Impl | Fast block call |
Algorithm::Permute | XS | no | yes | no | no | no | + | Impl | Iterator or fast block call |
Algorithm::Loops | Perl | no | yes | no | no | no | + | Impl | Iterator |
List::Permutor | Perl | no | yes | no | no | no | - | Lexico | Iterator |
Iterator::Misc | Perl | no | yes | no | no | no | - - | Lexico | Iterator |
Math::Permute::Array | Perl | no | yes | no | no | no | - - | Impl | Iterator or index |
Math::Permute::List | Perl | no | yes | no | no | no | Impl | Block call | |
Math::GSL::Permutation | XS | no | yes | no | no | no | - | Lexico | function interface |
Math::Disarrange::List | Perl | no | no | no | no | yes | Impl | Block call | |
Math::GSL::Combination | XS | yes | no | no | no | no | + | Lexico | iterator or by index |