Re: [eigen] Interest in more initialisation methods for dynamic-size arrays/matrices

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


Am 27.03.2015 um 18:50 schrieb Deanna Hood:
Has anyone else ever wanted to do
Array2Xf x = Array2Xf::Random(5);  (i.e. only specify free-dim size)

You can write

  Array2Xf x = Array2Xf::Random(2,5);

and similar for expressions where one parameter is fixed, the other is not.
We intentionally do not allow passing only one parameter here, since it is not necessarily evident if this is intended or a programming error. The redundant parameter is ignored when compiling without assertions (and a smart compiler should be able to optimize it away in most other cases, as well).

Christoph



--
----------------------------------------------
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+ http://listengine.tuxfamily.org/