[eigen] Snippet for select

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Here is a small patch to have an example for select().  At least the next newbie will not bother the devs as much as I do, je je

--
ricard
http://www.ricardmarxer.com
http://www.caligraft.com
Index: doc/snippets/MatrixBase_select.cpp
===================================================================
--- doc/snippets/MatrixBase_select.cpp	(revision 0)
+++ doc/snippets/MatrixBase_select.cpp	(revision 0)
@@ -0,0 +1,6 @@
+MatrixXi m(3, 3);
+m << 1, 2, 3, 
+     4, 5, 6, 
+     7, 8, 9;
+m = (m.cwise() >= 5).select(-m, m);
+cout << m << endl;
Index: Eigen/src/Array/Select.h
===================================================================
--- Eigen/src/Array/Select.h	(revision 911551)
+++ Eigen/src/Array/Select.h	(working copy)
@@ -108,6 +108,9 @@
   * \returns a matrix where each coefficient (i,j) is equal to \a thenMatrix(i,j)
   * if \c *this(i,j), and \a elseMatrix(i,j) otherwise.
   *
+  * Example: \include MatrixBase_select.cpp
+  * Output: \verbinclude MatrixBase_select.out
+  *
   * \sa class Select
   */
 template<typename Derived>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/