[eigen] Expression templates

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi all again,
I am doing some audio processing and I am working with a set of N arrays (ArrayXf in this case). At a certain point, I am doing something like this:

ArrayXf eachArray[N]; // this is pre-loaded before
ArrayXf arrayMult[N]; // this is also pre-loaded
ArrayXf result;

result = eachArray[0] * arrayMult[0] + eachArray[1] +�arrayMult[1] + .... +�eachArray[N-1] * arrayMult[N-1];


This operation is performed on a templated class that takes N as a template parameter. I made some tests and, as expected, doing something like

result.setZero();
for (int i=0; i < N; i++)
��result += eachArray[i] * arrayMult[i];

is not the best option, and neither is

result =�eachArray[0] * arrayMult[0];;
for (int i=1; i < N; i++)
��result += eachArray[i] * arrayMult[i];


This is probably because of memory accessing speed, so I was looking for a way to 'unroll' this loop properly. Is there any template/class in Eigen that would allow me to do this easily?

Thanks!
Carlos


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/