Code covered by the BSD License  

Highlights from

Be the first to rate this file! 5 Downloads (last 30 days) File Size: 1.86 KB File ID: #23067 Version: 1.0




Obtain a single permutation of the numbers 1:N

| Watch this File

File Information

   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


This file inspired Nthperm.

MATLAB release MATLAB 7 (R14)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
18 Dec 2013 Peter Li

Peter Li (view profile)

Ah, based on recursive permutation as here:

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.

Comment only

Contact us