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 4 of 6 Topic 45809 of 47017
Post > Topic >>

Re: optimize this ****fting code ?

by Jerry Coffin <jcoffin@[EMAIL PROTECTED] > May 8, 2008 at 07:07 PM

In article <fvurcu$jq0$1@[EMAIL PROTECTED]
>, matthias79
@[EMAIL PROTECTED]
 says...
> 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.
> 
> // *********************************
> // Cycle changes 012 345 to 345 012
> // *********************************
> void QFFTW::Cycle(complex<double> *A1,long N)
> {
> 	Cycle(A1,N,N/2);
> }

If I understand your requirements correctly, std::swap_ranges should do 
the job quite easily:

void QFFTW::Cycle(complex<double> *A1, long N) {
	complex<double> *mid = A1+N/2;
	std::swap_ranges(A1, mid, mid);
}

Since you're doing an FFT, I'd guess you don't care about the 
possibility of N being odd.

-- 
    Later,
    Jerry.

The universe is a figment of its own imagination.
 




 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 Thu Jul 24 15:49:51 CDT 2008.