
Dongfei Yin a écrit :
Hi John, 1. I have tried that if you write d(d(d(d(x*x*x*x, x), x), x), x), it will take a long compile time without optimized. I have do something to optimized it. I need to write a lot of specialized Can't this be mapped onto a d<N>(f,v) function that is optimized for N = 1,2,3,... ? I bet that if you use proto, matching d(d(d( ... )))) and repalcing by d<N>(...) should be easy.
Do you perform your derivation recursively on the derivative degree (ie d(d(x*x,x),x) is y = d(x*x,x); d(y,x);) If yes, you may want to use coarser grain. Let's say you specialized d() d<2>() and d<3>() for ex. Computing d<5> is d<2>(d<3>()) instead of d(d(d(d(d()))). Of course, using d,d2, d4 is maybe a better option so you cna use bit representaiton of derivative degree to find how to combine the derivative.