Make use of is_same_dense helper instead of extract_data to detect input/outputs are the same.

This commit is contained in:
Gael Guennebaud 2016-04-13 18:47:12 +02:00
parent b7716c0328
commit 6f960b83ff
4 changed files with 4 additions and 9 deletions

View File

@ -1006,8 +1006,7 @@ struct transposition_matrix_product
const Index size = tr.size(); const Index size = tr.size();
StorageIndex j = 0; StorageIndex j = 0;
const typename Dest::Scalar *dst_data = internal::extract_data(dst); if(!is_same_dense(dst,mat))
if(!(is_same<MatrixTypeCleaned,Dest>::value && dst_data!=0 && dst_data == extract_data(mat)))
dst = mat; dst = mat;
for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k<size ; Transposed?--k:++k) for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k<size ; Transposed?--k:++k)

View File

@ -213,8 +213,7 @@ template<int Side, typename TriangularType, typename Rhs> struct triangular_solv
template<typename Dest> inline void evalTo(Dest& dst) const template<typename Dest> inline void evalTo(Dest& dst) const
{ {
const typename Dest::Scalar *dst_data = internal::extract_data(dst); if(!is_same_dense(dst,m_rhs))
if(!(is_same<RhsNestedCleaned,Dest>::value && dst_data!=0 && dst_data == extract_data(m_rhs)))
dst = m_rhs; dst = m_rhs;
m_triangularMatrix.template solveInPlace<Side>(dst); m_triangularMatrix.template solveInPlace<Side>(dst);
} }

View File

@ -532,8 +532,7 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularViewImpl<_Mat
template<typename RhsType, typename DstType> template<typename RhsType, typename DstType>
EIGEN_DEVICE_FUNC EIGEN_DEVICE_FUNC
EIGEN_STRONG_INLINE void _solve_impl(const RhsType &rhs, DstType &dst) const { EIGEN_STRONG_INLINE void _solve_impl(const RhsType &rhs, DstType &dst) const {
const typename DstType::Scalar *dst_data = internal::extract_data(dst); if(!internal::is_same_dense(dst,rhs))
if(!(internal::is_same<RhsType,DstType>::value && dst_data!=0 && dst_data == internal::extract_data(rhs)))
dst = rhs; dst = rhs;
this->solveInPlace(dst); this->solveInPlace(dst);
} }

View File

@ -243,9 +243,7 @@ template<typename VectorsType, typename CoeffsType, int Side> class HouseholderS
{ {
workspace.resize(rows()); workspace.resize(rows());
Index vecs = m_length; Index vecs = m_length;
const typename Dest::Scalar *dst_data = internal::extract_data(dst); if(is_same_dense(dst,m_vectors))
if( internal::is_same<typename internal::remove_all<VectorsType>::type,Dest>::value
&& dst_data!=0 && dst_data == internal::extract_data(m_vectors))
{ {
// in-place // in-place
dst.diagonal().setOnes(); dst.diagonal().setOnes();