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>
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>
77template<
typename ExprScalar,
typename T,
typename PromotedType,
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>
137 operator T()
const {
return T(Value); }
185template<
typename T>
struct packet_traits;
187template<
typename T>
struct unpacket_traits;
189template<
int Size,
typename PacketType,
193template<
int Size,
typename PacketType>
199template<
int Size,
typename PacketType>
205template<
typename T,
int Size>
211#if EIGEN_MAX_STATIC_ALIGN_BYTES>0
212template<
int ArrayBytes,
int AlignmentBytes,
213 bool Match = bool((ArrayBytes%AlignmentBytes)==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>
250template<
typename _Scalar,
int _Rows,
int _Cols,
255 int _MaxRows = _Rows,
260 IsColVector = _Cols==1 && _Rows!=1,
261 IsRowVector = _Rows==1 && _Cols!=1,
263 : IsRowVector ? (_Options |
RowMajor) & ~ColMajor
270template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
295template<typename T, typename StorageKind = typename traits<T>::StorageKind>
struct plain_matrix_type;
303 typedef typename T::PlainObject
type;
332template<typename T, typename StorageKind = typename traits<T>::StorageKind>
struct eval;
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>
367template<typename T, typename StorageKind = typename traits<T>::StorageKind>
struct plain_object_eval;
432template<
typename T1,
typename T2>
479 return const_cast<T*
>(
ptr);
482template<typename Derived, typename XprKind = typename traits<Derived>::XprKind>
488template<
typename Derived>
494template<
typename Derived>
500template<typename Derived, typename XprKind = typename traits<Derived>::XprKind,
typename StorageKind =
typename traits<Derived>::StorageKind>
503template<
typename Derived,
typename XprKind>
598template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
601 typedef Matrix<Scalar, 1, ExpressionType::ColsAtCompileTime,
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>
644template<
typename Expr,
typename Scalar =
typename Expr::Scalar>
658template<
typename ExpressionType>
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>
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
730std::string demangle_traversal(
int t)
739std::string demangle_unrolling(
int t)
746std::string demangle_flags(
int f)
800template<
typename ScalarA,
typename ScalarB,
typename BinaryOp=
internal::scalar_product_op<ScalarA,ScalarB> >
802#ifndef EIGEN_PARSED_BY_DOXYGEN
808template<
typename T,
typename BinaryOp>
814template <
typename T,
typename BinaryOp>
819template <
typename T,
typename BinaryOp>
826template<
typename T,
typename BinaryOp>
833template<
typename T,
typename BinaryOp>
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)
#define EIGEN_DEFAULT_COPY_CONSTRUCTOR(CLASS)
Definition: Macros.h:1231
#define EIGEN_SIZE_MIN_PREFER_DYNAMIC(a, b)
Definition: Macros.h:1304
#define eigen_internal_assert(x)
Definition: Macros.h:1053
#define EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(Derived)
Definition: Macros.h:1257
#define EIGEN_CONSTEXPR
Definition: Macros.h:797
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:1059
#define EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION
Definition: Macros.h:29
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_NO_THROW
Definition: Macros.h:1430
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define EIGEN_SIZE_MIN_PREFER_FIXED(a, b)
Definition: Macros.h:1312
#define EIGEN_EMPTY_STRUCT_CTOR(X)
Definition: XprHelper.h:22
Base class for all 1D and 2D array, and related expressions.
Definition: ArrayBase.h:41
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
Matrix< _Scalar, _Rows, _Cols, Options, _MaxRows, _MaxCols > type
Definition: XprHelper.h:267
Definition: XprHelper.h:110
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T value)
Definition: XprHelper.h:149
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T value() const
Definition: XprHelper.h:147
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE variable_if_dynamic(T value=0) EIGEN_NO_THROW
Definition: XprHelper.h:146
Definition: XprHelper.h:130
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T v) const
Definition: XprHelper.h:139
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR T value()
Definition: XprHelper.h:135
EIGEN_DEVICE_FUNC T EIGEN_STRONG_INLINE value() const
Definition: XprHelper.h:171
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T value)
Definition: XprHelper.h:172
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE variable_if_dynamicindex(T value)
Definition: XprHelper.h:170
Definition: XprHelper.h:155
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void setValue(T)
Definition: XprHelper.h:162
static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR T value()
Definition: XprHelper.h:160
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE variable_if_dynamicindex(T v)
Definition: XprHelper.h:158
type
Definition: core.h:575
@ 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
EIGEN_DEVICE_FUNC T * const_cast_ptr(const T *ptr)
Definition: XprHelper.h:477
EIGEN_DEVICE_FUNC IndexDest convert_index(const IndexSrc &idx)
Definition: XprHelper.h:31
EIGEN_DEVICE_FUNC bool is_same_dense(const T1 &mat1, const T2 &mat2, typename enable_if< possibly_same_dense< T1, T2 >::value >::type *=0)
Definition: XprHelper.h:695
Namespace containing all symbols from the Eigen library.
Definition: Core:141
const unsigned int NestByRefBit
Definition: Constants.h:169
const int HugeCost
This value means that the cost to evaluate an expression coefficient is either very expensive or cann...
Definition: Constants.h:44
@ InnerVectorizedTraversal
Definition: Constants.h:282
@ LinearVectorizedTraversal
Definition: Constants.h:285
@ DefaultTraversal
Definition: Constants.h:277
@ SliceVectorizedTraversal
Definition: Constants.h:288
@ LinearTraversal
Definition: Constants.h:279
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
@ InnerUnrolling
Definition: Constants.h:301
@ CompleteUnrolling
Definition: Constants.h:304
@ NoUnrolling
Definition: Constants.h:299
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition: Constants.h:22
Definition: Eigen_Colamd.h:50
Definition: BFloat16.h:88
The type used to identify an array expression.
Definition: Constants.h:525
The type used to identify a dense storage.
Definition: Constants.h:507
Definition: Constants.h:528
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:233
The type used to identify a permutation storage.
Definition: Constants.h:516
T ReturnType
Definition: XprHelper.h:811
T ReturnType
Definition: XprHelper.h:817
T ReturnType
Definition: XprHelper.h:829
T ReturnType
Definition: XprHelper.h:822
T ReturnType
Definition: XprHelper.h:836
void ReturnType
Definition: XprHelper.h:843
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
const T type
Definition: Meta.h:214
Definition: XprHelper.h:510
remove_all< CastType >::type _CastType
Definition: XprHelper.h:512
XprType::Scalar CurrentScalarType
Definition: XprHelper.h:511
_CastType::Scalar NewScalarType
Definition: XprHelper.h:513
conditional< is_same< CurrentScalarType, NewScalarType >::value, constXprType &, CastType >::type type
Definition: XprHelper.h:515
Definition: XprHelper.h:237
Definition: XprHelper.h:242
ArrayBase< Derived > type
Definition: XprHelper.h:497
MatrixBase< Derived > type
Definition: XprHelper.h:491
Definition: XprHelper.h:484
const Array< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & type
Definition: XprHelper.h:362
const Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & type
Definition: XprHelper.h:356
plain_matrix_type< T >::type type
Definition: XprHelper.h:336
plain_matrix_type< T >::type type
Definition: XprHelper.h:349
Definition: XprHelper.h:332
Definition: CoreEvaluators.h:91
Definition: XprHelper.h:201
find_best_packet_helper< Size, typenameunpacket_traits< PacketType >::half >::type type
Definition: XprHelper.h:202
Definition: XprHelper.h:195
PacketType type
Definition: XprHelper.h:196
Definition: XprHelper.h:191
Definition: XprHelper.h:207
find_best_packet_helper< Size, typenamepacket_traits< T >::type >::type type
Definition: XprHelper.h:208
Definition: XprHelper.h:176
@ PacketAccess
Definition: XprHelper.h:180
@ Cost
Definition: XprHelper.h:179
@ IsRepeatable
Definition: XprHelper.h:181
dense_xpr_base< Derived, XprKind >::type type
Definition: XprHelper.h:506
Definition: XprHelper.h:501
TriangularShape type
Definition: XprHelper.h:686
Definition: XprHelper.h:685
Definition: ForwardDeclarations.h:26
Definition: XprHelper.h:666
@ ret
Definition: XprHelper.h:666
Definition: XprHelper.h:679
Definition: XprHelper.h:660
Definition: XprHelper.h:39
Definition: XprHelper.h:458
conditional< Evaluate, PlainObject, typenameref_selector< T >::type >::type type
Definition: XprHelper.h:472
@ CoeffReadCost
Definition: XprHelper.h:461
@ CostNoEval
Definition: XprHelper.h:468
@ NAsInteger
Definition: XprHelper.h:466
@ ScalarReadCost
Definition: XprHelper.h:460
@ Evaluate
Definition: XprHelper.h:469
@ CostEval
Definition: XprHelper.h:467
Definition: XprHelper.h:615
Array< Scalar, ExpressionType::RowsAtCompileTime, 1, ExpressionType::PlainObject::Options &~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1 > ArrayColType
Definition: XprHelper.h:619
conditional< is_same< typenametraits< ExpressionType >::XprKind, MatrixXpr >::value, MatrixColType, ArrayColType >::type type
Definition: XprHelper.h:625
Matrix< Scalar, ExpressionType::RowsAtCompileTime, 1, ExpressionType::PlainObject::Options &~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1 > MatrixColType
Definition: XprHelper.h:617
Definition: XprHelper.h:646
Matrix< Scalar, traits< Expr >::RowsAtCompileTime, traits< Expr >::ColsAtCompileTime, Options, traits< Expr >::MaxRowsAtCompileTime, traits< Expr >::MaxColsAtCompileTime > matrix_type
Definition: XprHelper.h:653
CwiseNullaryOp< scalar_constant_op< Scalar >, const typename conditional< is_same< typename traits< Expr >::XprKind, MatrixXpr >::value, matrix_type, array_type >::type > type
Definition: XprHelper.h:655
@ Options
Definition: XprHelper.h:647
Array< Scalar, traits< Expr >::RowsAtCompileTime, traits< Expr >::ColsAtCompileTime, Options, traits< Expr >::MaxRowsAtCompileTime, traits< Expr >::MaxColsAtCompileTime > array_type
Definition: XprHelper.h:650
Definition: XprHelper.h:630
@ diag_size
Definition: XprHelper.h:631
@ max_diag_size
Definition: XprHelper.h:632
conditional< is_same< typenametraits< ExpressionType >::XprKind, MatrixXpr >::value, MatrixDiagType, ArrayDiagType >::type type
Definition: XprHelper.h:641
Matrix< Scalar, diag_size, 1, ExpressionType::PlainObject::Options &~RowMajor, max_diag_size, 1 > MatrixDiagType
Definition: XprHelper.h:634
Array< Scalar, diag_size, 1, ExpressionType::PlainObject::Options &~RowMajor, max_diag_size, 1 > ArrayDiagType
Definition: XprHelper.h:635
plain_matrix_type_dense< T, typenametraits< T >::XprKind, traits< T >::Flags >::type type
Definition: XprHelper.h:299
T::PlainObject type
Definition: XprHelper.h:303
Definition: XprHelper.h:379
@ Rows
Definition: XprHelper.h:380
@ MaxRows
Definition: XprHelper.h:382
@ MaxCols
Definition: XprHelper.h:383
@ Cols
Definition: XprHelper.h:381
Definition: XprHelper.h:296
Definition: XprHelper.h:397
@ MaxCols
Definition: XprHelper.h:401
@ MaxRows
Definition: XprHelper.h:400
@ Cols
Definition: XprHelper.h:399
@ Rows
Definition: XprHelper.h:398
Definition: XprHelper.h:295
plain_matrix_type_dense< T, typenametraits< T >::XprKind, evaluator< T >::Flags >::type type
Definition: XprHelper.h:372
Definition: XprHelper.h:367
Definition: XprHelper.h:600
conditional< is_same< typenametraits< ExpressionType >::XprKind, MatrixXpr >::value, MatrixRowType, ArrayRowType >::type type
Definition: XprHelper.h:610
Matrix< Scalar, 1, ExpressionType::ColsAtCompileTime, int(ExpressionType::PlainObject::Options)|int(RowMajor), 1, ExpressionType::MaxColsAtCompileTime > MatrixRowType
Definition: XprHelper.h:602
Array< Scalar, 1, ExpressionType::ColsAtCompileTime, int(ExpressionType::PlainObject::Options)|int(RowMajor), 1, ExpressionType::MaxColsAtCompileTime > ArrayRowType
Definition: XprHelper.h:604
Definition: XprHelper.h:689
Definition: XprHelper.h:417
conditional< bool(traits< T >::Flags &NestByRefBit), Tconst &, constT >::type type
Definition: XprHelper.h:422
conditional< bool(traits< T >::Flags &NestByRefBit), T &, T >::type non_const_type
Definition: XprHelper.h:428
T type
Definition: Meta.h:126
Definition: XprHelper.h:710
Definition: NullaryFunctors.h:31
Definition: XprHelper.h:282
Definition: XprHelper.h:287
Definition: ForwardDeclarations.h:17
Definition: XprHelper.h:434
conditional< bool(internal::is_const< T1 >::value), typenameinternal::add_const_on_value_type< T2 >::type, T2 >::type type
Definition: XprHelper.h:439
T half
Definition: GenericPacketMath.h:135
@ size
Definition: GenericPacketMath.h:138
Definition: XprHelper.h:54
#define S(label, offset, message)
Definition: Errors.h:119