Is there C++ class that implements operations with permutations?

前端 未结 1 529
孤城傲影
孤城傲影 2021-01-13 03:26

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条回答
  • 2021-01-13 03:53

    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.

    0 讨论(0)
提交回复
热议问题