Rank: 2780 based on 26 downloads (last 30 days) and 1 file submitted
photo

Michal

E-mail

Personal Profile:

Professional Interests:

 

Watch this Author's files

 

Files Posted by Michal
Updated   File Tags Downloads
(last 30 days)
Comments Rating
28 Nov 2008 fpermute Derives a matrix of all possible permutations of natural numbers 1, 2, ... , N for a given N Author: Michal statistics, mathematics 26 1
  • 3.0
3.0 | 1 rating
Comments and Ratings on Michal's Files
Updated File Comment by Comments Rating
11 Dec 2008 fpermute Derives a matrix of all possible permutations of natural numbers 1, 2, ... , N for a given N Author: Michal Davis, Tim

A few suggestions. First and foremost, this code needs commenting. You have to look at the output matrix to figure out what matrix it's computing. This code has no comments at all. That's really the main reason I give it a rating of 3.

The second reason is that it needs to be redesigned. Wouldn't it make more sense to provide a function that returns each of the n! permutations one at a time? The matrix itself is huge. fpermute(10) returns a (10!)-by-10 matrix, about 3.6 million by 10. Surely an application doesn't need all 3.6 million permutations at the same time.

Something like:

k = 1
[p,k] = next_permutation(n,k)

which increments k. k=1 gives the first one (p=1:n), k=2 the next one, etc.

That would be a useful function. This one is limited by memory requirement to small values of n.

Top Tags Applied by Michal
mathematics, statistics
Files Tagged by Michal
Updated   File Tags Downloads
(last 30 days)
Comments Rating
28 Nov 2008 fpermute Derives a matrix of all possible permutations of natural numbers 1, 2, ... , N for a given N Author: Michal statistics, mathematics 26 1
  • 3.0
3.0 | 1 rating
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com