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

大城市里の小女人 提交于 2019-12-30 09:37:09

问题


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:


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.



来源:https://stackoverflow.com/questions/1205744/is-there-c-class-that-implements-operations-with-permutations

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!