[Math] Permutations?
Hello, Would it be useful for Boost to provide a permutation class? The standard provides a couple of relevant functions (is_permutation, next_permutation) and Boost.Iterator offers a permutation_iterator adaptor. But as far as I can tell, no class that can be manipulated similarly to the mathematical object, something like this: https://gist.github.com/Kojirion/8503800 I admit I do not have many use cases in mind, just the impression this is a useful tool. As an example, once in a gui application I wished to animate the rearranging of a table; writing a permutation class made it easy to get the sequence of transpositions of rows and columns that would yield the desired result. (note though the above api doesn't include an asTranspositions() because I 'm not sure what is the most useful way to represent a transposition). I 'd be happy to hear your thoughts, Albert
On Jan 19, 2014, at 4:11 AM, Vee Kay
Hello,
Would it be useful for Boost to provide a permutation class? The standard provides a couple of relevant functions (is_permutation, next_permutation) and Boost.Iterator offers a permutation_iterator adaptor. But as far as I can tell, no class that can be manipulated similarly to the mathematical object, something like this:
https://gist.github.com/Kojirion/8503800
I admit I do not have many use cases in mind, just the impression this is a useful tool. As an example, once in a gui application I wished to animate the rearranging of a table; writing a permutation class made it easy to get the sequence of transpositions of rows and columns that would yield the desired result. (note though the above api doesn't include an asTranspositions() because I 'm not sure what is the most useful way to represent a transposition).
You might also look at: http://home.roadrunner.com/~hinnant/combinations.html — Marshall
participants (2)
-
Marshall Clow
-
Vee Kay