Re: [eigen] Cost of a map operation

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


This is as efficient as it could be: typically, this expands to
nothing more than:

for(int i = 0; i < cordNum; ++i)
  AddressVector[i] = address[i];

and then 1) Eigen unrolls this if appropriate and 2) Eigen vectorizes
this if possible.

Basically, the Map object itself is just an expression, so its
construction is cheap at least, and in practice the compiler is able
to avoid actually creating it, everything gets "inlined".

Tip: you could check the resulting assembly code for yourself, just
put asm comments around this, asm("#hello"); , and use gcc -S to get
the assembly...

Benoit



2009/9/2 Rohit Garg <rpg.314@xxxxxxxxx>:
> What is the cost of this map operation?
>
> AddressVector_t AddressVector = Map<AddressVector_t,ForceAligned>(address)
>
> where AddressVector_t itself is a typedef for
>
> typedef Matrix<int,cordNum,1> AddressVector_t;
>
> cordNum is a compile time constant.
>
> This map operation occurs in inner loop of my application, so I want
> to know, how costly is it gonna be? I mean with what use in mind was
> it written for?
> --
> Rohit Garg
>
> http://rpg-314.blogspot.com/
>
> Senior Undergraduate
> Department of Physics
> Indian Institute of Technology
> Bombay
>
>
>



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