Discussion:
[eigen] Aligned Fixed Sized Mapped matrices
Sameer Agarwal
2018-01-12 21:13:09 UTC
Permalink
I was playing with mapping small fixed aligned buffers to fixed sized
matrices and encountered an interesting eigen assertion failure in MapBase.h

Line 190 MapBase.h:
eigen_assert(( ((internal::UIntPtr(m_data) %
internal::traits<Derived>::Alignment) == 0)
|| (cols() * rows() * innerStride() * sizeof(Scalar)) <
internal::traits<Derived>::Alignment ) && "data is not aligned");

I am particularly curious about the requirement

(cols() * rows() * innerStride() * sizeof(Scalar)) <
internal::traits<Derived>::Alignment

Why this rather strict requirement?

Sameer
Gael Guennebaud
2018-01-12 21:52:59 UTC
Permalink
Hi Sameer,

it's not really a requirement but a condition that relax the first
requirement, it reads:

- is the given pointer aligned as specified by the user?
- if not, then let's not trigger an assertion if the input data is too
small to bother about vectorization (and thus alignment) anyway.

I hope that makes more sense now?

Gael
Post by Sameer Agarwal
I was playing with mapping small fixed aligned buffers to fixed sized
matrices and encountered an interesting eigen assertion failure in MapBase.h
eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits<Derived>::Alignment)
== 0)
|| (cols() * rows() * innerStride() * sizeof(Scalar))
< internal::traits<Derived>::Alignment ) && "data is not aligned");
I am particularly curious about the requirement
(cols() * rows() * innerStride() * sizeof(Scalar)) <
internal::traits<Derived>::Alignment
Why this rather strict requirement?
Sameer
Sameer Agarwal
2018-01-28 00:44:52 UTC
Permalink
Thanks gael that makes sense.
Post by Gael Guennebaud
Hi Sameer,
it's not really a requirement but a condition that relax the first
- is the given pointer aligned as specified by the user?
- if not, then let's not trigger an assertion if the input data is too
small to bother about vectorization (and thus alignment) anyway.
I hope that makes more sense now?
Gael
Post by Sameer Agarwal
I was playing with mapping small fixed aligned buffers to fixed sized
matrices and encountered an interesting eigen assertion failure in MapBase.h
eigen_assert(( ((internal::UIntPtr(m_data) %
internal::traits<Derived>::Alignment) == 0)
|| (cols() * rows() * innerStride() * sizeof(Scalar))
< internal::traits<Derived>::Alignment ) && "data is not aligned");
I am particularly curious about the requirement
(cols() * rows() * innerStride() * sizeof(Scalar)) <
internal::traits<Derived>::Alignment
Why this rather strict requirement?
Sameer
Loading...