File Exchange

image thumbnail

ONEPERM

version 1.0.0.0 (1.86 KB) by Darren Rowland
Obtain a single permutation of the numbers 1:N

2 Downloads

Updated 22 Feb 2009

View License

perm = ONEPERM(N,M) returns the M-th permutation of the sorted list of all permutations from PERMS, where M=1 corresponds to identity permutation. N, M are non-negative scalar, perm has size 1-by-N.
Makes use of a fast algorithm to generate a single permutation.

See also PERMS
and NPERMUTEK, RECPERMS, NEXTPERM, PERMS1 on the File Exchange

Cite As

Darren Rowland (2019). ONEPERM (https://www.mathworks.com/matlabcentral/fileexchange/23067-oneperm), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Peter Li

Ah, based on recursive permutation as here: http://www.mathworks.com/matlabcentral/fileexchange/13060-perms1

So not in the same order as Matlab PERMS or C++ STL NEXT_PERMUTATION. I guess this means I can't use this as starting points for a multithreaded version based on STL.

MATLAB Release Compatibility
Created with R14
Compatible with any release
Platform Compatibility
Windows macOS Linux
Acknowledgements

Inspired: nthperm