11#ifndef EIGEN_RESHAPED_H
12#define EIGEN_RESHAPED_H
48template<
typename XprType,
int Rows,
int Cols,
int Order>
57 RowsAtCompileTime = Rows,
58 ColsAtCompileTime = Cols,
59 MaxRowsAtCompileTime = Rows,
60 MaxColsAtCompileTime = Cols,
62 ReshapedStorageOrder = (RowsAtCompileTime == 1 && ColsAtCompileTime != 1) ?
RowMajor
63 : (ColsAtCompileTime == 1 && RowsAtCompileTime != 1) ?
ColMajor
65 HasSameStorageOrderAsXprType = (ReshapedStorageOrder == XpxStorageOrder),
66 InnerSize = (ReshapedStorageOrder==
int(
RowMajor)) ?
int(ColsAtCompileTime) :
int(RowsAtCompileTime),
67 InnerStrideAtCompileTime = HasSameStorageOrderAsXprType
77 && (InnerStrideAtCompileTime == 1)
80 FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ?
LinearAccessBit : 0,
86 Flags = (Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit | FlagsDirectAccessBit)
90template<
typename XprType,
int Rows,
int Cols,
int Order,
bool HasDirectAccess>
class ReshapedImpl_dense;
94template<
typename XprType,
int Rows,
int Cols,
int Order,
typename StorageKind>
class ReshapedImpl;
96template<
typename XprType,
int Rows,
int Cols,
int Order>
class Reshaped
97 :
public ReshapedImpl<XprType, Rows, Cols, Order, typename internal::traits<XprType>::StorageKind>
121 :
Impl(xpr, reshapeRows, reshapeCols)
124 && (ColsAtCompileTime==
Dynamic || ColsAtCompileTime==reshapeCols));
125 eigen_assert(reshapeRows * reshapeCols == xpr.rows() * xpr.cols());
131template<
typename XprType,
int Rows,
int Cols,
int Order>
141 :
Impl(xpr, reshapeRows, reshapeCols) {}
147template<
typename XprType,
int Rows,
int Cols,
int Order>
167 : m_xpr(
xpr), m_rows(Rows), m_cols(Cols)
180 #ifdef EIGEN_PARSED_BY_DOXYGEN
206template<
typename XprType,
int Rows,
int Cols,
int Order>
208 :
public MapBase<Reshaped<XprType, Rows, Cols, Order> >
246 return m_xpr.innerStride();
262template<
typename ArgType,
int Rows,
int Cols,
int Order,
bool HasDirectAccess>
struct reshaped_evaluator;
264template<
typename ArgType,
int Rows,
int Cols,
int Order>
266 :
reshaped_evaluator<ArgType, Rows, Cols, Order, traits<Reshaped<ArgType,Rows,Cols,Order> >::HasDirectAccess>
291 Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit | FlagsDirectAccessBit,
294 Alignment =
evaluator<ArgType>::Alignment
303template<
typename ArgType,
int Rows,
int Cols,
int Order>
370 Rows == 1 ? index : 0);
379 Rows == 1 ? index : 0);
387 Rows == 1 ? index : 0);
392 template<
int LoadMode>
400 template<
int LoadMode>
402 inline void writePacket(
Index rowId,
Index colId,
const PacketScalar& val)
404 const RowCol row_col = index_remap(rowId, colId);
405 m_argImpl.const_cast_derived().template writePacket<Unaligned>
406 (row_col.first, row_col.second, val);
409 template<
int LoadMode>
411 inline PacketScalar packet(Index index)
const
413 const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index,
414 RowsAtCompileTime == 1 ? index : 0);
415 return m_argImpl.template packet<Unaligned>(row_col.first, row_col.second);
418 template<
int LoadMode>
420 inline void writePacket(Index index,
const PacketScalar& val)
422 const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index,
423 RowsAtCompileTime == 1 ? index : 0);
424 return m_argImpl.template packet<Unaligned>(row_col.first, row_col.second, val);
434template<
typename ArgType,
int Rows,
int Cols,
int Order>
437 typename Reshaped<ArgType, Rows, Cols, Order>::PlainObject>
#define EIGEN_PLAIN_ENUM_MAX(a, b)
Definition Macros.h:1289
#define EIGEN_GENERIC_PUBLIC_INTERFACE(Derived)
Definition Macros.h:1264
#define EIGEN_CONSTEXPR
Definition Macros.h:787
#define EIGEN_DEVICE_FUNC
Definition Macros.h:976
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition Macros.h:1283
#define eigen_assert(x)
Definition Macros.h:1037
#define EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Derived)
Definition Macros.h:1231
#define EIGEN_STRONG_INLINE
Definition Macros.h:917
int data[]
Definition Map_placement_new.cpp:1
#define EIGEN_STATIC_ASSERT_LVALUE(Derived)
Definition StaticAssert.h:202
#define EIGEN_INTERNAL_CHECK_COST_VALUE(C)
Definition StaticAssert.h:218
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition StaticAssert.h:127
int rows
Definition Tutorial_commainit_02.cpp:1
int cols
Definition Tutorial_commainit_02.cpp:1
Scalar Scalar int size
Definition benchVecAdd.cpp:17
SCALAR Scalar
Definition bench_gemm.cpp:46
An InnerIterator allows to loop over the element of any matrix expression.
Definition CoreIterators.h:34
Definition ForwardDeclarations.h:112
Impl Base
Definition Reshaped.h:137
EIGEN_DEVICE_FUNC ReshapedImpl(XprType &xpr, Index reshapeRows, Index reshapeCols)
Definition Reshaped.h:140
Expression of a fixed-size or dynamic-size reshape.
Definition Reshaped.h:98
EIGEN_DEVICE_FUNC Reshaped(XprType &xpr, Index reshapeRows, Index reshapeCols)
Definition Reshaped.h:119
Impl Base
Definition Reshaped.h:102
EIGEN_DEVICE_FUNC Reshaped(XprType &xpr)
Definition Reshaped.h:109
EIGEN_DEVICE_FUNC Index rows() const
Definition Reshaped.h:177
EIGEN_DEVICE_FUNC ReshapedImpl_dense(XprType &xpr, Index nRows, Index nCols)
Definition Reshaped.h:173
internal::dense_xpr_base< ReshapedType >::type Base
Definition Reshaped.h:154
EIGEN_DEVICE_FUNC const internal::remove_all< XprType >::type & nestedExpression() const
Definition Reshaped.h:190
EIGEN_DEVICE_FUNC Index cols() const
Definition Reshaped.h:178
MatrixTypeNested m_xpr
Definition Reshaped.h:199
const internal::variable_if_dynamic< Index, Cols > m_cols
Definition Reshaped.h:201
const internal::variable_if_dynamic< Index, Rows > m_rows
Definition Reshaped.h:200
EIGEN_DEVICE_FUNC internal::remove_reference< XprType >::type & nestedExpression()
Definition Reshaped.h:195
EIGEN_DEVICE_FUNC const internal::remove_all< XprTypeNested >::type & nestedExpression() const
Definition Reshaped.h:234
EIGEN_DEVICE_FUNC ReshapedImpl_dense(XprType &xpr, Index nRows, Index nCols)
Definition Reshaped.h:228
EIGEN_DEVICE_FUNC ReshapedImpl_dense(XprType &xpr)
Definition Reshaped.h:221
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const
Definition Reshaped.h:251
EIGEN_DEVICE_FUNC XprType & nestedExpression()
Definition Reshaped.h:240
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerStride() const
Definition Reshaped.h:244
XprTypeNested m_xpr
Definition Reshaped.h:258
MapBase< ReshapedType > Base
Definition Reshaped.h:214
Definition TensorRef.h:81
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
const unsigned int PacketAccessBit
Definition Constants.h:94
const unsigned int LinearAccessBit
Definition Constants.h:130
const unsigned int DirectAccessBit
Definition Constants.h:155
const unsigned int LvalueBit
Definition Constants.h:144
const unsigned int RowMajorBit
Definition Constants.h:66
DenseIndex ret
Definition level1_cplx_impl.h:44
std::size_t UIntPtr
Definition Meta.h:92
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
const unsigned int HereditaryBits
Definition Constants.h:195
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
const int Dynamic
Definition Constants.h:22
Definition BandTriangularSolver.h:13
CwiseBinaryOp< internal::scalar_sum_op< double, double >, const CpyMatrixXd, const CpyMatrixXd > XprType
Definition nestbyvalue.cpp:15
Definition Constants.h:507
Definition XprHelper.h:484
packet_traits< Scalar >::type PacketScalar
Definition Reshaped.h:271
reshaped_evaluator< ArgType, Rows, Cols, Order, HasDirectAccess > reshaped_evaluator_type
Definition Reshaped.h:296
EIGEN_DEVICE_FUNC evaluator(const XprType &xpr)
Definition Reshaped.h:297
XprType::Scalar Scalar
Definition Reshaped.h:269
Reshaped< ArgType, Rows, Cols, Order > XprType
Definition Reshaped.h:268
Definition CoreEvaluators.h:111
Definition CoreEvaluators.h:91
Definition ForwardDeclarations.h:26
Definition DenseCoeffsBase.h:659
Definition XprHelper.h:660
Definition CoreEvaluators.h:885
Definition GenericPacketMath.h:107
Definition XprHelper.h:417
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index index)
Definition Reshaped.h:366
std::pair< Index, Index > RowCol
Definition Reshaped.h:325
EIGEN_DEVICE_FUNC reshaped_evaluator(const XprType &xpr)
Definition Reshaped.h:317
EIGEN_DEVICE_FUNC Scalar & coeffRef(Index rowId, Index colId)
Definition Reshaped.h:344
const XprType & m_xpr
Definition Reshaped.h:430
XprType::CoeffReturnType CoeffReturnType
Definition Reshaped.h:323
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index index) const
Definition Reshaped.h:376
EIGEN_DEVICE_FUNC const Scalar & coeffRef(Index rowId, Index colId) const
Definition Reshaped.h:352
Reshaped< ArgType, Rows, Cols, Order > XprType
Definition Reshaped.h:307
EIGEN_DEVICE_FUNC const CoeffReturnType coeff(Index index) const
Definition Reshaped.h:384
evaluator< ArgType > m_argImpl
Definition Reshaped.h:429
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const
Definition Reshaped.h:359
RowCol index_remap(Index rowId, Index colId) const
Definition Reshaped.h:327
XprType::Scalar Scalar
Definition Reshaped.h:322
EIGEN_DEVICE_FUNC reshaped_evaluator(const XprType &xpr)
Definition Reshaped.h:442
Reshaped< ArgType, Rows, Cols, Order > XprType
Definition Reshaped.h:439
XprType::Scalar Scalar
Definition Reshaped.h:440
Definition Reshaped.h:262
traits< XprType >::StorageKind StorageKind
Definition Reshaped.h:52
traits< XprType >::XprKind XprKind
Definition Reshaped.h:53
traits< XprType >::Scalar Scalar
Definition Reshaped.h:51
Definition ForwardDeclarations.h:17
Definition GenericPacketMath.h:133