Re: [eigen] signal invalid matrix or vector

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


On 2016-01-26 17:27, Christian Keck wrote:
Is it possible to set the size of a matrix oder vector to zero? How can
the elements of a vector set to a NaN? My compiler (Microsoft Visual C++
2013) does not yet support assignments with signalling NaNs.

You can resize matrices/vectors to 0 using the resize method:
  vector.resize(0);
  matrix.resize(0,0);
However, this does not work for fixed-sized matrices/vectors, i.e., Matrix2d, Vector3f, etc.
You can also set a matrix/vector to NaN, e.g. by:
  matrix.setConstant(0.0/0.0);
and check using
  bool invalid = matrix.hasNaN();

Christoph




--
 Dipl. Inf., Dipl. Math. Christoph Hertzberg

 Universität Bremen
 FB 3 - Mathematik und Informatik
 AG Robotik
 Robert-Hooke-Straße 1
 28359 Bremen, Germany

 Zentrale: +49 421 178 45-6611

 Besuchsadresse der Nebengeschäftsstelle:
 Robert-Hooke-Straße 5
 28359 Bremen, Germany

 Tel.:    +49 421 178 45-4021
 Empfang: +49 421 178 45-6600
 Fax:     +49 421 178 45-4150
 E-Mail:  chtz@xxxxxxxxxxxxxxxxxxxxxxxx

 Weitere Informationen: http://www.informatik.uni-bremen.de/robotik



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