views:

328

answers:

3

Is there C++ template class that implements operations with permutations and permutation group? Such class has to implement finding product and inverse, multiplication, etc.

+1  A: 

This is the best I've found... but is in C so you'll have to write a wrapper. CodeCogs also gives you a library on combinatorics.

yeyeyerman
A: 
Janaka
Please, "algorithm" not "algorithm.h"!
KTC
How does it help me to find inverse permution for instance?
Alexey Malistov
It doesn't. This function merely enumerates the members of the permutation group. It knows nothing about the structure of the group -- it just relies on the elements of the input array having a defined order.
Steve Jessop
A: 

I don't know of one, but it should be easy enough to implement. Internally you could represent the permutation as a vector e.g. (1 3 4 2 7 5 6) being a perm of 1-7 sending 1->1, 2->3, 3->4, 4->2 etc. or as a set of cycles e.g. (1) (2 3 4) (5 7 6), and implement the operations in terms of these. Presumably the template argument would be the size of the permutation group.