diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 22090c777..8949e5a8e 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -402,9 +402,10 @@ class Matrix void swap(const MatrixBase& other); /** \name Map - * These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects, - * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned - * \a data pointers. + * These are convenience functions returning Map objects. + * + * \warning Do not use MapAligned in the Eigen 2.0. Mapping aligned arrays will be fully + * supported in Eigen 3.0 (already implemented in the development branch) * * \see class Map */ diff --git a/doc/QuickStartGuide.dox b/doc/QuickStartGuide.dox index 90dc29277..d99be0f56 100644 --- a/doc/QuickStartGuide.dox +++ b/doc/QuickStartGuide.dox @@ -229,17 +229,24 @@ Of course, fixed-size matrices can't be resized. \subsection TutorialMap Map -Any memory buffer can be mapped as an Eigen expression: -
+Any memory buffer can be mapped as an Eigen expression using the Map() static method: \code std::vector stlarray(10); -Map(&stlarray[0], stlarray.size()).setOnes(); -int data[4] = 1, 2, 3, 4; -Matrix2i mat2x2(data); -MatrixXi mat2x2 = Map(data); -MatrixXi mat2x2 = Map(data,2,2); +VectorXf::Map(&stlarray[0], stlarray.size()).squaredNorm(); +\endcode +Here VectorXf::Map returns an object of class Map, which behaves like a VectorXf except that it uses the existing array. You can write to this object, that will write to the existing array. You can also construct a named obtect to reuse it: +\code +float array[rows*cols]; +Map m(array,rows,cols); +m = othermatrix1 * othermatrix2; +m.eigenvalues(); +\endcode +In the fixed-size case, no need to pass sizes: +\code +float array[9]; +Map m(array); +Matrix3d::Map(array).setIdentity(); \endcode -