[eigen] two technical points: WithAlignedOperatorNew and std::complex casting |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] two technical points: WithAlignedOperatorNew and std::complex casting
- From: "Benoit Jacob" <jacob.benoit.1@xxxxxxxxx>
- Date: Wed, 24 Dec 2008 07:13:21 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=qgLVmj8qeu3tGweOEItLkktyCawIxLPGP0juUwieM8o=; b=j4MDCeWZKgFb9YW+m3jJ7rUQ38xE35FTcuGjwXGkwdVBU5nYYv/k4UR0cz375ILHmF 5o6oqEKCHbw9AP4K5I6My90DocoCOaljldbbWGcYWEZYXUCf2mdndx61dySg3Ev61Kxj O7pFJ2DU/hWL+0ZcYCh9yQFf/FF3znmJSR2ac=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=NqDrbxrZcMM3AMFyaTznQv3rGDZVuAXBhmx5Wr8Q4S/8hXiHYgVZ9pXPkXzZbJ5eko kmPoKK2KFV5tan0qGZeC0MkYsiFqyT05peh6FT0mymPwhbjJ1k0pupzIbICO80XGKZdz rpdN7RhG9G9h0YBjdG04/VYqBdfxa2j5uEeB0=
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
earlier.
2) Should we allow doing "some_complex_matrix = some_real_matrix" ? In
other words should we allow operator= to implicitly cast from real to
complex?
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.
Cheers,
Benoit
---