diff --git a/Eigen/src/Core/CwiseUnaryOp.h b/Eigen/src/Core/CwiseUnaryOp.h index 8d2737e12..e2ae35b3d 100644 --- a/Eigen/src/Core/CwiseUnaryOp.h +++ b/Eigen/src/Core/CwiseUnaryOp.h @@ -143,10 +143,10 @@ MatrixBase::cwiseAbs2() const * * \sa adjoint() */ template -inline const CwiseUnaryOp::Scalar>, Derived> +inline const typename MatrixBase::ConjugateReturnType MatrixBase::conjugate() const { - return derived(); + return ConjugateReturnType(derived()); } /** \returns an expression of *this with the \a Scalar type casted to diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 8d1b03eb6..27d60d078 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -304,10 +304,17 @@ template class MatrixBase Transpose transpose(); const Transpose transpose() const; - const Transpose< - NestByValue::Scalar>, Derived> > - > - adjoint() const; + + /** the return type of MatrixBase::conjugate() */ + typedef typename ei_meta_if::IsComplex, + CwiseUnaryOp, Derived>, + Derived& + >::ret ConjugateReturnType; + /** the return type of MatrixBase::adjoint() */ + typedef Transpose< + NestByValue::type> + > AdjointReturnType; + const AdjointReturnType adjoint() const; //@} /// \name Sub-matrices @@ -465,7 +472,7 @@ template class MatrixBase /// \name Coefficient-wise operations //@{ - const CwiseUnaryOp::Scalar>, Derived> conjugate() const; + const ConjugateReturnType conjugate() const; template const CwiseBinaryOp::Scalar>, Derived, OtherDerived> diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h index dc2ea950e..51f38e8d8 100644 --- a/Eigen/src/Core/NestByValue.h +++ b/Eigen/src/Core/NestByValue.h @@ -71,12 +71,23 @@ template class NestByValue return m_expression.coeff(row, col); } + inline Scalar& _coeffRef(int row, int col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + template inline const PacketScalar _packetCoeff(int row, int col) const { return m_expression.template packetCoeff(row, col); } + template + inline void _writePacketCoeff(int row, int col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacketCoeff(row, col, x); + } + protected: const ExpressionType m_expression; }; diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index c65e6ec47..cd7d9ca93 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -228,7 +228,7 @@ struct ei_traits > _LostBits = HereditaryBits & ~( (_RowMajor ? 0 : RowMajorBit) | ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)), - Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits) + Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits & ~NestedByValue) | EvalBeforeAssigningBit | EvalBeforeNestingBit | (_Vectorizable ? VectorizableBit : 0), diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 8c59d2425..5c9cd54ac 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -125,9 +125,7 @@ MatrixBase::transpose() const * * \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */ template -inline const Transpose< - NestByValue::Scalar>, Derived > > - > +inline const typename MatrixBase::AdjointReturnType MatrixBase::adjoint() const { return conjugate().nestByValue();