Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #2629
| From | Giacomo Boffi <giacomo.boffi@polimi.it> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Fun python 3.2 one-liner |
| Date | Tue, 05 Apr 2011 07:36:53 +0200 |
| Organization | The Sun and The Rain |
| Lines | 20 |
| Message-ID | <86d3l1w96y.fsf@aiuole.stru.polimi.it> (permalink) |
| References | <df2af546-af99-4e69-bc8e-38c21a045a29@z27g2000prz.googlegroups.com> <o%pkp.365$0s5.220@newsfe17.iad> <86k4f9wzgx.fsf@aiuole.stru.polimi.it> <mailman.20.1301953602.9059.python-list@python.org> |
| NNTP-Posting-Host | donzauker.stru.polimi.it |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | newsserver.cilea.it 1301981743 25986 131.175.189.147 (5 Apr 2011 05:35:43 GMT) |
| X-Complaints-To | news@cilea.it |
| NNTP-Posting-Date | 5 Apr 2011 05:35:43 GMT |
| User-Agent | Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.5-b29 (linux) |
| Cancel-Lock | sha1:0OR8yxIaudUdwWSXOfaZuYYRYxU= |
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-zh.switch.ch!kanaga.switch.ch!switch.ch!newsserver.news.garr.it!newsserver.cilea.it!not-for-mail |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:2629 |
Show key headers only | View raw
Chris Angelico <rosuav@gmail.com> writes:
>> def f(x,n,w): return x if n==1 else\
>> (lambda x0=f(x[::2],n/2,w[::2]),\
>> x1=f(x[1::2],n/2,w[::2]): reduce(lambda a,b: a+b ,\
>> zip(*[(x0[k]+w[k]*x1[k],\
>> x0[k]-w[k]*x1[k])\
>> for k in range(n/2)])))()
> What sort of parameters does this take? So far all I can figure out
> is that n is an integer and x and w are sliceables, but I'm not sure
> whether x and w should be strings or arrays.
def direct_fft(x,n):
return f(x,n,[exp(-2*pi*1j*k/n) for k in range(n/2)])
def inverse_fft(x,n):
return [x/n for x in f(x,n,[exp(+2*pi*1j*k/n) for k in range(n/2)])]
--
le mie sacrosante questioni di principio
VS gli sciocchi puntigli di quel cretino del mio vicino
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Fun python 3.2 one-liner harrismh777 <harrismh777@charter.net> - 2011-03-29 14:00 -0500
Re: Fun python 3.2 one-liner gb <gb@cabiate.it> - 2011-04-04 22:09 +0200
Re: Fun python 3.2 one-liner Chris Angelico <rosuav@gmail.com> - 2011-04-05 07:46 +1000
Re: Fun python 3.2 one-liner Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2011-04-05 10:16 +1200
Re: Fun python 3.2 one-liner Chris Angelico <rosuav@gmail.com> - 2011-04-05 08:45 +1000
Re: Fun python 3.2 one-liner Emile van Sebille <emile@fenx.com> - 2011-04-04 15:46 -0700
Re: Fun python 3.2 one-liner Giacomo Boffi <giacomo.boffi@polimi.it> - 2011-04-05 07:36 +0200
csiph-web