Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: optimize th...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 6 Topic 45809 of 47034
Post > Topic >>

Re: optimize this ****fting code ?

by "Victor Bazarov" <v.Abazarov@[EMAIL PROTECTED] > May 8, 2008 at 08:53 PM

Matthias Pospiech wrote:
> In FFT one usually needs to ****ft/cycle the values in an array.
> Typically the entries are ****fted in the way:
> 012 345 to 345 012
>
> The following code does this, but I wonder if there are possibilites
> to optimize it? It is very generall, but the ****fting with the
> delimiter in the middle is the only one that I need.

You might consider using swap N/2 times, in place, instead of
allocating another array and doing so many loops:

    for (int i = 0, half = N/2; i < half; ++i)
        swap(A[i], A[i + half]);

Now, you didn't say what should happen if the array has an odd
number of elements, so please adjust the loop accordingly.

> [..]

V
-- 
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
 




 6 Posts in Topic:
optimize this Shifting code ?
Matthias Pospiech <mat  2008-05-08 14:23:56 
Re: optimize this Shifting code ?
lunar_lty <penglu96@[E  2008-05-08 05:56:56 
Re: optimize this Shifting code ?
"Victor Bazarov"  2008-05-08 20:53:03 
Re: optimize this Shifting code ?
Jerry Coffin <jcoffin@  2008-05-08 19:07:22 
Re: optimize this Shifting code ?
"Steven G. Johnson&q  2008-05-08 21:45:11 
Re: optimize this Shifting code ?
Jerry Coffin <jcoffin@  2008-05-09 07:54:26 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 2:56:59 CDT 2008.