13#ifndef EIGEN_COREEVALUATORS_H
14#define EIGEN_COREEVALUATORS_H
22template<
typename StorageKind>
85 static const bool value =
false;
93 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
103 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
109template<
typename ExpressionType>
138 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
141#ifndef EIGEN_INTERNAL_DEBUGGING
142 EIGEN_UNUSED_VARIABLE(outerStride);
146 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
153 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
155 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
156 Index outerStride()
const {
return m_outerStride; }
162template<
typename Derived>
167 typedef typename PlainObjectType::Scalar Scalar;
168 typedef typename PlainObjectType::CoeffReturnType CoeffReturnType;
171 IsRowMajor = PlainObjectType::IsRowMajor,
172 IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime,
173 RowsAtCompileTime = PlainObjectType::RowsAtCompileTime,
174 ColsAtCompileTime = PlainObjectType::ColsAtCompileTime,
182 OuterStrideAtCompileTime = IsVectorAtCompileTime ? 0
183 : int(IsRowMajor) ? ColsAtCompileTime
187 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
189 : m_d(0,OuterStrideAtCompileTime)
191 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
194 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
196 : m_d(m.data(),IsVectorAtCompileTime ? 0 : m.outerStride())
198 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
201 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
202 CoeffReturnType coeff(
Index row,
Index col)
const
205 return m_d.data[row * m_d.outerStride() + col];
207 return m_d.data[row + col * m_d.outerStride()];
210 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
211 CoeffReturnType coeff(
Index index)
const
213 return m_d.data[index];
216 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
220 return const_cast<Scalar*
>(m_d.data)[row * m_d.outerStride() + col];
222 return const_cast<Scalar*
>(m_d.data)[row + col * m_d.outerStride()];
225 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
226 Scalar& coeffRef(
Index index)
228 return const_cast<Scalar*
>(m_d.data)[index];
231 template<
int LoadMode,
typename PacketType>
241 template<
int LoadMode,
typename PacketType>
243 PacketType packet(
Index index)
const
248 template<
int StoreMode,
typename PacketType>
250 void writePacket(
Index row,
Index col,
const PacketType& x)
254 (
const_cast<Scalar*
>(m_d.data) + row * m_d.outerStride() + col, x);
257 (
const_cast<Scalar*
>(m_d.data) + row + col * m_d.outerStride(), x);
260 template<
int StoreMode,
typename PacketType>
262 void writePacket(
Index index,
const PacketType& x)
272template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
274 :
evaluator<PlainObjectBase<Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > >
278 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
281 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
287template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
289 :
evaluator<PlainObjectBase<Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols> > >
293 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
296 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
304template<
typename ArgType>
316 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
319 typedef typename XprType::Scalar Scalar;
320 typedef typename XprType::CoeffReturnType CoeffReturnType;
322 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
323 CoeffReturnType coeff(
Index row,
Index col)
const
325 return m_argImpl.coeff(col, row);
328 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
329 CoeffReturnType coeff(
Index index)
const
331 return m_argImpl.coeff(index);
334 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
337 return m_argImpl.coeffRef(col, row);
340 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
341 typename XprType::Scalar& coeffRef(
Index index)
343 return m_argImpl.coeffRef(index);
346 template<
int LoadMode,
typename PacketType>
353 template<
int LoadMode,
typename PacketType>
355 PacketType packet(
Index index)
const
360 template<
int StoreMode,
typename PacketType>
362 void writePacket(
Index row,
Index col,
const PacketType& x)
367 template<
int StoreMode,
typename PacketType>
369 void writePacket(
Index index,
const PacketType& x)
382template<
typename Scalar,
typename NullaryOp,
388 template <
typename IndexType>
389 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType i, IndexType j)
const {
return op(i,j); }
390 template <
typename IndexType>
391 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType i)
const {
return op(i); }
393 template <
typename T,
typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType i, IndexType j)
const {
return op.template
packetOp<T>(i,j); }
394 template <
typename T,
typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType i)
const {
return op.template
packetOp<T>(i); }
397template<
typename Scalar,
typename NullaryOp>
400 template <
typename IndexType>
401 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType=0, IndexType=0)
const {
return op(); }
402 template <
typename T,
typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType=0, IndexType=0)
const {
return op.template
packetOp<T>(); }
405template<
typename Scalar,
typename NullaryOp>
408 template <
typename IndexType>
409 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType i, IndexType j=0)
const {
return op(i,j); }
410 template <
typename T,
typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType i, IndexType j=0)
const {
return op.template
packetOp<T>(i,j); }
416template<
typename Scalar,
typename NullaryOp>
419 template <
typename IndexType>
420 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType i, IndexType j)
const {
421 eigen_assert(i==0 || j==0);
424 template <
typename T,
typename IndexType> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType i, IndexType j)
const {
425 eigen_assert(i==0 || j==0);
429 template <
typename IndexType>
430 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType i)
const {
return op(i); }
431 template <
typename T,
typename IndexType>
432 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType i)
const {
return op.template
packetOp<T>(i); }
435template<
typename Scalar,
typename NullaryOp>
438#if 0 && EIGEN_COMP_MSVC>0
461template<
typename Scalar,
typename NullaryOp>
464 template <
typename IndexType>
465 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType i, IndexType j)
const {
471 template <
typename IndexType>
472 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(
const NullaryOp& op, IndexType i)
const {
473 return nullary_wrapper<Scalar,NullaryOp,
474 has_nullary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
475 has_unary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
476 has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().
operator()(op,i);
479 template <
typename T,
typename IndexType>
480 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType i, IndexType j)
const {
481 return nullary_wrapper<Scalar,NullaryOp,
482 has_nullary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
483 has_unary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
484 has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().
template packetOp<T>(op,i,j);
486 template <
typename T,
typename IndexType>
487 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(
const NullaryOp& op, IndexType i)
const {
488 return nullary_wrapper<Scalar,NullaryOp,
489 has_nullary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
490 has_unary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value,
491 has_binary_operator<NullaryOp,nullary_wrapper_workaround_msvc<IndexType> >::value>().
template packetOp<T>(op,i);
496template<
typename NullaryOp,
typename PlainObjectType>
501 typedef typename internal::remove_all<PlainObjectType>::type PlainObjectTypeCleaned;
511 Alignment = AlignedMax
515 : m_functor(n.functor()), m_wrapper()
517 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
520 typedef typename XprType::CoeffReturnType CoeffReturnType;
522 template <
typename IndexType>
523 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
524 CoeffReturnType coeff(IndexType row, IndexType col)
const
526 return m_wrapper(m_functor, row, col);
529 template <
typename IndexType>
530 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
531 CoeffReturnType coeff(IndexType index)
const
533 return m_wrapper(m_functor,index);
536 template<
int LoadMode,
typename PacketType,
typename IndexType>
538 PacketType packet(IndexType row, IndexType col)
const
543 template<
int LoadMode,
typename PacketType,
typename IndexType>
545 PacketType packet(IndexType index)
const
557template<
typename UnaryOp,
typename ArgType>
571 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
575 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
578 typedef typename XprType::CoeffReturnType CoeffReturnType;
580 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
581 CoeffReturnType coeff(
Index row,
Index col)
const
583 return m_d.func()(m_d.argImpl.coeff(row, col));
586 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
587 CoeffReturnType coeff(
Index index)
const
589 return m_d.func()(m_d.argImpl.coeff(index));
592 template<
int LoadMode,
typename PacketType>
599 template<
int LoadMode,
typename PacketType>
601 PacketType packet(
Index index)
const
611 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
612 Data(
const XprType&
xpr) : op(
xpr.functor()), argImpl(
xpr.nestedExpression()) {}
613 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
614 const UnaryOp& func()
const {
return op; }
625template<
typename TernaryOp,
typename Arg1,
typename Arg2,
typename Arg3>
635template<
typename TernaryOp,
typename Arg1,
typename Arg2,
typename Arg3>
649 Flags0 = (
int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) & (
651 | (
int(Arg1Flags) &
int(Arg2Flags) &
int(Arg3Flags) &
657 Flags = (Flags0 & ~RowMajorBit) | (Arg1Flags &
RowMajorBit),
658 Alignment = EIGEN_PLAIN_ENUM_MIN(
666 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
669 typedef typename XprType::CoeffReturnType CoeffReturnType;
671 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
672 CoeffReturnType coeff(
Index row,
Index col)
const
674 return m_d.func()(m_d.arg1Impl.coeff(row, col), m_d.arg2Impl.coeff(row, col), m_d.arg3Impl.coeff(row, col));
677 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
678 CoeffReturnType coeff(
Index index)
const
680 return m_d.func()(m_d.arg1Impl.coeff(index), m_d.arg2Impl.coeff(index), m_d.arg3Impl.coeff(index));
683 template<
int LoadMode,
typename PacketType>
692 template<
int LoadMode,
typename PacketType>
694 PacketType packet(
Index index)
const
705 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
706 Data(
const XprType&
xpr) : op(
xpr.functor()), arg1Impl(
xpr.arg1()), arg2Impl(
xpr.arg2()), arg3Impl(
xpr.arg3()) {}
707 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
708 const TernaryOp& func()
const {
return op; }
721template<
typename BinaryOp,
typename Lhs,
typename Rhs>
728 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
732template<
typename BinaryOp,
typename Lhs,
typename Rhs>
745 Flags0 = (
int(LhsFlags) | int(RhsFlags)) & (
747 | (
int(LhsFlags) &
int(RhsFlags) &
753 Flags = (Flags0 & ~RowMajorBit) | (LhsFlags &
RowMajorBit),
757 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
761 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
764 typedef typename XprType::CoeffReturnType CoeffReturnType;
766 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
767 CoeffReturnType coeff(
Index row,
Index col)
const
769 return m_d.func()(m_d.lhsImpl.coeff(row, col), m_d.rhsImpl.coeff(row, col));
772 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
773 CoeffReturnType coeff(
Index index)
const
775 return m_d.func()(m_d.lhsImpl.coeff(index), m_d.rhsImpl.coeff(index));
778 template<
int LoadMode,
typename PacketType>
786 template<
int LoadMode,
typename PacketType>
788 PacketType packet(
Index index)
const
799 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
801 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
802 const BinaryOp& func()
const {
return op; }
813template<
typename UnaryOp,
typename ArgType>
830 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
833 typedef typename XprType::Scalar Scalar;
834 typedef typename XprType::CoeffReturnType CoeffReturnType;
836 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
837 CoeffReturnType coeff(
Index row,
Index col)
const
839 return m_d.func()(m_d.argImpl.coeff(row, col));
842 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
843 CoeffReturnType coeff(
Index index)
const
845 return m_d.func()(m_d.argImpl.coeff(index));
848 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
851 return m_d.func()(m_d.argImpl.coeffRef(row, col));
854 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
855 Scalar& coeffRef(
Index index)
857 return m_d.func()(m_d.argImpl.coeffRef(index));
865 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
866 Data(
const XprType&
xpr) : op(
xpr.functor()), argImpl(
xpr.nestedExpression()) {}
867 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
868 const UnaryOp& func()
const {
return op; }
880template<
typename Derived,
typename PlainObjectType>
883template<
typename Derived,
typename PlainObjectType>
886 typedef Derived XprType;
887 typedef typename XprType::PointerType PointerType;
888 typedef typename XprType::Scalar Scalar;
889 typedef typename XprType::CoeffReturnType CoeffReturnType;
892 IsRowMajor = XprType::RowsAtCompileTime,
893 ColsAtCompileTime = XprType::ColsAtCompileTime,
897 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
899 : m_data(
const_cast<PointerType
>(map.data())),
900 m_innerStride(map.innerStride()),
901 m_outerStride(map.outerStride())
904 PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1);
905 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
908 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
909 CoeffReturnType coeff(
Index row,
Index col)
const
911 return m_data[col * colStride() + row * rowStride()];
914 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
915 CoeffReturnType coeff(
Index index)
const
917 return m_data[index * m_innerStride.
value()];
920 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
923 return m_data[col * colStride() + row * rowStride()];
926 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
927 Scalar& coeffRef(
Index index)
929 return m_data[index * m_innerStride.
value()];
932 template<
int LoadMode,
typename PacketType>
936 PointerType ptr = m_data + row * rowStride() + col * colStride();
937 return internal::ploadt<PacketType, LoadMode>(ptr);
940 template<
int LoadMode,
typename PacketType>
942 PacketType packet(
Index index)
const
944 return internal::ploadt<PacketType, LoadMode>(m_data + index * m_innerStride.
value());
947 template<
int StoreMode,
typename PacketType>
949 void writePacket(
Index row,
Index col,
const PacketType& x)
951 PointerType ptr = m_data + row * rowStride() + col * colStride();
952 return internal::pstoret<Scalar, PacketType, StoreMode>(ptr, x);
955 template<
int StoreMode,
typename PacketType>
957 void writePacket(
Index index,
const PacketType& x)
959 internal::pstoret<Scalar, PacketType, StoreMode>(m_data + index * m_innerStride.
value(), x);
962 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
963 Index rowStride()
const EIGEN_NOEXCEPT {
964 return XprType::IsRowMajor ? m_outerStride.
value() : m_innerStride.
value();
966 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
967 Index colStride()
const EIGEN_NOEXCEPT {
968 return XprType::IsRowMajor ? m_innerStride.
value() : m_outerStride.
value();
976template<
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
978 :
public mapbase_evaluator<Map<PlainObjectType, MapOptions, StrideType>, PlainObjectType>
981 typedef typename XprType::Scalar Scalar;
983 typedef typename packet_traits<Scalar>::type PacketScalar;
986 InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0
987 ? int(PlainObjectType::InnerStrideAtCompileTime)
988 : int(StrideType::InnerStrideAtCompileTime),
989 OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0
990 ? int(PlainObjectType::OuterStrideAtCompileTime)
991 : int(StrideType::OuterStrideAtCompileTime),
992 HasNoInnerStride = InnerStrideAtCompileTime == 1,
993 HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0,
994 HasNoStride = HasNoInnerStride && HasNoOuterStride,
995 IsDynamicSize = PlainObjectType::SizeAtCompileTime==
Dynamic,
997 PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(
PacketAccessBit),
998 LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(
LinearAccessBit),
1011template<
typename PlainObjectType,
int RefOptions,
typename Str
ideType>
1013 :
public mapbase_evaluator<Ref<PlainObjectType, RefOptions, StrideType>, PlainObjectType>
1022 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1033template<
typename ArgType,
int BlockRows,
int BlockCols,
bool InnerPanel>
1038 typedef typename XprType::Scalar Scalar;
1040 typedef typename packet_traits<Scalar>::type PacketScalar;
1051 IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1
1052 : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0
1053 : ArgTypeIsRowMajor,
1054 HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor),
1055 InnerSize = IsRowMajor ?
int(ColsAtCompileTime) : int(RowsAtCompileTime),
1056 InnerStrideAtCompileTime = HasSameStorageOrderAsArgType
1059 OuterStrideAtCompileTime = HasSameStorageOrderAsArgType
1062 MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ?
PacketAccessBit : 0,
1068 MaskPacketAccessBit),
1069 Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit,
1073 && (OuterStrideAtCompileTime!=0)
1074 && (((OuterStrideAtCompileTime * int(
sizeof(Scalar))) %
int(PacketAlignment)) == 0)) ?
int(PacketAlignment) : 0,
1078 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1081 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
1086template<
typename ArgType,
int BlockRows,
int BlockCols,
bool InnerPanel>
1092 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1098template<
typename ArgType,
int BlockRows,
int BlockCols,
bool InnerPanel>
1100 :
evaluator_base<Block<ArgType, BlockRows, BlockCols, InnerPanel> >
1104 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1106 : m_argImpl(block.nestedExpression()),
1107 m_startRow(block.startRow()),
1108 m_startCol(block.startCol()),
1109 m_linear_offset(ForwardLinearAccess?(ArgType::IsRowMajor ? block.startRow()*block.nestedExpression().cols() + block.startCol() : block.startCol()*block.nestedExpression().rows() + block.startRow()):0)
1112 typedef typename XprType::Scalar Scalar;
1113 typedef typename XprType::CoeffReturnType CoeffReturnType;
1116 RowsAtCompileTime = XprType::RowsAtCompileTime,
1120 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1121 CoeffReturnType coeff(
Index row,
Index col)
const
1123 return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col);
1126 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1127 CoeffReturnType coeff(
Index index)
const
1132 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1135 return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col);
1138 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1139 Scalar& coeffRef(
Index index)
1144 template<
int LoadMode,
typename PacketType>
1146 PacketType packet(
Index row,
Index col)
const
1151 template<
int LoadMode,
typename PacketType>
1153 PacketType packet(
Index index)
const
1155 if (ForwardLinearAccess)
1159 RowsAtCompileTime == 1 ? index : 0);
1162 template<
int StoreMode,
typename PacketType>
1164 void writePacket(
Index row,
Index col,
const PacketType& x)
1169 template<
int StoreMode,
typename PacketType>
1171 void writePacket(
Index index,
const PacketType& x)
1173 if (ForwardLinearAccess)
1177 RowsAtCompileTime == 1 ? index : 0,
1182 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1185 return m_argImpl.coeff(m_linear_offset.value() + index);
1187 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1190 return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1193 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1196 return m_argImpl.coeffRef(m_linear_offset.value() + index);
1198 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1201 return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0);
1213template<
typename ArgType,
int BlockRows,
int BlockCols,
bool InnerPanel>
1216 typename Block<ArgType, BlockRows, BlockCols, InnerPanel>::PlainObject>
1219 typedef typename XprType::Scalar Scalar;
1221 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1235template<
typename ConditionMatrixType,
typename ThenMatrixType,
typename ElseMatrixType>
1237 :
evaluator_base<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
1250 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1252 : m_conditionImpl(select.conditionMatrix()),
1253 m_thenImpl(select.thenMatrix()),
1254 m_elseImpl(select.elseMatrix())
1256 EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost);
1259 typedef typename XprType::CoeffReturnType CoeffReturnType;
1261 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1262 CoeffReturnType coeff(
Index row,
Index col)
const
1264 if (m_conditionImpl.coeff(row, col))
1265 return m_thenImpl.coeff(row, col);
1267 return m_elseImpl.coeff(row, col);
1270 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1271 CoeffReturnType coeff(
Index index)
const
1273 if (m_conditionImpl.coeff(index))
1274 return m_thenImpl.coeff(index);
1276 return m_elseImpl.coeff(index);
1288template<
typename ArgType,
int RowFactor,
int ColFactor>
1293 typedef typename XprType::CoeffReturnType CoeffReturnType;
1298 typedef typename internal::remove_all<ArgTypeNested>::type ArgTypeNestedCleaned;
1302 LinearAccessMask = XprType::IsVectorAtCompileTime ?
LinearAccessBit : 0,
1308 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1310 : m_arg(replicate.nestedExpression()),
1312 m_rows(replicate.nestedExpression().rows()),
1313 m_cols(replicate.nestedExpression().cols())
1316 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1317 CoeffReturnType coeff(
Index row,
Index col)
const
1322 : row % m_rows.value();
1325 : col % m_cols.value();
1330 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1331 CoeffReturnType coeff(
Index index)
const
1335 ? (
ColFactor==1 ? index : index%m_cols.value())
1336 : (
RowFactor==1 ? index : index%m_rows.value());
1341 template<
int LoadMode,
typename PacketType>
1343 PacketType packet(
Index row,
Index col)
const
1347 : row % m_rows.value();
1350 : col % m_cols.value();
1355 template<
int LoadMode,
typename PacketType>
1357 PacketType packet(
Index index)
const
1360 ? (
ColFactor==1 ? index : index%m_cols.value())
1361 : (
RowFactor==1 ? index : index%m_rows.value());
1378template<
typename XprType>
1382 typedef typename remove_all<typename XprType::NestedExpressionType>::type ArgType;
1389 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1392 typedef typename ArgType::Scalar Scalar;
1393 typedef typename ArgType::CoeffReturnType CoeffReturnType;
1395 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1396 CoeffReturnType coeff(
Index row,
Index col)
const
1398 return m_argImpl.coeff(row, col);
1401 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1402 CoeffReturnType coeff(
Index index)
const
1404 return m_argImpl.coeff(index);
1407 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1410 return m_argImpl.coeffRef(row, col);
1413 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1414 Scalar& coeffRef(
Index index)
1416 return m_argImpl.coeffRef(index);
1419 template<
int LoadMode,
typename PacketType>
1421 PacketType packet(
Index row,
Index col)
const
1426 template<
int LoadMode,
typename PacketType>
1428 PacketType packet(
Index index)
const
1433 template<
int StoreMode,
typename PacketType>
1435 void writePacket(
Index row,
Index col,
const PacketType& x)
1440 template<
int StoreMode,
typename PacketType>
1442 void writePacket(
Index index,
const PacketType& x)
1451template<
typename TArgType>
1457 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1463template<
typename TArgType>
1469 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1481template<
typename ArgType,
int Direction>
1486 typedef typename XprType::Scalar Scalar;
1487 typedef typename XprType::CoeffReturnType CoeffReturnType;
1490 IsRowMajor = XprType::IsRowMajor,
1491 IsColMajor = !IsRowMajor,
1495 || ((Direction ==
Vertical) && IsColMajor)
1496 || ((Direction ==
Horizontal) && IsRowMajor),
1504 || ((ReverseRow && XprType::ColsAtCompileTime==1) || (ReverseCol && XprType::RowsAtCompileTime==1))
1507 Flags = int(Flags0) & (HereditaryBits |
PacketAccessBit | LinearAccess),
1512 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1514 : m_argImpl(reverse.nestedExpression()),
1515 m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1),
1516 m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1)
1519 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1520 CoeffReturnType coeff(
Index row,
Index col)
const
1522 return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row,
1523 ReverseCol ? m_cols.value() - col - 1 : col);
1526 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1527 CoeffReturnType coeff(
Index index)
const
1529 return m_argImpl.coeff(m_rows.value() * m_cols.value() - index - 1);
1532 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1535 return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row,
1536 ReverseCol ? m_cols.value() - col - 1 : col);
1539 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1540 Scalar& coeffRef(
Index index)
1542 return m_argImpl.coeffRef(m_rows.value() * m_cols.value() - index - 1);
1545 template<
int LoadMode,
typename PacketType>
1547 PacketType packet(
Index row,
Index col)
const
1551 OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
1552 OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1
1556 ReverseRow ? m_rows.value() - row - OffsetRow : row,
1557 ReverseCol ? m_cols.value() - col - OffsetCol : col));
1560 template<
int LoadMode,
typename PacketType>
1562 PacketType packet(
Index index)
const
1568 template<
int LoadMode,
typename PacketType>
1570 void writePacket(
Index row,
Index col,
const PacketType& x)
1575 OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1,
1576 OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1
1580 ReverseRow ? m_rows.value() - row - OffsetRow : row,
1581 ReverseCol ? m_cols.value() - col - OffsetCol : col,
1582 reverse_packet::run(x));
1585 template<
int LoadMode,
typename PacketType>
1587 void writePacket(
Index index,
const PacketType& x)
1591 (m_rows.value() * m_cols.value() - index - PacketSize, preverse(x));
1606template<
typename ArgType,
int DiagIndex>
1620 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1622 : m_argImpl(diagonal.nestedExpression()),
1623 m_index(diagonal.index())
1626 typedef typename XprType::Scalar Scalar;
1627 typedef typename XprType::CoeffReturnType CoeffReturnType;
1629 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1630 CoeffReturnType coeff(
Index row,
Index)
const
1632 return m_argImpl.coeff(row + rowOffset(), row + colOffset());
1635 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1636 CoeffReturnType coeff(
Index index)
const
1638 return m_argImpl.coeff(index + rowOffset(), index + colOffset());
1641 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1644 return m_argImpl.coeffRef(row + rowOffset(), row + colOffset());
1647 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
1648 Scalar& coeffRef(
Index index)
1650 return m_argImpl.coeffRef(index + rowOffset(), index + colOffset());
1658 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
1659 Index rowOffset()
const {
return m_index.value() > 0 ? 0 : -m_index.value(); }
1660 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR
1661 Index colOffset()
const {
return m_index.value() > 0 ? m_index.value() : 0; }
1675template<
typename ArgType>
1680template<
typename ArgType>
1693 const ArgType& arg()
const
1698 EIGEN_CONSTEXPR
Index rows()
const EIGEN_NOEXCEPT
1700 return m_arg.rows();
1703 EIGEN_CONSTEXPR
Index cols()
const EIGEN_NOEXCEPT
1705 return m_arg.cols();
1709 const ArgType& m_arg;
1712template<
typename ArgType>
1714 :
public evaluator<typename ArgType::PlainObject>
1717 typedef typename ArgType::PlainObject PlainObject;
1721 : m_result(
xpr.arg())
1723 ::new (
static_cast<Base*
>(
this))
Base(m_result);
1727 EIGEN_DEVICE_FUNC
evaluator(
const ArgType& arg)
1730 ::new (
static_cast<Base*
>(
this))
Base(m_result);
1734 PlainObject m_result;
Expression of a mathematical vector or matrix as an array object.
Definition ArrayWrapper.h:43
General-purpose arrays with easy API for coefficient-wise operations.
Definition Array.h:47
Expression of a fixed-size or dynamic-size block.
Definition Block.h:105
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition CwiseBinaryOp.h:84
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:61
Generic expression where a coefficient-wise ternary operator is applied to two expressions.
Definition CwiseTernaryOp.h:88
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition CwiseUnaryOp.h:56
Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector.
Definition CwiseUnaryView.h:59
EIGEN_DEVICE_FUNC CoeffReturnType value() const
Definition DenseBase.h:526
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Definition Diagonal.h:65
A matrix or vector expression mapping an existing array of data.
Definition Map.h:96
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
Expression of an array as a mathematical vector or matrix.
Definition ArrayWrapper.h:141
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
Convenience specialization of Stride to specify only an outer stride See class Map for some examples.
Definition Stride.h:111
Definition PlainObjectBase.h:100
A matrix or vector expression mapping an existing expression.
Definition Ref.h:283
Expression of the multiple replication of a matrix or vector.
Definition Replicate.h:63
Expression of the reverse of a vector or matrix.
Definition Reverse.h:65
Expression of a coefficient wise version of the C++ ternary operator ?:
Definition Select.h:54
Expression of the transpose of a matrix.
Definition Transpose.h:54
Definition CoreEvaluators.h:1683
Definition CoreEvaluators.h:136
Definition XprHelper.h:130
Definition XprHelper.h:155
@ BothDirections
For Reverse, both rows and columns are reversed; not used for PartialReduxExpr and VectorwiseOp.
Definition Constants.h:270
@ Horizontal
For Reverse, all rows are reversed; for PartialReduxExpr and VectorwiseOp, act on rows.
Definition Constants.h:267
@ Vertical
For Reverse, all columns are reversed; for PartialReduxExpr and VectorwiseOp, act on columns.
Definition Constants.h:264
const unsigned int PacketAccessBit
Short version: means the expression might be vectorized.
Definition Constants.h:94
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 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
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
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 Constants.h:528
The type used to identify a dense storage.
Definition Constants.h:507
Holds information about the various numeric (i.e.
Definition NumTraits.h:236
Definition Constants.h:535
The type used to identify a permutation storage.
Definition Constants.h:516
Definition Constants.h:529
The type used to identify a general solver (factored) storage.
Definition Constants.h:513
Definition Constants.h:536
The type used to identify a permutation storage.
Definition Constants.h:519
Definition Constants.h:542
Definition CoreEvaluators.h:61
Definition CoreEvaluators.h:1031
Definition XprHelper.h:484
Definition CoreEvaluators.h:84
Definition CoreEvaluators.h:111
Definition CoreEvaluators.h:71
Definition CoreEvaluators.h:80
Definition CoreEvaluators.h:1381
Definition CoreEvaluators.h:91
Definition NullaryFunctors.h:151
Definition XprHelper.h:176
Definition ForwardDeclarations.h:26
Definition DenseCoeffsBase.h:659
Definition CoreEvaluators.h:885
Definition CoreEvaluators.h:387
Definition DenseCoeffsBase.h:671
Definition CoreEvaluators.h:23
Definition CoreEvaluators.h:29
Definition CoreEvaluators.h:55
Definition ForwardDeclarations.h:17
Definition CoreEvaluators.h:65
Definition GenericPacketMath.h:133