diff --git a/Eigen/src/SparseCore/SparseAssign.h b/Eigen/src/SparseCore/SparseAssign.h index 68a6ca20e..c99f4b74e 100644 --- a/Eigen/src/SparseCore/SparseAssign.h +++ b/Eigen/src/SparseCore/SparseAssign.h @@ -143,7 +143,7 @@ template template inline Derived& SparseMatrixBase::operator=(const SparseMatrixBase& other) { - internal::call_assignment_no_alias(derived(), other.derived()); + internal::call_assignment/*_no_alias*/(derived(), other.derived()); return derived(); } @@ -184,7 +184,7 @@ void assign_sparse_to_sparse(DstXprType &dst, const SrcXprType &src) typedef typename internal::evaluator::type SrcEvaluatorType; SrcEvaluatorType srcEvaluator(src); - + const bool transpose = (DstEvaluatorType::Flags & RowMajorBit) != (SrcEvaluatorType::Flags & RowMajorBit); const Index outerSize = (int(SrcEvaluatorType::Flags) & RowMajorBit) ? src.rows() : src.cols(); if ((!transpose) && src.isRValue()) diff --git a/Eigen/src/SparseCore/SparseMatrix.h b/Eigen/src/SparseCore/SparseMatrix.h index 56bf5aaf1..6df4da51a 100644 --- a/Eigen/src/SparseCore/SparseMatrix.h +++ b/Eigen/src/SparseCore/SparseMatrix.h @@ -649,7 +649,13 @@ class SparseMatrix EIGEN_STATIC_ASSERT((internal::is_same::value), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) check_template_parameters(); +#ifndef EIGEN_TEST_EVALUATORS *this = other.derived(); +#else + const bool needToTranspose = (Flags & RowMajorBit) != (internal::evaluator::Flags & RowMajorBit); + if (needToTranspose) *this = other.derived(); + else internal::call_assignment_no_alias(*this, other.derived()); +#endif } /** Constructs a sparse matrix from the sparse selfadjoint view \a other */ @@ -722,6 +728,7 @@ class SparseMatrix return *this; } +#ifndef EIGEN_TEST_EVALUATORS #ifndef EIGEN_PARSED_BY_DOXYGEN template inline SparseMatrix& operator=(const SparseSparseProduct& product) @@ -738,6 +745,7 @@ class SparseMatrix inline SparseMatrix& operator=(const EigenBase& other) { return Base::operator=(other.derived()); } #endif +#endif // EIGEN_TEST_EVALUATORS template EIGEN_DONT_INLINE SparseMatrix& operator=(const SparseMatrixBase& other); @@ -1174,7 +1182,9 @@ EIGEN_DONT_INLINE SparseMatrix& SparseMatrix > Flags = SparseMatrixType::Flags }; - evaluator(const SparseMatrixType &mat) : m_matrix(mat) {} + evaluator() : m_matrix(0) {} + evaluator(const SparseMatrixType &mat) : m_matrix(&mat) {} - operator SparseMatrixType&() { return m_matrix.const_cast_derived(); } - operator const SparseMatrixType&() const { return m_matrix; } + operator SparseMatrixType&() { return m_matrix->const_cast_derived(); } + operator const SparseMatrixType&() const { return *m_matrix; } - const SparseMatrixType &m_matrix; + const SparseMatrixType *m_matrix; }; }