[eigen] Expression templates |

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

*To*: eigen@xxxxxxxxxxxxxxxxxxx*Subject*: [eigen] Expression templates*From*: Carlos Becker <carlosbecker@xxxxxxxxx>*Date*: Fri, 30 Jul 2010 15:45:19 +0100*Dkim-signature*: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=be6YaVfeZJf44P+kl9uzfIYBCYCvlkLwYgQZZFfreA4=; b=IFzemTF5XuBkhmvXQ5ouKM3nmvOai4uPv7bVhz+PE0K1uQgJZfJWI+tQeZEHWIkuGk uuU5oYOLoYECCaWOEzMr6FDpcc25v5UJ8eeHliTwXSHmqNKhaNzM8d5Bzcoz8ZbiKv0E DfK9AQbr/b83h9AKayuOeyR1fuF96WRpEsZp8=*Domainkey-signature*: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=l0I7ycfYw42sBrRX6Ni7fyhYNR1+6i9hfqUHVqKta1iC0YfKEwdkTy66sxvm1m8ozo pEMaPUUVqBBRAI/mKSXTf8vVUrewZJTfODOcw9BmnHaFRZ8dCseh9aCqtOqZU9hmq+XG 8Oixbk2ESNSxkM9aArlQtuKxT+xW1P41H9ZmM=

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

**Follow-Ups**:**Re: [eigen] Expression templates***From:*Benoit Jacob

**Messages sorted by:**[ date | thread ]- Prev by Date:
**Re: [eigen] Feature idea: coeffRef() ---> setCoeff()** - Next by Date:
**[eigen] Matrices based on compact-triangular storage** - Previous by thread:
**[eigen] InnerPanel change mis-detects alignment?** - Next by thread:
**Re: [eigen] Expression templates**

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