aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/C07_TutorialReductionsVisitorsBroadcasting.dox
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2010-10-19 11:40:49 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2010-10-19 11:40:49 +0200
commitf66fe2663f9c30b8fb77105432151a392fa12423 (patch)
treeb68070696010c5d70215c3752270eb78304434ec /doc/C07_TutorialReductionsVisitorsBroadcasting.dox
parent9f8b6ad43e3e11eff89270616382bc15556895bd (diff)
update CSS to doxygen 1.7.2, new CSS and cleaning of the tutorial
Diffstat (limited to 'doc/C07_TutorialReductionsVisitorsBroadcasting.dox')
-rw-r--r--doc/C07_TutorialReductionsVisitorsBroadcasting.dox78
1 files changed, 47 insertions, 31 deletions
diff --git a/doc/C07_TutorialReductionsVisitorsBroadcasting.dox b/doc/C07_TutorialReductionsVisitorsBroadcasting.dox
index 130514189..44e963424 100644
--- a/doc/C07_TutorialReductionsVisitorsBroadcasting.dox
+++ b/doc/C07_TutorialReductionsVisitorsBroadcasting.dox
@@ -13,7 +13,7 @@ This tutorial explains Eigen's reductions, visitors and broadcasting and how the
- \ref TutorialReductionsVisitorsBroadcastingReductions
- \ref TutorialReductionsVisitorsBroadcastingReductionsNorm
- \ref TutorialReductionsVisitorsBroadcastingReductionsBool
- - FIXME: .redux()
+ - \ref TutorialReductionsVisitorsBroadcastingReductionsUserdefined
- \ref TutorialReductionsVisitorsBroadcastingVisitors
- \ref TutorialReductionsVisitorsBroadcastingPartialReductions
- \ref TutorialReductionsVisitorsBroadcastingPartialReductionsCombined
@@ -26,11 +26,13 @@ In Eigen, a reduction is a function taking a matrix or array, and returning a si
scalar value. One of the most used reductions is \link DenseBase::sum() .sum() \endlink,
returning the sum of all the coefficients inside a given matrix or array.
-<table class="tutorial_code"><tr><td>
-Example: \include tut_arithmetic_redux_basic.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include tut_arithmetic_redux_basic.cpp
</td>
<td>
-Output: \verbinclude tut_arithmetic_redux_basic.out
+\verbinclude tut_arithmetic_redux_basic.out
</td></tr></table>
The \em trace of a matrix, as returned by the function \c trace(), is the sum of the diagonal coefficients and can equivalently be computed <tt>a.diagonal().sum()</tt>.
@@ -48,11 +50,12 @@ If you want other \f$\ell^p\f$ norms, use the \link MatrixBase::lpNorm() lpNnorm
The following example demonstrates these methods.
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_reductions_norm.out
</td></tr></table>
@@ -65,14 +68,20 @@ The following reductions operate on boolean values:
These are typically used in conjunction with the coefficient-wise comparison and equality operators provided by Array. For instance, <tt>array > 0</tt> is an %Array of the same size as \c array , with \b true at those positions where the corresponding coefficient of \c array is positive. Thus, <tt>(array > 0).all()</tt> tests whether all coefficients of \c array are positive. This can be seen in the following example:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.out
</td></tr></table>
+\subsection TutorialReductionsVisitorsBroadcastingReductionsUserdefined User defined reductions
+
+TODO
+
+In the meantime you can have a look at the DenseBase::redux() function.
\section TutorialReductionsVisitorsBroadcastingVisitors Visitors
Visitors are useful when one wants to obtain the location of a coefficient inside
@@ -86,11 +95,12 @@ The arguments passed to a visitor are pointers to the variables where the
row and column position are to be stored. These variables should be of type
\link DenseBase::Index Index \endlink (FIXME: link ok?), as shown below:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_visitors.out
</td></tr></table>
@@ -106,21 +116,23 @@ with \link DenseBase::colwise() colwise() \endlink or \link DenseBase::rowwise()
A simple example is obtaining the maximum of the elements
in each column in a given matrix, storing the result in a row-vector:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_colwise.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_colwise.out
</td></tr></table>
The same operation can be performed row-wise:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_rowwise.out
</td></tr></table>
@@ -132,11 +144,12 @@ It is also possible to use the result of a partial reduction to do further proce
Here is another example that aims to find the column whose sum of elements is the maximum
within a matrix. With column-wise partial reductions this can be coded as:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_maxnorm.out
</td></tr></table>
@@ -169,11 +182,12 @@ one direction.
A simple example is to add a certain column-vector to each column in a matrix.
This can be accomplished with:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.out
</td></tr></table>
@@ -184,11 +198,12 @@ The same applies for the Array class, where the equivalent for VectorXf is Array
Therefore, to perform the same operation row-wise we can do:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.out
</td></tr></table>
@@ -200,11 +215,12 @@ Now that broadcasting, reductions and partial reductions have been introduced, w
the nearest neighbour of a vector <tt>v</tt> within the columns of matrix <tt>m</tt>. The Euclidean distance will be used in this example,
computing the squared Euclidean distance with the partial reduction named \link MatrixBase::squaredNorm() squaredNorm() \endlink:
-<table class="tutorial_code"><tr><td>
-Example: \include Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp
+<table class="example">
+<tr><th>Example:</th><th>Output:</th></tr>
+<tr><td>
+\include Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.cpp
</td>
<td>
-Output:
\verbinclude Tutorial_ReductionsVisitorsBroadcasting_broadcast_1nn.out
</td></tr></table>