[eigen] two technical points: WithAlignedOperatorNew and std::complex casting

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

Hi List (yes Gael I'm looking at you especially when you're available
but there's no hurry),

I need your opinion on two changes I'm considering doing.

1) Currently, WithAlignedOperatorNew is empty if EIGEN_VECTORIZE is
not defined. Which amounts to say, "if there's no vectorization, then
no need to get aligned pointers". I think we should change that to
letting WithAlignedOperatorNew be always the same i.e. always get
aligned pointers. Reasons:

a) the current solution seems dangerous to me if the user links
together two files a.cpp and b.cpp using Eigen, if a.cpp is compiled
without vectorization and b.cpp is compiled with vectorization, if a
structure created in a.cpp is passed to b.cpp then b.cpp will expect
it to be aligned...
Notice that for static alignment (EIGEN_ALIGN_128) we already go for
always-align-even-when-vectorization-is-disabled for similar reasons.

b) the current solution also forces us to only do the alignment
assertion (the one that links to the web page) when vectorization is
enabled. Which means that if an application developers develops
without vectorization, he can't see that assertion. Changing this so
that the assertion is always made, would allow to discover issues

2) Should we allow doing "some_complex_matrix = some_real_matrix" ? In
other words should we allow operator= to implicitly cast from real to
In the last days I've been very conservative in these respects so
beta3 forbids that. But looking back to Assign.h, we are already
allowing some convenience here like some_row_vector =
some_column_vector. Maybe some_complex_matrix = some_real_matrix is
also in the domain of what we can allow to make the user's life
easier, without much risk.

One of the reasons why we may want to forbid auto-casting, is when
casting has a direct or indirect (like preventing vectorization) cost.
However here, this casting seems to have neither cost. So... maybe
allow it?

And yes, a user (Ricard) already reported to have been relying on this
auto casting in the past so it's really a concrete issue.



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