From 302377110a26d88a9e0bad8322324227eda2e1c4 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Wed, 20 Feb 2019 15:18:48 +0100 Subject: [PATCH] Update documentation of Matrix and Array type aliases. --- Eigen/src/Core/Array.h | 43 ++++++++++++++++++++++++++--------------- Eigen/src/Core/Matrix.h | 14 +++++++++++++- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/Eigen/src/Core/Array.h b/Eigen/src/Core/Array.h index a85d5084b..ee12d96fc 100644 --- a/Eigen/src/Core/Array.h +++ b/Eigen/src/Core/Array.h @@ -304,7 +304,7 @@ class Array /** \defgroup arraytypedefs Global array typedefs * \ingroup Core_Module * - * Eigen defines several typedef shortcuts for most common 1D and 2D array types. + * %Eigen defines several typedef shortcuts for most common 1D and 2D array types. * * The general patterns are the following: * @@ -317,6 +317,12 @@ class Array * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is * a fixed-size 1D array of 4 complex floats. * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `ArrayRowsCols` where `Rows` and `Cols` can be \c 2,\c 3,\c 4, or \c X for fixed or dynamic size. + * - `ArraySize` where `Size` can be \c 2,\c 3,\c 4 or \c X for fixed or dynamic size 1D arrays. + * * \sa class Array */ @@ -349,35 +355,40 @@ EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cd) #undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES #undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS #if EIGEN_HAS_CXX11 -#define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \ -/** \ingroup matrixtypedefs */ \ +#define EIGEN_MAKE_ARRAY_TYPEDEFS(Size, SizeSuffix) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ template \ using Array##SizeSuffix##SizeSuffix = Array; \ -/** \ingroup matrixtypedefs */ \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ template \ using Array##SizeSuffix = Array; -#define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \ -/** \ingroup matrixtypedefs */ \ +#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Size) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ template \ using Array##Size##X = Array; \ -/** \ingroup matrixtypedefs */ \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ template \ using Array##X##Size = Array; -EIGEN_MAKE_TYPEDEFS(2, 2) -EIGEN_MAKE_TYPEDEFS(3, 3) -EIGEN_MAKE_TYPEDEFS(4, 4) -EIGEN_MAKE_TYPEDEFS(Dynamic, X) -EIGEN_MAKE_FIXED_TYPEDEFS(2) -EIGEN_MAKE_FIXED_TYPEDEFS(3) -EIGEN_MAKE_FIXED_TYPEDEFS(4) +EIGEN_MAKE_ARRAY_TYPEDEFS(2, 2) +EIGEN_MAKE_ARRAY_TYPEDEFS(3, 3) +EIGEN_MAKE_ARRAY_TYPEDEFS(4, 4) +EIGEN_MAKE_ARRAY_TYPEDEFS(Dynamic, X) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(2) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(3) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(4) -#undef EIGEN_MAKE_TYPEDEFS -#undef EIGEN_MAKE_FIXED_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS #endif // EIGEN_HAS_CXX11 diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index 83cffc8e6..e7df4a901 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -450,7 +450,7 @@ class Matrix * * \ingroup Core_Module * - * Eigen defines several typedef shortcuts for most common matrix and vector types. + * %Eigen defines several typedef shortcuts for most common matrix and vector types. * * The general patterns are the following: * @@ -462,6 +462,13 @@ class Matrix * * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is * a fixed-size vector of 4 complex floats. + * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `MatrixSize` where `Size` can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size. + * - `MatrixXSize`and `MatrixSizeX` where `Size` can be \c 2,\c 3,\c 4 for hybrid dynamic/fixed matrices. + * - `VectorSize` and `RowVectorSize` for column and row vectors. * * \sa class Matrix */ @@ -503,20 +510,25 @@ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cd) #define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \ /** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ template \ using Matrix##SizeSuffix = Matrix; \ /** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ template \ using Vector##SizeSuffix = Matrix; \ /** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ template \ using RowVector##SizeSuffix = Matrix; #define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \ /** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ template \ using Matrix##Size##X = Matrix; \ /** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ template \ using Matrix##X##Size = Matrix;