Eigne Matrix Class Library
Dependents: MPC_current_control HydraulicControlBoard_SW AHRS Test_ekf ... more
src/Core/Array.h@0:13a5d365ba16, 2016-10-13 (annotated)
- Committer:
- ykuroda
- Date:
- Thu Oct 13 04:07:23 2016 +0000
- Revision:
- 0:13a5d365ba16
First commint, Eigne Matrix Class Library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ykuroda | 0:13a5d365ba16 | 1 | // This file is part of Eigen, a lightweight C++ template library |
ykuroda | 0:13a5d365ba16 | 2 | // for linear algebra. |
ykuroda | 0:13a5d365ba16 | 3 | // |
ykuroda | 0:13a5d365ba16 | 4 | // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr> |
ykuroda | 0:13a5d365ba16 | 5 | // |
ykuroda | 0:13a5d365ba16 | 6 | // This Source Code Form is subject to the terms of the Mozilla |
ykuroda | 0:13a5d365ba16 | 7 | // Public License v. 2.0. If a copy of the MPL was not distributed |
ykuroda | 0:13a5d365ba16 | 8 | // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. |
ykuroda | 0:13a5d365ba16 | 9 | |
ykuroda | 0:13a5d365ba16 | 10 | #ifndef EIGEN_ARRAY_H |
ykuroda | 0:13a5d365ba16 | 11 | #define EIGEN_ARRAY_H |
ykuroda | 0:13a5d365ba16 | 12 | |
ykuroda | 0:13a5d365ba16 | 13 | namespace Eigen { |
ykuroda | 0:13a5d365ba16 | 14 | |
ykuroda | 0:13a5d365ba16 | 15 | /** \class Array |
ykuroda | 0:13a5d365ba16 | 16 | * \ingroup Core_Module |
ykuroda | 0:13a5d365ba16 | 17 | * |
ykuroda | 0:13a5d365ba16 | 18 | * \brief General-purpose arrays with easy API for coefficient-wise operations |
ykuroda | 0:13a5d365ba16 | 19 | * |
ykuroda | 0:13a5d365ba16 | 20 | * The %Array class is very similar to the Matrix class. It provides |
ykuroda | 0:13a5d365ba16 | 21 | * general-purpose one- and two-dimensional arrays. The difference between the |
ykuroda | 0:13a5d365ba16 | 22 | * %Array and the %Matrix class is primarily in the API: the API for the |
ykuroda | 0:13a5d365ba16 | 23 | * %Array class provides easy access to coefficient-wise operations, while the |
ykuroda | 0:13a5d365ba16 | 24 | * API for the %Matrix class provides easy access to linear-algebra |
ykuroda | 0:13a5d365ba16 | 25 | * operations. |
ykuroda | 0:13a5d365ba16 | 26 | * |
ykuroda | 0:13a5d365ba16 | 27 | * This class can be extended with the help of the plugin mechanism described on the page |
ykuroda | 0:13a5d365ba16 | 28 | * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. |
ykuroda | 0:13a5d365ba16 | 29 | * |
ykuroda | 0:13a5d365ba16 | 30 | * \sa \ref TutorialArrayClass, \ref TopicClassHierarchy |
ykuroda | 0:13a5d365ba16 | 31 | */ |
ykuroda | 0:13a5d365ba16 | 32 | namespace internal { |
ykuroda | 0:13a5d365ba16 | 33 | template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> |
ykuroda | 0:13a5d365ba16 | 34 | struct traits<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > : traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > |
ykuroda | 0:13a5d365ba16 | 35 | { |
ykuroda | 0:13a5d365ba16 | 36 | typedef ArrayXpr XprKind; |
ykuroda | 0:13a5d365ba16 | 37 | typedef ArrayBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > XprBase; |
ykuroda | 0:13a5d365ba16 | 38 | }; |
ykuroda | 0:13a5d365ba16 | 39 | } |
ykuroda | 0:13a5d365ba16 | 40 | |
ykuroda | 0:13a5d365ba16 | 41 | template<typename _Scalar, int _Rows, int _Cols, int _Options, int _MaxRows, int _MaxCols> |
ykuroda | 0:13a5d365ba16 | 42 | class Array |
ykuroda | 0:13a5d365ba16 | 43 | : public PlainObjectBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > |
ykuroda | 0:13a5d365ba16 | 44 | { |
ykuroda | 0:13a5d365ba16 | 45 | public: |
ykuroda | 0:13a5d365ba16 | 46 | |
ykuroda | 0:13a5d365ba16 | 47 | typedef PlainObjectBase<Array> Base; |
ykuroda | 0:13a5d365ba16 | 48 | EIGEN_DENSE_PUBLIC_INTERFACE(Array) |
ykuroda | 0:13a5d365ba16 | 49 | |
ykuroda | 0:13a5d365ba16 | 50 | enum { Options = _Options }; |
ykuroda | 0:13a5d365ba16 | 51 | typedef typename Base::PlainObject PlainObject; |
ykuroda | 0:13a5d365ba16 | 52 | |
ykuroda | 0:13a5d365ba16 | 53 | protected: |
ykuroda | 0:13a5d365ba16 | 54 | template <typename Derived, typename OtherDerived, bool IsVector> |
ykuroda | 0:13a5d365ba16 | 55 | friend struct internal::conservative_resize_like_impl; |
ykuroda | 0:13a5d365ba16 | 56 | |
ykuroda | 0:13a5d365ba16 | 57 | using Base::m_storage; |
ykuroda | 0:13a5d365ba16 | 58 | |
ykuroda | 0:13a5d365ba16 | 59 | public: |
ykuroda | 0:13a5d365ba16 | 60 | |
ykuroda | 0:13a5d365ba16 | 61 | using Base::base; |
ykuroda | 0:13a5d365ba16 | 62 | using Base::coeff; |
ykuroda | 0:13a5d365ba16 | 63 | using Base::coeffRef; |
ykuroda | 0:13a5d365ba16 | 64 | |
ykuroda | 0:13a5d365ba16 | 65 | /** |
ykuroda | 0:13a5d365ba16 | 66 | * The usage of |
ykuroda | 0:13a5d365ba16 | 67 | * using Base::operator=; |
ykuroda | 0:13a5d365ba16 | 68 | * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped |
ykuroda | 0:13a5d365ba16 | 69 | * the usage of 'using'. This should be done only for operator=. |
ykuroda | 0:13a5d365ba16 | 70 | */ |
ykuroda | 0:13a5d365ba16 | 71 | template<typename OtherDerived> |
ykuroda | 0:13a5d365ba16 | 72 | EIGEN_STRONG_INLINE Array& operator=(const EigenBase<OtherDerived> &other) |
ykuroda | 0:13a5d365ba16 | 73 | { |
ykuroda | 0:13a5d365ba16 | 74 | return Base::operator=(other); |
ykuroda | 0:13a5d365ba16 | 75 | } |
ykuroda | 0:13a5d365ba16 | 76 | |
ykuroda | 0:13a5d365ba16 | 77 | /** Copies the value of the expression \a other into \c *this with automatic resizing. |
ykuroda | 0:13a5d365ba16 | 78 | * |
ykuroda | 0:13a5d365ba16 | 79 | * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), |
ykuroda | 0:13a5d365ba16 | 80 | * it will be initialized. |
ykuroda | 0:13a5d365ba16 | 81 | * |
ykuroda | 0:13a5d365ba16 | 82 | * Note that copying a row-vector into a vector (and conversely) is allowed. |
ykuroda | 0:13a5d365ba16 | 83 | * The resizing, if any, is then done in the appropriate way so that row-vectors |
ykuroda | 0:13a5d365ba16 | 84 | * remain row-vectors and vectors remain vectors. |
ykuroda | 0:13a5d365ba16 | 85 | */ |
ykuroda | 0:13a5d365ba16 | 86 | template<typename OtherDerived> |
ykuroda | 0:13a5d365ba16 | 87 | EIGEN_STRONG_INLINE Array& operator=(const ArrayBase<OtherDerived>& other) |
ykuroda | 0:13a5d365ba16 | 88 | { |
ykuroda | 0:13a5d365ba16 | 89 | return Base::_set(other); |
ykuroda | 0:13a5d365ba16 | 90 | } |
ykuroda | 0:13a5d365ba16 | 91 | |
ykuroda | 0:13a5d365ba16 | 92 | /** This is a special case of the templated operator=. Its purpose is to |
ykuroda | 0:13a5d365ba16 | 93 | * prevent a default operator= from hiding the templated operator=. |
ykuroda | 0:13a5d365ba16 | 94 | */ |
ykuroda | 0:13a5d365ba16 | 95 | EIGEN_STRONG_INLINE Array& operator=(const Array& other) |
ykuroda | 0:13a5d365ba16 | 96 | { |
ykuroda | 0:13a5d365ba16 | 97 | return Base::_set(other); |
ykuroda | 0:13a5d365ba16 | 98 | } |
ykuroda | 0:13a5d365ba16 | 99 | |
ykuroda | 0:13a5d365ba16 | 100 | /** Default constructor. |
ykuroda | 0:13a5d365ba16 | 101 | * |
ykuroda | 0:13a5d365ba16 | 102 | * For fixed-size matrices, does nothing. |
ykuroda | 0:13a5d365ba16 | 103 | * |
ykuroda | 0:13a5d365ba16 | 104 | * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix |
ykuroda | 0:13a5d365ba16 | 105 | * is called a null matrix. This constructor is the unique way to create null matrices: resizing |
ykuroda | 0:13a5d365ba16 | 106 | * a matrix to 0 is not supported. |
ykuroda | 0:13a5d365ba16 | 107 | * |
ykuroda | 0:13a5d365ba16 | 108 | * \sa resize(Index,Index) |
ykuroda | 0:13a5d365ba16 | 109 | */ |
ykuroda | 0:13a5d365ba16 | 110 | EIGEN_STRONG_INLINE Array() : Base() |
ykuroda | 0:13a5d365ba16 | 111 | { |
ykuroda | 0:13a5d365ba16 | 112 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 113 | EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED |
ykuroda | 0:13a5d365ba16 | 114 | } |
ykuroda | 0:13a5d365ba16 | 115 | |
ykuroda | 0:13a5d365ba16 | 116 | #ifndef EIGEN_PARSED_BY_DOXYGEN |
ykuroda | 0:13a5d365ba16 | 117 | // FIXME is it still needed ?? |
ykuroda | 0:13a5d365ba16 | 118 | /** \internal */ |
ykuroda | 0:13a5d365ba16 | 119 | Array(internal::constructor_without_unaligned_array_assert) |
ykuroda | 0:13a5d365ba16 | 120 | : Base(internal::constructor_without_unaligned_array_assert()) |
ykuroda | 0:13a5d365ba16 | 121 | { |
ykuroda | 0:13a5d365ba16 | 122 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 123 | EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED |
ykuroda | 0:13a5d365ba16 | 124 | } |
ykuroda | 0:13a5d365ba16 | 125 | #endif |
ykuroda | 0:13a5d365ba16 | 126 | |
ykuroda | 0:13a5d365ba16 | 127 | #ifdef EIGEN_HAVE_RVALUE_REFERENCES |
ykuroda | 0:13a5d365ba16 | 128 | Array(Array&& other) |
ykuroda | 0:13a5d365ba16 | 129 | : Base(std::move(other)) |
ykuroda | 0:13a5d365ba16 | 130 | { |
ykuroda | 0:13a5d365ba16 | 131 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 132 | if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic) |
ykuroda | 0:13a5d365ba16 | 133 | Base::_set_noalias(other); |
ykuroda | 0:13a5d365ba16 | 134 | } |
ykuroda | 0:13a5d365ba16 | 135 | Array& operator=(Array&& other) |
ykuroda | 0:13a5d365ba16 | 136 | { |
ykuroda | 0:13a5d365ba16 | 137 | other.swap(*this); |
ykuroda | 0:13a5d365ba16 | 138 | return *this; |
ykuroda | 0:13a5d365ba16 | 139 | } |
ykuroda | 0:13a5d365ba16 | 140 | #endif |
ykuroda | 0:13a5d365ba16 | 141 | |
ykuroda | 0:13a5d365ba16 | 142 | /** Constructs a vector or row-vector with given dimension. \only_for_vectors |
ykuroda | 0:13a5d365ba16 | 143 | * |
ykuroda | 0:13a5d365ba16 | 144 | * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, |
ykuroda | 0:13a5d365ba16 | 145 | * it is redundant to pass the dimension here, so it makes more sense to use the default |
ykuroda | 0:13a5d365ba16 | 146 | * constructor Matrix() instead. |
ykuroda | 0:13a5d365ba16 | 147 | */ |
ykuroda | 0:13a5d365ba16 | 148 | EIGEN_STRONG_INLINE explicit Array(Index dim) |
ykuroda | 0:13a5d365ba16 | 149 | : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) |
ykuroda | 0:13a5d365ba16 | 150 | { |
ykuroda | 0:13a5d365ba16 | 151 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 152 | EIGEN_STATIC_ASSERT_VECTOR_ONLY(Array) |
ykuroda | 0:13a5d365ba16 | 153 | eigen_assert(dim >= 0); |
ykuroda | 0:13a5d365ba16 | 154 | eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); |
ykuroda | 0:13a5d365ba16 | 155 | EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED |
ykuroda | 0:13a5d365ba16 | 156 | } |
ykuroda | 0:13a5d365ba16 | 157 | |
ykuroda | 0:13a5d365ba16 | 158 | #ifndef EIGEN_PARSED_BY_DOXYGEN |
ykuroda | 0:13a5d365ba16 | 159 | template<typename T0, typename T1> |
ykuroda | 0:13a5d365ba16 | 160 | EIGEN_STRONG_INLINE Array(const T0& val0, const T1& val1) |
ykuroda | 0:13a5d365ba16 | 161 | { |
ykuroda | 0:13a5d365ba16 | 162 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 163 | this->template _init2<T0,T1>(val0, val1); |
ykuroda | 0:13a5d365ba16 | 164 | } |
ykuroda | 0:13a5d365ba16 | 165 | #else |
ykuroda | 0:13a5d365ba16 | 166 | /** constructs an uninitialized matrix with \a rows rows and \a cols columns. |
ykuroda | 0:13a5d365ba16 | 167 | * |
ykuroda | 0:13a5d365ba16 | 168 | * This is useful for dynamic-size matrices. For fixed-size matrices, |
ykuroda | 0:13a5d365ba16 | 169 | * it is redundant to pass these parameters, so one should use the default constructor |
ykuroda | 0:13a5d365ba16 | 170 | * Matrix() instead. */ |
ykuroda | 0:13a5d365ba16 | 171 | Array(Index rows, Index cols); |
ykuroda | 0:13a5d365ba16 | 172 | /** constructs an initialized 2D vector with given coefficients */ |
ykuroda | 0:13a5d365ba16 | 173 | Array(const Scalar& val0, const Scalar& val1); |
ykuroda | 0:13a5d365ba16 | 174 | #endif |
ykuroda | 0:13a5d365ba16 | 175 | |
ykuroda | 0:13a5d365ba16 | 176 | /** constructs an initialized 3D vector with given coefficients */ |
ykuroda | 0:13a5d365ba16 | 177 | EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2) |
ykuroda | 0:13a5d365ba16 | 178 | { |
ykuroda | 0:13a5d365ba16 | 179 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 180 | EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) |
ykuroda | 0:13a5d365ba16 | 181 | m_storage.data()[0] = val0; |
ykuroda | 0:13a5d365ba16 | 182 | m_storage.data()[1] = val1; |
ykuroda | 0:13a5d365ba16 | 183 | m_storage.data()[2] = val2; |
ykuroda | 0:13a5d365ba16 | 184 | } |
ykuroda | 0:13a5d365ba16 | 185 | /** constructs an initialized 4D vector with given coefficients */ |
ykuroda | 0:13a5d365ba16 | 186 | EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2, const Scalar& val3) |
ykuroda | 0:13a5d365ba16 | 187 | { |
ykuroda | 0:13a5d365ba16 | 188 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 189 | EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) |
ykuroda | 0:13a5d365ba16 | 190 | m_storage.data()[0] = val0; |
ykuroda | 0:13a5d365ba16 | 191 | m_storage.data()[1] = val1; |
ykuroda | 0:13a5d365ba16 | 192 | m_storage.data()[2] = val2; |
ykuroda | 0:13a5d365ba16 | 193 | m_storage.data()[3] = val3; |
ykuroda | 0:13a5d365ba16 | 194 | } |
ykuroda | 0:13a5d365ba16 | 195 | |
ykuroda | 0:13a5d365ba16 | 196 | explicit Array(const Scalar *data); |
ykuroda | 0:13a5d365ba16 | 197 | |
ykuroda | 0:13a5d365ba16 | 198 | /** Constructor copying the value of the expression \a other */ |
ykuroda | 0:13a5d365ba16 | 199 | template<typename OtherDerived> |
ykuroda | 0:13a5d365ba16 | 200 | EIGEN_STRONG_INLINE Array(const ArrayBase<OtherDerived>& other) |
ykuroda | 0:13a5d365ba16 | 201 | : Base(other.rows() * other.cols(), other.rows(), other.cols()) |
ykuroda | 0:13a5d365ba16 | 202 | { |
ykuroda | 0:13a5d365ba16 | 203 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 204 | Base::_set_noalias(other); |
ykuroda | 0:13a5d365ba16 | 205 | } |
ykuroda | 0:13a5d365ba16 | 206 | /** Copy constructor */ |
ykuroda | 0:13a5d365ba16 | 207 | EIGEN_STRONG_INLINE Array(const Array& other) |
ykuroda | 0:13a5d365ba16 | 208 | : Base(other.rows() * other.cols(), other.rows(), other.cols()) |
ykuroda | 0:13a5d365ba16 | 209 | { |
ykuroda | 0:13a5d365ba16 | 210 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 211 | Base::_set_noalias(other); |
ykuroda | 0:13a5d365ba16 | 212 | } |
ykuroda | 0:13a5d365ba16 | 213 | /** Copy constructor with in-place evaluation */ |
ykuroda | 0:13a5d365ba16 | 214 | template<typename OtherDerived> |
ykuroda | 0:13a5d365ba16 | 215 | EIGEN_STRONG_INLINE Array(const ReturnByValue<OtherDerived>& other) |
ykuroda | 0:13a5d365ba16 | 216 | { |
ykuroda | 0:13a5d365ba16 | 217 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 218 | Base::resize(other.rows(), other.cols()); |
ykuroda | 0:13a5d365ba16 | 219 | other.evalTo(*this); |
ykuroda | 0:13a5d365ba16 | 220 | } |
ykuroda | 0:13a5d365ba16 | 221 | |
ykuroda | 0:13a5d365ba16 | 222 | /** \sa MatrixBase::operator=(const EigenBase<OtherDerived>&) */ |
ykuroda | 0:13a5d365ba16 | 223 | template<typename OtherDerived> |
ykuroda | 0:13a5d365ba16 | 224 | EIGEN_STRONG_INLINE Array(const EigenBase<OtherDerived> &other) |
ykuroda | 0:13a5d365ba16 | 225 | : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) |
ykuroda | 0:13a5d365ba16 | 226 | { |
ykuroda | 0:13a5d365ba16 | 227 | Base::_check_template_params(); |
ykuroda | 0:13a5d365ba16 | 228 | Base::_resize_to_match(other); |
ykuroda | 0:13a5d365ba16 | 229 | *this = other; |
ykuroda | 0:13a5d365ba16 | 230 | } |
ykuroda | 0:13a5d365ba16 | 231 | |
ykuroda | 0:13a5d365ba16 | 232 | /** Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the |
ykuroda | 0:13a5d365ba16 | 233 | * data pointers. |
ykuroda | 0:13a5d365ba16 | 234 | */ |
ykuroda | 0:13a5d365ba16 | 235 | template<typename OtherDerived> |
ykuroda | 0:13a5d365ba16 | 236 | void swap(ArrayBase<OtherDerived> const & other) |
ykuroda | 0:13a5d365ba16 | 237 | { this->_swap(other.derived()); } |
ykuroda | 0:13a5d365ba16 | 238 | |
ykuroda | 0:13a5d365ba16 | 239 | inline Index innerStride() const { return 1; } |
ykuroda | 0:13a5d365ba16 | 240 | inline Index outerStride() const { return this->innerSize(); } |
ykuroda | 0:13a5d365ba16 | 241 | |
ykuroda | 0:13a5d365ba16 | 242 | #ifdef EIGEN_ARRAY_PLUGIN |
ykuroda | 0:13a5d365ba16 | 243 | #include EIGEN_ARRAY_PLUGIN |
ykuroda | 0:13a5d365ba16 | 244 | #endif |
ykuroda | 0:13a5d365ba16 | 245 | |
ykuroda | 0:13a5d365ba16 | 246 | private: |
ykuroda | 0:13a5d365ba16 | 247 | |
ykuroda | 0:13a5d365ba16 | 248 | template<typename MatrixType, typename OtherDerived, bool SwapPointers> |
ykuroda | 0:13a5d365ba16 | 249 | friend struct internal::matrix_swap_impl; |
ykuroda | 0:13a5d365ba16 | 250 | }; |
ykuroda | 0:13a5d365ba16 | 251 | |
ykuroda | 0:13a5d365ba16 | 252 | /** \defgroup arraytypedefs Global array typedefs |
ykuroda | 0:13a5d365ba16 | 253 | * \ingroup Core_Module |
ykuroda | 0:13a5d365ba16 | 254 | * |
ykuroda | 0:13a5d365ba16 | 255 | * Eigen defines several typedef shortcuts for most common 1D and 2D array types. |
ykuroda | 0:13a5d365ba16 | 256 | * |
ykuroda | 0:13a5d365ba16 | 257 | * The general patterns are the following: |
ykuroda | 0:13a5d365ba16 | 258 | * |
ykuroda | 0:13a5d365ba16 | 259 | * \c ArrayRowsColsType where \c Rows and \c Cols can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size, |
ykuroda | 0:13a5d365ba16 | 260 | * 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 |
ykuroda | 0:13a5d365ba16 | 261 | * for complex double. |
ykuroda | 0:13a5d365ba16 | 262 | * |
ykuroda | 0:13a5d365ba16 | 263 | * For example, \c Array33d is a fixed-size 3x3 array type of doubles, and \c ArrayXXf is a dynamic-size matrix of floats. |
ykuroda | 0:13a5d365ba16 | 264 | * |
ykuroda | 0:13a5d365ba16 | 265 | * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is |
ykuroda | 0:13a5d365ba16 | 266 | * a fixed-size 1D array of 4 complex floats. |
ykuroda | 0:13a5d365ba16 | 267 | * |
ykuroda | 0:13a5d365ba16 | 268 | * \sa class Array |
ykuroda | 0:13a5d365ba16 | 269 | */ |
ykuroda | 0:13a5d365ba16 | 270 | |
ykuroda | 0:13a5d365ba16 | 271 | #define EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ |
ykuroda | 0:13a5d365ba16 | 272 | /** \ingroup arraytypedefs */ \ |
ykuroda | 0:13a5d365ba16 | 273 | typedef Array<Type, Size, Size> Array##SizeSuffix##SizeSuffix##TypeSuffix; \ |
ykuroda | 0:13a5d365ba16 | 274 | /** \ingroup arraytypedefs */ \ |
ykuroda | 0:13a5d365ba16 | 275 | typedef Array<Type, Size, 1> Array##SizeSuffix##TypeSuffix; |
ykuroda | 0:13a5d365ba16 | 276 | |
ykuroda | 0:13a5d365ba16 | 277 | #define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ |
ykuroda | 0:13a5d365ba16 | 278 | /** \ingroup arraytypedefs */ \ |
ykuroda | 0:13a5d365ba16 | 279 | typedef Array<Type, Size, Dynamic> Array##Size##X##TypeSuffix; \ |
ykuroda | 0:13a5d365ba16 | 280 | /** \ingroup arraytypedefs */ \ |
ykuroda | 0:13a5d365ba16 | 281 | typedef Array<Type, Dynamic, Size> Array##X##Size##TypeSuffix; |
ykuroda | 0:13a5d365ba16 | 282 | |
ykuroda | 0:13a5d365ba16 | 283 | #define EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ |
ykuroda | 0:13a5d365ba16 | 284 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 2, 2) \ |
ykuroda | 0:13a5d365ba16 | 285 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 3, 3) \ |
ykuroda | 0:13a5d365ba16 | 286 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 4, 4) \ |
ykuroda | 0:13a5d365ba16 | 287 | EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ |
ykuroda | 0:13a5d365ba16 | 288 | EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ |
ykuroda | 0:13a5d365ba16 | 289 | EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ |
ykuroda | 0:13a5d365ba16 | 290 | EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 4) |
ykuroda | 0:13a5d365ba16 | 291 | |
ykuroda | 0:13a5d365ba16 | 292 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(int, i) |
ykuroda | 0:13a5d365ba16 | 293 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(float, f) |
ykuroda | 0:13a5d365ba16 | 294 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(double, d) |
ykuroda | 0:13a5d365ba16 | 295 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex<float>, cf) |
ykuroda | 0:13a5d365ba16 | 296 | EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex<double>, cd) |
ykuroda | 0:13a5d365ba16 | 297 | |
ykuroda | 0:13a5d365ba16 | 298 | #undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES |
ykuroda | 0:13a5d365ba16 | 299 | #undef EIGEN_MAKE_ARRAY_TYPEDEFS |
ykuroda | 0:13a5d365ba16 | 300 | |
ykuroda | 0:13a5d365ba16 | 301 | #undef EIGEN_MAKE_ARRAY_TYPEDEFS_LARGE |
ykuroda | 0:13a5d365ba16 | 302 | |
ykuroda | 0:13a5d365ba16 | 303 | #define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ |
ykuroda | 0:13a5d365ba16 | 304 | using Eigen::Matrix##SizeSuffix##TypeSuffix; \ |
ykuroda | 0:13a5d365ba16 | 305 | using Eigen::Vector##SizeSuffix##TypeSuffix; \ |
ykuroda | 0:13a5d365ba16 | 306 | using Eigen::RowVector##SizeSuffix##TypeSuffix; |
ykuroda | 0:13a5d365ba16 | 307 | |
ykuroda | 0:13a5d365ba16 | 308 | #define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(TypeSuffix) \ |
ykuroda | 0:13a5d365ba16 | 309 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ |
ykuroda | 0:13a5d365ba16 | 310 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ |
ykuroda | 0:13a5d365ba16 | 311 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ |
ykuroda | 0:13a5d365ba16 | 312 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ |
ykuroda | 0:13a5d365ba16 | 313 | |
ykuroda | 0:13a5d365ba16 | 314 | #define EIGEN_USING_ARRAY_TYPEDEFS \ |
ykuroda | 0:13a5d365ba16 | 315 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(i) \ |
ykuroda | 0:13a5d365ba16 | 316 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(f) \ |
ykuroda | 0:13a5d365ba16 | 317 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(d) \ |
ykuroda | 0:13a5d365ba16 | 318 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cf) \ |
ykuroda | 0:13a5d365ba16 | 319 | EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cd) |
ykuroda | 0:13a5d365ba16 | 320 | |
ykuroda | 0:13a5d365ba16 | 321 | } // end namespace Eigen |
ykuroda | 0:13a5d365ba16 | 322 | |
ykuroda | 0:13a5d365ba16 | 323 | #endif // EIGEN_ARRAY_H |