fft_threads_transformer< C, FFTER, thr > Class Template Reference

#include <fft_threads.hpp>

List of all members.

Classes

Public Types

Public Member Functions

Static Public Member Functions

Public Attributes

Static Public Attributes


Detailed Description

template<typename C, typename FFTER = fft_blocks_transformer<C, fft_naive_transformer<C>, 8, 6, 10>, nat thr = 14>
class mmx::fft_threads_transformer< C, FFTER, thr >

Definition at line 30 of file fft_threads.hpp.


Member Typedef Documentation

typedef FFTER::R R

Definition at line 33 of file fft_threads.hpp.

typedef R::S S

Definition at line 35 of file fft_threads.hpp.

typedef R::U U

Definition at line 34 of file fft_threads.hpp.

typedef implementation<vector_linear,vector_threads<vector_naive> > Vec

Definition at line 32 of file fft_threads.hpp.


Constructor & Destructor Documentation

fft_threads_transformer ( nat  n,
const format< C > &  fm 
) [inline]

Definition at line 44 of file fft_threads.hpp.

00044                                                              :
00045     ffter (new FFTER (n, fm)),
00046     depth (ffter->depth), len (ffter->len), roots (ffter->roots) {}
  inline ~fft_threads_transformer () { delete ffter; }

~fft_threads_transformer (  )  [inline]

Definition at line 47 of file fft_threads.hpp.

References fft_threads_transformer< C, FFTER, thr >::ffter.

00047 { delete ffter; }


Member Function Documentation

static void copy ( C d,
nat  drs,
nat  dcs,
C s,
nat  srs,
nat  scs,
nat  r,
nat  c 
) [inline, static]

Definition at line 50 of file fft_threads.hpp.

References mmx::C.

Referenced by outer_fft_task_rep::execute().

00050                                                                       {
00051     for (nat j=0; j<c; j++, d+=dcs, s+=scs) {
00052       C* dd= d; C* ss= s;
00053       for (nat i=0; i<r; i++, dd+=drs, ss+=srs)
00054         *dd= *ss;
00055     }
00056   }

void dfft ( C c,
nat  stride,
nat  shift,
nat  steps,
nat  step1,
nat  step2 
) [inline]

Definition at line 179 of file fft_threads.hpp.

References fft_threads_transformer< C, FFTER, thr >::fft(), and fft_threads_transformer< C, FFTER, thr >::ffter.

00179                                                                       {
00180     if (step1 == 0 && step2 == steps && steps > thr)
00181       fft (true, c, stride, shift, steps);
00182     else ffter->dfft (c, stride, shift, steps, step1, step2);
00183   }

void dfft ( C c,
nat  stride,
nat  shift,
nat  steps 
) [inline]

Definition at line 167 of file fft_threads.hpp.

References fft_threads_transformer< C, FFTER, thr >::fft(), and fft_threads_transformer< C, FFTER, thr >::ffter.

Referenced by fft_threads_transformer< C, FFTER, thr >::direct_transform().

00167                                                 {
00168     if (steps <= thr) ffter->dfft (c, stride, shift, steps);
00169     else fft (true, c, stride, shift, steps);
00170   }

void direct_transform ( C c  )  [inline]
void fft ( bool  direct,
C c,
nat  stride,
nat  shift,
nat  steps 
) [inline]

Definition at line 118 of file fft_threads.hpp.

References mmx::C, fft_threads_transformer< C, FFTER, thr >::ffter, min(), and fft_threads_transformer< C, FFTER, thr >::min_reps.

Referenced by fft_threads_transformer< C, FFTER, thr >::dfft(), and fft_threads_transformer< C, FFTER, thr >::ifft().

