mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-23 10:09:36 +08:00
change the value of Dynamic to -1, since the index type is now configurable.
remove EIGEN_ENUM_MIN/MAX, implement new macros instead
This commit is contained in:
parent
52e8c42a00
commit
bdd7c6c88a
@ -89,8 +89,10 @@ struct ei_any_unroller<Derived, Dynamic>
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline bool DenseBase<Derived>::all() const
|
inline bool DenseBase<Derived>::all() const
|
||||||
{
|
{
|
||||||
const bool unroll = SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost)
|
const bool unroll = SizeAtCompileTime != Dynamic
|
||||||
<= EIGEN_UNROLLING_LIMIT;
|
&& CoeffReadCost != Dynamic
|
||||||
|
&& NumTraits<Scalar>::AddCost != Dynamic
|
||||||
|
&& SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost) <= EIGEN_UNROLLING_LIMIT;
|
||||||
if(unroll)
|
if(unroll)
|
||||||
return ei_all_unroller<Derived,
|
return ei_all_unroller<Derived,
|
||||||
unroll ? int(SizeAtCompileTime) : Dynamic
|
unroll ? int(SizeAtCompileTime) : Dynamic
|
||||||
@ -113,8 +115,10 @@ inline bool DenseBase<Derived>::all() const
|
|||||||
template<typename Derived>
|
template<typename Derived>
|
||||||
inline bool DenseBase<Derived>::any() const
|
inline bool DenseBase<Derived>::any() const
|
||||||
{
|
{
|
||||||
const bool unroll = SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost)
|
const bool unroll = SizeAtCompileTime != Dynamic
|
||||||
<= EIGEN_UNROLLING_LIMIT;
|
&& CoeffReadCost != Dynamic
|
||||||
|
&& NumTraits<Scalar>::AddCost != Dynamic
|
||||||
|
&& SizeAtCompileTime * (CoeffReadCost + NumTraits<Scalar>::AddCost) <= EIGEN_UNROLLING_LIMIT;
|
||||||
if(unroll)
|
if(unroll)
|
||||||
return ei_any_unroller<Derived,
|
return ei_any_unroller<Derived,
|
||||||
unroll ? int(SizeAtCompileTime) : Dynamic
|
unroll ? int(SizeAtCompileTime) : Dynamic
|
||||||
|
@ -58,7 +58,7 @@ struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
|
|||||||
MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime,
|
||||||
Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits,
|
Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits,
|
||||||
CoeffReadCost = ei_traits<typename ei_cleantype<ConditionMatrixNested>::type>::CoeffReadCost
|
CoeffReadCost = ei_traits<typename ei_cleantype<ConditionMatrixNested>::type>::CoeffReadCost
|
||||||
+ EIGEN_ENUM_MAX(ei_traits<typename ei_cleantype<ThenMatrixNested>::type>::CoeffReadCost,
|
+ EIGEN_SIZE_MAX(ei_traits<typename ei_cleantype<ThenMatrixNested>::type>::CoeffReadCost,
|
||||||
ei_traits<typename ei_cleantype<ElseMatrixNested>::type>::CoeffReadCost)
|
ei_traits<typename ei_cleantype<ElseMatrixNested>::type>::CoeffReadCost)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,8 @@ private:
|
|||||||
&& (DstIsAligned || MaxSizeAtCompileTime == Dynamic),
|
&& (DstIsAligned || MaxSizeAtCompileTime == Dynamic),
|
||||||
/* If the destination isn't aligned, we have to do runtime checks and we don't unroll,
|
/* If the destination isn't aligned, we have to do runtime checks and we don't unroll,
|
||||||
so it's only good for large enough sizes. */
|
so it's only good for large enough sizes. */
|
||||||
MaySliceVectorize = MightVectorize && DstHasDirectAccess && int(InnerMaxSize)>=3*PacketSize
|
MaySliceVectorize = MightVectorize && DstHasDirectAccess
|
||||||
|
&& (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=3*PacketSize)
|
||||||
/* slice vectorization can be slow, so we only want it if the slices are big, which is
|
/* slice vectorization can be slow, so we only want it if the slices are big, which is
|
||||||
indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block
|
indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block
|
||||||
in a fixed-size matrix */
|
in a fixed-size matrix */
|
||||||
@ -86,8 +87,12 @@ public:
|
|||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
UnrollingLimit = EIGEN_UNROLLING_LIMIT * (Vectorized ? int(PacketSize) : 1),
|
UnrollingLimit = EIGEN_UNROLLING_LIMIT * (Vectorized ? int(PacketSize) : 1),
|
||||||
MayUnrollCompletely = int(Derived::SizeAtCompileTime) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit),
|
MayUnrollCompletely = int(Derived::SizeAtCompileTime) != Dynamic
|
||||||
MayUnrollInner = int(InnerSize) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit)
|
&& int(OtherDerived::CoeffReadCost) != Dynamic
|
||||||
|
&& int(Derived::SizeAtCompileTime) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit),
|
||||||
|
MayUnrollInner = int(InnerSize) != Dynamic
|
||||||
|
&& int(OtherDerived::CoeffReadCost) != Dynamic
|
||||||
|
&& int(InnerSize) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit)
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -138,9 +138,8 @@ class BandMatrix : public EigenBase<BandMatrix<_Scalar,Rows,Cols,Supers,Subs,Opt
|
|||||||
DiagonalSize = (RowsAtCompileTime==Dynamic || ColsAtCompileTime==Dynamic)
|
DiagonalSize = (RowsAtCompileTime==Dynamic || ColsAtCompileTime==Dynamic)
|
||||||
? Dynamic
|
? Dynamic
|
||||||
: (ActualIndex<0
|
: (ActualIndex<0
|
||||||
// we handled Dynamic already, so can use EIGEN_ENUM_MIN safely here.
|
? EIGEN_SIZE_MIN(ColsAtCompileTime, RowsAtCompileTime + ActualIndex)
|
||||||
? EIGEN_ENUM_MIN(ColsAtCompileTime, RowsAtCompileTime + ActualIndex)
|
: EIGEN_SIZE_MIN(RowsAtCompileTime, ColsAtCompileTime - ActualIndex))
|
||||||
: EIGEN_ENUM_MIN(RowsAtCompileTime, ColsAtCompileTime - ActualIndex))
|
|
||||||
};
|
};
|
||||||
typedef Block<DataType,1, DiagonalSize> BuildType;
|
typedef Block<DataType,1, DiagonalSize> BuildType;
|
||||||
typedef typename ei_meta_if<Conjugate,
|
typedef typename ei_meta_if<Conjugate,
|
||||||
|
@ -50,9 +50,12 @@ struct ei_traits<CwiseUnaryView<ViewOp, MatrixType> >
|
|||||||
Flags = (ei_traits<_MatrixTypeNested>::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)),
|
Flags = (ei_traits<_MatrixTypeNested>::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)),
|
||||||
CoeffReadCost = ei_traits<_MatrixTypeNested>::CoeffReadCost + ei_functor_traits<ViewOp>::Cost,
|
CoeffReadCost = ei_traits<_MatrixTypeNested>::CoeffReadCost + ei_functor_traits<ViewOp>::Cost,
|
||||||
MatrixTypeInnerStride = ei_inner_stride_at_compile_time<MatrixType>::ret,
|
MatrixTypeInnerStride = ei_inner_stride_at_compile_time<MatrixType>::ret,
|
||||||
|
// need to cast the sizeof's from size_t to int explicitly, otherwise:
|
||||||
|
// "error: no integral type can represent all of the enumerator values
|
||||||
InnerStrideAtCompileTime = MatrixTypeInnerStride == Dynamic
|
InnerStrideAtCompileTime = MatrixTypeInnerStride == Dynamic
|
||||||
? Dynamic
|
? int(Dynamic)
|
||||||
: MatrixTypeInnerStride * sizeof(typename ei_traits<MatrixType>::Scalar) / sizeof(Scalar),
|
: int(MatrixTypeInnerStride)
|
||||||
|
* int(sizeof(typename ei_traits<MatrixType>::Scalar) / sizeof(Scalar)),
|
||||||
OuterStrideAtCompileTime = ei_outer_stride_at_compile_time<MatrixType>::ret
|
OuterStrideAtCompileTime = ei_outer_stride_at_compile_time<MatrixType>::ret
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -512,15 +512,12 @@ class DenseStorageBase : public ei_dense_xpr_base<Derived>::type
|
|||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor)
|
EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor)
|
||||||
&& EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0)
|
&& EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0)
|
||||||
&& (RowsAtCompileTime >= MaxRowsAtCompileTime)
|
&& ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0))
|
||||||
&& (ColsAtCompileTime >= MaxColsAtCompileTime)
|
&& ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0))
|
||||||
&& (MaxRowsAtCompileTime >= 0)
|
&& ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0))
|
||||||
&& (MaxColsAtCompileTime >= 0)
|
&& ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0))
|
||||||
&& (RowsAtCompileTime <= Dynamic)
|
|
||||||
&& (ColsAtCompileTime <= Dynamic)
|
|
||||||
&& (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic)
|
&& (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic)
|
||||||
&& (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic)
|
&& (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic)
|
||||||
&& ((MaxRowsAtCompileTime==Dynamic?1:MaxRowsAtCompileTime)*(MaxColsAtCompileTime==Dynamic?1:MaxColsAtCompileTime)<Dynamic)
|
|
||||||
&& (Options & (DontAlign|RowMajor)) == Options),
|
&& (Options & (DontAlign|RowMajor)) == Options),
|
||||||
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
INVALID_MATRIX_TEMPLATE_PARAMETERS)
|
||||||
}
|
}
|
||||||
|
@ -51,13 +51,15 @@ struct ei_traits<Diagonal<MatrixType,DiagIndex> >
|
|||||||
typedef typename MatrixType::StorageKind StorageKind;
|
typedef typename MatrixType::StorageKind StorageKind;
|
||||||
enum {
|
enum {
|
||||||
AbsDiagIndex = DiagIndex<0 ? -DiagIndex : DiagIndex, // only used if DiagIndex != Dynamic
|
AbsDiagIndex = DiagIndex<0 ? -DiagIndex : DiagIndex, // only used if DiagIndex != Dynamic
|
||||||
|
// FIXME these computations are broken in the case where the matrix is rectangular and DiagIndex!=0
|
||||||
RowsAtCompileTime = (int(DiagIndex) == Dynamic || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic
|
RowsAtCompileTime = (int(DiagIndex) == Dynamic || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic
|
||||||
: (EIGEN_ENUM_MIN(MatrixType::RowsAtCompileTime,
|
: (EIGEN_SIZE_MIN(MatrixType::RowsAtCompileTime,
|
||||||
MatrixType::ColsAtCompileTime) - AbsDiagIndex),
|
MatrixType::ColsAtCompileTime) - AbsDiagIndex),
|
||||||
ColsAtCompileTime = 1,
|
ColsAtCompileTime = 1,
|
||||||
MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic
|
MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic
|
||||||
: DiagIndex == Dynamic ? EIGEN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime)
|
: DiagIndex == Dynamic ? EIGEN_MAXSIZE_MIN(MatrixType::MaxRowsAtCompileTime,
|
||||||
: (EIGEN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) - AbsDiagIndex),
|
MatrixType::MaxColsAtCompileTime)
|
||||||
|
: (EIGEN_MAXSIZE_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime) - AbsDiagIndex),
|
||||||
MaxColsAtCompileTime = 1,
|
MaxColsAtCompileTime = 1,
|
||||||
Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit) & ~RowMajorBit,
|
Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit) & ~RowMajorBit,
|
||||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost,
|
CoeffReadCost = _MatrixTypeNested::CoeffReadCost,
|
||||||
|
@ -79,10 +79,14 @@ struct ei_traits<Map<PlainObjectType, MapOptions, StrideType> >
|
|||||||
{
|
{
|
||||||
typedef typename PlainObjectType::Scalar Scalar;
|
typedef typename PlainObjectType::Scalar Scalar;
|
||||||
enum {
|
enum {
|
||||||
InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime,
|
InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
|
||||||
OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime,
|
? int(PlainObjectType::InnerStrideAtCompileTime)
|
||||||
HasNoInnerStride = InnerStrideAtCompileTime <= 1,
|
: int(StrideType::InnerStrideAtCompileTime),
|
||||||
HasNoOuterStride = OuterStrideAtCompileTime == 0,
|
OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
|
||||||
|
? int(PlainObjectType::OuterStrideAtCompileTime)
|
||||||
|
: int(StrideType::OuterStrideAtCompileTime),
|
||||||
|
HasNoInnerStride = InnerStrideAtCompileTime == 1,
|
||||||
|
HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
|
||||||
HasNoStride = HasNoInnerStride && HasNoOuterStride,
|
HasNoStride = HasNoInnerStride && HasNoOuterStride,
|
||||||
IsAligned = int(int(MapOptions)&Aligned)==Aligned,
|
IsAligned = int(int(MapOptions)&Aligned)==Aligned,
|
||||||
IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic,
|
IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic,
|
||||||
|
@ -185,10 +185,11 @@ template<typename Derived> class MapBase
|
|||||||
|
|
||||||
void checkSanity() const
|
void checkSanity() const
|
||||||
{
|
{
|
||||||
ei_assert( ((!(ei_traits<Derived>::Flags&AlignedBit))
|
EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(ei_traits<Derived>::Flags&PacketAccessBit,
|
||||||
|| ((size_t(m_data)&0xf)==0)) && "data is not aligned");
|
ei_inner_stride_at_compile_time<Derived>::ret==1),
|
||||||
ei_assert( ((!(ei_traits<Derived>::Flags&PacketAccessBit))
|
PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
|
||||||
|| (innerStride()==1)) && "packet access incompatible with inner stride greater than 1");
|
ei_assert(EIGEN_IMPLIES(ei_traits<Derived>::Flags&AlignedBit, (size_t(m_data)&0xf)==0)
|
||||||
|
&& "data is not aligned");
|
||||||
}
|
}
|
||||||
|
|
||||||
const Scalar* EIGEN_RESTRICT m_data;
|
const Scalar* EIGEN_RESTRICT m_data;
|
||||||
|
@ -98,8 +98,8 @@ template<typename Derived> class MatrixBase
|
|||||||
|
|
||||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||||
/** type of the equivalent square matrix */
|
/** type of the equivalent square matrix */
|
||||||
typedef Matrix<Scalar,EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime),
|
typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime),
|
||||||
EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
|
EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
|
||||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
||||||
|
|
||||||
/** \returns the size of the main diagonal, which is min(rows(),cols()).
|
/** \returns the size of the main diagonal, which is min(rows(),cols()).
|
||||||
|
@ -61,16 +61,16 @@ template<typename Lhs, typename Rhs> struct ei_product_type
|
|||||||
enum {
|
enum {
|
||||||
Rows = _Lhs::MaxRowsAtCompileTime,
|
Rows = _Lhs::MaxRowsAtCompileTime,
|
||||||
Cols = _Rhs::MaxColsAtCompileTime,
|
Cols = _Rhs::MaxColsAtCompileTime,
|
||||||
Depth = EIGEN_ENUM_MIN(_Lhs::MaxColsAtCompileTime,_Rhs::MaxRowsAtCompileTime)
|
Depth = EIGEN_MAXSIZE_MIN(_Lhs::MaxColsAtCompileTime,_Rhs::MaxRowsAtCompileTime)
|
||||||
};
|
};
|
||||||
|
|
||||||
// the splitting into different lines of code here, introducing the _select enums and the typedef below,
|
// the splitting into different lines of code here, introducing the _select enums and the typedef below,
|
||||||
// is to work around an internal compiler error with gcc 4.1 and 4.2.
|
// is to work around an internal compiler error with gcc 4.1 and 4.2.
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
rows_select = Rows >=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Rows==1 ? 1 : Small),
|
rows_select = Rows == Dynamic || Rows >=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Rows==1 ? 1 : Small),
|
||||||
cols_select = Cols >=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Cols==1 ? 1 : Small),
|
cols_select = Cols == Dynamic || Cols >=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Cols==1 ? 1 : Small),
|
||||||
depth_select = Depth>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Depth==1 ? 1 : Small)
|
depth_select = Depth == Dynamic || Depth>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD ? Large : (Depth==1 ? 1 : Small)
|
||||||
};
|
};
|
||||||
typedef ei_product_type_selector<rows_select, cols_select, depth_select> product_type_selector;
|
typedef ei_product_type_selector<rows_select, cols_select, depth_select> product_type_selector;
|
||||||
|
|
||||||
@ -78,6 +78,18 @@ public:
|
|||||||
enum {
|
enum {
|
||||||
value = product_type_selector::ret
|
value = product_type_selector::ret
|
||||||
};
|
};
|
||||||
|
#ifdef EIGEN_DEBUG_PRODUCT
|
||||||
|
static void debug()
|
||||||
|
{
|
||||||
|
EIGEN_DEBUG_VAR(Rows);
|
||||||
|
EIGEN_DEBUG_VAR(Cols);
|
||||||
|
EIGEN_DEBUG_VAR(Depth);
|
||||||
|
EIGEN_DEBUG_VAR(rows_select);
|
||||||
|
EIGEN_DEBUG_VAR(cols_select);
|
||||||
|
EIGEN_DEBUG_VAR(depth_select);
|
||||||
|
EIGEN_DEBUG_VAR(value);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The following allows to select the kind of product at compile time
|
/* The following allows to select the kind of product at compile time
|
||||||
@ -440,6 +452,9 @@ MatrixBase<Derived>::operator*(const MatrixBase<OtherDerived> &other) const
|
|||||||
EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
|
EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors),
|
||||||
INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
|
INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION)
|
||||||
EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
|
EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT)
|
||||||
|
#ifdef EIGEN_DEBUG_PRODUCT
|
||||||
|
ei_product_type<Derived,OtherDerived>::debug();
|
||||||
|
#endif
|
||||||
return typename ProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
|
return typename ProductReturnType<Derived,OtherDerived>::Type(derived(), other.derived());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,14 +61,18 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
Cost = Derived::SizeAtCompileTime * Derived::CoeffReadCost
|
Cost = ( Derived::SizeAtCompileTime == Dynamic
|
||||||
+ (Derived::SizeAtCompileTime-1) * NumTraits<typename Derived::Scalar>::AddCost,
|
|| Derived::CoeffReadCost == Dynamic
|
||||||
|
|| (Derived::SizeAtCompileTime!=1 && ei_functor_traits<Func>::Cost == Dynamic)
|
||||||
|
) ? Dynamic
|
||||||
|
: Derived::SizeAtCompileTime * Derived::CoeffReadCost
|
||||||
|
+ (Derived::SizeAtCompileTime-1) * ei_functor_traits<Func>::Cost,
|
||||||
UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize))
|
UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize))
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
Unrolling = Cost <= UnrollingLimit
|
Unrolling = Cost != Dynamic && Cost <= UnrollingLimit
|
||||||
? CompleteUnrolling
|
? CompleteUnrolling
|
||||||
: NoUnrolling
|
: NoUnrolling
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ class ei_trsolve_traits
|
|||||||
};
|
};
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
Unrolling = (RhsIsVectorAtCompileTime && Rhs::SizeAtCompileTime <= 8)
|
Unrolling = (RhsIsVectorAtCompileTime && Rhs::SizeAtCompileTime != Dynamic && Rhs::SizeAtCompileTime <= 8)
|
||||||
? CompleteUnrolling : NoUnrolling,
|
? CompleteUnrolling : NoUnrolling,
|
||||||
RhsVectors = RhsIsVectorAtCompileTime ? 1 : Dynamic
|
RhsVectors = RhsIsVectorAtCompileTime ? 1 : Dynamic
|
||||||
};
|
};
|
||||||
|
@ -508,7 +508,9 @@ template<typename MatrixType, unsigned int Mode>
|
|||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
void TriangularView<MatrixType, Mode>::lazyAssign(const MatrixBase<OtherDerived>& other)
|
void TriangularView<MatrixType, Mode>::lazyAssign(const MatrixBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
const bool unroll = MatrixType::SizeAtCompileTime * ei_traits<OtherDerived>::CoeffReadCost / 2
|
const bool unroll = MatrixType::SizeAtCompileTime != Dynamic
|
||||||
|
&& ei_traits<OtherDerived>::CoeffReadCost != Dynamic
|
||||||
|
&& MatrixType::SizeAtCompileTime * ei_traits<OtherDerived>::CoeffReadCost / 2
|
||||||
<= EIGEN_UNROLLING_LIMIT;
|
<= EIGEN_UNROLLING_LIMIT;
|
||||||
ei_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
|
ei_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
|
||||||
|
|
||||||
@ -542,7 +544,9 @@ template<typename MatrixType, unsigned int Mode>
|
|||||||
template<typename OtherDerived>
|
template<typename OtherDerived>
|
||||||
void TriangularView<MatrixType, Mode>::lazyAssign(const TriangularBase<OtherDerived>& other)
|
void TriangularView<MatrixType, Mode>::lazyAssign(const TriangularBase<OtherDerived>& other)
|
||||||
{
|
{
|
||||||
const bool unroll = MatrixType::SizeAtCompileTime * ei_traits<OtherDerived>::CoeffReadCost / 2
|
const bool unroll = MatrixType::SizeAtCompileTime != Dynamic
|
||||||
|
&& ei_traits<OtherDerived>::CoeffReadCost != Dynamic
|
||||||
|
&& MatrixType::SizeAtCompileTime * ei_traits<OtherDerived>::CoeffReadCost / 2
|
||||||
<= EIGEN_UNROLLING_LIMIT;
|
<= EIGEN_UNROLLING_LIMIT;
|
||||||
ei_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
|
ei_assert(m_matrix.rows() == other.rows() && m_matrix.cols() == other.cols());
|
||||||
|
|
||||||
@ -579,7 +583,9 @@ template<typename Derived>
|
|||||||
template<typename DenseDerived>
|
template<typename DenseDerived>
|
||||||
void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
|
void TriangularBase<Derived>::evalToLazy(MatrixBase<DenseDerived> &other) const
|
||||||
{
|
{
|
||||||
const bool unroll = DenseDerived::SizeAtCompileTime * Derived::CoeffReadCost / 2
|
const bool unroll = DenseDerived::SizeAtCompileTime != Dynamic
|
||||||
|
&& ei_traits<Derived>::CoeffReadCost != Dynamic
|
||||||
|
&& DenseDerived::SizeAtCompileTime * ei_traits<Derived>::CoeffReadCost / 2
|
||||||
<= EIGEN_UNROLLING_LIMIT;
|
<= EIGEN_UNROLLING_LIMIT;
|
||||||
ei_assert(this->rows() == other.rows() && this->cols() == other.cols());
|
ei_assert(this->rows() == other.rows() && this->cols() == other.cols());
|
||||||
|
|
||||||
|
@ -86,8 +86,10 @@ template<typename Derived>
|
|||||||
template<typename Visitor>
|
template<typename Visitor>
|
||||||
void DenseBase<Derived>::visit(Visitor& visitor) const
|
void DenseBase<Derived>::visit(Visitor& visitor) const
|
||||||
{
|
{
|
||||||
const bool unroll = SizeAtCompileTime * CoeffReadCost
|
const bool unroll = SizeAtCompileTime != Dynamic
|
||||||
+ (SizeAtCompileTime-1) * ei_functor_traits<Visitor>::Cost
|
&& CoeffReadCost != Dynamic
|
||||||
|
&& (SizeAtCompileTime == 1 || ei_functor_traits<Visitor>::Cost != Dynamic)
|
||||||
|
&& SizeAtCompileTime * CoeffReadCost + (SizeAtCompileTime-1) * ei_functor_traits<Visitor>::Cost
|
||||||
<= EIGEN_UNROLLING_LIMIT;
|
<= EIGEN_UNROLLING_LIMIT;
|
||||||
return ei_visitor_impl<Visitor, Derived,
|
return ei_visitor_impl<Visitor, Derived,
|
||||||
unroll ? int(SizeAtCompileTime) : Dynamic
|
unroll ? int(SizeAtCompileTime) : Dynamic
|
||||||
|
@ -63,7 +63,7 @@ struct ei_traits<CoeffBasedProduct<LhsNested,RhsNested,NestingFlags> >
|
|||||||
|
|
||||||
RowsAtCompileTime = _LhsNested::RowsAtCompileTime,
|
RowsAtCompileTime = _LhsNested::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = _RhsNested::ColsAtCompileTime,
|
ColsAtCompileTime = _RhsNested::ColsAtCompileTime,
|
||||||
InnerSize = EIGEN_ENUM_MIN(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
|
InnerSize = EIGEN_SIZE_MIN(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
|
||||||
|
|
||||||
MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
|
||||||
@ -130,7 +130,7 @@ class CoeffBasedProduct
|
|||||||
enum {
|
enum {
|
||||||
PacketSize = ei_packet_traits<Scalar>::size,
|
PacketSize = ei_packet_traits<Scalar>::size,
|
||||||
InnerSize = ei_traits<CoeffBasedProduct>::InnerSize,
|
InnerSize = ei_traits<CoeffBasedProduct>::InnerSize,
|
||||||
Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT,
|
Unroll = CoeffReadCost != Dynamic && CoeffReadCost <= EIGEN_UNROLLING_LIMIT,
|
||||||
CanVectorizeInner = ei_traits<CoeffBasedProduct>::CanVectorizeInner
|
CanVectorizeInner = ei_traits<CoeffBasedProduct>::CanVectorizeInner
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -269,14 +269,6 @@ struct ei_product_coeff_impl<DefaultTraversal, Dynamic, Lhs, Rhs, RetScalar>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// prevent buggy user code from causing an infinite recursion
|
|
||||||
template<typename Lhs, typename Rhs, typename RetScalar>
|
|
||||||
struct ei_product_coeff_impl<DefaultTraversal, -1, Lhs, Rhs, RetScalar>
|
|
||||||
{
|
|
||||||
typedef typename Lhs::Index Index;
|
|
||||||
EIGEN_STRONG_INLINE static void run(Index, Index, const Lhs&, const Rhs&, RetScalar&) {}
|
|
||||||
};
|
|
||||||
|
|
||||||
/*******************************************
|
/*******************************************
|
||||||
*** Scalar path with inner vectorization ***
|
*** Scalar path with inner vectorization ***
|
||||||
*******************************************/
|
*******************************************/
|
||||||
|
@ -163,7 +163,7 @@ struct ei_sybb_kernel
|
|||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
PacketSize = ei_packet_traits<Scalar>::size,
|
PacketSize = ei_packet_traits<Scalar>::size,
|
||||||
BlockSize = EIGEN_ENUM_MAX(mr,nr)
|
BlockSize = EIGEN_PLAIN_ENUM_MAX(mr,nr)
|
||||||
};
|
};
|
||||||
void operator()(Scalar* res, Index resStride, const Scalar* blockA, const Scalar* blockB, Index size, Index depth, Scalar* workspace)
|
void operator()(Scalar* res, Index resStride, const Scalar* blockA, const Scalar* blockB, Index size, Index depth, Scalar* workspace)
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,true,
|
|||||||
|
|
||||||
typedef ei_product_blocking_traits<Scalar> Blocking;
|
typedef ei_product_blocking_traits<Scalar> Blocking;
|
||||||
enum {
|
enum {
|
||||||
SmallPanelWidth = EIGEN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
||||||
IsLower = (Mode&Lower) == Lower
|
IsLower = (Mode&Lower) == Lower
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ struct ei_product_triangular_matrix_matrix<Scalar,Index,Mode,false,
|
|||||||
|
|
||||||
typedef ei_product_blocking_traits<Scalar> Blocking;
|
typedef ei_product_blocking_traits<Scalar> Blocking;
|
||||||
enum {
|
enum {
|
||||||
SmallPanelWidth = EIGEN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
||||||
IsLower = (Mode&Lower) == Lower
|
IsLower = (Mode&Lower) == Lower
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheLeft,Mode,Conjugate,TriStora
|
|||||||
|
|
||||||
typedef ei_product_blocking_traits<Scalar> Blocking;
|
typedef ei_product_blocking_traits<Scalar> Blocking;
|
||||||
enum {
|
enum {
|
||||||
SmallPanelWidth = EIGEN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
||||||
IsLower = (Mode&Lower) == Lower
|
IsLower = (Mode&Lower) == Lower
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ struct ei_triangular_solve_matrix<Scalar,Index,OnTheRight,Mode,Conjugate,TriStor
|
|||||||
typedef ei_product_blocking_traits<Scalar> Blocking;
|
typedef ei_product_blocking_traits<Scalar> Blocking;
|
||||||
enum {
|
enum {
|
||||||
RhsStorageOrder = TriStorageOrder,
|
RhsStorageOrder = TriStorageOrder,
|
||||||
SmallPanelWidth = EIGEN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
SmallPanelWidth = EIGEN_PLAIN_ENUM_MAX(Blocking::mr,Blocking::nr),
|
||||||
IsLower = (Mode&Lower) == Lower
|
IsLower = (Mode&Lower) == Lower
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -29,19 +29,9 @@
|
|||||||
/** This value means that a quantity is not known at compile-time, and that instead the value is
|
/** This value means that a quantity is not known at compile-time, and that instead the value is
|
||||||
* stored in some runtime variable.
|
* stored in some runtime variable.
|
||||||
*
|
*
|
||||||
* Explanation for the choice of this value:
|
|
||||||
* - It should be positive and larger than the number of entries in any reasonable fixed-size matrix.
|
|
||||||
* This allows to simplify many compile-time conditions throughout Eigen.
|
|
||||||
* - It should be smaller than the sqrt of INT_MAX. Indeed, we often multiply a number of rows with a number
|
|
||||||
* of columns in order to compute a number of coefficients. Even if we guard that with an "if" checking whether
|
|
||||||
* the values are Dynamic, we still get a compiler warning "integer overflow". So the only way to get around
|
|
||||||
* it would be a meta-selector. Doing this everywhere would reduce code readability and lengthen compilation times.
|
|
||||||
* Also, disabling compiler warnings for integer overflow, sounds like a bad idea.
|
|
||||||
* - It should be a prime number, because for example the old value 10000 led to bugs with 100x100 matrices.
|
|
||||||
*
|
|
||||||
* Changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for Matrix.
|
* Changing the value of Dynamic breaks the ABI, as Dynamic is often used as a template parameter for Matrix.
|
||||||
*/
|
*/
|
||||||
const int Dynamic = sizeof(int) >= 4 ? 33331 : 101;
|
const int Dynamic = -1;
|
||||||
|
|
||||||
/** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm<int>().
|
/** This value means +Infinity; it is currently used only as the p parameter to MatrixBase::lpNorm<int>().
|
||||||
* The value Infinity there means the L-infinity norm.
|
* The value Infinity there means the L-infinity norm.
|
||||||
|
@ -306,11 +306,31 @@
|
|||||||
using Base::const_cast_derived;
|
using Base::const_cast_derived;
|
||||||
|
|
||||||
|
|
||||||
#define EIGEN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
|
#define EIGEN_PLAIN_ENUM_MIN(a,b) (((int)a <= (int)b) ? (int)a : (int)b)
|
||||||
#define EIGEN_SIZE_MIN(a,b) (((int)a == 1 || (int)b == 1) ? 1 \
|
#define EIGEN_PLAIN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
|
||||||
|
|
||||||
|
// EIGEN_SIZE_MIN gives the min between compile-time sizes. 0 has absolute priority, followed by 1,
|
||||||
|
// followed by Dynamic, followed by other finite values. The reason for giving Dynamic the priority over
|
||||||
|
// finite values is that min(3, Dynamic) should be Dynamic, since that could be anything between 0 and 3.
|
||||||
|
#define EIGEN_SIZE_MIN(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
|
||||||
|
: ((int)a == 1 || (int)b == 1) ? 1 \
|
||||||
: ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
|
: ((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
|
||||||
: ((int)a <= (int)b) ? (int)a : (int)b)
|
: ((int)a <= (int)b) ? (int)a : (int)b)
|
||||||
#define EIGEN_ENUM_MAX(a,b) (((int)a >= (int)b) ? (int)a : (int)b)
|
|
||||||
|
// EIGEN_MAXSIZE_MIN is a variant of EIGEN_SIZE_MIN comparing MaxSizes. The difference is that finite values
|
||||||
|
// now have priority over Dynamic, so that min(3, Dynamic) gives 3. Indeed, whatever the actual value is
|
||||||
|
// (between 0 and 3), it is not more than 3.
|
||||||
|
#define EIGEN_MAXSIZE_MIN(a,b) (((int)a == 0 || (int)b == 0) ? 0 \
|
||||||
|
: ((int)a == 1 || (int)b == 1) ? 1 \
|
||||||
|
: ((int)a == Dynamic && (int)b == Dynamic) ? Dynamic \
|
||||||
|
: ((int)a == Dynamic) ? (int)b \
|
||||||
|
: ((int)b == Dynamic) ? (int)a \
|
||||||
|
: ((int)a <= (int)b) ? (int)a : (int)b)
|
||||||
|
|
||||||
|
// see EIGEN_SIZE_MIN. No need for a separate variant for MaxSizes here.
|
||||||
|
#define EIGEN_SIZE_MAX(a,b) (((int)a == Dynamic || (int)b == Dynamic) ? Dynamic \
|
||||||
|
: ((int)a >= (int)b) ? (int)a : (int)b)
|
||||||
|
|
||||||
#define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
|
#define EIGEN_LOGICAL_XOR(a,b) (((a) || (b)) && !((a) && (b)))
|
||||||
|
|
||||||
#define EIGEN_IMPLIES(a,b) (!(a) || (b))
|
#define EIGEN_IMPLIES(a,b) (!(a) || (b))
|
||||||
|
@ -84,7 +84,8 @@
|
|||||||
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES,
|
THIS_METHOD_IS_ONLY_FOR_EXPRESSIONS_WITH_DIRECT_MEMORY_ACCESS_SUCH_AS_MAP_OR_PLAIN_MATRICES,
|
||||||
YOU_ALREADY_SPECIFIED_THIS_STRIDE,
|
YOU_ALREADY_SPECIFIED_THIS_STRIDE,
|
||||||
INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION,
|
INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION,
|
||||||
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD
|
THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD,
|
||||||
|
PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -293,9 +293,15 @@ struct ei_ref_selector
|
|||||||
*/
|
*/
|
||||||
template<typename T, int n=1, typename PlainObject = typename ei_eval<T>::type> struct ei_nested
|
template<typename T, int n=1, typename PlainObject = typename ei_eval<T>::type> struct ei_nested
|
||||||
{
|
{
|
||||||
|
// this is a direct port of the logic used when Dynamic was 33331, to make an atomic commit.
|
||||||
enum {
|
enum {
|
||||||
CostEval = (n+1) * int(NumTraits<typename ei_traits<T>::Scalar>::ReadCost),
|
_ScalarReadCost = NumTraits<typename ei_traits<T>::Scalar>::ReadCost,
|
||||||
CostNoEval = (n-1) * int(ei_traits<T>::CoeffReadCost)
|
ScalarReadCost = _ScalarReadCost == Dynamic ? 33331 : int(_ScalarReadCost),
|
||||||
|
_CoeffReadCost = int(ei_traits<T>::CoeffReadCost),
|
||||||
|
CoeffReadCost = _CoeffReadCost == Dynamic ? 33331 : int(_CoeffReadCost),
|
||||||
|
N = n == Dynamic ? 33331 : n,
|
||||||
|
CostEval = (N+1) * int(ScalarReadCost),
|
||||||
|
CostNoEval = (N-1) * int(CoeffReadCost)
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef typename ei_meta_if<
|
typedef typename ei_meta_if<
|
||||||
@ -304,6 +310,24 @@ template<typename T, int n=1, typename PlainObject = typename ei_eval<T>::type>
|
|||||||
PlainObject,
|
PlainObject,
|
||||||
typename ei_ref_selector<T>::type
|
typename ei_ref_selector<T>::type
|
||||||
>::ret type;
|
>::ret type;
|
||||||
|
|
||||||
|
/* this is what the above logic should be updated to look like:
|
||||||
|
enum {
|
||||||
|
ScalarReadCost = NumTraits<typename ei_traits<T>::Scalar>::ReadCost,
|
||||||
|
CoeffReadCost = ei_traits<T>::CoeffReadCost,
|
||||||
|
CostEval = n == Dynamic || ScalarReadCost == Dynamic ? int(Dynamic) : (n+1) * int(ScalarReadCost),
|
||||||
|
CostNoEval = n == Dynamic || (CoeffReadCost == Dynamic && n>1) ? int(Dynamic) : (n-1) * int(CoeffReadCost)
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef typename ei_meta_if<
|
||||||
|
( int(ei_traits<T>::Flags) & EvalBeforeNestingBit ) ||
|
||||||
|
( int(CostNoEval) == Dynamic ? true
|
||||||
|
: int(CostEval) == Dynamic ? false
|
||||||
|
: int(CostEval) <= int(CostNoEval) ),
|
||||||
|
PlainObject,
|
||||||
|
typename ei_ref_selector<T>::type
|
||||||
|
>::ret type;
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
template<unsigned int Flags> struct ei_are_flags_consistent
|
template<unsigned int Flags> struct ei_are_flags_consistent
|
||||||
@ -405,7 +429,7 @@ template<typename MatrixType, typename Scalar = typename MatrixType::Scalar>
|
|||||||
struct ei_plain_diag_type
|
struct ei_plain_diag_type
|
||||||
{
|
{
|
||||||
enum { diag_size = EIGEN_SIZE_MIN(MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime),
|
enum { diag_size = EIGEN_SIZE_MIN(MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime),
|
||||||
max_diag_size = EIGEN_SIZE_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime)
|
max_diag_size = EIGEN_MAXSIZE_MIN(MatrixType::MaxRowsAtCompileTime, MatrixType::MaxColsAtCompileTime)
|
||||||
};
|
};
|
||||||
typedef Matrix<Scalar, diag_size, 1, MatrixType::PlainObject::Options & ~RowMajor, max_diag_size, 1> type;
|
typedef Matrix<Scalar, diag_size, 1, MatrixType::PlainObject::Options & ~RowMajor, max_diag_size, 1> type;
|
||||||
};
|
};
|
||||||
|
@ -48,8 +48,8 @@ namespace
|
|||||||
MinRowsAtCompileTime = EIGEN_SIZE_MIN(MatrixType::RowsAtCompileTime, OtherMatrixType::RowsAtCompileTime),
|
MinRowsAtCompileTime = EIGEN_SIZE_MIN(MatrixType::RowsAtCompileTime, OtherMatrixType::RowsAtCompileTime),
|
||||||
|
|
||||||
// When possible we want to choose some small fixed size value since the result
|
// When possible we want to choose some small fixed size value since the result
|
||||||
// is likely to fit on the stack. Here EIGEN_ENUM_MIN is really what we want.
|
// is likely to fit on the stack. So here, EIGEN_SIZE_MIN is not what we want.
|
||||||
HomogeneousDimension = EIGEN_ENUM_MIN(MinRowsAtCompileTime+1, Dynamic)
|
HomogeneousDimension = int(MinRowsAtCompileTime) == Dynamic ? Dynamic : int(MinRowsAtCompileTime)+1
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef Matrix<typename ei_traits<MatrixType>::Scalar,
|
typedef Matrix<typename ei_traits<MatrixType>::Scalar,
|
||||||
|
@ -559,7 +559,7 @@ struct ei_kernel_retval<FullPivLU<_MatrixType> >
|
|||||||
{
|
{
|
||||||
EIGEN_MAKE_KERNEL_HELPERS(FullPivLU<_MatrixType>)
|
EIGEN_MAKE_KERNEL_HELPERS(FullPivLU<_MatrixType>)
|
||||||
|
|
||||||
enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN(
|
enum { MaxSmallDimAtCompileTime = EIGEN_MAXSIZE_MIN(
|
||||||
MatrixType::MaxColsAtCompileTime,
|
MatrixType::MaxColsAtCompileTime,
|
||||||
MatrixType::MaxRowsAtCompileTime)
|
MatrixType::MaxRowsAtCompileTime)
|
||||||
};
|
};
|
||||||
@ -644,7 +644,7 @@ struct ei_image_retval<FullPivLU<_MatrixType> >
|
|||||||
{
|
{
|
||||||
EIGEN_MAKE_IMAGE_HELPERS(FullPivLU<_MatrixType>)
|
EIGEN_MAKE_IMAGE_HELPERS(FullPivLU<_MatrixType>)
|
||||||
|
|
||||||
enum { MaxSmallDimAtCompileTime = EIGEN_SIZE_MIN(
|
enum { MaxSmallDimAtCompileTime = EIGEN_MAXSIZE_MIN(
|
||||||
MatrixType::MaxColsAtCompileTime,
|
MatrixType::MaxColsAtCompileTime,
|
||||||
MatrixType::MaxRowsAtCompileTime)
|
MatrixType::MaxRowsAtCompileTime)
|
||||||
};
|
};
|
||||||
|
@ -72,7 +72,7 @@ template<typename MatrixType, unsigned int Options> class JacobiSVD
|
|||||||
DiagSizeAtCompileTime = EIGEN_SIZE_MIN(RowsAtCompileTime,ColsAtCompileTime),
|
DiagSizeAtCompileTime = EIGEN_SIZE_MIN(RowsAtCompileTime,ColsAtCompileTime),
|
||||||
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime,
|
||||||
MaxDiagSizeAtCompileTime = EIGEN_SIZE_MIN(MaxRowsAtCompileTime,MaxColsAtCompileTime),
|
MaxDiagSizeAtCompileTime = EIGEN_MAXSIZE_MIN(MaxRowsAtCompileTime,MaxColsAtCompileTime),
|
||||||
MatrixOptions = MatrixType::Options
|
MatrixOptions = MatrixType::Options
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -138,8 +138,8 @@ template<typename Derived> class SparseMatrixBase : public EigenBase<Derived>
|
|||||||
typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > ConstantReturnType;
|
typedef CwiseNullaryOp<ei_scalar_constant_op<Scalar>,Matrix<Scalar,Dynamic,Dynamic> > ConstantReturnType;
|
||||||
|
|
||||||
/** type of the equivalent square matrix */
|
/** type of the equivalent square matrix */
|
||||||
typedef Matrix<Scalar,EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime),
|
typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime),
|
||||||
EIGEN_ENUM_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
|
EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType;
|
||||||
|
|
||||||
inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
|
inline const Derived& derived() const { return *static_cast<const Derived*>(this); }
|
||||||
inline Derived& derived() { return *static_cast<Derived*>(this); }
|
inline Derived& derived() { return *static_cast<Derived*>(this); }
|
||||||
|
@ -66,7 +66,7 @@ struct ei_traits<SparseProduct<LhsNested, RhsNested> >
|
|||||||
|
|
||||||
RowsAtCompileTime = _LhsNested::RowsAtCompileTime,
|
RowsAtCompileTime = _LhsNested::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = _RhsNested::ColsAtCompileTime,
|
ColsAtCompileTime = _RhsNested::ColsAtCompileTime,
|
||||||
InnerSize = EIGEN_ENUM_MIN(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
|
InnerSize = EIGEN_SIZE_MIN(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
|
||||||
|
|
||||||
MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
// License and a copy of the GNU General Public License along with
|
// License and a copy of the GNU General Public License along with
|
||||||
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
// Eigen. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#define EIGEN_NO_STATIC_ASSERT // otherwise we fail at compile time on unused paths
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
template<typename MatrixType> void block(const MatrixType& m)
|
template<typename MatrixType> void block(const MatrixType& m)
|
||||||
@ -71,8 +72,10 @@ template<typename MatrixType> void block(const MatrixType& m)
|
|||||||
m1.block(r1,c1,r2-r1+1,c2-c1+1) = s1 * m2.block(0, 0, r2-r1+1,c2-c1+1);
|
m1.block(r1,c1,r2-r1+1,c2-c1+1) = s1 * m2.block(0, 0, r2-r1+1,c2-c1+1);
|
||||||
m1.block(r1,c1,r2-r1+1,c2-c1+1)(r2-r1,c2-c1) = m2.block(0, 0, r2-r1+1,c2-c1+1)(0,0);
|
m1.block(r1,c1,r2-r1+1,c2-c1+1)(r2-r1,c2-c1) = m2.block(0, 0, r2-r1+1,c2-c1+1)(0,0);
|
||||||
|
|
||||||
const int BlockRows = EIGEN_ENUM_MIN(MatrixType::RowsAtCompileTime,2);
|
enum {
|
||||||
const int BlockCols = EIGEN_ENUM_MIN(MatrixType::ColsAtCompileTime,5);
|
BlockRows = 2,
|
||||||
|
BlockCols = 5
|
||||||
|
};
|
||||||
if (rows>=5 && cols>=8)
|
if (rows>=5 && cols>=8)
|
||||||
{
|
{
|
||||||
// test fixed block() as lvalue
|
// test fixed block() as lvalue
|
||||||
|
@ -47,7 +47,7 @@ template<typename MatrixType> void householder(const MatrixType& m)
|
|||||||
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic> VBlockMatrixType;
|
typedef Matrix<Scalar, MatrixType::RowsAtCompileTime, Dynamic> VBlockMatrixType;
|
||||||
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime> TMatrixType;
|
typedef Matrix<Scalar, MatrixType::ColsAtCompileTime, MatrixType::RowsAtCompileTime> TMatrixType;
|
||||||
|
|
||||||
Matrix<Scalar, EIGEN_ENUM_MAX(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime), 1> _tmp(std::max(rows,cols));
|
Matrix<Scalar, EIGEN_SIZE_MAX(MatrixType::RowsAtCompileTime,MatrixType::ColsAtCompileTime), 1> _tmp(std::max(rows,cols));
|
||||||
Scalar* tmp = &_tmp.coeffRef(0,0);
|
Scalar* tmp = &_tmp.coeffRef(0,0);
|
||||||
|
|
||||||
Scalar beta;
|
Scalar beta;
|
||||||
|
@ -221,7 +221,7 @@ bool ei_companion<_Scalar,_Deg>::balancedR( Scalar colNorm, Scalar rowNorm,
|
|||||||
template< typename _Scalar, int _Deg >
|
template< typename _Scalar, int _Deg >
|
||||||
void ei_companion<_Scalar,_Deg>::balance()
|
void ei_companion<_Scalar,_Deg>::balance()
|
||||||
{
|
{
|
||||||
EIGEN_STATIC_ASSERT( 1 < Deg, YOU_MADE_A_PROGRAMMING_MISTAKE );
|
EIGEN_STATIC_ASSERT( Deg == Dynamic || 1 < Deg, YOU_MADE_A_PROGRAMMING_MISTAKE );
|
||||||
const Index deg = m_monic.size();
|
const Index deg = m_monic.size();
|
||||||
const Index deg_1 = deg-1;
|
const Index deg_1 = deg-1;
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@ public:
|
|||||||
typedef typename NumTraits<Scalar>::Real RealScalar;
|
typedef typename NumTraits<Scalar>::Real RealScalar;
|
||||||
|
|
||||||
/** type of the equivalent square matrix */
|
/** type of the equivalent square matrix */
|
||||||
typedef Matrix<Scalar, EIGEN_ENUM_MAX(RowsAtCompileTime, ColsAtCompileTime),
|
typedef Matrix<Scalar, EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime),
|
||||||
EIGEN_ENUM_MAX(RowsAtCompileTime, ColsAtCompileTime) > SquareMatrixType;
|
EIGEN_SIZE_MAX(RowsAtCompileTime, ColsAtCompileTime) > SquareMatrixType;
|
||||||
|
|
||||||
inline const Derived& derived() const {
|
inline const Derived& derived() const {
|
||||||
return *static_cast<const Derived*> (this);
|
return *static_cast<const Derived*> (this);
|
||||||
|
@ -48,7 +48,7 @@ struct ei_traits<SkylineProduct<LhsNested, RhsNested, ProductMode> > {
|
|||||||
|
|
||||||
RowsAtCompileTime = _LhsNested::RowsAtCompileTime,
|
RowsAtCompileTime = _LhsNested::RowsAtCompileTime,
|
||||||
ColsAtCompileTime = _RhsNested::ColsAtCompileTime,
|
ColsAtCompileTime = _RhsNested::ColsAtCompileTime,
|
||||||
InnerSize = EIGEN_ENUM_MIN(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
|
InnerSize = EIGEN_SIZE_MIN(_LhsNested::ColsAtCompileTime, _RhsNested::RowsAtCompileTime),
|
||||||
|
|
||||||
MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
|
MaxRowsAtCompileTime = _LhsNested::MaxRowsAtCompileTime,
|
||||||
MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
|
MaxColsAtCompileTime = _RhsNested::MaxColsAtCompileTime,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user