From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: does Matlab have any such function
Date: Tue, 3 Feb 2009 03:50:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <gm8etb$4a3$>
References: <>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1233633003 4419 (3 Feb 2009 03:50:03 GMT)
NNTP-Posting-Date: Tue, 3 Feb 2009 03:50:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:515574

Will <> wrote in message <>...
> I need to take a vector of the numbers
> v={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15} and go through all 15 factorial permutations of these numbers. With each of these permutations I need to do a calculation on a vector that contains 25,000 numerical entries.
> Does anyone know if Matlab has a convenient function for generating, one step at a time, all of the permutations of v?
> Also, does anyone know if this going to take a really long time to complete?
> Thanks.

  There is also Mathworks' own 'perms' which generates all permutations, but like Matt's function, they are produced all in one array which would be a massive 1.3e12 x 15 in size.  If you have a computation to do involving a vector with 25000 entries for each row, I think one can predict a very, very long computation process!

  I think your best bet would be to try to do this computation, whatever it is, on a different basis, one that doesn't require tediously working with each separate permutation.  You might be surprised at the shortcuts that could be found in such problems.  Why don't you try explaining what it is you propose to do with each row to see if such a simplification is possible?

Roger Stafford