Re: [eigen] question on alignment |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
On 10/10/2012 04:32 AM, Sylvain Pointeau wrote:
Hi,
I am new to Eigen and I have some hesitations on the alignment.
do we have to propagate the EIGEN_MAKE_ALIGNED_OPERATOR_NEW to every
class using a class containing an EIGEN class?
for example:
class Foo
{
...
Eigen::Vector2d v;
...
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
};
I don't think this is sufficient to ensure the alignment of v if any of
the following are true
a) Foo has class members declared before v whose size is not a multiple
of 16 bytes (or 32 bytes to be avx-ready)
b) Foo has a parent class with non-aligned size
c) Foo has virtual functions (requiring a vtable)
class A
{
...
Foo v;
...
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW <---- do I have to use it here?
};
Same as above, plus additional conditions for A
additionally for this:
class AList
{
...
std::vector<A,Eigen::aligned_allocator<A> > mylist
...
public:
EIGEN_MAKE_ALIGNED_OPERATOR_NEW <---- do I have to use it here?
}
No. AList will not need an operator new(). All allocations are done by
mylist.