|Re: [eigen] Support for true Array|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Support for true Array
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 25 Nov 2009 18:36:06 -0500
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=viknGJT6xMDttqyVHvTlVdKREUN0YlgbNNjIWnVNBNY=; b=Y3HrxAOZba5G2iQ9BdpzrmqtDyTJEY+kzAVuVwkoix88x5y/m/D4ZQESivysOXPqZP zfYdDcnsfVXCok4i9TVaeHkUWl2CglaCynN+XvpXZlOP4+HXKB+48aSH0mSAK30V/ALZ P7u/YfkWiFm8w6BBKTO5T4csWv4PMrSQ35elQ=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=kKUgwXtIOfNO/MC6tSj/IHoF2HNRh681xgB1T8aP7n1vQ4iMmevxWaztFmLosu9j5E +yfJhxPhXJ1AcKxcmoYq/0zDHb/5CgyRtR0qp6NdyaITY+BwPN6ChgqTFhoZP7Y5oVSR xKTc9Hhg+ikzxvHe/GCRYKSWOyQCM/FTowGhw=
2009/11/25 Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
> actually Eigen already allows you to do either SoA or AoS. For instance,
> let's consider a list of Vector3f. To get the AoS behavior you'd do:
> Matrix<float,3,Dynamic,ColMajor> data;
> and for the SoA:
> Matrix<float,3,Dynamic,RowMajor> data;
> Unlike a vector of Vector3f, you have to access the element using .col(i),
> instead of [i].
> Then you can for instance normalize all vectors:
> If you opted for the SoA layout, this normalization will be vectorized
> (though there is still room for optimizations here).
> Note that all basics linear operations (+, -, scalar products) are
> automatically vectorized in both cases because in this case, Eigen will
> interpret such a matrix as a 3*size linear vector.
> Finallly, this SoA layout is still not optimal. A better option is to group
> the data per packet, e.g., for a 2D vector of floats you would do:
> x0, x1, x2, x3, y0, y1, y2, y3, x4, x5, x6, x6, y4, y5, y6, y7, ....
> but that one is more difficult to implement because it requires special
Yes, so I agree with all you say, but the nice thing with the Array
class will be that it will work with the most natural syntax and
without special care at all (in particular without hardcoding a
specific packet size). That's pretty awesome!