Hi Aaron,

Interesting example. It shows that we have some efficiency problems with the current fir implementation. Here is an alternative implementation :

fir((c,lc)) = _ <: *(c), R(1,lc) :> _ with {
    R(n,(c,lc)) = (@(n):*(c)), R(n+1,lc);
    R(n, c)     = (@(n):*(c));                };
fir(c) = *(c);

Cheers

Yann



Le 10/05/13 00:04, Aaron Heller a écrit :
In general, I've found that the combination of 'par' and 'sum' with 'take' triggers long translation times, because take is O(n) in the number of graph nodes generated, so the overall behavior is O(n^2).

I was trying to implement a hilbert transformer (512 length FIR) with the definition of 'fir' in filter.lib and getting compilations that timed out at 500s (I didn't have the patience to wait 60 min).  I made a new definition of fir that avoids sum and take (and has some other special case rules) and now get translation times around 0.5 sec.   Looking at the 'light' case, both generate the same C++ code.

I put a copy of the full file at  http://www.ai.sri.com/ajh/hilbert.dsp


// light  length = 33
//process = firx(hilbert_light_coeffs);  //real 0m0.033s user 0m0.016s sys 0m0.013s
//process = fir(hilbert_light_coeffs);   //real 0m0.068s user 0m0.048s sys 0m0.016s

// medium length = 257
//process = firx(hilbert_medium_coeffs); //real 0m0.116s user 0m0.096s sys 0m0.017s
//process = fir(hilbert_medium_coeffs);  // abort at 500s

// heavy length = 513
process = firx(hilbert_heavy_coeffs);    //real 0m0.516s user 0m0.492s sys 0m0.022s
//process = fir(hilbert_heavy_coeffs);   // abort at 500s

firx(coeffs) = fir_cell(coeffs):>_ with
  {
    fir_cell(0) = !;
    fir_cell(float(0)) = fir_cell(0);
    fir_cell(1) = _;
    fir_cell(float(1)) = fir_cell(1);

    fir_cell((0,(coeffs))) = (mem:fir_cell(coeffs));
    fir_cell((float(0),(coeffs))) = fir_cell((0,coeffs));

    fir_cell((c,0)) = fir_cell(c);
    fir_cell((c,float(0))) = fir_cell((c,0));

    fir_cell((c,(coeffs))) = _<:fir_cell(c),(mem:fir_cell(coeffs));

    fir_cell(c) = *(c);
  };


Best...

Aaron Heller ([email protected])
Menlo Park, CA  US




------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may


_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users



------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users

Reply via email to