From 90d2ae7fec1000c244472c94af24126c5f2ca2a2 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 5 Jan 2010 12:46:07 +0100 Subject: fix aliasing detection --- Eigen/src/Core/SelfCwiseBinaryOp.h | 5 +++-- Eigen/src/Core/Transpose.h | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'Eigen/src') diff --git a/Eigen/src/Core/SelfCwiseBinaryOp.h b/Eigen/src/Core/SelfCwiseBinaryOp.h index 55bd93f9e..df35d0ee9 100644 --- a/Eigen/src/Core/SelfCwiseBinaryOp.h +++ b/Eigen/src/Core/SelfCwiseBinaryOp.h @@ -35,7 +35,7 @@ * method to directly performs a +=/-= operations in an optimal way. In particular, * this allows to make sure that the input/output data are loaded only once using * aligned packet loads. - * + * * \sa class SwapWrapper for a similar trick. */ template @@ -58,6 +58,7 @@ template class SelfCwiseBinaryOp inline int rows() const { return m_matrix.rows(); } inline int cols() const { return m_matrix.cols(); } inline int stride() const { return m_matrix.stride(); } + inline const Scalar* data() const { return m_matrix.data(); } // note that this function is needed by assign to correctly align loads/stores // TODO make Assign use .data() @@ -136,5 +137,5 @@ inline Derived& DenseBase::operator/=(const Scalar& other) tmp = PlainMatrixType::Constant(rows(),cols(), NumTraits::HasFloatingPoint ? Scalar(1)/other : other); return derived(); } - + #endif // EIGEN_SELFCWISEBINARYOP_H diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index fcc07e916..80b056527 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -299,6 +299,15 @@ inline void MatrixBase::adjointInPlace() // The following is to detect aliasing problems in most common cases. +template +struct ei_blas_traits > + : ei_blas_traits +{ + typedef SelfCwiseBinaryOp XprType; + static inline const XprType extract(const XprType& x) { return x; } +}; + + template::ActualAccess> struct ei_extract_data_selector { static typename T::Scalar* run(const T& m) -- cgit v1.2.3