Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:56:15

0001 // This file is part of Eigen, a lightweight C++ template library
0002 // for linear algebra.
0003 //
0004 // Copyright (C) 2006-2010 Benoit Jacob <jacob.benoit.1@gmail.com>
0005 // Copyright (C) 2008-2009 Gael Guennebaud <gael.guennebaud@inria.fr>
0006 //
0007 // This Source Code Form is subject to the terms of the Mozilla
0008 // Public License v. 2.0. If a copy of the MPL was not distributed
0009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
0010 
0011 #ifndef EIGEN_MATRIX_H
0012 #define EIGEN_MATRIX_H
0013 
0014 namespace Eigen {
0015 
0016 namespace internal {
0017 template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
0018 struct traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
0019 {
0020 private:
0021   enum { size = internal::size_at_compile_time<_Rows,_Cols>::ret };
0022   typedef typename find_best_packet<_Scalar,size>::type PacketScalar;
0023   enum {
0024       row_major_bit = _Options&RowMajor ? RowMajorBit : 0,
0025       is_dynamic_size_storage = _MaxRows==Dynamic || _MaxCols==Dynamic,
0026       max_size = is_dynamic_size_storage ? Dynamic : _MaxRows*_MaxCols,
0027       default_alignment = compute_default_alignment<_Scalar,max_size>::value,
0028       actual_alignment = ((_Options&DontAlign)==0) ? default_alignment : 0,
0029       required_alignment = unpacket_traits<PacketScalar>::alignment,
0030       packet_access_bit = (packet_traits<_Scalar>::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ? PacketAccessBit : 0
0031     };
0032 
0033 public:
0034   typedef _Scalar Scalar;
0035   typedef Dense StorageKind;
0036   typedef Eigen::Index StorageIndex;
0037   typedef MatrixXpr XprKind;
0038   enum {
0039     RowsAtCompileTime = _Rows,
0040     ColsAtCompileTime = _Cols,
0041     MaxRowsAtCompileTime = _MaxRows,
0042     MaxColsAtCompileTime = _MaxCols,
0043     Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret,
0044     Options = _Options,
0045     InnerStrideAtCompileTime = 1,
0046     OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime,
0047 
0048     // FIXME, the following flag in only used to define NeedsToAlign in PlainObjectBase
0049     EvaluatorFlags = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit,
0050     Alignment = actual_alignment
0051   };
0052 };
0053 }
0054 
0055 /** \class Matrix
0056   * \ingroup Core_Module
0057   *
0058   * \brief The matrix class, also used for vectors and row-vectors
0059   *
0060   * The %Matrix class is the work-horse for all \em dense (\ref dense "note") matrices and vectors within Eigen.
0061   * Vectors are matrices with one column, and row-vectors are matrices with one row.
0062   *
0063   * The %Matrix class encompasses \em both fixed-size and dynamic-size objects (\ref fixedsize "note").
0064   *
0065   * The first three template parameters are required:
0066   * \tparam _Scalar Numeric type, e.g. float, double, int or std::complex<float>.
0067   *                 User defined scalar types are supported as well (see \ref user_defined_scalars "here").
0068   * \tparam _Rows Number of rows, or \b Dynamic
0069   * \tparam _Cols Number of columns, or \b Dynamic
0070   *
0071   * The remaining template parameters are optional -- in most cases you don't have to worry about them.
0072   * \tparam _Options A combination of either \b #RowMajor or \b #ColMajor, and of either
0073   *                 \b #AutoAlign or \b #DontAlign.
0074   *                 The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required
0075   *                 for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size.
0076   * \tparam _MaxRows Maximum number of rows. Defaults to \a _Rows (\ref maxrows "note").
0077   * \tparam _MaxCols Maximum number of columns. Defaults to \a _Cols (\ref maxrows "note").
0078   *
0079   * Eigen provides a number of typedefs covering the usual cases. Here are some examples:
0080   *
0081   * \li \c Matrix2d is a 2x2 square matrix of doubles (\c Matrix<double, 2, 2>)
0082   * \li \c Vector4f is a vector of 4 floats (\c Matrix<float, 4, 1>)
0083   * \li \c RowVector3i is a row-vector of 3 ints (\c Matrix<int, 1, 3>)
0084   *
0085   * \li \c MatrixXf is a dynamic-size matrix of floats (\c Matrix<float, Dynamic, Dynamic>)
0086   * \li \c VectorXf is a dynamic-size vector of floats (\c Matrix<float, Dynamic, 1>)
0087   *
0088   * \li \c Matrix2Xf is a partially fixed-size (dynamic-size) matrix of floats (\c Matrix<float, 2, Dynamic>)
0089   * \li \c MatrixX3d is a partially dynamic-size (fixed-size) matrix of double (\c Matrix<double, Dynamic, 3>)
0090   *
0091   * See \link matrixtypedefs this page \endlink for a complete list of predefined \em %Matrix and \em Vector typedefs.
0092   *
0093   * You can access elements of vectors and matrices using normal subscripting:
0094   *
0095   * \code
0096   * Eigen::VectorXd v(10);
0097   * v[0] = 0.1;
0098   * v[1] = 0.2;
0099   * v(0) = 0.3;
0100   * v(1) = 0.4;
0101   *
0102   * Eigen::MatrixXi m(10, 10);
0103   * m(0, 1) = 1;
0104   * m(0, 2) = 2;
0105   * m(0, 3) = 3;
0106   * \endcode
0107   *
0108   * This class can be extended with the help of the plugin mechanism described on the page
0109   * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN.
0110   *
0111   * <i><b>Some notes:</b></i>
0112   *
0113   * <dl>
0114   * <dt><b>\anchor dense Dense versus sparse:</b></dt>
0115   * <dd>This %Matrix class handles dense, not sparse matrices and vectors. For sparse matrices and vectors, see the Sparse module.
0116   *
0117   * Dense matrices and vectors are plain usual arrays of coefficients. All the coefficients are stored, in an ordinary contiguous array.
0118   * This is unlike Sparse matrices and vectors where the coefficients are stored as a list of nonzero coefficients.</dd>
0119   *
0120   * <dt><b>\anchor fixedsize Fixed-size versus dynamic-size:</b></dt>
0121   * <dd>Fixed-size means that the numbers of rows and columns are known are compile-time. In this case, Eigen allocates the array
0122   * of coefficients as a fixed-size array, as a class member. This makes sense for very small matrices, typically up to 4x4, sometimes up
0123   * to 16x16. Larger matrices should be declared as dynamic-size even if one happens to know their size at compile-time.
0124   *
0125   * Dynamic-size means that the numbers of rows or columns are not necessarily known at compile-time. In this case they are runtime
0126   * variables, and the array of coefficients is allocated dynamically on the heap.
0127   *
0128   * Note that \em dense matrices, be they Fixed-size or Dynamic-size, <em>do not</em> expand dynamically in the sense of a std::map.
0129   * If you want this behavior, see the Sparse module.</dd>
0130   *
0131   * <dt><b>\anchor maxrows _MaxRows and _MaxCols:</b></dt>
0132   * <dd>In most cases, one just leaves these parameters to the default values.
0133   * These parameters mean the maximum size of rows and columns that the matrix may have. They are useful in cases
0134   * when the exact numbers of rows and columns are not known are compile-time, but it is known at compile-time that they cannot
0135   * exceed a certain value. This happens when taking dynamic-size blocks inside fixed-size matrices: in this case _MaxRows and _MaxCols
0136   * are the dimensions of the original matrix, while _Rows and _Cols are Dynamic.</dd>
0137   * </dl>
0138   *
0139   * <i><b>ABI and storage layout</b></i>
0140   *
0141   * The table below summarizes the ABI of some possible Matrix instances which is fixed thorough the lifetime of Eigen 3.
0142   * <table  class="manual">
0143   * <tr><th>Matrix type</th><th>Equivalent C structure</th></tr>
0144   * <tr><td>\code Matrix<T,Dynamic,Dynamic> \endcode</td><td>\code
0145   * struct {
0146   *   T *data;                  // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0
0147   *   Eigen::Index rows, cols;
0148   *  };
0149   * \endcode</td></tr>
0150   * <tr class="alt"><td>\code
0151   * Matrix<T,Dynamic,1>
0152   * Matrix<T,1,Dynamic> \endcode</td><td>\code
0153   * struct {
0154   *   T *data;                  // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0
0155   *   Eigen::Index size;
0156   *  };
0157   * \endcode</td></tr>
0158   * <tr><td>\code Matrix<T,Rows,Cols> \endcode</td><td>\code
0159   * struct {
0160   *   T data[Rows*Cols];        // with (size_t(data)%A(Rows*Cols*sizeof(T)))==0
0161   *  };
0162   * \endcode</td></tr>
0163   * <tr class="alt"><td>\code Matrix<T,Dynamic,Dynamic,0,MaxRows,MaxCols> \endcode</td><td>\code
0164   * struct {
0165   *   T data[MaxRows*MaxCols];  // with (size_t(data)%A(MaxRows*MaxCols*sizeof(T)))==0
0166   *   Eigen::Index rows, cols;
0167   *  };
0168   * \endcode</td></tr>
0169   * </table>
0170   * Note that in this table Rows, Cols, MaxRows and MaxCols are all positive integers. A(S) is defined to the largest possible power-of-two
0171   * smaller to EIGEN_MAX_STATIC_ALIGN_BYTES.
0172   *
0173   * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy,
0174   * \ref TopicStorageOrders
0175   */
0176 
0177 template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols>
0178 class Matrix
0179   : public PlainObjectBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
0180 {
0181   public:
0182 
0183     /** \brief Base class typedef.
0184       * \sa PlainObjectBase
0185       */
0186     typedef PlainObjectBase<Matrix> Base;
0187 
0188     enum { Options = _Options };
0189 
0190     EIGEN_DENSE_PUBLIC_INTERFACE(Matrix)
0191 
0192     typedef typename Base::PlainObject PlainObject;
0193 
0194     using Base::base;
0195     using Base::coeffRef;
0196 
0197     /**
0198       * \brief Assigns matrices to each other.
0199       *
0200       * \note This is a special case of the templated operator=. Its purpose is
0201       * to prevent a default operator= from hiding the templated operator=.
0202       *
0203       * \callgraph
0204       */
0205     EIGEN_DEVICE_FUNC
0206     EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other)
0207     {
0208       return Base::_set(other);
0209     }
0210 
0211     /** \internal
0212       * \brief Copies the value of the expression \a other into \c *this with automatic resizing.
0213       *
0214       * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized),
0215       * it will be initialized.
0216       *
0217       * Note that copying a row-vector into a vector (and conversely) is allowed.
0218       * The resizing, if any, is then done in the appropriate way so that row-vectors
0219       * remain row-vectors and vectors remain vectors.
0220       */
0221     template<typename OtherDerived>
0222     EIGEN_DEVICE_FUNC
0223     EIGEN_STRONG_INLINE Matrix& operator=(const DenseBase<OtherDerived>& other)
0224     {
0225       return Base::_set(other);
0226     }
0227 
0228     /* Here, doxygen failed to copy the brief information when using \copydoc */
0229 
0230     /**
0231       * \brief Copies the generic expression \a other into *this.
0232       * \copydetails DenseBase::operator=(const EigenBase<OtherDerived> &other)
0233       */
0234     template<typename OtherDerived>
0235     EIGEN_DEVICE_FUNC
0236     EIGEN_STRONG_INLINE Matrix& operator=(const EigenBase<OtherDerived> &other)
0237     {
0238       return Base::operator=(other);
0239     }
0240 
0241     template<typename OtherDerived>
0242     EIGEN_DEVICE_FUNC
0243     EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue<OtherDerived>& func)
0244     {
0245       return Base::operator=(func);
0246     }
0247 
0248     /** \brief Default constructor.
0249       *
0250       * For fixed-size matrices, does nothing.
0251       *
0252       * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix
0253       * is called a null matrix. This constructor is the unique way to create null matrices: resizing
0254       * a matrix to 0 is not supported.
0255       *
0256       * \sa resize(Index,Index)
0257       */
0258     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0259     Matrix() : Base()
0260     {
0261       Base::_check_template_params();
0262       EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
0263     }
0264 
0265     // FIXME is it still needed
0266     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0267     explicit Matrix(internal::constructor_without_unaligned_array_assert)
0268       : Base(internal::constructor_without_unaligned_array_assert())
0269     { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
0270 
0271 #if EIGEN_HAS_RVALUE_REFERENCES
0272     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0273     Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
0274       : Base(std::move(other))
0275     {
0276       Base::_check_template_params();
0277     }
0278     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0279     Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
0280     {
0281       Base::operator=(std::move(other));
0282       return *this;
0283     }
0284 #endif
0285 
0286 #if EIGEN_HAS_CXX11
0287     /** \copydoc PlainObjectBase(const Scalar&, const Scalar&, const Scalar&,  const Scalar&, const ArgTypes&... args)
0288      *
0289      * Example: \include Matrix_variadic_ctor_cxx11.cpp
0290      * Output: \verbinclude Matrix_variadic_ctor_cxx11.out
0291      *
0292      * \sa Matrix(const std::initializer_list<std::initializer_list<Scalar>>&)
0293      */
0294     template <typename... ArgTypes>
0295     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0296     Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2,  const Scalar& a3, const ArgTypes&... args)
0297       : Base(a0, a1, a2, a3, args...) {}
0298 
0299     /** \brief Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11
0300       *
0301       * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients:
0302       *
0303       * Example: \include Matrix_initializer_list_23_cxx11.cpp
0304       * Output: \verbinclude Matrix_initializer_list_23_cxx11.out
0305       *
0306       * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered.
0307       *
0308       * In the case of a compile-time column vector, implicit transposition from a single row is allowed.
0309       * Therefore <code>VectorXd{{1,2,3,4,5}}</code> is legal and the more verbose syntax
0310       * <code>RowVectorXd{{1},{2},{3},{4},{5}}</code> can be avoided:
0311       *
0312       * Example: \include Matrix_initializer_list_vector_cxx11.cpp
0313       * Output: \verbinclude Matrix_initializer_list_vector_cxx11.out
0314       *
0315       * In the case of fixed-sized matrices, the initializer list sizes must exactly match the matrix sizes,
0316       * and implicit transposition is allowed for compile-time vectors only.
0317       *
0318       * \sa Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2,  const Scalar& a3, const ArgTypes&... args)
0319       */
0320     EIGEN_DEVICE_FUNC
0321     explicit EIGEN_STRONG_INLINE Matrix(const std::initializer_list<std::initializer_list<Scalar>>& list) : Base(list) {}
0322 #endif // end EIGEN_HAS_CXX11
0323 
0324 #ifndef EIGEN_PARSED_BY_DOXYGEN
0325 
0326     // This constructor is for both 1x1 matrices and dynamic vectors
0327     template<typename T>
0328     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0329     explicit Matrix(const T& x)
0330     {
0331       Base::_check_template_params();
0332       Base::template _init1<T>(x);
0333     }
0334 
0335     template<typename T0, typename T1>
0336     EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
0337     Matrix(const T0& x, const T1& y)
0338     {
0339       Base::_check_template_params();
0340       Base::template _init2<T0,T1>(x, y);
0341     }
0342 
0343 
0344 #else
0345     /** \brief Constructs a fixed-sized matrix initialized with coefficients starting at \a data */
0346     EIGEN_DEVICE_FUNC
0347     explicit Matrix(const Scalar *data);
0348 
0349     /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors
0350       *
0351       * This is useful for dynamic-size vectors. For fixed-size vectors,
0352       * it is redundant to pass these parameters, so one should use the default constructor
0353       * Matrix() instead.
0354       *
0355       * \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance,
0356       * calling Matrix<double,1,1>(1) will call the initialization constructor: Matrix(const Scalar&).
0357       * For fixed-size \c 1x1 matrices it is therefore recommended to use the default
0358       * constructor Matrix() instead, especially when using one of the non standard
0359       * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives).
0360       */
0361     EIGEN_STRONG_INLINE explicit Matrix(Index dim);
0362     /** \brief Constructs an initialized 1x1 matrix with the given coefficient
0363       * \sa Matrix(const Scalar&, const Scalar&, const Scalar&,  const Scalar&, const ArgTypes&...) */
0364     Matrix(const Scalar& x);
0365     /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns.
0366       *
0367       * This is useful for dynamic-size matrices. For fixed-size matrices,
0368       * it is redundant to pass these parameters, so one should use the default constructor
0369       * Matrix() instead.
0370       *
0371       * \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance,
0372       * calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y).
0373       * For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default
0374       * constructor Matrix() instead, especially when using one of the non standard
0375       * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives).
0376       */
0377     EIGEN_DEVICE_FUNC
0378     Matrix(Index rows, Index cols);
0379 
0380     /** \brief Constructs an initialized 2D vector with given coefficients
0381       * \sa Matrix(const Scalar&, const Scalar&, const Scalar&,  const Scalar&, const ArgTypes&...) */
0382     Matrix(const Scalar& x, const Scalar& y);
0383     #endif  // end EIGEN_PARSED_BY_DOXYGEN
0384 
0385     /** \brief Constructs an initialized 3D vector with given coefficients
0386       * \sa Matrix(const Scalar&, const Scalar&, const Scalar&,  const Scalar&, const ArgTypes&...)
0387       */
0388     EIGEN_DEVICE_FUNC
0389     EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z)
0390     {
0391       Base::_check_template_params();
0392       EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3)
0393       m_storage.data()[0] = x;
0394       m_storage.data()[1] = y;
0395       m_storage.data()[2] = z;
0396     }
0397     /** \brief Constructs an initialized 4D vector with given coefficients
0398       * \sa Matrix(const Scalar&, const Scalar&, const Scalar&,  const Scalar&, const ArgTypes&...)
0399       */
0400     EIGEN_DEVICE_FUNC
0401     EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w)
0402     {
0403       Base::_check_template_params();
0404       EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4)
0405       m_storage.data()[0] = x;
0406       m_storage.data()[1] = y;
0407       m_storage.data()[2] = z;
0408       m_storage.data()[3] = w;
0409     }
0410 
0411 
0412     /** \brief Copy constructor */
0413     EIGEN_DEVICE_FUNC
0414     EIGEN_STRONG_INLINE Matrix(const Matrix& other) : Base(other)
0415     { }
0416 
0417     /** \brief Copy constructor for generic expressions.
0418       * \sa MatrixBase::operator=(const EigenBase<OtherDerived>&)
0419       */
0420     template<typename OtherDerived>
0421     EIGEN_DEVICE_FUNC
0422     EIGEN_STRONG_INLINE Matrix(const EigenBase<OtherDerived> &other)
0423       : Base(other.derived())
0424     { }
0425 
0426     EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
0427     inline Index innerStride() const EIGEN_NOEXCEPT { return 1; }
0428     EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
0429     inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); }
0430 
0431     /////////// Geometry module ///////////
0432 
0433     template<typename OtherDerived>
0434     EIGEN_DEVICE_FUNC
0435     explicit Matrix(const RotationBase<OtherDerived,ColsAtCompileTime>& r);
0436     template<typename OtherDerived>
0437     EIGEN_DEVICE_FUNC
0438     Matrix& operator=(const RotationBase<OtherDerived,ColsAtCompileTime>& r);
0439 
0440     // allow to extend Matrix outside Eigen
0441     #ifdef EIGEN_MATRIX_PLUGIN
0442     #include EIGEN_MATRIX_PLUGIN
0443     #endif
0444 
0445   protected:
0446     template <typename Derived, typename OtherDerived, bool IsVector>
0447     friend struct internal::conservative_resize_like_impl;
0448 
0449     using Base::m_storage;
0450 };
0451 
0452 /** \defgroup matrixtypedefs Global matrix typedefs
0453   *
0454   * \ingroup Core_Module
0455   *
0456   * %Eigen defines several typedef shortcuts for most common matrix and vector types.
0457   *
0458   * The general patterns are the following:
0459   *
0460   * \c MatrixSizeType where \c Size can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size,
0461   * and where \c Type can be \c i for integer, \c f for float, \c d for double, \c cf for complex float, \c cd
0462   * for complex double.
0463   *
0464   * For example, \c Matrix3d is a fixed-size 3x3 matrix type of doubles, and \c MatrixXf is a dynamic-size matrix of floats.
0465   *
0466   * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is
0467   * a fixed-size vector of 4 complex floats.
0468   *
0469   * With \cpp11, template alias are also defined for common sizes.
0470   * They follow the same pattern as above except that the scalar type suffix is replaced by a
0471   * template parameter, i.e.:
0472   *   - `MatrixSize<Type>` where `Size` can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size.
0473   *   - `MatrixXSize<Type>` and `MatrixSizeX<Type>` where `Size` can be \c 2,\c 3,\c 4 for hybrid dynamic/fixed matrices.
0474   *   - `VectorSize<Type>` and `RowVectorSize<Type>` for column and row vectors.
0475   *
0476   * With \cpp11, you can also use fully generic column and row vector types: `Vector<Type,Size>` and `RowVector<Type,Size>`.
0477   *
0478   * \sa class Matrix
0479   */
0480 
0481 #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix)   \
0482 /** \ingroup matrixtypedefs */                                    \
0483 typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix;  \
0484 /** \ingroup matrixtypedefs */                                    \
0485 typedef Matrix<Type, Size, 1>    Vector##SizeSuffix##TypeSuffix;  \
0486 /** \ingroup matrixtypedefs */                                    \
0487 typedef Matrix<Type, 1, Size>    RowVector##SizeSuffix##TypeSuffix;
0488 
0489 #define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size)         \
0490 /** \ingroup matrixtypedefs */                                    \
0491 typedef Matrix<Type, Size, Dynamic> Matrix##Size##X##TypeSuffix;  \
0492 /** \ingroup matrixtypedefs */                                    \
0493 typedef Matrix<Type, Dynamic, Size> Matrix##X##Size##TypeSuffix;
0494 
0495 #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
0496 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
0497 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
0498 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
0499 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \
0500 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \
0501 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \
0502 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4)
0503 
0504 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int,                  i)
0505 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float,                f)
0506 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double,               d)
0507 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>,  cf)
0508 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
0509 
0510 #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
0511 #undef EIGEN_MAKE_TYPEDEFS
0512 #undef EIGEN_MAKE_FIXED_TYPEDEFS
0513 
0514 #if EIGEN_HAS_CXX11
0515 
0516 #define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix)                     \
0517 /** \ingroup matrixtypedefs */                                    \
0518 /** \brief \cpp11 */                                              \
0519 template <typename Type>                                          \
0520 using Matrix##SizeSuffix = Matrix<Type, Size, Size>;              \
0521 /** \ingroup matrixtypedefs */                                    \
0522 /** \brief \cpp11 */                                              \
0523 template <typename Type>                                          \
0524 using Vector##SizeSuffix = Matrix<Type, Size, 1>;                 \
0525 /** \ingroup matrixtypedefs */                                    \
0526 /** \brief \cpp11 */                                              \
0527 template <typename Type>                                          \
0528 using RowVector##SizeSuffix = Matrix<Type, 1, Size>;
0529 
0530 #define EIGEN_MAKE_FIXED_TYPEDEFS(Size)                           \
0531 /** \ingroup matrixtypedefs */                                    \
0532 /** \brief \cpp11 */                                              \
0533 template <typename Type>                                          \
0534 using Matrix##Size##X = Matrix<Type, Size, Dynamic>;              \
0535 /** \ingroup matrixtypedefs */                                    \
0536 /** \brief \cpp11 */                                              \
0537 template <typename Type>                                          \
0538 using Matrix##X##Size = Matrix<Type, Dynamic, Size>;
0539 
0540 EIGEN_MAKE_TYPEDEFS(2, 2)
0541 EIGEN_MAKE_TYPEDEFS(3, 3)
0542 EIGEN_MAKE_TYPEDEFS(4, 4)
0543 EIGEN_MAKE_TYPEDEFS(Dynamic, X)
0544 EIGEN_MAKE_FIXED_TYPEDEFS(2)
0545 EIGEN_MAKE_FIXED_TYPEDEFS(3)
0546 EIGEN_MAKE_FIXED_TYPEDEFS(4)
0547 
0548 /** \ingroup matrixtypedefs
0549   * \brief \cpp11 */
0550 template <typename Type, int Size>
0551 using Vector = Matrix<Type, Size, 1>;
0552 
0553 /** \ingroup matrixtypedefs
0554   * \brief \cpp11 */
0555 template <typename Type, int Size>
0556 using RowVector = Matrix<Type, 1, Size>;
0557 
0558 #undef EIGEN_MAKE_TYPEDEFS
0559 #undef EIGEN_MAKE_FIXED_TYPEDEFS
0560 
0561 #endif // EIGEN_HAS_CXX11
0562 
0563 } // end namespace Eigen
0564 
0565 #endif // EIGEN_MATRIX_H