11#ifndef EIGEN_XPRHELPER_H
12#define EIGEN_XPRHELPER_H
17#if EIGEN_COMP_GNUC && !EIGEN_GNUC_AT(4,3)
18 #define EIGEN_EMPTY_STRUCT_CTOR(X) \
19 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X() {} \
20 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE X(const X& ) {}
22 #define EIGEN_EMPTY_STRUCT_CTOR(X)
29template<
typename IndexDest,
typename IndexSrc>
31inline IndexDest convert_index(
const IndexSrc& idx) {
33 eigen_internal_assert(idx <= NumTraits<IndexDest>::highest() &&
"Index value to big for target type");
34 return IndexDest(idx);
41#if EIGEN_HAS_TYPE_TRAITS
53template<
typename RowIndices,
typename ColIndices>
67template<
typename ExprScalar,
typename T,
bool IsSupported>
70template<
typename S,
typename T>
83template<
typename S,
typename T>
87template<
typename S,
typename T,
typename PromotedType>
95template<
typename ExprScalar,
typename T,
typename PromotedType>
101template<
typename S,
typename T,
typename PromotedType,
bool ConvertibleToLiteral>
105template<
typename S,
typename T>
119template<
typename I1,
typename I2>
133 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
134 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
135 T value() {
return T(Value); }
136 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
137 operator T()
const {
return T(Value); }
138 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
139 void setValue(T v)
const { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
146 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit variable_if_dynamic(T value = 0) EIGEN_NO_THROW : m_value(value) {}
147 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T value()
const {
return m_value; }
148 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
operator T()
const {
return m_value; }
149 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void setValue(T value) { m_value = value; }
158 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
159 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
160 T value() {
return T(Value); }
161 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
171 EIGEN_DEVICE_FUNC T EIGEN_STRONG_INLINE value()
const {
return m_value; }
172 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void setValue(T value) { m_value = value; }
180 PacketAccess =
false,
189template<
int Size,
typename PacketType,
193template<
int Size,
typename PacketType>
196 typedef PacketType type;
199template<
int Size,
typename PacketType>
205template<
typename T,
int Size>
211#if EIGEN_MAX_STATIC_ALIGN_BYTES>0
220template<
int ArrayBytes,
int AlignmentBytes,
bool TryHalf>
221struct compute_default_alignment_helper<ArrayBytes, AlignmentBytes, true, TryHalf>
223 enum { value = AlignmentBytes };
226template<
int ArrayBytes,
int AlignmentBytes>
227struct compute_default_alignment_helper<ArrayBytes, AlignmentBytes, false, true>
230 enum { value = compute_default_alignment_helper<ArrayBytes, AlignmentBytes/2>::value };
235template<
int ArrayBytes,
int AlignmentBytes>
247 enum { value = EIGEN_MAX_ALIGN_BYTES };
250template<
typename _Scalar,
int _Rows,
int _Cols,
254 : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
270template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
303 typedef typename T::PlainObject type;
353template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
359template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
432template<
typename T1,
typename T2>
467 CostEval = (NAsInteger+1) * ScalarReadCost + CoeffReadCost,
468 CostNoEval = NAsInteger * CoeffReadCost,
477inline T* const_cast_ptr(
const T* ptr)
479 return const_cast<T*
>(ptr);
488template<
typename Derived>
494template<
typename Derived>
503template<
typename Derived,
typename XprKind>
511 typedef typename XprType::Scalar CurrentScalarType;
512 typedef typename remove_all<CastType>::type _CastType;
513 typedef typename _CastType::Scalar NewScalarType;
598template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
601 typedef Matrix<Scalar, 1, ExpressionType::ColsAtCompileTime,
602 int(ExpressionType::PlainObject::Options) | int(
RowMajor), 1, ExpressionType::MaxColsAtCompileTime>
MatrixRowType;
603 typedef Array<Scalar, 1, ExpressionType::ColsAtCompileTime,
604 int(ExpressionType::PlainObject::Options) | int(
RowMajor), 1, ExpressionType::MaxColsAtCompileTime>
ArrayRowType;
613template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
616 typedef Matrix<Scalar, ExpressionType::RowsAtCompileTime, 1,
617 ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>
MatrixColType;
618 typedef Array<Scalar, ExpressionType::RowsAtCompileTime, 1,
619 ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>
ArrayColType;
628template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
631 enum { diag_size = EIGEN_SIZE_MIN_PREFER_DYNAMIC(ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime),
632 max_diag_size = EIGEN_SIZE_MIN_PREFER_FIXED(ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime)
644template<
typename Expr,
typename Scalar =
typename Expr::Scalar>
658template<
typename ExpressionType>
666{
enum { ret =
false }; };
669{
enum { ret =
true }; };
672{
enum { ret =
true }; };
675{
enum { ret =
true }; };
679{
enum { value =
false }; };
682{
enum { value =
true }; };
688template<
typename T1,
typename T2>
693template<
typename T1,
typename T2>
697 return (
mat1.data()==
mat2.data()) && (
mat1.innerStride()==
mat2.innerStride()) && (
mat1.outerStride()==
mat2.outerStride());
700template<
typename T1,
typename T2>
702bool is_same_dense(
const T1 &,
const T2 &,
typename enable_if<!possibly_same_dense<T1,T2>::value>::type * = 0)
709template<
typename T,
bool Vectorized=false,
typename EnableIf =
void>
714template<
typename T,
bool Vectorized>
723template<
bool Vectorized>
725template<
bool Vectorized>
729#ifdef EIGEN_DEBUG_ASSIGN
732 if(t==DefaultTraversal)
return "DefaultTraversal";
733 if(t==LinearTraversal)
return "LinearTraversal";
734 if(t==InnerVectorizedTraversal)
return "InnerVectorizedTraversal";
735 if(t==LinearVectorizedTraversal)
return "LinearVectorizedTraversal";
736 if(t==SliceVectorizedTraversal)
return "SliceVectorizedTraversal";
741 if(t==NoUnrolling)
return "NoUnrolling";
742 if(t==InnerUnrolling)
return "InnerUnrolling";
743 if(t==CompleteUnrolling)
return "CompleteUnrolling";
746std::string demangle_flags(
int f)
754 if(f&NestByRefBit) res +=
" | NestByRef";
800template<
typename ScalarA,
typename ScalarB,
typename BinaryOp=
internal::scalar_product_op<ScalarA,ScalarB> >
808template<
typename T,
typename BinaryOp>
811 typedef T ReturnType;
814template <
typename T,
typename BinaryOp>
817 typedef T ReturnType;
819template <
typename T,
typename BinaryOp>
822 typedef T ReturnType;
826template<
typename T,
typename BinaryOp>
829 typedef T ReturnType;
833template<
typename T,
typename BinaryOp>
836 typedef T ReturnType;
840template<
typename BinaryOp>
850#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \
851 EIGEN_STATIC_ASSERT((Eigen::internal::has_ReturnType<ScalarBinaryOpTraits<LHS, RHS,BINOP> >::value), \
852 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY)
General-purpose arrays with easy API for coefficient-wise operations.
Definition Array.h:47
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:61
Definition DiagonalMatrix.h:19
Represents a diagonal matrix with its storage.
Definition DiagonalMatrix.h:142
Expression of a diagonal matrix.
Definition DiagonalMatrix.h:295
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
Definition XprHelper.h:272
Definition XprHelper.h:258
Definition XprHelper.h:110
Definition XprHelper.h:130
Definition XprHelper.h:155
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:319
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:321
@ AutoAlign
Align the matrix itself if it is vectorizable fixed-size.
Definition Constants.h:323
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition Constants.h:94
const unsigned int NoPreferredStorageOrderBit
for an expression, this means that the storage order can be either row-major or column-major.
Definition Constants.h:178
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition Constants.h:130
const unsigned int EvalBeforeNestingBit
means the expression should be evaluated by the calling expression
Definition Constants.h:70
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array.
Definition Constants.h:155
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition Constants.h:144
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition LDLT.h:16
const int HugeCost
This value means that the cost to evaluate an expression coefficient is either very expensive or cann...
Definition Constants.h:44
const int DynamicIndex
This value means that a signed quantity (e.g., a signed index) is not known at compile-time,...
Definition Constants.h:27
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition Constants.h:22
The type used to identify an array expression.
Definition Constants.h:525
Definition Constants.h:528
The type used to identify a dense storage.
Definition Constants.h:507
Definition Constants.h:531
The type used to identify a matrix expression.
Definition Constants.h:522
Holds information about the various numeric (i.e.
Definition NumTraits.h:236
The type used to identify a permutation storage.
Definition Constants.h:516
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition XprHelper.h:806
The type used to identify a general sparse storage.
Definition Constants.h:510
Definition Constants.h:533
Definition XprHelper.h:510
Definition XprHelper.h:237
Definition XprHelper.h:242
Definition XprHelper.h:484
Definition XprHelper.h:332
Definition CoreEvaluators.h:91
Definition XprHelper.h:191
Definition XprHelper.h:207
Definition XprHelper.h:176
Definition XprHelper.h:501
Definition XprHelper.h:685
Definition ForwardDeclarations.h:26
Definition XprHelper.h:666
Definition XprHelper.h:679
Definition XprHelper.h:660
Definition XprHelper.h:39
Definition XprHelper.h:458
Definition GenericPacketMath.h:107
Definition XprHelper.h:615
Definition XprHelper.h:646
Definition XprHelper.h:630
Definition XprHelper.h:379
Definition XprHelper.h:296
Definition XprHelper.h:397
Definition XprHelper.h:295
Definition XprHelper.h:367
Definition XprHelper.h:600
Definition XprHelper.h:689
Definition XprHelper.h:417
Definition XprHelper.h:710
Definition NullaryFunctors.h:31
Definition XprHelper.h:282
Definition XprHelper.h:287
Definition ForwardDeclarations.h:17
Definition XprHelper.h:434
Definition GenericPacketMath.h:133
Definition XprHelper.h:54
Definition PacketMath.h:47