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.


|