Re: [eigen] New true array class ?

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


indeed, because switching from ArrayXd to VectorXd and replacing the
"*" by cwiseProduct() makes Eigen significantly faster.... I'm
investigating...

gael

On Thu, Jan 28, 2010 at 3:11 AM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
> 2010/1/27 Boris Mansencal <boris.mansencal@xxxxxxxx>:
>> Quoting Gael Guennebaud <gael.guennebaud@xxxxxxxxx>:
>>
>>> this is because this was not implemented. done now for sin, cos, exp,
>>> log, abs, and sqrt. feel free to send a patch to support more (I've no
>>> time right now)
>>
>> Thanks a lot. Perfect.
>>
>> One more question, the attached test try to compare std::valarray &
>> Eigen::Array for a simple computation.
>> Eigen::Array is much slower than std::valrray.
>>
>> It seems that Array copy constructor is called too many times (and
>> posix_memalign with it).
>>
>> Do you have any idea from where it comes from ?
>> Is it because of missed inlining ?
>
> Wow, indeed, there's a problem. While the valarray version is
> perfectly vectorized and without any temporaries, the Eigen version
> has a lot of posix_memalign() and free() going on in the loop.
>
> A small improvement for both valarray and Eigen is to use the v4 that
> you constructed instead of declaring a local v4 inside of the for
> loop. So:
>
>    for (size_t i=0; i<NB_REPEATS; ++i) {
>      v4 = v1 * M_PI * (v2 * 0.321) * (0.5 * v2);
>      v3 += v4;
>    }
>
> valarray is still easily 4x faster than eigen.
>
> Definitely a big issue! My best guess is that a bug is causing Eigen
> to evaluate each product into a temporary.
>
> Benoit
>
>
>



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