Re: [eigen] two things

[ Thread Index | Date Index | More Archives ]


On Wed, Jun 25, 2008 at 9:23 PM, Benoît Jacob <jacob@xxxxxxxxxxxxxxx> wrote:
> Hi,
> 1) we had a debate about introducing a separate Vector class recently, but
> since then I realized that it would increase the number of instantiations as
> Vector<n> and Matrix<n,1> would be considered as two separate types. Hence
> having vector currently implemented as a special case of matrix, is in fact
> an optimization. I'm tempted to say that this outweighs the scariness of
> Matrix constructors, hence we can bury the idea of Vector class. ok?

right, an intermediate solution would be to specialize Matrix<> if one
of the dim is 1, e.g. let's add an additional "hidden" template

template <typename T, int R, int C, ...,  int IsVector = R==1 || C==1>
class Matrix {....};

template <typename T, int R, int C, ..., int Flags>
class Matrix<T,R,C, ...,  MaxSize,1,Flags,true> {  /* vector */ };

but this only allows to improve a bit the constructors and this does
not offer any template Vector<> class, so I'm not sure it's  worth it,
just an idea....

> 2) about linear vectorization: i remember you suggested adding a packet(int)
> method. I think this is still a good idea and would still improve linear
> vectorization despite the improvements you already made. OK?

actually I'm not sure that's worth it: I've done some bench and if I
remember well the overhead between a MatrixXf(R,C); versus a
VectorXf(R*C); was negligible, like x1.1 or x1.2.....


Mail converted by MHonArc 2.6.19+