Re: [eigen] [Review] Pull request 66, Huge Tensor module improvements

[ Thread Index | Date Index | More Archives ]

On 11.06.2014 19:53, Benoit Steiner wrote:
I use std::array in order to encode ordered lists of dimensions. I am not
convinced that using Eigen::Array instead is a good choice:
  * Eigen Array is a 2d object. Users will always wonder if they need to
order their coefficients in a row or a column.

Currently, at many places row vectors and column vectors are automatically converted to each other, so that should be possible here as well.

  * The Array class lacks nice to have cxx11 features such as initialization
lists. This is syntactic sugar, but if I can use a recent compiler I'd
rather write:
     Tensor<float, 3> T({1,2,3})
     Array<ptrdiff_t, 3, 1> dims;
     coeffs << 1, 2, 3;
     Tensor<float, 3> T(dims);

For that (simple) case it would just be
  Tensor<float, 3> T(Array3i(1,2,3));
That's with integers instead of ptrdiff, but so was your C++11 example. And it is currently limited to 4 dimensions. I do agree that the C++11 syntax is nicer, and I would definitely not object supporting std::array if it is available -- my question was basically, if there is a need to partially re-implement std::array if it does not give additional features compared to Eigen::Array.


Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252

Mail converted by MHonArc 2.6.19+