diff options
author | Gael Guennebaud <g.gael@free.fr> | 2014-07-21 13:43:48 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2014-07-21 13:43:48 +0200 |
commit | 339f14b8d1b73db0366afc3a497d566cecf72e1b (patch) | |
tree | fe6051d5410ff306dbeca5b684896d1fff49280e /doc/PreprocessorDirectives.dox | |
parent | d4cc1bdc7f27b856c4aefc939254ec851c831bf0 (diff) |
bug #826: document caveats in 1x1 and 2x1 constructors.
Diffstat (limited to 'doc/PreprocessorDirectives.dox')
-rw-r--r-- | doc/PreprocessorDirectives.dox | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/doc/PreprocessorDirectives.dox b/doc/PreprocessorDirectives.dox index 96d273823..4be2167ef 100644 --- a/doc/PreprocessorDirectives.dox +++ b/doc/PreprocessorDirectives.dox @@ -27,10 +27,23 @@ are doing. Defaults to the %IOFormat constructed by the default constructor IOFormat::IOFormat(). - \b EIGEN_INITIALIZE_MATRICES_BY_ZERO - if defined, all entries of newly constructed matrices and arrays are initialized to zero, as are new entries in matrices and arrays after resizing. Not defined by default. + \warning The unary (resp. binary) constructor of \c 1x1 (resp. \c 2x1 or \c 1x2) fixed size matrices is + always interpreted as an initialization constructor where the argument(s) are the coefficient values + and not the sizes. For instance, \code Vector2d v(2,1); \endcode will create a vector with coeficients [2,1], + and \b not a \c 2x1 vector initialized with zeros (i.e., [0,0]). If such cases might occur, then it is + recommended to use the default constructor with a explicit call to resize: + \code + Matrix<?,SizeAtCompileTime,1> v; + v.resize(size); + Matrix<?,RowsAtCompileTime,ColsAtCompileTime> m; + m.resize(rows,cols); + \endcode - \b EIGEN_INITIALIZE_MATRICES_BY_NAN - if defined, all entries of newly constructed matrices and arrays are initialized to NaN, as are new entries in matrices and arrays after resizing. This option is especially useful for debugging purpose, though a memory tool like <a href="http://valgrind.org/">valgrind</a> is preferable. Not defined by default. + \warning See the documentation of \c EIGEN_INITIALIZE_MATRICES_BY_ZERO for a discussion on a limitations + of these macros when applied to \c 1x1, \c 1x2, and \c 2x1 fixed-size matrices. - \b EIGEN_NO_AUTOMATIC_RESIZING - if defined, the matrices (or arrays) on both sides of an assignment <tt>a = b</tt> have to be of the same size; otherwise, %Eigen automatically resizes \c a so that it is of the correct size. Not defined by default. |