fft_triadic_threads_transformer< C, FFTER, thr > Class Template Reference

#include <fft_triadic_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_triadic_naive_transformer<C>, nat thr = 9>
class mmx::fft_triadic_threads_transformer< C, FFTER, thr >

Definition at line 26 of file fft_triadic_threads.hpp.


Member Typedef Documentation

typedef implementation<vector_linear,vector_naive> NVec

Definition at line 28 of file fft_triadic_threads.hpp.

typedef V::template helper<C>::roots_type R

Definition at line 30 of file fft_triadic_threads.hpp.

typedef R::U U

Definition at line 31 of file fft_triadic_threads.hpp.

typedef FFTER::V V

Definition at line 29 of file fft_triadic_threads.hpp.


Constructor & Destructor Documentation

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

Definition at line 41 of file fft_triadic_threads.hpp.

00041                                                                      :
00042     ffter (new FFTER (n, fm)),
00043     depth (ffter->depth), len (ffter->len),
00044     roots (ffter->roots), stoor (ffter->stoor) {}
  inline ~fft_triadic_threads_transformer () { delete ffter; }

Definition at line 45 of file fft_triadic_threads.hpp.

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

00045 { delete ffter; }


Member Function Documentation

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

Definition at line 48 of file fft_triadic_threads.hpp.

Referenced by outer_fft_triadic_task_rep< CC >::execute().

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

void dfft_triadic ( CC *  c,
nat  stride,
nat  shift,
nat  steps,
nat  step1,
nat  step2 
) [inline]

Definition at line 186 of file fft_triadic_threads.hpp.

References fft_triadic_threads_transformer< C, FFTER, thr >::fft_triadic(), and fft_triadic_threads_transformer< C, FFTER, thr >::ffter.

00187                                       {
00188     if (step1 == 0 && step2 == steps && steps > thr)
00189       fft_triadic (true, c, stride, shift, steps);
00190     else ffter->dfft_triadic (c, stride, shift, steps, step1, step2);
00191   }

void dfft_triadic ( CC *  c,
nat  stride,
nat  shift,
nat  steps 
) [inline]

Definition at line 174 of file fft_triadic_threads.hpp.

References fft_triadic_threads_transformer< C, FFTER, thr >::fft_triadic(), and fft_triadic_threads_transformer< C, FFTER, thr >::ffter.

Referenced by fft_triadic_threads_transformer< C, FFTER, thr >::direct_transform_triadic().

00174                                                          {
00175     if (steps <= thr) ffter->dfft_triadic (c, stride, shift, steps);
00176     else fft_triadic (true, c, stride, shift, steps);
00177   }

void direct_transform_triadic ( C c  )  [inline]
void fft_triadic ( bool  direct,
CC *  c,
nat  stride,
nat  shift,
nat  steps 
) [inline]

Definition at line 122 of file fft_triadic_threads.hpp.

References binpow(), fft_triadic_threads_transformer< C, FFTER, thr >::ffter, and fft_triadic_threads_transformer< C, FFTER, thr >::min_reps.

Referenced by fft_triadic_threads_transformer< C, FFTER, thr >::dfft_triadic(), and fft_triadic_threads_transformer< C, FFTER, thr >::ifft_triadic().

00122                                                                      {
00123     nat nt= threads_number;
00124     nat half1= steps >> 1;
00125     nat half2= steps - half1;
00126     nat len1= binpow ((nat) 3, half1);
00127     nat len2= binpow ((nat) 3, half2);
00128     if (steps <= thr || len2 <= min_reps || nt == 1) {
00129       if (direct) ffter->dfft_triadic (c, stride, shift, steps);
00130       else ffter->ifft_triadic (c, stride, shift, steps);
00131     }
00132     else {
00133       for (nat stage=0; stage<2; stage++) {
00134         if ((stage == 0) ^ (!direct)) {
00135           // Below is multi-threaded the following loop:
00136           // C*  cc1  = c;
00137           // for (nat i=0; i< len2; i++, cc1 += stride)
00138           //   if (direct)
00139           //     ffter->dfft_triadic (cc1, stride * len2, shift, half1);
00140           //   else
00141           //     ffter->ifft_triadic (cc1, stride * len2, shift, half1);
00142           nat bsz= min_reps * len1; // Recall min_reps < len2
00143           CC* buf= mmx_new<CC> (nt * bsz);
00144           task tasks[nt];
00145           for (nat i=0; i<nt; i++) {
00146             nat sta= min_reps * ((  i   * len2) / (min_reps * nt));
00147             nat end= min_reps * (((i+1) * len2) / (min_reps * nt));
00148             tasks[i]= new outer_fft_triadic_task_rep<CC>
00149               (ffter, direct, buf + i*bsz, end-sta, len2,
00150                c + sta*stride, stride, shift / len2, half1);
00151           }
00152           threads_execute (tasks, nt);
00153           mmx_delete<CC> (buf, nt * bsz);
00154         }
00155         else {
00156           // Below is multi-threaded the following loop:
00157           // CC* cc2= c;
00158           // for (nat i=0; i<len1; i++, cc2 += stride*len2)
00159           //   if (direct)
00160           //     ffter->dfft_triadic (cc2, stride, shift + i*len2, half2);
00161           //   else
00162           //     ffter->ifft_triadic (cc2, stride, shift + i*len2, half2);
00163           task tasks[nt];
00164           for (nat i=0; i<nt; i++)
00165             tasks[i]= new inner_fft_triadic_task_rep<CC>
00166               (ffter, direct, i, nt, len1, c, stride, shift, half2);
00167           threads_execute (tasks, nt);
00168         }
00169       }
00170     }
00171   }

void ifft_triadic ( CC *  c,
nat  stride,
nat  shift,
nat  steps,
nat  step1,
nat  step2 
) [inline]

Definition at line 194 of file fft_triadic_threads.hpp.

References fft_triadic_threads_transformer< C, FFTER, thr >::fft_triadic(), and fft_triadic_threads_transformer< C, FFTER, thr >::ffter.

00195                                       {
00196     if (step1 == 0 && step2 == steps && steps > thr)
00197       fft_triadic (false, c, stride, shift, steps);
00198     else ffter->ifft_triadic (c, stride, shift, steps, step1, step2);
00199   }

void ifft_triadic ( CC *  c,
nat  stride,
nat  shift,
nat  steps 
) [inline]

Definition at line 180 of file fft_triadic_threads.hpp.

References fft_triadic_threads_transformer< C, FFTER, thr >::fft_triadic(), and fft_triadic_threads_transformer< C, FFTER, thr >::ffter.

Referenced by fft_triadic_threads_transformer< C, FFTER, thr >::inverse_transform_triadic().

00180                                                          {
00181     if (steps <= thr) ffter->ifft_triadic (c, stride, shift, steps);
00182     else fft_triadic (false, c, stride, shift, steps);
00183   }

void inverse_transform_triadic ( C c,
bool  shift = true 
) [inline]

Member Data Documentation

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

Definition at line 37 of file fft_triadic_threads.hpp.

U* stoor

Definition at line 38 of file fft_triadic_threads.hpp.


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

Generated on 6 Dec 2012 for algebramix by  doxygen 1.6.1