|Re: [eigen] Re: VectorBase issue|
[ Thread Index |
| More lists.tuxfamily.org/eigen Archives
- To: "Benoît Jacob" <jacob@xxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Re: VectorBase issue
- From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
- Date: Wed, 4 Jun 2008 15:29:36 +0200
- Cc: eigen@xxxxxxxxxxxxxxxxxxx
- 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:cc:in-reply-to:mime-version:content-type:references; bh=bEkl4vY8kK2DNyeSknlDXEPUzcYRWgPhIgNUT5B7vpA=; b=s7xBKzFV54+SYGIoCwHpXslnIJ48lJUzfJ7bSh5o0x2uAZwDI/ii0Ih4bT5xE9CVLp krH+jBMWRphamHcOk451J2lkbzCKnxiP+SZ2t5PUsTieN1sB33nUS/baLlvPbClkAmZX ToapdGd8feWEhFdh9qp67kKuVpTBSFYtdvus8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:references; b=ISLc0uxrYTytjYhfF25/tvNUlghvxy6/Hlrz9T329mMfN2gAFjTrH5UH/vAJRcGtwr l6rviiQ5KLyuKoCSECadHYYCa8Nzr4EG5h7Fsx1A50Xehz35r3ChF8HLGOc1XG5s8du9 RyJnV/nodXTBQw71L4wRW6kLDD+J1s6qIjT/I=
> to get back to VectorBase, the motivation of VectorBase was two folds:I just had another idea. The correct solution to your problem 2b is probably
> 1 - better API by hiding vector specific methods from matrix expressions
> (aka compile time errors).
> 2 - faster compilation for matrix code.
> Another minor advantage is that all vector specific methods get grouped in
> a separate class.
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
What do you think?
In fact I believe this is the correct C++ solution. The only issue that I see
is that it's going to be difficult to make Doxygen understand that!
though about that option too (solution 2-c), this would be very good
for compilation time, the problem is when you write a generic code for
fixed-size matrices: you might (easily?) end up with degenerated
matrices that becomes vector (or 1x1 matrices), that means
coeff(int,int), corner(...), block(int,int,int,int), etc. must be
available even if the matrix has one dimension equals to 1 ? in other
words, a matrix is not necessarily a vector (=>VectorBase), but a
vector *is* a matrix, isn'it ? e.g., currently there is no
However, internally we can use VectorBase<false> versus
VectorBase<true> to avoid the need of meta selector. I did that
for isApprox and similar fuzzy stuff before giving up with VectorBase
(MatrixBase::isApprox call this->isApproxImpl that is defined in one
of the VectorBase specialization).
there is still the option 2-a....