00118                                                             {
00119     if (steps <= thr) {
00120       if (direct) ffter->dfft (c, stride, shift, steps);
00121       else ffter->ifft (c, stride, shift, steps);
00122     }
00123     else {
00124       nat half1= min(log_2 (threads_number), steps);
00125       nat half2= steps - half1;
00126 
00127       for (nat stage=0; stage<2; stage++) {
00128         if ((stage == 0) ^ (!direct)) {
00129           //C*  cc1  = c;
00130           //for (nat i=0; i<((nat) 1<<half2); i++, cc1 += stride)
00131           //  ffter->fft (direct, cc1, stride << half2,
00132           //              shift >> half2, half1);
00133 
00134           nat nt = threads_number;
00135           nat bsz= (min_reps << half1);
00136           C* buf= mmx_new<C> (nt * bsz);
00137           task tasks[nt];
00138           for (nat i=0; i<nt; i++) {
00139             nat tot= 1 << half2;
00140             nat sta= min_reps * ((  i   * tot) / (min_reps * nt));
00141             nat end= min_reps * (((i+1) * tot) / (min_reps * nt));
00142             tasks[i]= new outer_fft_task_rep
00143               (ffter, direct, buf + i*bsz, end-sta, tot,
00144                c + sta*stride, stride, shift >> half2, half1);
00145           }
00146           threads_execute (tasks, nt);
00147           mmx_delete<C> (buf, nt * bsz);
00148 
00149         }
00150         else {
00151           //C* cc2= c;
00152           //for (nat i=0; i<((nat) 1<<half1); i++, cc2 += (stride << half2))
00153           //  ffter->fft (direct, cc2, stride,
00154           //              shift + ((i << half2) >> 1), half2);
00155           nat nt= threads_number;
00156           task tasks[nt];
00157           for (nat i=0; i<nt; i++)
00158             tasks[i]= new inner_fft_task_rep
00159               (ffter, direct, i, nt, 1 << half1, c, stride, shift, half2);
00160           threads_execute (tasks, nt);
00161         }
00162       }
00163     }
00164   }

void ifft ( C c,
nat  stride,
nat  shift,
nat  steps,
nat  step1,
nat  step2 
) [inline]

Definition at line 186 of file fft_threads.hpp.

References fft_threads_transformer< C, FFTER, thr >::fft(), and fft_threads_transformer< C, FFTER, thr >::ffter.

00186                                                                       {
00187     if (step1 == 0 && step2 == steps && steps > thr)
00188       fft (false, c, stride, shift, steps);
00189     else ffter->ifft (c, stride, shift, steps, step1, step2);
00190   }

void ifft ( C c,
nat  stride,
nat  shift,
nat  steps 
) [inline]

Definition at line 173 of file fft_threads.hpp.

References fft_threads_transformer< C, FFTER, thr >::fft(), and fft_threads_transformer< C, FFTER, thr >::ffter.

Referenced by fft_threads_transformer< C, FFTER, thr >::inverse_transform().

00173                                                 {
00174     if (steps <= thr) ffter->ifft (c, stride, shift, steps);
00175     else fft (false, c, stride, shift, steps);
00176   }

void inverse_transform ( C c,
bool  divide = true 
) [inline]

Definition at line 197 of file fft_threads.hpp.

References binpow(), fft_threads_transformer< C, FFTER, thr >::depth, fft_threads_transformer< C, FFTER, thr >::ifft(), mmx::invert(), fft_threads_transformer< C, FFTER, thr >::len, and mmx::x.

00197                                              {
00198     ifft (c, 1, 0, depth);
00199     if (divide) {
00200       S x= binpow (S (2), depth);
00201       x= invert (x);
00202       Vec::template vec_unary_scalar<typename R::fft_mul_sc_op> (c, x, len);
00203     }
00204   }


Member Data Documentation

nat depth
FFTER* ffter
nat len
const nat min_reps = 16 [static]
U* roots

Definition at line 41 of file fft_threads.hpp.


The documentation for this class was generated from the following file:

Generated on 20 Mar 2013 for algebramix by  doxygen 1.6.1