aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2018-09-19 11:49:26 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2018-09-19 11:49:26 +0200
commitdfa8439e4d71a3b8dafc38a8419998e683f3ee96 (patch)
treee265df048a88fe428c28f60d10e3544cd906eb7f /Eigen
parent5c68ba41a8b5fab7a742d786a12e7b3b92119b3e (diff)
Update reshaped API to use RowMajor/ColMajor directly as integral values instead of introducing RowOrder/ColOrder types.
The API changed from A.respahed(rows,cols,RowOrder) to A.template reshaped<RowOrder>(rows,cols).
Diffstat (limited to 'Eigen')
-rw-r--r--Eigen/src/Core/Reshaped.h6
-rw-r--r--Eigen/src/Core/util/IntegralConstant.h5
-rw-r--r--Eigen/src/Core/util/ReshapedHelper.h1
-rw-r--r--Eigen/src/plugins/ReshapedMethods.h16
4 files changed, 12 insertions, 16 deletions
diff --git a/Eigen/src/Core/Reshaped.h b/Eigen/src/Core/Reshaped.h
index 56fd3519a..aaa5a5739 100644
--- a/Eigen/src/Core/Reshaped.h
+++ b/Eigen/src/Core/Reshaped.h
@@ -62,7 +62,7 @@ struct traits<Reshaped<XprType, Rows, Cols, Order> > : traits<XprType>
: (ColsAtCompileTime == 1 && RowsAtCompileTime != 1) ? ColMajor
: XpxStorageOrder,
HasSameStorageOrderAsXprType = (ReshapedStorageOrder == XpxStorageOrder),
- InnerSize = (ReshapedStorageOrder==RowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
+ InnerSize = (ReshapedStorageOrder==int(RowMajor)) ? int(ColsAtCompileTime) : int(RowsAtCompileTime),
InnerStrideAtCompileTime = HasSameStorageOrderAsXprType
? int(inner_stride_at_compile_time<XprType>::ret)
: Dynamic,
@@ -78,7 +78,7 @@ struct traits<Reshaped<XprType, Rows, Cols, Order> > : traits<XprType>
//MaskAlignedBit = ((OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0,
FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0,
FlagsLvalueBit = is_lvalue<XprType>::value ? LvalueBit : 0,
- FlagsRowMajorBit = (ReshapedStorageOrder==RowMajor) ? RowMajorBit : 0,
+ FlagsRowMajorBit = (ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0,
FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0,
Flags0 = traits<XprType>::Flags & ( (HereditaryBits & ~RowMajorBit) | MaskPacketAccessBit),
@@ -284,7 +284,7 @@ struct evaluator<Reshaped<ArgType, Rows, Cols, Order> >
// OuterStrideAtCompileTime = Dynamic,
FlagsLinearAccessBit = (traits<XprType>::RowsAtCompileTime == 1 || traits<XprType>::ColsAtCompileTime == 1 || HasDirectAccess) ? LinearAccessBit : 0,
- FlagsRowMajorBit = (traits<XprType>::ReshapedStorageOrder==RowMajor) ? RowMajorBit : 0,
+ FlagsRowMajorBit = (traits<XprType>::ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0,
FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0,
Flags0 = evaluator<ArgType>::Flags & (HereditaryBits & ~RowMajorBit),
Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit | FlagsDirectAccessBit,
diff --git a/Eigen/src/Core/util/IntegralConstant.h b/Eigen/src/Core/util/IntegralConstant.h
index 4310aada1..c7d3b1c06 100644
--- a/Eigen/src/Core/util/IntegralConstant.h
+++ b/Eigen/src/Core/util/IntegralConstant.h
@@ -265,11 +265,6 @@ static const auto fix(int val);
#endif // EIGEN_PARSED_BY_DOXYGEN
-const int AutoOrderValue = 2;
-const internal::FixedInt<ColMajor> ColOrder;
-const internal::FixedInt<RowMajor> RowOrder;
-const internal::FixedInt<AutoOrderValue> AutoOrder;
-
} // end namespace Eigen
#endif // EIGEN_INTEGRAL_CONSTANT_H
diff --git a/Eigen/src/Core/util/ReshapedHelper.h b/Eigen/src/Core/util/ReshapedHelper.h
index 7b7435205..97370c138 100644
--- a/Eigen/src/Core/util/ReshapedHelper.h
+++ b/Eigen/src/Core/util/ReshapedHelper.h
@@ -14,6 +14,7 @@
namespace Eigen {
enum AutoSize_t { AutoSize };
+const int AutoOrder = 2;
namespace internal {
diff --git a/Eigen/src/plugins/ReshapedMethods.h b/Eigen/src/plugins/ReshapedMethods.h
index b22d8bb32..db55cffe7 100644
--- a/Eigen/src/plugins/ReshapedMethods.h
+++ b/Eigen/src/plugins/ReshapedMethods.h
@@ -27,16 +27,16 @@
/// \sa operator()(placeholders::all), class Reshaped, fix, fix<N>(int)
///
#ifdef EIGEN_PARSED_BY_DOXYGEN
-template<typename NRowsType, typename NColsType, typename OrderType = ColOrder>
+template<int Order = ColMajor, typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
inline Reshaped<Derived,...>
-reshaped(NRowsType nRows, NColsType nCols, OrderType order = ColOrder);
+reshaped(NRowsType nRows, NColsType nCols);
/** This is the const version of reshaped(NRowsType,NColsType). */
-template<typename NRowsType, typename NColsType, typename OrderType = ColOrder>
+template<int Order = ColMajor, typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
inline const Reshaped<const Derived,...>
-reshaped(NRowsType nRows, NColsType nCols, OrderType order = ColOrder) const;
+reshaped(NRowsType nRows, NColsType nCols) const;
/// \returns as expression of \c *this with columns stacked to a linear column vector
///
@@ -83,18 +83,18 @@ reshaped(NRowsType nRows, NColsType nCols) EIGEN_RESHAPED_METHOD_CONST
internal::get_runtime_reshape_size(nCols,internal::get_runtime_value(nRows),size()));
}
-template<typename NRowsType, typename NColsType, typename OrderType>
+template<int Order, typename NRowsType, typename NColsType>
EIGEN_DEVICE_FUNC
inline Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,
internal::get_compiletime_reshape_size<NRowsType,NColsType,SizeAtCompileTime>::value,
internal::get_compiletime_reshape_size<NColsType,NRowsType,SizeAtCompileTime>::value,
- OrderType::value==AutoOrderValue?Flags&RowMajorBit:OrderType::value>
-reshaped(NRowsType nRows, NColsType nCols, OrderType) EIGEN_RESHAPED_METHOD_CONST
+ Order==AutoOrder?Flags&RowMajorBit:Order>
+reshaped(NRowsType nRows, NColsType nCols) EIGEN_RESHAPED_METHOD_CONST
{
return Reshaped<EIGEN_RESHAPED_METHOD_CONST Derived,
internal::get_compiletime_reshape_size<NRowsType,NColsType,SizeAtCompileTime>::value,
internal::get_compiletime_reshape_size<NColsType,NRowsType,SizeAtCompileTime>::value,
- OrderType::value==AutoOrderValue?Flags&RowMajorBit:OrderType::value>
+ Order==AutoOrder?Flags&RowMajorBit:Order>
(derived(),
internal::get_runtime_reshape_size(nRows,internal::get_runtime_value(nCols),size()),
internal::get_runtime_reshape_size(nCols,internal::get_runtime_value(nRows),size()));