diff options
author | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-06-16 10:49:44 +0000 |
---|---|---|
committer | Benoit Jacob <jacob.benoit.1@gmail.com> | 2008-06-16 10:49:44 +0000 |
commit | c905b31b42cd8b5341bf8807d3143d1e45d5dacc (patch) | |
tree | c1102fa8e8cf0d583ad4efdc1b46fea1122b9a77 /Eigen/src/Core/util | |
parent | bc0c7c57edd8b4022deeb6d30edf202c2e8609b4 (diff) |
* Big rework of Assign.h:
** Much better organization
** Fix a few bugs
** Add the ability to unroll only the inner loop
** Add an unrolled path to the Like1D vectorization. Not well tested.
** Add placeholder for sliced vectorization. Unimplemented.
* Rework of corrected_flags:
** improve rules determining vectorizability
** for vectors, the storage-order is indifferent, so we tweak it
to allow vectorization of row-vectors.
* fix compilation in benchmark, and a warning in Transpose.
Diffstat (limited to 'Eigen/src/Core/util')
-rw-r--r-- | Eigen/src/Core/util/Constants.h | 4 | ||||
-rw-r--r-- | Eigen/src/Core/util/ForwardDeclarations.h | 6 | ||||
-rw-r--r-- | Eigen/src/Core/util/Meta.h | 34 |
3 files changed, 25 insertions, 19 deletions
diff --git a/Eigen/src/Core/util/Constants.h b/Eigen/src/Core/util/Constants.h index 163832394..fab5b1321 100644 --- a/Eigen/src/Core/util/Constants.h +++ b/Eigen/src/Core/util/Constants.h @@ -94,12 +94,12 @@ const unsigned int SelfAdjointBit = 0x100; /** \ingroup flags * - * means the strictly triangular lower part is 0 */ + * means the strictly lower triangular part is 0 */ const unsigned int UpperTriangularBit = 0x200; /** \ingroup flags * - * means the strictly triangular upper part is 0 */ + * means the strictly upper triangular part is 0 */ const unsigned int LowerTriangularBit = 0x400; /** \ingroup flags diff --git a/Eigen/src/Core/util/ForwardDeclarations.h b/Eigen/src/Core/util/ForwardDeclarations.h index 3e2b504c5..f586b15d9 100644 --- a/Eigen/src/Core/util/ForwardDeclarations.h +++ b/Eigen/src/Core/util/ForwardDeclarations.h @@ -28,15 +28,13 @@ template<typename T> struct ei_traits; template<typename Lhs, typename Rhs> struct ei_product_eval_mode; template<typename T> struct NumTraits; -template<typename Scalar, int Size, unsigned int SuggestedFlags> class ei_corrected_matrix_flags; - -template<int _Rows, int _Cols> struct ei_size_at_compile_time; +template<typename Scalar, int Rows, int Cols, int MaxRows, int MaxCols, unsigned int SuggestedFlags> class ei_corrected_matrix_flags; template<typename _Scalar, int _Rows, int _Cols, int _MaxRows = _Rows, int _MaxCols = _Cols, unsigned int _Flags = ei_corrected_matrix_flags< _Scalar, - ei_size_at_compile_time<_MaxRows,_MaxCols>::ret, + _Rows, _Cols, _MaxRows, _MaxCols, EIGEN_DEFAULT_MATRIX_FLAGS >::ret > diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index 5df6d89d0..e50b3bb81 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -147,19 +147,28 @@ template<typename T> struct ei_packet_traits enum {size=1}; }; -template<typename Scalar, int Size, unsigned int SuggestedFlags> +template<typename Scalar, int Rows, int Cols, int MaxRows, int MaxCols, unsigned int SuggestedFlags> class ei_corrected_matrix_flags { - enum { is_vectorizable + enum { row_major_bit = (Rows != 1 && Cols != 1) // if this is not a vector, + // then the storage order really matters, + // so let us strictly honor the user's choice. + ? SuggestedFlags&RowMajorBit + : Cols > 1 ? RowMajorBit : 0, + is_big = MaxRows == Dynamic || MaxCols == Dynamic, + inner_size = row_major_bit ? Cols : Rows, + vectorizable_bit = ei_packet_traits<Scalar>::size > 1 - && (Size%ei_packet_traits<Scalar>::size==0), - _flags1 = (SuggestedFlags & ~(EvalBeforeNestingBit | EvalBeforeAssigningBit)) | Like1DArrayBit | DirectAccessBit + && (is_big || inner_size%ei_packet_traits<Scalar>::size==0) + ? VectorizableBit : 0, + + _flags1 = (SuggestedFlags & ~(EvalBeforeNestingBit | EvalBeforeAssigningBit | VectorizableBit | RowMajorBit)) + | Like1DArrayBit | DirectAccessBit }; public: - enum { ret = int(is_vectorizable) - ? int(_flags1) | int(VectorizableBit) - : int(_flags1) & ~int(VectorizableBit) + enum { ret = (SuggestedFlags & ~(EvalBeforeNestingBit | EvalBeforeAssigningBit | VectorizableBit | RowMajorBit)) + | Like1DArrayBit | DirectAccessBit | vectorizable_bit | row_major_bit }; }; @@ -171,20 +180,19 @@ template<int _Rows, int _Cols> struct ei_size_at_compile_time template<typename T> class ei_eval { typedef typename ei_traits<T>::Scalar _Scalar; - enum {_MaxRows = ei_traits<T>::MaxRowsAtCompileTime, + enum {_Rows = ei_traits<T>::RowsAtCompileTime, + _Cols = ei_traits<T>::ColsAtCompileTime, + _MaxRows = ei_traits<T>::MaxRowsAtCompileTime, _MaxCols = ei_traits<T>::MaxColsAtCompileTime, _Flags = ei_traits<T>::Flags }; public: typedef Matrix<_Scalar, - ei_traits<T>::RowsAtCompileTime, - ei_traits<T>::ColsAtCompileTime, - ei_traits<T>::MaxRowsAtCompileTime, - ei_traits<T>::MaxColsAtCompileTime, + _Rows, _Cols, _MaxRows, _MaxCols, ei_corrected_matrix_flags< _Scalar, - ei_size_at_compile_time<_MaxRows,_MaxCols>::ret, + _Rows, _Cols, _MaxRows, _MaxCols, _Flags >::ret > type; |