[eigen] Snippet for select |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] Snippet for select
- From: Ricard Marxer Piñón <email@xxxxxxxxxxxxxxxx>
- Date: Sat, 17 Jan 2009 10:53:50 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=1hsGHBf/J3ICnc1XMxl4nebPneCRG7M4TBIt5dDckPM=; b=Dle2+3XyFb02nWSofmJbSj71yYDtwYv5lAtO4djxWg/MDWafFpmXJq4xLf6apzhm7T wvoGY68iZrQRrhH/BPHCv1x0ju+3pt9MvtVxjRC4TWUJ1bi8BmvIa6epbjdZ/u2eJnSM Hs385hUysMzBZIWB5sO1eAO89K65Cvs+hsaMg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=uJ4iN7qmRA6aEk5HsCYAIVT6bj5KR2aawmx5dCJmbAQN5UQTzygegVptX2hCudHhDQ 1EpA5M15PxkvCZAa7TvWZ2a3VIqOr9ukJT7l8DRlKk/MbpWrj7Blac+loUDzJLvqjmOS 3B0Exg/IQs9bKX7fuIOr7+XWPsGN4yY0qfajI=
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>