Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!newsfeed.kamp.net!newsfeed.kamp.net!feeder1.cambriumusenet.nl!82.197.223.103.MISMATCH!feeder3.cambriumusenet.nl!82.197.223.108.MISMATCH!feeder3.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'arrays': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'array.': 0.16; 'numpy': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:generation': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'all,': 0.19; 'header:User- Agent:1': 0.23; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'array': 0.29; 'received:132': 0.31; 'guess': 0.33; "i'd": 0.34; 'could': 0.34; 'there': 0.35; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'back': 0.62; 'more': 0.64; 'skip:\xe2 10': 0.65; 'between': 0.67; 'forth': 0.81; 'calculations': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Wolfgang Maier Subject: Re: Speeding up permutations generation Date: Fri, 06 Mar 2015 09:44:39 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: px1.ruf.uni-freiburg.de User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.19 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1425631533 news.xs4all.nl 2889 [2001:888:2000:d::a6]:32939 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:87000 On 03/06/2015 09:34 AM, Mark Lawrence wrote: > On 06/03/2015 06:44, Abhiram R wrote: >> Hi all, >> Is there a way to generate permutations of large arrays of sizes say,in >> the hundreds, faster than in the time itertools.permutations() can >> return? >> >> ​-Abhiram.R >> /~Never give up/ >> > > If there is I'd guess that you'd use numpy http://www.numpy.org/. The > more mathematically minded may well be able to give better answers. > Well, numpy would be faster if you could call into it once and retrieve all permutations as an array. This would allow you to do all calculations in C, while itertools.permutations has to jump back and forth between C and Pyhon code. However, 50! is still ~ 3*10^64. So where would you want to store the array of these many permutations ?