From ec07c4109d255f13b5f49e0d69d4f06b00853351 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Fri, 25 Jun 2010 14:48:16 +0200 Subject: [PATCH] add default parameters for InnerStride/OuterStride to be able to simply write OuterStride<> instead of OuterStride --- Eigen/src/Core/Map.h | 4 +++- Eigen/src/Core/Stride.h | 11 +++++++---- doc/snippets/Map_outer_stride.cpp | 4 +--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Eigen/src/Core/Map.h b/Eigen/src/Core/Map.h index aa6713251..0c4d08a17 100644 --- a/Eigen/src/Core/Map.h +++ b/Eigen/src/Core/Map.h @@ -57,7 +57,9 @@ * * Here's an example of mapping an array while specifying an outer stride. Here, since we're mapping * as a column-major matrix, 'outer stride' means the pointer increment between two consecutive columns. - * Here, we're specifying the outer stride as a runtime parameter. + * Here, we're specifying the outer stride as a runtime parameter. Note that here \c OuterStride<> is + * a short version of \c OuterStride because the default template parameter of OuterStride + * is \c Dynamic * \include Map_outer_stride.cpp * Output: \verbinclude Map_outer_stride.out * diff --git a/Eigen/src/Core/Stride.h b/Eigen/src/Core/Stride.h index a965b5a55..5f9a18523 100644 --- a/Eigen/src/Core/Stride.h +++ b/Eigen/src/Core/Stride.h @@ -46,6 +46,7 @@ * \param _OuterStrideAtCompileTime the outer stride, or Dynamic if you want to specify it at runtime. * \param _InnerStrideAtCompileTime the inner stride, or Dynamic if you want to specify it at runtime. * + * Here is an example: * \include Map_general_stride.cpp * Output: \verbinclude Map_general_stride.out * @@ -90,8 +91,9 @@ class Stride ei_variable_if_dynamic m_inner; }; -/** \brief Convenience specialization of Stride to specify only an inner stride */ -template +/** \brief Convenience specialization of Stride to specify only an inner stride + * See class Map for some examples */ +template class InnerStride : public Stride<0, Value> { typedef Stride<0, Value> Base; @@ -101,8 +103,9 @@ class InnerStride : public Stride<0, Value> InnerStride(Index v) : Base(0, v) {} }; -/** \brief Convenience specialization of Stride to specify only an outer stride */ -template +/** \brief Convenience specialization of Stride to specify only an outer stride + * See class Map for some examples */ +template class OuterStride : public Stride { typedef Stride Base; diff --git a/doc/snippets/Map_outer_stride.cpp b/doc/snippets/Map_outer_stride.cpp index 4bedaa508..2f6f052c3 100644 --- a/doc/snippets/Map_outer_stride.cpp +++ b/doc/snippets/Map_outer_stride.cpp @@ -1,5 +1,3 @@ int array[12]; for(int i = 0; i < 12; ++i) array[i] = i; -cout << Map > - (array, 3, 3, OuterStride(4)) - << endl; +cout << Map >(array, 3, 3, OuterStride<>(4)) << endl;