| Re: [eigen] Re: VectorBase issue |
[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]
On Wednesday 04 June 2008 15:02:43 Benoît Jacob wrote:
> I just had another idea. The correct solution to your problem 2b is
> probably that, if you are going to put vector-specific methods in
> VectorBase<true> then you could as well put matrix-specific methods in
> VectorBase<false>. So that they would never be in conflict with one
> another. (of course the naming could be improved, MatrixBase becomes
> XprBase, VectorBase<true> becomes VectorBase, VectorBase<false> becomes
> MatrixBase, VectorBase itself becomes a meta-selector).
Some more thoughts :)
If feels weird to have a XprBase class inheriting a VectorBase class, so I
propose renaming VectorBase to VectorMethods !
So the inheritance scheme is:
VectorMethods
\
\
*or* XprBase --- Matrix
/ \
/ -- other xprs
MatrixMethods
Now that feels weird to have a single class Matrix on the right, and actually
there are in Matrix some ugly issues caused by the semantic conflict between
vectors and matrices (see Matrix(int,int) constructor). And it would be nice
to have a template for vectors of given Size, Vector<Size>, instead of doing
Matrix<Size,1> all the time. So perhaps it's time to reintroduce a Vector
class!
VectorMethods Vector
\ /
\ /
*or* XprBase --- other xprs
/ \
/ \
MatrixMethods Matrix
What do you think? I think it's ok to reconsider the Vector/Matrix unification
since sooo much changed since last time. Of course we don't want to sacrifice
anything regarding the integration of vectors and matrices together, but in
this respect, we must ask: what is really important?
IMO what really matters is that things like operator+, operator/= .... don't
need to be written twice for Matrices and Vectors. If we preserve that we're
good.
What matters less is to provide the ability for a function to do
if(IsVectorAtCompileTime). For if it really needs to do that, then it means
that it has two completely different behaviors for vectors and matrices,
which suggests that it's better to split it anyway (at least with a meta
selector). On the other hand, operator+ does exactly the same thing for
vectors and matrices, so it's really great that we allow to write it only
once. That's what we want to preserve.
Cheers,
Benoit
Attachment:
signature.asc
Description: This is a digitally signed message part.
| Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |