Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wrapper in MDArray for class cern.colt.GenericPermuting #3

Open
rbotafogo opened this issue Mar 27, 2015 · 0 comments
Open

Add wrapper in MDArray for class cern.colt.GenericPermuting #3

rbotafogo opened this issue Mar 27, 2015 · 0 comments

Comments

@rbotafogo
Copy link

Generically reorders (permutes) arbitrary shaped data (for example, an array, three arrays, a 2-d matrix, two linked lists) using an in-place swapping algorithm. Imagine having a couple of apples. For some reason you decide to reorder them. The green one before the red one. The pale one after the shiny one, etc. This class helps to do the job.

This class swaps elements around, in a way that avoids stumbling over its own feet: Let before be the generic data before calling the reordering method. Let after be the generic data after calling the reordering method. Then there holds after[i] == before[indexes[i]].

Similar to GenericSorting, this class has no idea what kind of data it is reordering. It can decide to swap the data at index a with the data at index b. It calls a user provided Swapper object that knows how to swap the data of these indexes.

For convenience, some non-generic variants are also provided. Further a method to generate the p-th lexicographical permutation indexes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant