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)
27typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE DenseIndex;
35typedef EIGEN_DEFAULT_DENSE_INDEX_TYPE Index;
39template<
typename IndexDest,
typename IndexSrc>
41inline IndexDest convert_index(
const IndexSrc& idx) {
43 eigen_internal_assert(idx <= NumTraits<IndexDest>::highest() &&
"Index value to big for target type");
44 return IndexDest(idx);
56template<
typename I1,
typename I2>
111 PacketAccess =
false,
129template<
int Size,
typename PacketType,
133template<
int Size,
typename PacketType>
136 typedef PacketType type;
139template<
int Size,
typename PacketType>
145template<
typename T,
int Size>
151#if EIGEN_MAX_STATIC_ALIGN_BYTES>0
160template<
int ArrayBytes,
int AlignmentBytes,
bool TryHalf>
161struct compute_default_alignment_helper<ArrayBytes, AlignmentBytes, true, TryHalf>
163 enum { value = AlignmentBytes };
166template<
int ArrayBytes,
int AlignmentBytes>
167struct compute_default_alignment_helper<ArrayBytes, AlignmentBytes, false, true>
170 enum { value = compute_default_alignment_helper<ArrayBytes, AlignmentBytes/2>::value };
175template<
int ArrayBytes,
int AlignmentBytes>
187 enum { value = EIGEN_MAX_ALIGN_BYTES };
190template<
typename _Scalar,
int _Rows,
int _Cols,
194 : EIGEN_DEFAULT_MATRIX_STORAGE_ORDER_OPTION ),
210template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
243 typedef typename T::PlainObject type;
293template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
299template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
372template<
typename T1,
typename T2>
406 NAsInteger = n == Dynamic ? HugeCost : n,
407 CostEval = (NAsInteger+1) * ScalarReadCost + CoeffReadCost,
408 CostNoEval = NAsInteger * CoeffReadCost
413 (
int(CostEval) < int(CostNoEval)) ),
421inline T* const_cast_ptr(
const T* ptr)
423 return const_cast<T*
>(ptr);
432template<
typename Derived>
438template<
typename Derived>
447template<
typename Derived,
typename XprKind>
455template<
typename Derived,
typename Scalar,
typename OtherScalar,
typename BaseType,
462 void operator*(
dummy)
const;
463 void operator/(
dummy)
const;
466template<
typename Derived,
typename Scalar,
typename OtherScalar,
typename BaseType>
472#ifdef EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN
480 operator*(
const OtherScalar& scalar,
const Derived& matrix)
482#ifdef EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN
491#ifdef EIGEN_SPECIAL_SCALAR_MULTIPLE_PLUGIN
501 typedef typename XprType::Scalar CurrentScalarType;
503 typedef typename _CastType::Scalar NewScalarType;
580template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
583 typedef Matrix<Scalar, 1, ExpressionType::ColsAtCompileTime,
584 ExpressionType::PlainObject::Options |
RowMajor, 1, ExpressionType::MaxColsAtCompileTime>
MatrixRowType;
585 typedef Array<Scalar, 1, ExpressionType::ColsAtCompileTime,
586 ExpressionType::PlainObject::Options |
RowMajor, 1, ExpressionType::MaxColsAtCompileTime>
ArrayRowType;
595template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
598 typedef Matrix<Scalar, ExpressionType::RowsAtCompileTime, 1,
599 ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>
MatrixColType;
600 typedef Array<Scalar, ExpressionType::RowsAtCompileTime, 1,
601 ExpressionType::PlainObject::Options & ~RowMajor, ExpressionType::MaxRowsAtCompileTime, 1>
ArrayColType;
610template<
typename ExpressionType,
typename Scalar =
typename ExpressionType::Scalar>
613 enum { diag_size = EIGEN_SIZE_MIN_PREFER_DYNAMIC(ExpressionType::RowsAtCompileTime, ExpressionType::ColsAtCompileTime),
614 max_diag_size = EIGEN_SIZE_MIN_PREFER_FIXED(ExpressionType::MaxRowsAtCompileTime, ExpressionType::MaxColsAtCompileTime)
626template<
typename ExpressionType>
634{
enum { ret =
false }; };
637{
enum { ret =
true }; };
640{
enum { ret =
true }; };
643{
enum { ret =
true }; };
648template<
typename T1,
typename T2>
651 return (
mat1.data()==
mat2.data()) && (
mat1.innerStride()==
mat2.innerStride()) && (
mat1.outerStride()==
mat2.outerStride());
654template<
typename T1,
typename T2>
655bool is_same_dense(
const T1 &,
const T2 &,
typename enable_if<!(has_direct_access<T1>::ret&&has_direct_access<T2>::ret),
T1>::type * = 0)
665#ifdef EIGEN_DEBUG_ASSIGN
668 if(t==DefaultTraversal)
return "DefaultTraversal";
669 if(t==LinearTraversal)
return "LinearTraversal";
670 if(t==InnerVectorizedTraversal)
return "InnerVectorizedTraversal";
671 if(t==LinearVectorizedTraversal)
return "LinearVectorizedTraversal";
672 if(t==SliceVectorizedTraversal)
return "SliceVectorizedTraversal";
677 if(t==NoUnrolling)
return "NoUnrolling";
678 if(t==InnerUnrolling)
return "InnerUnrolling";
679 if(t==CompleteUnrolling)
return "CompleteUnrolling";
682std::string demangle_flags(
int f)
690 if(f&NestByRefBit) res +=
" | NestByRef";
706#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \
707 EIGEN_STATIC_ASSERT((internal::functor_is_product_like<BINOP>::ret \
708 ? int(internal::scalar_product_traits<LHS, RHS>::Defined) \
709 : int(internal::is_same_or_void<LHS, RHS>::value)), \
710 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
Definition DiagonalMatrix.h:19
Represents a diagonal matrix with its storage.
Definition DiagonalMatrix.h:119
Expression of a diagonal matrix.
Definition DiagonalMatrix.h:248
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
Pseudo expression representing a solving operation.
Definition Solve.h:63
Definition XprHelper.h:212
Definition XprHelper.h:198
Definition XprHelper.h:50
Definition XprHelper.h:67
Definition XprHelper.h:88
@ ColMajor
Storage order is column major (see TopicStorageOrders).
Definition Constants.h:320
@ RowMajor
Storage order is row major (see TopicStorageOrders).
Definition Constants.h:322
@ AutoAlign
Align the matrix itself if it is vectorizable fixed-size.
Definition Constants.h:324
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition Constants.h:88
const unsigned int NoPreferredStorageOrderBit
for an expression, this means that the storage order can be either row-major or column-major.
Definition Constants.h:172
const unsigned int LinearAccessBit
Short version: means the expression can be seen as 1D vector.
Definition Constants.h:124
const unsigned int EvalBeforeNestingBit
means the expression should be evaluated by the calling expression
Definition Constants.h:65
const unsigned int DirectAccessBit
Means that the underlying array of coefficients can be directly accessed as a plain strided array.
Definition Constants.h:149
const unsigned int LvalueBit
Means the expression has a coeffRef() method, i.e.
Definition Constants.h:138
const unsigned int RowMajorBit
for a matrix, this means that the storage order is row-major.
Definition Constants.h:61
The type used to identify an array expression.
Definition Constants.h:508
Definition Constants.h:511
The type used to identify a dense storage.
Definition Constants.h:490
Definition Constants.h:514
The type used to identify a matrix expression.
Definition Constants.h:505
The type used to identify a permutation storage.
Definition Constants.h:499
Definition Constants.h:516
Definition XprHelper.h:500
Definition XprHelper.h:177
Definition XprHelper.h:182
Definition XprHelper.h:428
Definition XprHelper.h:272
Definition CoreEvaluators.h:82
Definition XprHelper.h:131
Definition XprHelper.h:147
Definition XprHelper.h:107
Definition XprHelper.h:445
Definition XprHelper.h:645
Definition ForwardDeclarations.h:26
Definition XprHelper.h:634
Definition XprHelper.h:628
Definition XprHelper.h:660
Definition XprHelper.h:398
Definition GenericPacketMath.h:90
Definition XprHelper.h:597
Definition XprHelper.h:612
Definition XprHelper.h:319
Definition XprHelper.h:236
Definition XprHelper.h:337
Definition XprHelper.h:235
Definition XprHelper.h:307
Definition XprHelper.h:582
Definition XprHelper.h:357
Definition BinaryFunctors.h:59
Definition XprHelper.h:222
Definition XprHelper.h:227
Definition XprHelper.h:461
Definition XprHelper.h:458
Definition ForwardDeclarations.h:17
Definition XprHelper.h:374
Definition XprHelper.h:119