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

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]





On Wed, Jun 11, 2014 at 10:21 PM, Christoph Hertzberg <chtz@xxxxxxxxxxxxxxxxxxxxxxxx> wrote:

  * 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})
than
     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.

We should allow any type exposing the right interface. For instance the SparseMatrix::reserve() function accept any "integer array" exposing a size() and operartor[](int). This way one can use std::vector, Eigen::ArrayXi, Eigen::ArrayXi::Constant, or some customized objecst computing the sizes procedurally.

gael
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/