mersenneforum.org  

Go Back   mersenneforum.org > Extra Stuff > Programming

Reply
 
Thread Tools
Old 2008-09-18, 23:19   #45
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
República de California

103·113 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
The prev.code is totally broken. Sorry. Will attatch a new one probably tomorrow.

--Nuggetprime
Don't take this the wrong way, but do you think it's worth anyone's time to look at some little code you wrote that uses a guaranteed-to-be-horribly-slow implementation?

Until you teach yourself the rudiments of the FFT and actually code one up and then write at least an old-style LL test around it which zero-pads the inputs [i.e. doesn't require the DWT], there's no point whatsoever in asking the experts to look at your code - YOU'RE the one who needs to look at your code, unless you've got some highly specific coding or build issue you need advice on.
ewmayer is offline   Reply With Quote
Old 2008-09-19, 15:39   #46
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

You are completely right Ernst.And it's hard to insult me, so don't worry
I found a page on the web telling me for FFT i don't have to break off 1 time, but so many times that fftlen=2 and then recombine. That is the point I've forgotten.

Thanks,
nuggetprime
nuggetprime is offline   Reply With Quote
Old 2008-09-24, 12:11   #47
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

I've now managed to code an FFT out of my DFT. It takes me ~0.5 seconds to do a length 8192-fft(with IFFT ~1 second). Still a very bad time. I don't ask to look at my code,but what is important to get normal speeds(at least ~0.3 ms/fft). That's a factor of 3000, so I'm sure I'm doing something pretty wrong. If I get asked, I can also post the code.

thanks,
nuggetprime

Last fiddled with by nuggetprime on 2008-09-24 at 12:11
nuggetprime is offline   Reply With Quote
Old 2008-09-24, 16:20   #48
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
República de California

103·113 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
I've now managed to code an FFT out of my DFT. It takes me ~0.5 seconds to do a length 8192-fft(with IFFT ~1 second). Still a very bad time. I don't ask to look at my code,but what is important to get normal speeds(at least ~0.3 ms/fft). That's a factor of 3000, so I'm sure I'm doing something pretty wrong. If I get asked, I can also post the code.

thanks,
nuggetprime
Suggest you also get hold of the Numerical Recipes FFT code and compare the timings of that with yours. Don't worry about real-vs-complex FFT for now, you only want to get some gross order-of-magnitude timing comparisons.
ewmayer is offline   Reply With Quote
Old 2008-09-24, 17:07   #49
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

I got(probably) the right code. It's less than 50 lines, so i could probably understand it. But how to use it?(small example).

Thanks,
nugget
nuggetprime is offline   Reply With Quote
Old 2008-09-24, 18:08   #50
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
República de California

101101011101112 Posts
Default

Specifically, you want the section titled "FFT of Single Real Function", i.e. the realft() code, and the functions called by that. That allows you to do both forward and inverse FFTs, so the general outline for a non-DWT-based LL test using this is;

0. Set a reasonable wordsize for DP-based arithmetic, say w = 16 bits per word.

1. Pick your real-double residue vector length. For a Mersenne exponent p and a power-of-2-length FFT implementation, this will be n = 2*2^ceiling[log2(p/w)], e.g. for p = 607 and w = 16, this gives n = 2*2^6 = 128. The leading multiply-by-2 here is to effect the zero-padding required by a non-DWT method.

2. Initialize your residue vector to have 4 in the lowest-order slot and zeros elsewhere.

3. Do a forward real-vector FFT.

4. Do a dyadic (a.k.a. pointwise) squaring of the forward FFT outputs

5. Do an inverse real-vector FFT.

6. Normalize the outputs of (5) by dividing each [call it xi] by w, carrying y = nint(xi/w) into xi+1, and replacing xi with w*[xi - y)]. Add any carry out of the highest-order vector element back into x0 and also subtract 2 form x0.

7. Perform steps 3-6 precisely (p-2) times. If the result is the zero vector, 2p-1 is prime, otherwise it's composite.

Last fiddled with by ewmayer on 2008-09-24 at 18:09
ewmayer is offline   Reply With Quote
Old 2008-10-23, 16:39   #51
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

After some time, I finally got a FFT working that's about 3 times as slow as gwnum.
I can understand the split-radix fft, but not how a real-data fft works. I've not found any explanatory material except of hard-to-read code. Can you please provide an explanation and a small example?

Thanks,
--nuggetprime
nuggetprime is offline   Reply With Quote
Old 2008-10-23, 21:35   #52
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

22×3×641 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
I can understand the split-radix fft, but not how a real-data fft works. I've not found any explanatory material except of hard-to-read code. Can you please provide an explanation and a small example?
So, you need more explanation and example than the "FFT explanation for non math guys" thread provides?

Last fiddled with by cheesehead on 2008-10-23 at 21:40
cheesehead is offline   Reply With Quote
Old 2008-10-24, 05:11   #53
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

Quote:
Originally Posted by cheesehead View Post
So, you need more explanation and example than the "FFT explanation for non math guys" thread provides?
The "FFT explanation for non math guys" thread doesn't provide an explanation about real-data fft.

--nuggetprime
nuggetprime is offline   Reply With Quote
Old 2008-10-24, 18:12   #54
ewmayer
2ω=0
 
ewmayer's Avatar
 
Sep 2002
República de California

103·113 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
I can understand the split-radix fft, but not how a real-data fft works. I've not found any explanatory material except of hard-to-read code.
Quote:
Originally Posted by ewmayer View Post
Specifically, you want the section titled "FFT of Single Real Function", i.e. the realft() code
The explanatory material you require is all in that section of NR.

Last fiddled with by ewmayer on 2008-10-24 at 18:14
ewmayer is offline   Reply With Quote
Old 2008-10-25, 17:36   #55
cheesehead
 
cheesehead's Avatar
 
"Richard B. Woods"
Aug 2002
Wisconsin USA

22·3·641 Posts
Default

Quote:
Originally Posted by ewmayer
Specifically, you want the section titled "FFT of Single Real Function", i.e. the realft() code
Ernst, could you add either a link to, or a summary or an explanation of what nuggetprime needed to the "FFT explanation for non math guys" thread?

Last fiddled with by cheesehead on 2008-10-25 at 17:38
cheesehead is offline   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone know enough about coding to do this? jrafanelli Software 2 2018-01-11 15:16
Python Coding Help? kelzo Programming 3 2016-11-27 05:16
Zhang's OPQBT coding help? flouran Programming 0 2009-07-25 02:43
coding midlet for TF starrynte Programming 1 2008-12-30 22:31
Coding Challenges R.D. Silverman Programming 18 2005-08-09 13:14

All times are UTC. The time now is 20:32.


Fri Jul 16 20:32:07 UTC 2021 up 49 days, 18:19, 1 user, load averages: 1.52, 1.90, 2.04

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.