From 1b7b538e05256e75a4c3a2ea82401c8ab6a2b34b Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Thu, 26 Mar 2009 16:30:54 +0000 Subject: [PATCH] The ABI break: * set AutoAlign=0, DontAlign!=0 * set Dynamic=33331 * add check on fixed sizes * bump version to 2.0.52 --- Eigen/src/Core/Matrix.h | 5 +++-- Eigen/src/Core/MatrixStorage.h | 2 +- Eigen/src/Core/util/Constants.h | 12 +++++++----- Eigen/src/Core/util/Macros.h | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 99f89356d..736bd438e 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -134,7 +134,7 @@ class Matrix ei_matrix_storage m_storage; public: - enum { NeedsToAlign = (Options&AutoAlign) == AutoAlign + enum { NeedsToAlign = (!(Options&DontAlign)) && SizeAtCompileTime!=Dynamic && ((sizeof(Scalar)*SizeAtCompileTime)%16)==0 }; EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) @@ -536,7 +536,8 @@ class Matrix { EIGEN_STATIC_ASSERT(((_MaxRows >= _Rows || _Rows==Dynamic) && (_MaxCols >= _Cols || _Cols==Dynamic) - && (_Options & (AutoAlign|RowMajor)) == _Options), + && ((_MaxRows==Dynamic?1:_MaxRows)*(_MaxCols==Dynamic?1:_MaxCols) struct ei_matrix_array { EIGEN_ALIGN_128 T array[Size]; diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h index 1d728a5d5..87c0a0859 100644 --- a/Eigen/src/Core/util/Constants.h +++ b/Eigen/src/Core/util/Constants.h @@ -30,17 +30,19 @@ * stored in some runtime variable. * * Explanation for the choice of this value: - * - It should be positive and larger than any reasonable compile-time-fixed number of rows or columns. + * - It should be positive and larger than the number of entries in any reasonable fixed-size matrix. * This allows to simplify many compile-time conditions throughout Eigen. * - It should be smaller than the sqrt of INT_MAX. Indeed, we often multiply a number of rows with a number * of columns in order to compute a number of coefficients. Even if we guard that with an "if" checking whether * the values are Dynamic, we still get a compiler warning "integer overflow". So the only way to get around * it would be a meta-selector. Doing this everywhere would reduce code readability and lenghten compilation times. * Also, disabling compiler warnings for integer overflow, sounds like a bad idea. + * - It should be a prime number, because for example the old value 10000 led to bugs with 100x100 matrices. * - * If you wish to port Eigen to a platform where sizeof(int)==2, it is perfectly possible to set Dynamic to, say, 100. + * If you wish to port Eigen to a platform where sizeof(int)==2, it is perfectly possible to set Dynamic to, say, 97. + * However, changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for Matrix. */ -const int Dynamic = 10000; +const int Dynamic = 33331; /** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm(). * The value Infinity there means the L-infinity norm. @@ -227,9 +229,9 @@ enum { RowMajor = 0x1, // it is only a coincidence that this is equal to RowMajorBit -- don't rely on that /** \internal Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated, may still be requested to be aligned) */ - DontAlign = 0, /** \internal Align the matrix itself if it is vectorizable fixed-size */ - AutoAlign = 0x2 + AutoAlign = 0, + DontAlign = 0x2 }; enum { diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h index 43c66d980..2ffb92d5e 100644 --- a/Eigen/src/Core/util/Macros.h +++ b/Eigen/src/Core/util/Macros.h @@ -30,7 +30,7 @@ #define EIGEN_WORLD_VERSION 2 #define EIGEN_MAJOR_VERSION 0 -#define EIGEN_MINOR_VERSION 51 +#define EIGEN_MINOR_VERSION 52 #define EIGEN_VERSION_AT_LEAST(x,y,z) (EIGEN_WORLD_VERSION>x || (EIGEN_WORLD_VERSION>=x && \ (EIGEN_MAJOR_VERSION>y || (EIGEN_MAJOR_VERSION>=y && \