mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-15 19:03:12 +08:00
* added _*coeffRef members in NestedByValue
* added ConjugateReturnType and AdjointReturnType that are type-defined to Derived& and Transpose<Derived> if the scalar type is not complex: this avoids abusive copies in the cache friendly Product
This commit is contained in:
parent
f54760c889
commit
73084dc754
@ -143,10 +143,10 @@ MatrixBase<Derived>::cwiseAbs2() const
|
|||||||
*
|
*
|
||||||
* \sa adjoint() */
|
* \sa adjoint() */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived>
|
inline const typename MatrixBase<Derived>::ConjugateReturnType
|
||||||
MatrixBase<Derived>::conjugate() const
|
MatrixBase<Derived>::conjugate() const
|
||||||
{
|
{
|
||||||
return derived();
|
return ConjugateReturnType(derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** \returns an expression of *this with the \a Scalar type casted to
|
/** \returns an expression of *this with the \a Scalar type casted to
|
||||||
|
@ -304,10 +304,17 @@ template<typename Derived> class MatrixBase
|
|||||||
|
|
||||||
Transpose<Derived> transpose();
|
Transpose<Derived> transpose();
|
||||||
const Transpose<Derived> transpose() const;
|
const Transpose<Derived> transpose() const;
|
||||||
const Transpose<
|
|
||||||
NestByValue<CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived> >
|
/** the return type of MatrixBase::conjugate() */
|
||||||
>
|
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
||||||
adjoint() const;
|
CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Derived>,
|
||||||
|
Derived&
|
||||||
|
>::ret ConjugateReturnType;
|
||||||
|
/** the return type of MatrixBase::adjoint() */
|
||||||
|
typedef Transpose<
|
||||||
|
NestByValue<typename ei_unref<ConjugateReturnType>::type>
|
||||||
|
> AdjointReturnType;
|
||||||
|
const AdjointReturnType adjoint() const;
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// \name Sub-matrices
|
/// \name Sub-matrices
|
||||||
@ -465,7 +472,7 @@ template<typename Derived> class MatrixBase
|
|||||||
|
|
||||||
/// \name Coefficient-wise operations
|
/// \name Coefficient-wise operations
|
||||||
//@{
|
//@{
|
||||||
const CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived> conjugate() const;
|
const ConjugateReturnType conjugate() const;
|
||||||
|
|
||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
const CwiseBinaryOp<ei_scalar_product_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
const CwiseBinaryOp<ei_scalar_product_op<typename ei_traits<Derived>::Scalar>, Derived, OtherDerived>
|
||||||
|
@ -71,12 +71,23 @@ template<typename ExpressionType> class NestByValue
|
|||||||
return m_expression.coeff(row, col);
|
return m_expression.coeff(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline Scalar& _coeffRef(int row, int col)
|
||||||
|
{
|
||||||
|
return m_expression.const_cast_derived().coeffRef(row, col);
|
||||||
|
}
|
||||||
|
|
||||||
template<int LoadMode>
|
template<int LoadMode>
|
||||||
inline const PacketScalar _packetCoeff(int row, int col) const
|
inline const PacketScalar _packetCoeff(int row, int col) const
|
||||||
{
|
{
|
||||||
return m_expression.template packetCoeff<LoadMode>(row, col);
|
return m_expression.template packetCoeff<LoadMode>(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<int LoadMode>
|
||||||
|
inline void _writePacketCoeff(int row, int col, const PacketScalar& x)
|
||||||
|
{
|
||||||
|
m_expression.const_cast_derived().template writePacketCoeff<LoadMode>(row, col, x);
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const ExpressionType m_expression;
|
const ExpressionType m_expression;
|
||||||
};
|
};
|
||||||
|
@ -228,7 +228,7 @@ struct ei_traits<Product<Lhs, Rhs, EvalMode> >
|
|||||||
_LostBits = HereditaryBits & ~(
|
_LostBits = HereditaryBits & ~(
|
||||||
(_RowMajor ? 0 : RowMajorBit)
|
(_RowMajor ? 0 : RowMajorBit)
|
||||||
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
| ((RowsAtCompileTime == Dynamic || ColsAtCompileTime == Dynamic) ? 0 : LargeBit)),
|
||||||
Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits)
|
Flags = ((unsigned int)(LhsFlags | RhsFlags) & _LostBits & ~NestedByValue)
|
||||||
| EvalBeforeAssigningBit
|
| EvalBeforeAssigningBit
|
||||||
| EvalBeforeNestingBit
|
| EvalBeforeNestingBit
|
||||||
| (_Vectorizable ? VectorizableBit : 0),
|
| (_Vectorizable ? VectorizableBit : 0),
|
||||||
|
@ -125,9 +125,7 @@ MatrixBase<Derived>::transpose() const
|
|||||||
*
|
*
|
||||||
* \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */
|
* \sa transpose(), conjugate(), class Transpose, class ei_scalar_conjugate_op */
|
||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline const Transpose<
|
inline const typename MatrixBase<Derived>::AdjointReturnType
|
||||||
NestByValue<CwiseUnaryOp<ei_scalar_conjugate_op<typename ei_traits<Derived>::Scalar>, Derived > >
|
|
||||||
>
|
|
||||||
MatrixBase<Derived>::adjoint() const
|
MatrixBase<Derived>::adjoint() const
|
||||||
{
|
{
|
||||||
return conjugate().nestByValue();
|
return conjugate().nestByValue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user