aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Eigen/src/Core/Block.h16
-rw-r--r--Eigen/src/Core/MapBase.h20
2 files changed, 32 insertions, 4 deletions
diff --git a/Eigen/src/Core/Block.h b/Eigen/src/Core/Block.h
index cf7730170..42d6bc3c3 100644
--- a/Eigen/src/Core/Block.h
+++ b/Eigen/src/Core/Block.h
@@ -201,6 +201,13 @@ template<typename MatrixType, int BlockRows, int BlockCols, int PacketAccess, in
m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), x);
}
+ #ifdef EIGEN_PARSED_BY_DOXYGEN
+ /** \sa MapBase::data() */
+ inline const Scalar* data() const;
+ /** \sa MapBase::stride() */
+ inline int stride() const;
+ #endif
+
protected:
const typename MatrixType::Nested m_matrix;
@@ -269,7 +276,14 @@ class Block<MatrixType,BlockRows,BlockCols,PacketAccess,HasDirectAccess>
&& startCol >= 0 && blockCols >= 0 && startCol + blockCols <= matrix.cols());
}
- inline int stride(void) const { return m_matrix.stride(); }
+ /** \sa MapBase::stride() */
+ inline int stride() const
+ {
+ return ((!Base::IsVectorAtCompileTime)
+ || (BlockRows==1 && ((Flags&RowMajorBit)==0))
+ || (BlockCols==1 && ((Flags&RowMajorBit)==RowMajorBit)))
+ ? m_matrix.stride() : 1;
+ }
#ifndef __SUNPRO_CC
// FIXME sunstudio is not friendly with the above friend...
diff --git a/Eigen/src/Core/MapBase.h b/Eigen/src/Core/MapBase.h
index a0311ffcf..404fa176e 100644
--- a/Eigen/src/Core/MapBase.h
+++ b/Eigen/src/Core/MapBase.h
@@ -62,7 +62,21 @@ template<typename Derived> class MapBase
inline int rows() const { return m_rows.value(); }
inline int cols() const { return m_cols.value(); }
+ /** Returns the leading dimension (for matrices) or the increment (for vectors) to be used with data().
+ *
+ * More precisely:
+ * - for a column major matrix it returns the number of elements between two successive columns
+ * - for a row major matrix it returns the number of elements between two successive rows
+ * - for a vector it returns the number of elements between two successive coefficients
+ * This function has to be used together with the MapBase::data() function.
+ *
+ * \sa MapBase::data() */
inline int stride() const { return derived().stride(); }
+
+ /** Returns a pointer to the first coefficient of the matrix or vector.
+ * This function has to be used together with the stride() function.
+ *
+ * \sa MapBase::stride() */
inline const Scalar* data() const { return m_data; }
template<bool IsForceAligned,typename Dummy> struct force_aligned_impl {
@@ -167,9 +181,9 @@ template<typename Derived> class MapBase
}
#ifndef _MSC_VER
- Derived& operator=(const MapBase& other)
- {
- return Base::operator=(other);
+ Derived& operator=(const MapBase& other)
+ {
+ return Base::operator=(other);
}
#endif