diff options
author | 2008-06-16 16:39:58 +0000 | |
---|---|---|
committer | 2008-06-16 16:39:58 +0000 | |
commit | 5dbfed190264dd39afa9d97f2bb9a1fc18e85e94 (patch) | |
tree | dba5b92292f06ba30fea2a13e9c0f2caac667fad /Eigen | |
parent | bb1f4e44f10de50b5b52a3973324c1a0952e3f29 (diff) |
fix two bugs dicovered by the previous commit.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Core/MatrixStorage.h | 18 | ||||
-rw-r--r-- | Eigen/src/Core/Product.h | 3 | ||||
-rw-r--r-- | Eigen/src/Core/util/Meta.h | 4 |
3 files changed, 13 insertions, 12 deletions
diff --git a/Eigen/src/Core/MatrixStorage.h b/Eigen/src/Core/MatrixStorage.h index 94336f1a8..72b9965b6 100644 --- a/Eigen/src/Core/MatrixStorage.h +++ b/Eigen/src/Core/MatrixStorage.h @@ -94,7 +94,7 @@ template<typename T, int Size, int _Rows, int _Cols> class ei_matrix_storage // dynamic-size matrix with fixed-size storage template<typename T, int Size> class ei_matrix_storage<T, Size, Dynamic, Dynamic> { - T m_data[Size]; + ei_aligned_array<T,Size,((Size*sizeof(T))%16)==0> m_data; int m_rows; int m_cols; public: @@ -107,14 +107,14 @@ template<typename T, int Size> class ei_matrix_storage<T, Size, Dynamic, Dynamic m_rows = rows; m_cols = cols; } - inline const T *data() const { return m_data; } - inline T *data() { return m_data; } + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } }; // dynamic-size matrix with fixed-size storage and fixed width template<typename T, int Size, int _Cols> class ei_matrix_storage<T, Size, Dynamic, _Cols> { - T m_data[Size]; + ei_aligned_array<T,Size,((Size*sizeof(T))%16)==0> m_data; int m_rows; public: inline ei_matrix_storage(int, int rows, int) : m_rows(rows) {} @@ -125,14 +125,14 @@ template<typename T, int Size, int _Cols> class ei_matrix_storage<T, Size, Dynam { m_rows = rows; } - inline const T *data() const { return m_data; } - inline T *data() { return m_data; } + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } }; // dynamic-size matrix with fixed-size storage and fixed height template<typename T, int Size, int _Rows> class ei_matrix_storage<T, Size, _Rows, Dynamic> { - T m_data[Size]; + ei_aligned_array<T,Size,((Size*sizeof(T))%16)==0> m_data; int m_cols; public: inline ei_matrix_storage(int, int, int cols) : m_cols(cols) {} @@ -143,8 +143,8 @@ template<typename T, int Size, int _Rows> class ei_matrix_storage<T, Size, _Rows { m_cols = cols; } - inline const T *data() const { return m_data; } - inline T *data() { return m_data; } + inline const T *data() const { return m_data.array; } + inline T *data() { return m_data.array; } }; // purely dynamic matrix. diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 8d4ed8779..def183b38 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -216,7 +216,8 @@ struct ei_traits<Product<Lhs, Rhs, EvalMode> > _RowMajor = (RhsFlags & RowMajorBit) && (EvalMode==(int)CacheFriendlyProduct ? (int)LhsFlags & RowMajorBit : (!_LhsPacketAccess)), _LostBits = ~((_RowMajor ? 0 : RowMajorBit) - | ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)), + | ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit) + | LinearAccessBit), Flags = ((unsigned int)(LhsFlags | RhsFlags) & HereditaryBits & _LostBits) | EvalBeforeAssigningBit | EvalBeforeNestingBit diff --git a/Eigen/src/Core/util/Meta.h b/Eigen/src/Core/util/Meta.h index de732f373..33a09f87c 100644 --- a/Eigen/src/Core/util/Meta.h +++ b/Eigen/src/Core/util/Meta.h @@ -161,7 +161,7 @@ class ei_corrected_matrix_flags = ei_packet_traits<Scalar>::size > 1 && (is_big || inner_size%ei_packet_traits<Scalar>::size==0) ? PacketAccessBit : 0, - + _flags1 = (SuggestedFlags & ~(EvalBeforeNestingBit | EvalBeforeAssigningBit | PacketAccessBit | RowMajorBit)) | LinearAccessBit | DirectAccessBit }; @@ -215,7 +215,7 @@ template<typename T, int n=1> struct ei_nested T, typename ei_meta_if< (int(ei_traits<T>::Flags) & EvalBeforeNestingBit) - || ((n+1) * int(NumTraits<typename ei_traits<T>::Scalar>::ReadCost) < (n-1) * int(T::CoeffReadCost)), + || ((n+1) * int(NumTraits<typename ei_traits<T>::Scalar>::ReadCost) <= (n-1) * int(T::CoeffReadCost)), typename ei_eval<T>::type, const T& >::ret |