Re: [eigen] (vec1*vec2.transpose())*vec3 on 2.0.5/6

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


2009/9/30 Márton Danóczy <marton78@xxxxxxxxx>:
> 2009/9/30 Rhys Ulerich <rhys.ulerich@xxxxxxxxx>:
>> When you're investigating, would you please also check that it behaves
>> correctly for
>>    (vec1*vec1.transpose())*vec2
>
> Just out of curiosity: why would anyone need to compute this kind of
> product? The scalar product in vec1*(vec1.dot(vec2)) would be much
> faster than forming the rank-1 matrix.

That's correct actually!

Notice that the rank 1 matrix isn't actually formed, only the abstract
expression. Still: doing

(vec1*vec1.transpose())*vec2

takes 3n^2-n operations, while doing

vec1*(vec1.dot(vec2))

takes 3n-1 operations.

So you're right it's much faster ;)

I guess that we still had to make sure that the other compiled... but
as you suggest,

> Or does Eigen automatically
> compute products the fastest way, no matter how bracketing is done?

It wouldn't be a bad idea to reorder this automatically so that one
can seamlessly write
vec1*vec1.transpose()*vec2

Benoit



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