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) 29 template<
typename IndexDest,
typename IndexSrc>
31 inline 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);
47 template<
typename ExprScalar,
typename T,
bool IsSupported>
50 template<
typename S,
typename T>
57 template<
typename ExprScalar,
typename T,
typename PromotedType,
63 template<
typename S,
typename T>
67 template<
typename S,
typename T,
typename PromotedType>
70 typedef PromotedType type;
75 template<
typename ExprScalar,
typename T,
typename PromotedType>
81 template<
typename S,
typename T,
typename PromotedType,
bool ConvertibleToLiteral>
85 template<
typename S,
typename T>
96 template<
typename I1,
typename I2>
110 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit variable_if_dynamic(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
111 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE T value() {
return T(Value); }
112 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void setValue(T) {}
120 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit variable_if_dynamic(T value) : m_value(value) {}
121 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T value()
const {
return m_value; }
122 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void setValue(T value) { m_value = value; }
131 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit variable_if_dynamicindex(T v) { EIGEN_ONLY_USED_FOR_DEBUG(v); eigen_assert(v == T(Value)); }
132 EIGEN_DEVICE_FUNC
static EIGEN_STRONG_INLINE T value() {
return T(Value); }
133 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void setValue(T) {}
142 EIGEN_DEVICE_FUNC T EIGEN_STRONG_INLINE value()
const {
return m_value; }
143 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void setValue(T value) { m_value = value; }
151 PacketAccess =
false,
173 template<
int Size,
typename PacketType>
176 typedef PacketType
type;
179 template<
int Size,
typename PacketType>
185 template<
typename T,
int Size>
191 #if EIGEN_MAX_STATIC_ALIGN_BYTES>0 192 template<
int ArrayBytes,
int AlignmentBytes,
193 bool Match = bool((ArrayBytes%AlignmentBytes)==0),
194 bool TryHalf = bool(EIGEN_MIN_ALIGN_BYTES<AlignmentBytes) >
200 template<
int ArrayBytes,
int AlignmentBytes,
bool TryHalf>
203 enum { value = AlignmentBytes };
206 template<
int ArrayBytes,
int AlignmentBytes>
215 template<
int ArrayBytes,
int AlignmentBytes>
227 enum { value = EIGEN_MAX_ALIGN_BYTES };
230 template<
typename _Scalar,
int _Rows,
int _Cols,
234 : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
235 int _MaxRows = _Rows,
240 IsColVector = _Cols==1 && _Rows!=1,
241 IsRowVector = _Rows==1 && _Cols!=1,
250 template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
275 template<typename T, typename StorageKind = typename traits<T>::StorageKind>
struct plain_matrix_type;
283 typedef typename T::PlainObject type;
312 template<typename T, typename StorageKind = typename traits<T>::StorageKind>
struct eval;
333 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
339 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
347 template<typename T, typename StorageKind = typename traits<T>::StorageKind>
struct plain_object_eval;
395 template <
typename T>
412 template<
typename T1,
typename T2>
437 template<typename T, int n, typename PlainObject = typename plain_object_eval<T>::type>
struct nested_eval 447 CostEval = (NAsInteger+1) * ScalarReadCost + CoeffReadCost,
448 CostNoEval = NAsInteger * CoeffReadCost,
457 inline T* const_cast_ptr(
const T* ptr)
459 return const_cast<T*
>(ptr);
462 template<typename Derived, typename XprKind = typename traits<Derived>::XprKind>
468 template<
typename Derived>
474 template<
typename Derived>
480 template<typename Derived, typename XprKind = typename traits<Derived>::XprKind,
typename StorageKind =
typename traits<Derived>::StorageKind>
483 template<
typename Derived,
typename XprKind>
491 typedef typename XprType::Scalar CurrentScalarType;
493 typedef typename _CastType::Scalar NewScalarType;
569 template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
572 typedef Matrix<Scalar, 1, ExpressionType::ColsAtCompileTime,
573 ExpressionType::PlainObject::Options |
RowMajor, 1, ExpressionType::MaxColsAtCompileTime>
MatrixRowType;
574 typedef Array<Scalar, 1, ExpressionType::ColsAtCompileTime,
575 ExpressionType::PlainObject::Options |
RowMajor, 1, ExpressionType::MaxColsAtCompileTime>
ArrayRowType;
584 template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
587 typedef Matrix<Scalar, ExpressionType::RowsAtCompileTime, 1,
588 ExpressionType::PlainObject::Options & ~
RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>
MatrixColType;
589 typedef Array<Scalar, ExpressionType::RowsAtCompileTime, 1,
590 ExpressionType::PlainObject::Options & ~
RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>
ArrayColType;
599 template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
602 enum { diag_size = EIGEN_SIZE_MIN_PREFER_DYNAMIC(ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime),
603 max_diag_size = EIGEN_SIZE_MIN_PREFER_FIXED(ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime)
615 template<
typename Expr,
typename Scalar =
typename Expr::Scalar>
629 template<
typename ExpressionType>
637 {
enum { ret =
false }; };
640 {
enum { ret =
true }; };
643 {
enum { ret =
true }; };
646 {
enum { ret =
true }; };
651 template<
typename T1,
typename T2>
654 return (mat1.data()==mat2.data()) && (mat1.innerStride()==mat2.innerStride()) && (mat1.outerStride()==mat2.outerStride());
657 template<
typename T1,
typename T2>
665 template<
typename T,
bool Vectorized=false,
typename EnaleIf =
void>
670 template<
typename T,
bool Vectorized>
679 template<
bool Vectorized>
681 template<
bool Vectorized>
685 #ifdef EIGEN_DEBUG_ASSIGN 686 std::string demangle_traversal(
int t)
688 if(t==DefaultTraversal)
return "DefaultTraversal";
689 if(t==LinearTraversal)
return "LinearTraversal";
690 if(t==InnerVectorizedTraversal)
return "InnerVectorizedTraversal";
691 if(t==LinearVectorizedTraversal)
return "LinearVectorizedTraversal";
692 if(t==SliceVectorizedTraversal)
return "SliceVectorizedTraversal";
695 std::string demangle_unrolling(
int t)
697 if(t==NoUnrolling)
return "NoUnrolling";
698 if(t==InnerUnrolling)
return "InnerUnrolling";
699 if(t==CompleteUnrolling)
return "CompleteUnrolling";
702 std::string demangle_flags(
int f)
710 if(f&NestByRefBit) res +=
" | NestByRef";
756 template<
typename ScalarA,
typename ScalarB,
typename BinaryOp=
internal::scalar_product_op<ScalarA,ScalarB> >
758 #ifndef EIGEN_PARSED_BY_DOXYGEN
761 #endif // EIGEN_PARSED_BY_DOXYGEN 764 template<
typename T,
typename BinaryOp>
770 template <
typename T,
typename BinaryOp>
775 template <
typename T,
typename BinaryOp>
782 template<
typename T,
typename BinaryOp>
789 template<
typename T,
typename BinaryOp>
796 template<
typename BinaryOp>
799 typedef void ReturnType;
806 #define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ 807 EIGEN_STATIC_ASSERT((Eigen::internal::has_ReturnType<ScalarBinaryOpTraits<LHS, RHS,BINOP> >::value), \ 808 YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) 812 #endif // EIGEN_XPRHELPER_H Generic expression of a matrix where all coefficients are defined by a functor.
Definition: CwiseNullaryOp.h:60
Definition: XprHelper.h:216
Definition: XprHelper.h:489
Definition: NonLinearOptimization.cpp:108
Definition: XprHelper.h:347
Storage order is column major (see TopicStorageOrders).
Definition: Constants.h:320
const int HugeCost
This value means that the cost to evaluate an expression coefficient is either very expensive or cann...
Definition: Constants.h:39
Definition: XprHelper.h:237
Definition: XprHelper.h:158
Definition: XprHelper.h:358
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array...
Definition: Constants.h:150
Definition: XprHelper.h:275
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition: Constants.h:139
The type used to identify a permutation storage.
Definition: Constants.h:500
Definition: CoreEvaluators.h:90
Represents a diagonal matrix with its storage.
Definition: DiagonalMatrix.h:116
Definition: XprHelper.h:413
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
const int DynamicIndex
This value means that a signed quantity (e.g., a signed index) is not known at compile-time, and that instead its value has to be specified at runtime.
Definition: Constants.h:26
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
Definition: XprHelper.h:186
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition: Constants.h:61
Definition: Constants.h:512
Definition: XprHelper.h:376
Definition: XprHelper.h:89
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition: Constants.h:89
Definition: XprHelper.h:127
Definition: XprHelper.h:463
Definition: XprHelper.h:437
The type used to identify a matrix expression.
Definition: Constants.h:506
Definition: XprHelper.h:171
Definition: XprHelper.h:266
Definition: GenericPacketMath.h:96
Definition: XprHelper.h:600
Align the matrix itself if it is vectorizable fixed-size.
Definition: Constants.h:324
Definition: XprHelper.h:616
Definition: XprHelper.h:276
Definition: Constants.h:515
Definition: XprHelper.h:106
Definition: ForwardDeclarations.h:25
Definition: XprHelper.h:396
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:39
The type used to identify a general sparse storage.
Definition: Constants.h:494
Definition: XprHelper.h:180
Definition: XprHelper.h:648
Definition: PacketMath.h:48
Definition: BandTriangularSolver.h:13
Definition: XprHelper.h:146
Definition: XprHelper.h:585
Definition: XprHelper.h:174
Definition: XprHelper.h:222
Definition: DiagonalMatrix.h:18
Definition: XprHelper.h:666
Definition: XprHelper.h:251
General-purpose arrays with easy API for coefficient-wise operations.
Definition: Array.h:45
Storage order is row major (see TopicStorageOrders).
Definition: Constants.h:322
Expression of a diagonal matrix.
Definition: DiagonalMatrix.h:245
The type used to identify a dense storage.
Definition: Constants.h:491
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition: XprHelper.h:757
The type used to identify an array expression.
Definition: Constants.h:509
Definition: Constants.h:517
Definition: datatypes.h:12
Definition: XprHelper.h:481
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
const unsigned int EvalBeforeNestingBit
means the expression should be evaluated by the calling expression
Definition: Constants.h:65
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:55
Definition: TensorMeta.h:50
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Definition: XprHelper.h:570
Definition: XprHelper.h:636
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:48
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition: Constants.h:125
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:630
Definition: XprHelper.h:312
Definition: XprHelper.h:261
const unsigned int NoPreferredStorageOrderBit
for an expression, this means that the storage order can be either row-major or column-major.
Definition: Constants.h:173