mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-08-11 19:29:02 +08:00
get rid of NestParentByRefBit
This commit is contained in:
parent
871698d3aa
commit
8b016e717f
@ -55,7 +55,7 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
|
||||
: ColFactor * MatrixType::ColsAtCompileTime,
|
||||
MaxRowsAtCompileTime = RowsAtCompileTime,
|
||||
MaxColsAtCompileTime = ColsAtCompileTime,
|
||||
Flags = (_MatrixTypeNested::Flags & HereditaryBits) | EIGEN_PROPAGATE_NESTING_BIT(MatrixType::Flags),
|
||||
Flags = (_MatrixTypeNested::Flags & HereditaryBits),
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
};
|
||||
|
@ -59,9 +59,7 @@ struct ei_traits<Reverse<MatrixType, Direction> >
|
||||
LinearAccess = ( (Direction==BothDirections) && (int(_MatrixTypeNested::Flags)&PacketAccessBit) )
|
||||
? LinearAccessBit : 0,
|
||||
|
||||
Flags = (int(_MatrixTypeNested::Flags)
|
||||
& (HereditaryBits | PacketAccessBit | LinearAccess))
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(MatrixType::Flags),
|
||||
Flags = int(_MatrixTypeNested::Flags) & (HereditaryBits | PacketAccessBit | LinearAccess),
|
||||
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
|
@ -55,11 +55,10 @@ struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
|
||||
ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime,
|
||||
MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime,
|
||||
MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime,
|
||||
Flags = ((unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits)
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ConditionMatrixType::Flags|ThenMatrixType::Flags|ElseMatrixType::Flags),
|
||||
CoeffReadCost = ei_traits<typename ei_cleantype<ConditionMatrixNested>::type>::CoeffReadCost
|
||||
+ EIGEN_ENUM_MAX(ei_traits<typename ei_cleantype<ThenMatrixNested>::type>::CoeffReadCost,
|
||||
ei_traits<typename ei_cleantype<ElseMatrixNested>::type>::CoeffReadCost)
|
||||
Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits,
|
||||
CoeffReadCost = ei_traits<typename ei_cleantype<ConditionMatrixNested>::type>::CoeffReadCost
|
||||
+ EIGEN_ENUM_MAX(ei_traits<typename ei_cleantype<ThenMatrixNested>::type>::CoeffReadCost,
|
||||
ei_traits<typename ei_cleantype<ElseMatrixNested>::type>::CoeffReadCost)
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -60,8 +60,7 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
|
||||
ColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::ColsAtCompileTime,
|
||||
MaxRowsAtCompileTime = Direction==Vertical ? 1 : MatrixType::MaxRowsAtCompileTime,
|
||||
MaxColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::MaxColsAtCompileTime,
|
||||
Flags = ((unsigned int)_MatrixTypeNested::Flags & HereditaryBits)
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(_MatrixTypeNested::Flags),
|
||||
Flags = (unsigned int)_MatrixTypeNested::Flags & HereditaryBits,
|
||||
TraversalSize = Direction==Vertical ? RowsAtCompileTime : ColsAtCompileTime
|
||||
};
|
||||
#if EIGEN_GNUC_AT_LEAST(3,4)
|
||||
|
@ -76,9 +76,7 @@ struct ei_traits<Block<MatrixType, BlockRows, BlockCols, _DirectAccessStatus> >
|
||||
MaskPacketAccessBit = (InnerMaxSize == Dynamic || (InnerSize >= ei_packet_traits<Scalar>::size))
|
||||
? PacketAccessBit : 0,
|
||||
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0,
|
||||
Flags = (ei_traits<MatrixType>::Flags & (HereditaryBits | MaskPacketAccessBit | DirectAccessBit))
|
||||
| FlagsLinearAccessBit
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags)
|
||||
Flags = (ei_traits<MatrixType>::Flags & (HereditaryBits | MaskPacketAccessBit | DirectAccessBit)) | FlagsLinearAccessBit
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -343,7 +343,7 @@ template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE void DenseBase<Derived>::copyCoeff(int index, const DenseBase<OtherDerived>& other)
|
||||
{
|
||||
ei_internal_assert(index >= 0 && index < size());
|
||||
derived().coeffRef(index) = Scalar(other.derived().coeff(index));
|
||||
derived().coeffRef(index) = other.derived().coeff(index);
|
||||
}
|
||||
|
||||
/** \internal Copies the packet at position (row,col) of other into *this.
|
||||
|
@ -72,7 +72,6 @@ struct ei_traits<CwiseBinaryOp<BinaryOp, Lhs, Rhs> > : ei_traits<Lhs>
|
||||
( AlignedBit
|
||||
| (StorageOrdersAgree ? LinearAccessBit : 0)
|
||||
| (ei_functor_traits<BinaryOp>::PacketAccess && StorageOrdersAgree ? PacketAccessBit : 0)
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(Lhs::Flags|Rhs::Flags)
|
||||
)
|
||||
)
|
||||
),
|
||||
|
@ -48,8 +48,7 @@ struct ei_traits<CwiseNullaryOp<NullaryOp, MatrixType> > : ei_traits<MatrixType>
|
||||
& ( HereditaryBits
|
||||
| (ei_functor_has_linear_access<NullaryOp>::ret ? LinearAccessBit : 0)
|
||||
| (ei_functor_traits<NullaryOp>::PacketAccess ? PacketAccessBit : 0)))
|
||||
| (ei_functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit)
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
| (ei_functor_traits<NullaryOp>::IsRepeatable ? 0 : EvalBeforeNestingBit),
|
||||
CoeffReadCost = ei_functor_traits<NullaryOp>::Cost
|
||||
};
|
||||
};
|
||||
|
@ -49,10 +49,9 @@ struct ei_traits<CwiseUnaryOp<UnaryOp, MatrixType> >
|
||||
typedef typename MatrixType::Nested MatrixTypeNested;
|
||||
typedef typename ei_unref<MatrixTypeNested>::type _MatrixTypeNested;
|
||||
enum {
|
||||
Flags = (_MatrixTypeNested::Flags & (
|
||||
Flags = _MatrixTypeNested::Flags & (
|
||||
HereditaryBits | LinearAccessBit | AlignedBit
|
||||
| (ei_functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)))
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
| (ei_functor_traits<UnaryOp>::PacketAccess ? PacketAccessBit : 0)),
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost + ei_functor_traits<UnaryOp>::Cost
|
||||
};
|
||||
};
|
||||
|
@ -47,8 +47,7 @@ struct ei_traits<CwiseUnaryView<ViewOp, MatrixType> >
|
||||
typedef typename MatrixType::Nested MatrixTypeNested;
|
||||
typedef typename ei_cleantype<MatrixTypeNested>::type _MatrixTypeNested;
|
||||
enum {
|
||||
Flags = (ei_traits<_MatrixTypeNested>::Flags & (HereditaryBits | LinearAccessBit | AlignedBit))
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags), // if I am not wrong, I need to test this on MatrixType and not on the nested type
|
||||
Flags = (ei_traits<_MatrixTypeNested>::Flags & (HereditaryBits | LinearAccessBit | AlignedBit)),
|
||||
CoeffReadCost = ei_traits<_MatrixTypeNested>::CoeffReadCost + ei_functor_traits<ViewOp>::Cost
|
||||
};
|
||||
};
|
||||
|
@ -58,8 +58,7 @@ struct ei_traits<Diagonal<MatrixType,Index> >
|
||||
: Index == Dynamic ? EIGEN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime)
|
||||
: (EIGEN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) - AbsIndex),
|
||||
MaxColsAtCompileTime = 1,
|
||||
Flags = ((unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit))
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit),
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
};
|
||||
|
@ -37,8 +37,7 @@ struct ei_traits<DiagonalProduct<MatrixType, DiagonalType, ProductOrder> >
|
||||
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
||||
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
||||
Flags = (HereditaryBits & (unsigned int)(MatrixType::Flags))
|
||||
| (PacketAccessBit & (unsigned int)(MatrixType::Flags) & (unsigned int)(DiagonalType::DiagonalVectorType::Flags))
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
| (PacketAccessBit & (unsigned int)(MatrixType::Flags) & (unsigned int)(DiagonalType::DiagonalVectorType::Flags)),
|
||||
CoeffReadCost = NumTraits<Scalar>::MulCost + MatrixType::CoeffReadCost + DiagonalType::DiagonalVectorType::CoeffReadCost
|
||||
};
|
||||
};
|
||||
|
@ -53,8 +53,7 @@ struct ei_traits<Minor<MatrixType> >
|
||||
int(MatrixType::MaxRowsAtCompileTime) - 1 : Dynamic,
|
||||
MaxColsAtCompileTime = (MatrixType::MaxColsAtCompileTime != Dynamic) ?
|
||||
int(MatrixType::MaxColsAtCompileTime) - 1 : Dynamic,
|
||||
Flags = (_MatrixTypeNested::Flags & HereditaryBits)
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
Flags = _MatrixTypeNested::Flags & HereditaryBits,
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost // minor is used typically on tiny matrices,
|
||||
// where loops are unrolled and the 'if' evaluates at compile time
|
||||
};
|
||||
|
@ -42,10 +42,7 @@ struct ei_traits<ProductBase<Derived,_Lhs,_Rhs> > //: ei_traits<typename ei_clea
|
||||
ColsAtCompileTime = ei_traits<Rhs>::ColsAtCompileTime,
|
||||
MaxRowsAtCompileTime = ei_traits<Lhs>::MaxRowsAtCompileTime,
|
||||
MaxColsAtCompileTime = ei_traits<Rhs>::MaxColsAtCompileTime,
|
||||
Flags = EvalBeforeNestingBit
|
||||
| EvalBeforeAssigningBit
|
||||
| NestParentByRefBit
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(Lhs::Flags|Rhs::Flags),
|
||||
Flags = EvalBeforeNestingBit | EvalBeforeAssigningBit,
|
||||
CoeffReadCost = 0 // FIXME why is it needed ?
|
||||
};
|
||||
};
|
||||
|
@ -47,9 +47,8 @@ struct ei_traits<SelfAdjointView<MatrixType, TriangularPart> > : ei_traits<Matri
|
||||
typedef MatrixType ExpressionType;
|
||||
enum {
|
||||
Mode = TriangularPart | SelfAdjoint,
|
||||
Flags = (_MatrixTypeNested::Flags & (HereditaryBits)
|
||||
& (~(PacketAccessBit | DirectAccessBit | LinearAccessBit))) // FIXME these flags should be preserved
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
Flags = _MatrixTypeNested::Flags & (HereditaryBits)
|
||||
& (~(PacketAccessBit | DirectAccessBit | LinearAccessBit)), // FIXME these flags should be preserved
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
};
|
||||
|
@ -90,7 +90,7 @@ template<typename BinaryOp, typename MatrixType> class SelfCwiseBinaryOp
|
||||
OtherDerived& _other = other.const_cast_derived();
|
||||
ei_internal_assert(index >= 0 && index < m_matrix.size());
|
||||
Scalar& tmp = m_matrix.coeffRef(index);
|
||||
tmp = m_functor(tmp, Scalar(_other.coeff(index)));
|
||||
tmp = m_functor(tmp, _other.coeff(index));
|
||||
}
|
||||
|
||||
template<typename OtherDerived, int StoreMode, int LoadMode>
|
||||
|
@ -50,8 +50,7 @@ struct ei_traits<Transpose<MatrixType> > : ei_traits<MatrixType>
|
||||
ColsAtCompileTime = MatrixType::RowsAtCompileTime,
|
||||
MaxRowsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
||||
MaxColsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
||||
Flags = (int(_MatrixTypeNested::Flags & ~NestByRefBit) ^ RowMajorBit)
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
Flags = int(_MatrixTypeNested::Flags & ~NestByRefBit) ^ RowMajorBit,
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
};
|
||||
@ -64,7 +63,7 @@ template<typename MatrixType> class Transpose
|
||||
public:
|
||||
|
||||
typedef typename TransposeImpl<MatrixType,typename ei_traits<MatrixType>::StorageType>::Base Base;
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE_NEW(Transpose)
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE_NEW(Transpose)
|
||||
|
||||
inline Transpose(const MatrixType& matrix) : m_matrix(matrix) {}
|
||||
|
||||
|
@ -130,8 +130,7 @@ struct ei_traits<TriangularView<MatrixType, _Mode> > : ei_traits<MatrixType>
|
||||
typedef MatrixType ExpressionType;
|
||||
enum {
|
||||
Mode = _Mode,
|
||||
Flags = (_MatrixTypeNested::Flags & (HereditaryBits) & (~(PacketAccessBit | DirectAccessBit | LinearAccessBit))) | Mode
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
Flags = (_MatrixTypeNested::Flags & (HereditaryBits) & (~(PacketAccessBit | DirectAccessBit | LinearAccessBit))) | Mode,
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
};
|
||||
|
@ -81,10 +81,8 @@ struct ei_traits<GeneralProduct<LhsNested,RhsNested,UnrolledProduct> >
|
||||
Flags = ((unsigned int)(LhsFlags | RhsFlags) & HereditaryBits & RemovedBits)
|
||||
| EvalBeforeAssigningBit
|
||||
| EvalBeforeNestingBit
|
||||
| NestParentByRefBit
|
||||
| (CanVectorizeLhs || CanVectorizeRhs ? PacketAccessBit : 0)
|
||||
| (LhsFlags & RhsFlags & AlignedBit)
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(LhsFlags|RhsFlags),
|
||||
| (LhsFlags & RhsFlags & AlignedBit),
|
||||
|
||||
CoeffReadCost = InnerSize == Dynamic ? Dynamic
|
||||
: InnerSize * (NumTraits<Scalar>::MulCost + LhsCoeffReadCost + RhsCoeffReadCost)
|
||||
|
@ -97,7 +97,6 @@ const unsigned int EvalBeforeAssigningBit = 0x4;
|
||||
*/
|
||||
const unsigned int PacketAccessBit = 0x8;
|
||||
|
||||
const unsigned int NestParentByRefBit = 0x80;
|
||||
const unsigned int NestByRefBit = 0x100;
|
||||
|
||||
#ifdef EIGEN_VECTORIZE
|
||||
|
@ -201,28 +201,6 @@ template<typename T> struct ei_plain_matrix_type_row_major
|
||||
// we should be able to get rid of this one too
|
||||
template<typename T> struct ei_must_nest_by_value { enum { ret = false }; };
|
||||
|
||||
template<class T>
|
||||
struct ei_is_reference
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
static void check() { std::cout << typeid(T).name() << std::endl; }
|
||||
#else
|
||||
static void check() {}
|
||||
#endif
|
||||
enum { ret = false };
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct ei_is_reference<T&>
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
static void check() { std::cout << typeid(T).name() << "&" << std::endl; }
|
||||
#else
|
||||
static void check() {}
|
||||
#endif
|
||||
enum { ret = true };
|
||||
};
|
||||
|
||||
/**
|
||||
* The reference selector for template expressions. The idea is that we don't
|
||||
* need to use references for expressions since they are light weight proxy
|
||||
@ -238,8 +216,6 @@ struct ei_ref_selector
|
||||
>::ret type;
|
||||
};
|
||||
|
||||
#define EIGEN_PROPAGATE_NESTING_BIT(ReferenceFlags) ((ReferenceFlags) & NestParentByRefBit)<<1
|
||||
|
||||
/** \internal Determines how a given expression should be nested into another one.
|
||||
* For example, when you do a * (b+c), Eigen will determine how the expression b+c should be
|
||||
* nested into the bigger product expression. The choice is between nesting the expression b+c as-is, or
|
||||
|
@ -55,8 +55,7 @@ struct ei_traits<Homogeneous<MatrixType,Direction> >
|
||||
ColsAtCompileTime = Direction==Horizontal ? ColsPlusOne : MatrixType::ColsAtCompileTime,
|
||||
MaxRowsAtCompileTime = RowsAtCompileTime,
|
||||
MaxColsAtCompileTime = ColsAtCompileTime,
|
||||
Flags = _MatrixTypeNested::Flags & HereditaryBits
|
||||
| EIGEN_PROPAGATE_NESTING_BIT(ei_traits<MatrixType>::Flags),
|
||||
Flags = _MatrixTypeNested::Flags & HereditaryBits,
|
||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user