Re: [eigen] Alignment

[ Thread Index | Date Index | More Archives ]


Are you using 2.0, or trunk?

We know about the std::vector::resize() problem.

We made a fix,
basically you just #include<Eigen/StdVector> and then you're able to
do std::vector<Eigen::Vector2d>.

However, in Eigen 2.0 our fix doesn't support the case of
std::vector<T> with T a custom class having an Eigen member.

Gael fixed that in trunk but that isn't backported to 2.0 (big change;
Gael: of course it's your choice whether this is backportable).

So can you try with trunk and see if it makes std::vector work for
you? (do  #include<Eigen/StdVector>).

> My understanding is that the std::vector variant should be safe unless
> resize() is called.

Indeed, but that's quite an incomfortable assumption, that's why we
went further and made Eigen/StdVector.

> What about boost::array? Given that it's a thin wrapper around a plain
> array (see [1]) is the compiler guaranteed to figure out how to lay
> things out in memory correctly?

If boost::array<T> honors T::operator new[] then I'd say it should
work fine, because EIGEN_MAKE_ALIGNED_OPERATOR_NEW overloads also this
form to make it return aligned pointers, and the EIGEN_ALIGN_128 on
Eigen's internal fixed-size arrays should also be honored.


Mail converted by MHonArc 2.6.19+