Hi Pierre,
I can't answer authoritatively, I am writing this email only because faust
developers didn't bother to reply, it seems they tend to ignore all the
technical questions ;)
> f(0,x) = x;
> f(n,x) = alpha*f(n-1,x);
>
> where alpha is a complicated expression, long to evaluate.
>
> Now, if I ask:
>
> process = par(i,M,f(i,x));
>
> each output will be an increasing call of f(n,x) from i=0 to M-1.
> Each term in this parallel composition will be computed from recurrence
> formula, Thus,
>
> f(M-1,x) = alpha*f(M-2,x) = ..... = alpha^(M-1) f(0,X)
>
> I suppose faust evaluation compute alpha^(M-1) f(0,X).
>
> However, as I asked
>
> process= par(i,M,f(i,x));
>
> faust already computed f(M-2,x) when i=M-1 and it could be used to compute
> straightly
>
> f(M-1,x) as f(M-1,x) = alpha f(M-2,x)
>
> In the light of this, I'm wondering if there is a way to tell faust in the
> code to use the previously computed expression f(i-1,x) instead of going all
> the way down the recurrence (up to f(0,x)) to compute the term f(i,x).
Again, I do not pretend I really understand the faust internals, but I don't
think this is possible. The problem is that multiplication is turned into
PowPrim by normalizeAddTerm() at simplification time, and after that only
f(0,x) can be "re-used".
However, there is a simple workaround which currently happens to work. you
can re-write f() as
f(0,x) = x;
f(n,x) = alpha * f(n-1,x) : attach(_,0);
this should do this trick, but only because attach() is broken imo; I mean
it is sub-optimal (and that is why it can help in this case), and it can only
be used with bargraphs (because generateXBargraph() calls addExecCode itself).
Another solution. You can add
#define kSamp() 0
into include file and
// this way it doesn't change x->nature()
kSamp(x) = (x + ffunction(int kSamp(), "include-file-name", ""));
into your faust code. Then you can re-write f() as, say,
f(0,x) = x;
f(n,x) = alpha * f(n-1,x) : kSamp;
"gcc -fno-signed-zeros" can optimize out the extra "+ iTemp" code generated
by faust.
Oleg.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Faudiostream-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/faudiostream-users