mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-09-14 18:33:16 +08:00
tutorial: add array module warnings when needed
This commit is contained in:
parent
3614321401
commit
a3b89e0ee6
@ -18,7 +18,7 @@
|
|||||||
// DOXYGEN_SET_MULTILINE_CPP_IS_BRIEF = NO
|
// DOXYGEN_SET_MULTILINE_CPP_IS_BRIEF = NO
|
||||||
// DOXYGEN_SET_DETAILS_AT_TOP = YES
|
// DOXYGEN_SET_DETAILS_AT_TOP = YES
|
||||||
// DOXYGEN_SET_INHERIT_DOCS = YES
|
// DOXYGEN_SET_INHERIT_DOCS = YES
|
||||||
// DOXYGEN_SET_ALIASES = "only_for_vectors=This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column." "array_module=This is defined in the %Array module. \code #include <Eigen/Array> \endcode" "lu_module=This is defined in the %LU module. \code #include <Eigen/LU> \endcode" "cholesky_module=This is defined in the %Cholesky module. \code #include <Eigen/Cholesky> \endcode" "qr_module=This is defined in the %QR module. \code #include <Eigen/QR> \endcode" "svd_module=This is defined in the %SVD module. \code #include <Eigen/SVD> \endcode" "geometry_module=This is defined in the %Geometry module. \code #include <Eigen/Geometry> \endcode" "regression_module=This is defined in the %Regression module. \code #include <Eigen/Regression> \endcode" "addexample=\anchor" "label=\bug"
|
// DOXYGEN_SET_ALIASES = "only_for_vectors=This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column." "array_module=This is defined in the %Array module. \code #include <Eigen/Array> \endcode" "lu_module=This is defined in the %LU module. \code #include <Eigen/LU> \endcode" "cholesky_module=This is defined in the %Cholesky module. \code #include <Eigen/Cholesky> \endcode" "qr_module=This is defined in the %QR module. \code #include <Eigen/QR> \endcode" "svd_module=This is defined in the %SVD module. \code #include <Eigen/SVD> \endcode" "geometry_module=This is defined in the %Geometry module. \code #include <Eigen/Geometry> \endcode" "regression_module=This is defined in the %Regression module. \code #include <Eigen/Regression> \endcode" "addexample=\anchor" "label=\bug" "redstar=<a href='#warningarraymodule' style='color:red;text-decoration: none;'><span style='color:red'>*</span></a>"
|
||||||
// DOXYGEN_SET_DISTRIBUTE_GROUP_DOC = NO
|
// DOXYGEN_SET_DISTRIBUTE_GROUP_DOC = NO
|
||||||
// DOXYGEN_SET_SUBGROUPING = YES
|
// DOXYGEN_SET_SUBGROUPING = YES
|
||||||
// DOXYGEN_SET_TYPEDEF_HIDES_STRUCT = NO
|
// DOXYGEN_SET_TYPEDEF_HIDES_STRUCT = NO
|
||||||
|
@ -206,7 +206,9 @@ ALIASES = "only_for_vectors=This is only for vectors (either row-
|
|||||||
"geometry_module=This is defined in the %Geometry module. \code #include <Eigen/Geometry> \endcode" \
|
"geometry_module=This is defined in the %Geometry module. \code #include <Eigen/Geometry> \endcode" \
|
||||||
"regression_module=This is defined in the %Regression module. \code #include <Eigen/Regression> \endcode" \
|
"regression_module=This is defined in the %Regression module. \code #include <Eigen/Regression> \endcode" \
|
||||||
"addexample=\anchor" \
|
"addexample=\anchor" \
|
||||||
"label=\bug"
|
"label=\bug" \
|
||||||
|
"redstar=<a href='#warningarraymodule' style='color:red;text-decoration: none;'><span style='color:red'>*</span></a>"
|
||||||
|
|
||||||
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
|
||||||
# sources only. Doxygen will then generate output that is more tailored for C.
|
# sources only. Doxygen will then generate output that is more tailored for C.
|
||||||
# For instance, some of the names that are used will be different. The list
|
# For instance, some of the names that are used will be different. The list
|
||||||
@ -584,7 +586,7 @@ RECURSIVE = NO
|
|||||||
# excluded from the INPUT source files. This way you can easily exclude a
|
# excluded from the INPUT source files. This way you can easily exclude a
|
||||||
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
# subdirectory from a directory tree whose root is specified with the INPUT tag.
|
||||||
|
|
||||||
EXCLUDE =
|
EXCLUDE =
|
||||||
|
|
||||||
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
|
||||||
# directories that are symbolic links (a Unix filesystem feature) are excluded
|
# directories that are symbolic links (a Unix filesystem feature) are excluded
|
||||||
@ -776,7 +778,7 @@ HTML_HEADER = ${EIGEN_BINARY_DIR}/doc/eigendoxy_header.html
|
|||||||
|
|
||||||
# the footer has not been customized yet, so let's use the default one
|
# the footer has not been customized yet, so let's use the default one
|
||||||
# ${EIGEN_BINARY_DIR}/doc/eigendoxy_footer.html
|
# ${EIGEN_BINARY_DIR}/doc/eigendoxy_footer.html
|
||||||
HTML_FOOTER =
|
HTML_FOOTER =
|
||||||
|
|
||||||
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
|
||||||
# style sheet that is used by each HTML page. It can be used to
|
# style sheet that is used by each HTML page. It can be used to
|
||||||
|
@ -27,7 +27,7 @@ namespace Eigen {
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<a href="#" class="top">top</a>\section TutorialCoreGettingStarted Getting started
|
\section TutorialCoreGettingStarted Getting started
|
||||||
|
|
||||||
In order to use Eigen, you just need to download and extract Eigen's source code. It is not necessary to use CMake or install anything.
|
In order to use Eigen, you just need to download and extract Eigen's source code. It is not necessary to use CMake or install anything.
|
||||||
|
|
||||||
@ -39,6 +39,9 @@ There is no library to link to. For good performance, add the \c -O2 compile-fla
|
|||||||
|
|
||||||
On the x86 architecture, the SSE2 instruction set is not enabled by default. Use \c -msse2 to enable it, and Eigen will then automatically enable its vectorized paths. On x86-64 and AltiVec-based architectures, vectorization is enabled by default.
|
On the x86 architecture, the SSE2 instruction set is not enabled by default. Use \c -msse2 to enable it, and Eigen will then automatically enable its vectorized paths. On x86-64 and AltiVec-based architectures, vectorization is enabled by default.
|
||||||
|
|
||||||
|
<a name="warningarraymodule" />
|
||||||
|
\warning \redstar In most cases it is enough to include the \c Eigen/Core header only to get started with Eigen. However, some features presented in this tutorial require the Array module to be included (\c \#include \c <Eigen/Array>). Those features are highlighted with a red star \redstar.
|
||||||
|
|
||||||
\section TutorialCoreSimpleExampleFixedSize Simple example with fixed-size matrices and vectors
|
\section TutorialCoreSimpleExampleFixedSize Simple example with fixed-size matrices and vectors
|
||||||
|
|
||||||
By fixed-size, we mean that the number of rows and columns are fixed at compile-time. In this case, Eigen avoids dynamic memory allocation, and unroll loops when that makes sense. This is useful for very small sizes: typically up to 4x4, sometimes up to 16x16.
|
By fixed-size, we mean that the number of rows and columns are fixed at compile-time. In this case, Eigen avoids dynamic memory allocation, and unroll loops when that makes sense. This is useful for very small sizes: typically up to 4x4, sometimes up to 16x16.
|
||||||
@ -51,8 +54,6 @@ output:
|
|||||||
\include Tutorial_simple_example_fixed_size.out
|
\include Tutorial_simple_example_fixed_size.out
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a href="#" class="top">top</a>\section TutorialCoreSimpleExampleDynamicSize Simple example with dynamic-size matrices and vectors
|
<a href="#" class="top">top</a>\section TutorialCoreSimpleExampleDynamicSize Simple example with dynamic-size matrices and vectors
|
||||||
|
|
||||||
By dynamic-size, we mean that the numbers of rows and columns are not fixed at compile-time. In this case, they are stored as runtime variables and the arrays are dynamically allocated.
|
By dynamic-size, we mean that the numbers of rows and columns are not fixed at compile-time. In this case, they are stored as runtime variables and the arrays are dynamically allocated.
|
||||||
@ -101,7 +102,7 @@ Eigen offers several static methods to create special matrix expressions, and no
|
|||||||
<td>Dynamic-size matrix</td>
|
<td>Dynamic-size matrix</td>
|
||||||
<td>Dynamic-size vector</td>
|
<td>Dynamic-size vector</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr style="border-bottom-style: none;">
|
||||||
<td>
|
<td>
|
||||||
\code
|
\code
|
||||||
Matrix3f x;
|
Matrix3f x;
|
||||||
@ -154,6 +155,7 @@ x.setRandom(size);
|
|||||||
\endcode
|
\endcode
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr style="border-top-style: none;"><td colspan="3">\redstar the Random() and setRandom() functions require the inclusion of the Array module (\c \#include \c <Eigen/Array>)</td></tr>
|
||||||
<tr><td colspan="3">Basis vectors \link MatrixBase::Unit [details]\endlink</td></tr>
|
<tr><td colspan="3">Basis vectors \link MatrixBase::Unit [details]\endlink</td></tr>
|
||||||
<tr><td>\code
|
<tr><td>\code
|
||||||
Vector3f::UnitX() // 1 0 0
|
Vector3f::UnitX() // 1 0 0
|
||||||
@ -262,7 +264,7 @@ mat3 = mat1 / s1; mat3 /= s1;\endcode
|
|||||||
In Eigen, only traditional mathematical operators can be used right away.
|
In Eigen, only traditional mathematical operators can be used right away.
|
||||||
But don't worry, thanks to the \link Cwise .cwise() \endlink operator prefix,
|
But don't worry, thanks to the \link Cwise .cwise() \endlink operator prefix,
|
||||||
Eigen's matrices are also very powerful as a numerical container supporting
|
Eigen's matrices are also very powerful as a numerical container supporting
|
||||||
most common coefficient-wise operators:
|
most common coefficient-wise operators.
|
||||||
<table class="noborder">
|
<table class="noborder">
|
||||||
<tr><td>
|
<tr><td>
|
||||||
<table class="tutorial_code" style="margin-right:10pt">
|
<table class="tutorial_code" style="margin-right:10pt">
|
||||||
@ -270,22 +272,22 @@ most common coefficient-wise operators:
|
|||||||
<td>\code mat3 = mat1.cwise() * mat2; \endcode
|
<td>\code mat3 = mat1.cwise() * mat2; \endcode
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
Add a scalar to all coefficients</td><td>\code
|
Add a scalar to all coefficients \redstar</td><td>\code
|
||||||
mat3 = mat1.cwise() + scalar;
|
mat3 = mat1.cwise() + scalar;
|
||||||
mat3.cwise() += scalar;
|
mat3.cwise() += scalar;
|
||||||
mat3.cwise() -= scalar;
|
mat3.cwise() -= scalar;
|
||||||
\endcode
|
\endcode
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
Coefficient wise \link Cwise::operator/() division \endlink</td><td>\code
|
Coefficient wise \link Cwise::operator/() division \endlink \redstar</td><td>\code
|
||||||
mat3 = mat1.cwise() / mat2; \endcode
|
mat3 = mat1.cwise() / mat2; \endcode
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
Coefficient wise \link Cwise::inverse() reciprocal \endlink</td><td>\code
|
Coefficient wise \link Cwise::inverse() reciprocal \endlink \redstar</td><td>\code
|
||||||
mat3 = mat1.cwise().inverse(); \endcode
|
mat3 = mat1.cwise().inverse(); \endcode
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
Coefficient wise comparisons \n
|
Coefficient wise comparisons \redstar \n
|
||||||
(support all operators)</td><td>\code
|
(support all operators)</td><td>\code
|
||||||
mat3 = mat1.cwise() < mat2;
|
mat3 = mat1.cwise() < mat2;
|
||||||
mat3 = mat1.cwise() <= mat2;
|
mat3 = mat1.cwise() <= mat2;
|
||||||
@ -296,14 +298,14 @@ etc.
|
|||||||
</td>
|
</td>
|
||||||
<td><table class="tutorial_code">
|
<td><table class="tutorial_code">
|
||||||
<tr><td>
|
<tr><td>
|
||||||
\b Trigo: \n
|
\b Trigo \redstar: \n
|
||||||
\link Cwise::sin sin \endlink, \link Cwise::cos cos \endlink</td><td>\code
|
\link Cwise::sin sin \endlink, \link Cwise::cos cos \endlink</td><td>\code
|
||||||
mat3 = mat1.cwise().sin();
|
mat3 = mat1.cwise().sin();
|
||||||
etc.
|
etc.
|
||||||
\endcode
|
\endcode
|
||||||
</td></tr>
|
</td></tr>
|
||||||
<tr><td>
|
<tr><td>
|
||||||
\b Power: \n \link Cwise::pow() pow \endlink,
|
\b Power \redstar: \n \link Cwise::pow() pow \endlink,
|
||||||
\link Cwise::square square \endlink,
|
\link Cwise::square square \endlink,
|
||||||
\link Cwise::cube cube \endlink, \n
|
\link Cwise::cube cube \endlink, \n
|
||||||
\link Cwise::sqrt sqrt \endlink,
|
\link Cwise::sqrt sqrt \endlink,
|
||||||
@ -326,6 +328,7 @@ mat3 = mat1.cwise().abs2(mat2);
|
|||||||
\endcode</td></tr>
|
\endcode</td></tr>
|
||||||
</table>
|
</table>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
|
\redstar Those functions require the inclusion of the Array module (\c \#include \c <Eigen/Array>).
|
||||||
|
|
||||||
<span class="note">\b Side \b note: If you think that the \c .cwise() syntax is too verbose for your own taste and prefer to have non-conventional mathematical operators directly available, then feel free to extend MatrixBase as described \ref ExtendingMatrixBase "here".</span>
|
<span class="note">\b Side \b note: If you think that the \c .cwise() syntax is too verbose for your own taste and prefer to have non-conventional mathematical operators directly available, then feel free to extend MatrixBase as described \ref ExtendingMatrixBase "here".</span>
|
||||||
|
|
||||||
@ -353,10 +356,10 @@ Eigen provides several reduction methods such as:
|
|||||||
\link MatrixBase::minCoeff() minCoeff() \endlink, \link MatrixBase::maxCoeff() maxCoeff() \endlink,
|
\link MatrixBase::minCoeff() minCoeff() \endlink, \link MatrixBase::maxCoeff() maxCoeff() \endlink,
|
||||||
\link MatrixBase::sum() sum() \endlink, \link MatrixBase::trace() trace() \endlink,
|
\link MatrixBase::sum() sum() \endlink, \link MatrixBase::trace() trace() \endlink,
|
||||||
\link MatrixBase::norm() norm() \endlink, \link MatrixBase::squaredNorm() squaredNorm() \endlink,
|
\link MatrixBase::norm() norm() \endlink, \link MatrixBase::squaredNorm() squaredNorm() \endlink,
|
||||||
\link MatrixBase::all() all() \endlink,and \link MatrixBase::any() any() \endlink.
|
\link MatrixBase::all() all() \endlink \redstar,and \link MatrixBase::any() any() \endlink \redstar.
|
||||||
All reduction operations can be done matrix-wise,
|
All reduction operations can be done matrix-wise,
|
||||||
\link MatrixBase::colwise() column-wise \endlink or
|
\link MatrixBase::colwise() column-wise \endlink \redstar or
|
||||||
\link MatrixBase::rowwise() row-wise \endlink. Usage example:
|
\link MatrixBase::rowwise() row-wise \endlink \redstar. Usage example:
|
||||||
<table class="tutorial_code">
|
<table class="tutorial_code">
|
||||||
<tr><td rowspan="3" style="border-right-style:dashed">\code
|
<tr><td rowspan="3" style="border-right-style:dashed">\code
|
||||||
5 3 1
|
5 3 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user