aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-06-25 14:48:16 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-06-25 14:48:16 +0200
commitec07c4109d255f13b5f49e0d69d4f06b00853351 (patch)
tree49d867e224a0ffedc1d89102a24aecb2a98764f0
parent4056db01e79eea090e0cb3688e614d2779672d72 (diff)
add default parameters for InnerStride/OuterStride to be
able to simply write OuterStride<> instead of OuterStride<Dynamic>
-rw-r--r--Eigen/src/Core/Map.h4
-rw-r--r--Eigen/src/Core/Stride.h11
-rw-r--r--doc/snippets/Map_outer_stride.cpp4
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<Dynamic> 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<Index, InnerStrideAtCompileTime> m_inner;
};
-/** \brief Convenience specialization of Stride to specify only an inner stride */
-template<int Value>
+/** \brief Convenience specialization of Stride to specify only an inner stride
+ * See class Map for some examples */
+template<int Value = Dynamic>
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<int Value>
+/** \brief Convenience specialization of Stride to specify only an outer stride
+ * See class Map for some examples */
+template<int Value = Dynamic>
class OuterStride : public Stride<Value, 0>
{
typedef Stride<Value, 0> 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<MatrixXi, 0, OuterStride<Dynamic> >
- (array, 3, 3, OuterStride<Dynamic>(4))
- << endl;
+cout << Map<MatrixXi, 0, OuterStride<> >(array, 3, 3, OuterStride<>(4)) << endl;