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>
77template<
typename ExprScalar,
typename T,
typename PromotedType,
83template<
typename S,
typename T>
87template<
typename S,
typename T,
typename PromotedType>
90 typedef PromotedType type;
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>
122 typedef typename conditional<(
sizeof(I1)<
sizeof(I2)), I2, I1>::type
type;
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
212template<
int ArrayBytes,
int AlignmentBytes,
213 bool Match = bool((ArrayBytes%AlignmentBytes)==0),
214 bool TryHalf = bool(EIGEN_MIN_ALIGN_BYTES<AlignmentBytes) >
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 ),
255 int _MaxRows = _Rows,
260 IsColVector = _Cols==1 && _Rows!=1,
261 IsRowVector = _Rows==1 && _Cols!=1,
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>
437 typename internal::add_const_on_value_type<T2>::type,
457template<typename T, int n, typename PlainObject = typename plain_object_eval<T>::type>
struct nested_eval
467 CostEval = (NAsInteger+1) * ScalarReadCost + CoeffReadCost,
468 CostNoEval = NAsInteger * CoeffReadCost,
477inline T* const_cast_ptr(
const T* ptr)
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>
511 typedef typename XprType::Scalar CurrentScalarType;
512 typedef typename remove_all<CastType>::type _CastType;
513 typedef typename _CastType::Scalar NewScalarType;
515 const XprType&,CastType>::type
type;
556 enum { value = LhsOrder };
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
730std::string demangle_traversal(
int t)
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";
739std::string demangle_unrolling(
int t)
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> >
802#ifndef EIGEN_PARSED_BY_DOXYGEN
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>
843 typedef void ReturnType;
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)
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
Definition XprHelper.h:110
Definition XprHelper.h:130
Definition XprHelper.h:155
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
@ AutoAlign
Definition Constants.h:323
const unsigned int PacketAccessBit
Definition Constants.h:94
const unsigned int NoPreferredStorageOrderBit
Definition Constants.h:178
const unsigned int LinearAccessBit
Definition Constants.h:130
const unsigned int EvalBeforeNestingBit
Definition Constants.h:70
const unsigned int DirectAccessBit
Definition Constants.h:155
const unsigned int LvalueBit
Definition Constants.h:144
const unsigned int RowMajorBit
Definition Constants.h:66
Namespace containing all symbols from the Eigen library.
Definition common.h:81
const int HugeCost
Definition Constants.h:44
const int DynamicIndex
Definition Constants.h:27
const int Dynamic
Definition Constants.h:22
Definition Constants.h:525
Definition Constants.h:528
Definition Constants.h:507
Definition Constants.h:531
Definition Constants.h:522
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:233
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
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 datatypes.h:12