33template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
34struct traits<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > : traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
36 typedef ArrayXpr XprKind;
37 typedef ArrayBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > XprBase;
41template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
43 :
public PlainObjectBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
47 typedef PlainObjectBase<Array> Base;
48 EIGEN_DENSE_PUBLIC_INTERFACE(
Array)
50 enum { Options = _Options };
51 typedef typename Base::PlainObject PlainObject;
54 template <
typename Derived,
typename OtherDerived,
bool IsVector>
55 friend struct internal::conservative_resize_like_impl;
57 using Base::m_storage;
71 template<
typename OtherDerived>
86 template<
typename OtherDerived>
110 EIGEN_STRONG_INLINE
Array() : Base()
112 Base::_check_template_params();
113 EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
116#ifndef EIGEN_PARSED_BY_DOXYGEN
119 Array(internal::constructor_without_unaligned_array_assert)
120 : Base(
internal::constructor_without_unaligned_array_assert())
122 Base::_check_template_params();
123 EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
127#ifdef EIGEN_HAVE_RVALUE_REFERENCES
129 : Base(std::move(other))
131 Base::_check_template_params();
148 EIGEN_STRONG_INLINE
explicit Array(Index dim)
151 Base::_check_template_params();
152 EIGEN_STATIC_ASSERT_VECTOR_ONLY(
Array)
153 eigen_assert(dim >= 0);
155 EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
158 #ifndef EIGEN_PARSED_BY_DOXYGEN
159 template<
typename T0,
typename T1>
160 EIGEN_STRONG_INLINE
Array(
const T0& val0,
const T1& val1)
162 Base::_check_template_params();
173 Array(
const Scalar& val0,
const Scalar& val1);
177 EIGEN_STRONG_INLINE
Array(
const Scalar& val0,
const Scalar& val1,
const Scalar& val2)
179 Base::_check_template_params();
180 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Array, 3)
181 m_storage.data()[0] = val0;
182 m_storage.data()[1] = val1;
183 m_storage.data()[2] = val2;
186 EIGEN_STRONG_INLINE
Array(
const Scalar& val0,
const Scalar& val1,
const Scalar& val2,
const Scalar& val3)
188 Base::_check_template_params();
189 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Array, 4)
190 m_storage.data()[0] = val0;
191 m_storage.data()[1] = val1;
192 m_storage.data()[2] = val2;
193 m_storage.data()[3] = val3;
199 template<
typename OtherDerived>
201 : Base(other.rows() * other.cols(), other.rows(), other.cols())
203 Base::_check_template_params();
208 : Base(other.rows() * other.cols(), other.rows(), other.cols())
210 Base::_check_template_params();
214 template<
typename OtherDerived>
215 EIGEN_STRONG_INLINE
Array(
const ReturnByValue<OtherDerived>& other)
217 Base::_check_template_params();
223 template<
typename OtherDerived>
225 : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
227 Base::_check_template_params();
235 template<
typename OtherDerived>
237 { this->
_swap(other.derived()); }
239 inline Index innerStride()
const {
return 1; }
240 inline Index outerStride()
const {
return this->
innerSize(); }
242 #ifdef EIGEN_ARRAY_PLUGIN
243 #include EIGEN_ARRAY_PLUGIN
248 template<
typename MatrixType,
typename OtherDerived,
bool SwapPo
inters>
249 friend struct internal::matrix_swap_impl;
271#define EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
273typedef Array<Type, Size, Size> Array##SizeSuffix##SizeSuffix##TypeSuffix; \
275typedef Array<Type, Size, 1> Array##SizeSuffix##TypeSuffix;
277#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \
279typedef Array<Type, Size, Dynamic> Array##Size##X##TypeSuffix; \
281typedef Array<Type, Dynamic, Size> Array##X##Size##TypeSuffix;
283#define EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
284EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 2, 2) \
285EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 3, 3) \
286EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 4, 4) \
287EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \
288EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \
289EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \
290EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 4)
292EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(
int, i)
293EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(
float, f)
294EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(
double, d)
295EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex<float>, cf)
296EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
298#undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES
299#undef EIGEN_MAKE_ARRAY_TYPEDEFS
301#undef EIGEN_MAKE_ARRAY_TYPEDEFS_LARGE
303#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \
304using Eigen::Matrix##SizeSuffix##TypeSuffix; \
305using Eigen::Vector##SizeSuffix##TypeSuffix; \
306using Eigen::RowVector##SizeSuffix##TypeSuffix;
308#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(TypeSuffix) \
309EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \
310EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \
311EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \
312EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \
314#define EIGEN_USING_ARRAY_TYPEDEFS \
315EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(i) \
316EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(f) \
317EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(d) \
318EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cf) \
319EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cd)
Base class for all 1D and 2D array, and related expressions.
Definition ArrayBase.h:41
Array(const Array &other)
Definition Array.h:207
Array(Index dim)
Definition Array.h:148
Array(Index rows, Index cols)
void swap(ArrayBase< OtherDerived > const &other)
Definition Array.h:236
Array & operator=(const ArrayBase< OtherDerived > &other)
Definition Array.h:87
Array & operator=(const Array &other)
Definition Array.h:95
Array(const ReturnByValue< OtherDerived > &other)
Definition Array.h:215
Array & operator=(const EigenBase< OtherDerived > &other)
Definition Array.h:72
Array(const EigenBase< OtherDerived > &other)
Definition Array.h:224
Array(const Scalar &val0, const Scalar &val1, const Scalar &val2, const Scalar &val3)
Definition Array.h:186
Array(const ArrayBase< OtherDerived > &other)
Definition Array.h:200
Array(const Scalar &val0, const Scalar &val1, const Scalar &val2)
Definition Array.h:177
Array(const Scalar &val0, const Scalar &val1)
Array()
Definition Array.h:110
Index innerSize() const
Definition DenseBase.h:203
@ RowsAtCompileTime
Definition DenseBase.h:102
@ SizeAtCompileTime
Definition DenseBase.h:115
@ ColsAtCompileTime
Definition DenseBase.h:108
Array & operator=(const PlainObjectBase &other)
Definition PlainObjectBase.h:404
void _init2(Index nbRows, Index nbCols, typename internal::enable_if< Base::SizeAtCompileTime!=2, T0 >::type *=0)
Definition PlainObjectBase.h:657
const Scalar * data() const
Definition PlainObjectBase.h:212
void _swap(DenseBase< OtherDerived > const &other)
Definition PlainObjectBase.h:679
void _resize_to_match(const EigenBase< OtherDerived > &other)
Definition PlainObjectBase.h:599
Array & _set_noalias(const DenseBase< OtherDerived > &other)
Definition PlainObjectBase.h:646
Array & _set(const DenseBase< OtherDerived > &other)
Definition PlainObjectBase.h:628
void resize(Index nbRows, Index nbCols)
Definition PlainObjectBase.h:235
Definition EigenBase.h:27