mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-12 11:49:02 +08:00
fix aliasing detection
This commit is contained in:
parent
37851cfe11
commit
90d2ae7fec
@ -35,7 +35,7 @@
|
|||||||
* method to directly performs a +=/-= operations in an optimal way. In particular,
|
* 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
|
* this allows to make sure that the input/output data are loaded only once using
|
||||||
* aligned packet loads.
|
* aligned packet loads.
|
||||||
*
|
*
|
||||||
* \sa class SwapWrapper for a similar trick.
|
* \sa class SwapWrapper for a similar trick.
|
||||||
*/
|
*/
|
||||||
template<typename BinaryOp, typename MatrixType>
|
template<typename BinaryOp, typename MatrixType>
|
||||||
@ -58,6 +58,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
|
|||||||
inline int rows() const { return m_matrix.rows(); }
|
inline int rows() const { return m_matrix.rows(); }
|
||||||
inline int cols() const { return m_matrix.cols(); }
|
inline int cols() const { return m_matrix.cols(); }
|
||||||
inline int stride() const { return m_matrix.stride(); }
|
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
|
// note that this function is needed by assign to correctly align loads/stores
|
||||||
// TODO make Assign use .data()
|
// TODO make Assign use .data()
|
||||||
@ -136,5 +137,5 @@ inline Derived& DenseBase<Derived>::operator/=(const Scalar& other)
|
|||||||
tmp = PlainMatrixType::Constant(rows(),cols(), NumTraits<Scalar>::HasFloatingPoint ? Scalar(1)/other : other);
|
tmp = PlainMatrixType::Constant(rows(),cols(), NumTraits<Scalar>::HasFloatingPoint ? Scalar(1)/other : other);
|
||||||
return derived();
|
return derived();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // EIGEN_SELFCWISEBINARYOP_H
|
#endif // EIGEN_SELFCWISEBINARYOP_H
|
||||||
|
@ -299,6 +299,15 @@ inline void MatrixBase<Derived>::adjointInPlace()
|
|||||||
|
|
||||||
// The following is to detect aliasing problems in most common cases.
|
// The following is to detect aliasing problems in most common cases.
|
||||||
|
|
||||||
|
template<typename BinOp,typename NestedXpr>
|
||||||
|
struct ei_blas_traits<SelfCwiseBinaryOp<BinOp,NestedXpr> >
|
||||||
|
: ei_blas_traits<NestedXpr>
|
||||||
|
{
|
||||||
|
typedef SelfCwiseBinaryOp<BinOp,NestedXpr> XprType;
|
||||||
|
static inline const XprType extract(const XprType& x) { return x; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
template<typename T, int Access=ei_blas_traits<T>::ActualAccess>
|
template<typename T, int Access=ei_blas_traits<T>::ActualAccess>
|
||||||
struct ei_extract_data_selector {
|
struct ei_extract_data_selector {
|
||||||
static typename T::Scalar* run(const T& m)
|
static typename T::Scalar* run(const T& m)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user