Re: [eigen] Eigen containers cannot be vectorized

[ Thread Index | Date Index | More Archives ]

On 2016-12-08 15:03, Francois Fayard wrote:
I was also surprised to see that in debug mode, bounds checking is done with: assert(i >=0 && i < n). This can be optimized into assert(static_cast<std::size_t>(i) < static_cast<std::size_t>(n)).

I would be surprised if any reasonably good compiler fails to see that optimization. I did not check though, and I guess it should not matter, since one should have disabled assertions if one really needs the last bit of performance (of course, only after making sure that everything works)

No compiler cannot do that as the optimization from the first _expression_ to the second one is only valid when n is nonnegative.

François Fayard
Founder & Consultant - Inside Loop
Applied Mathematics & High Performance Computing
Tel: +33 (0)6 01 44 06 93

Mail converted by MHonArc 2.6.19+