15#include "./InternalHeaderCheck.h"
20template <
typename Scalar_,
int Rows_,
int Cols_,
int Options_,
int MaxRows_,
int MaxCols_>
21struct traits<Matrix<Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_>> {
23 constexpr static int size = internal::size_at_compile_time(Rows_, Cols_);
24 typedef typename find_best_packet<Scalar_, size>::type PacketScalar;
27 is_dynamic_size_storage = MaxRows_ ==
Dynamic || MaxCols_ ==
Dynamic,
28 max_size = is_dynamic_size_storage ?
Dynamic : MaxRows_ * MaxCols_,
29 default_alignment = compute_default_alignment<Scalar_, max_size>::value,
30 actual_alignment = ((Options_ &
DontAlign) == 0) ? default_alignment : 0,
31 required_alignment = unpacket_traits<PacketScalar>::alignment,
32 packet_access_bit = (packet_traits<Scalar_>::Vectorizable &&
33 (EIGEN_UNALIGNED_VECTORIZE || (int(actual_alignment) >= int(required_alignment))))
39 typedef Scalar_ Scalar;
40 typedef Dense StorageKind;
42 typedef MatrixXpr XprKind;
44 RowsAtCompileTime = Rows_,
45 ColsAtCompileTime = Cols_,
46 MaxRowsAtCompileTime = MaxRows_,
47 MaxColsAtCompileTime = MaxCols_,
48 Flags = compute_matrix_flags(Options_),
50 InnerStrideAtCompileTime = 1,
51 OuterStrideAtCompileTime = (int(Options) & int(RowMajor)) ? ColsAtCompileTime : RowsAtCompileTime,
55 Alignment = actual_alignment
185template <
typename Scalar_,
int Rows_,
int Cols_,
int Options_,
int MaxRows_,
int MaxCols_>
193 enum { Options = Options_ };
195 EIGEN_DENSE_PUBLIC_INTERFACE(
Matrix)
197 typedef typename Base::PlainObject PlainObject;
200 using Base::coeffRef;
210 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix&
operator=(
const Matrix& other) {
return Base::_set(other); }
222 template <
typename OtherDerived>
224 return Base::_set(other);
233 template <
typename OtherDerived>
235 return Base::operator=(other);
238 template <
typename OtherDerived>
239 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Matrix& operator=(
const ReturnByValue<OtherDerived>& func) {
240 return Base::operator=(func);
253 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix()
254 :
Base(){EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED}
257 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr explicit Matrix(
258 internal::constructor_without_unaligned_array_assert)
259 : Base(internal::constructor_without_unaligned_array_assert()){EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED}
261 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix(Matrix && other)
262 EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
263 : Base(std::move(other)) {}
264 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix& operator=(Matrix&& other)
265 EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value) {
266 Base::operator=(std::move(other));
277 template <
typename... ArgTypes>
279 const ArgTypes&... args)
280 :
Base(a0, a1, a2, a3, args...) {}
305 EIGEN_DEVICE_FUNC
explicit constexpr EIGEN_STRONG_INLINE
Matrix(
306 const std::initializer_list<std::initializer_list<Scalar>>& list)
309#ifndef EIGEN_PARSED_BY_DOXYGEN
312 template <
typename T>
313 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit Matrix(
const T& x) {
314 Base::template _init1<T>(x);
317 template <
typename T0,
typename T1>
318 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(
const T0& x,
const T1& y) {
319 Base::template _init2<T0, T1>(x, y);
365 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Matrix, 3)
366 m_storage.data()[0] = x;
367 m_storage.data()[1] = y;
368 m_storage.data()[2] = z;
374 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Matrix, 4)
375 m_storage.data()[0] = x;
376 m_storage.data()[1] = y;
377 m_storage.data()[2] = z;
378 m_storage.data()[3] = w;
387 template <
typename OtherDerived>
390 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index innerStride() const EIGEN_NOEXCEPT {
return 1; }
391 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
inline Index outerStride() const EIGEN_NOEXCEPT {
return this->innerSize(); }
395 template <
typename OtherDerived>
396 EIGEN_DEVICE_FUNC
explicit Matrix(
const RotationBase<OtherDerived, ColsAtCompileTime>& r);
397 template <
typename OtherDerived>
398 EIGEN_DEVICE_FUNC Matrix& operator=(
const RotationBase<OtherDerived, ColsAtCompileTime>& r);
401#ifdef EIGEN_MATRIX_PLUGIN
402#include EIGEN_MATRIX_PLUGIN
406 template <
typename Derived,
typename OtherDerived,
bool IsVector>
407 friend struct internal::conservative_resize_like_impl;
409 using Base::m_storage;
443#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
446 typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \
449 typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; \
452 typedef Matrix<Type, 1, Size> RowVector##SizeSuffix##TypeSuffix;
454#define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \
457 typedef Matrix<Type, Size, Dynamic> Matrix##Size##X##TypeSuffix; \
460 typedef Matrix<Type, Dynamic, Size> Matrix##X##Size##TypeSuffix;
462#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
463 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
464 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
465 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
466 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \
467 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \
468 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \
469 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4)
471EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
int, i)
472EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
float, f)
473EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
double, d)
474EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<
float>, cf)
475EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<
double>, cd)
477#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
478#undef EIGEN_MAKE_TYPEDEFS
479#undef EIGEN_MAKE_FIXED_TYPEDEFS
481#define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \
484 template <typename Type> \
485 using Matrix##SizeSuffix = Matrix<Type, Size, Size>; \
488 template <typename Type> \
489 using Vector##SizeSuffix = Matrix<Type, Size, 1>; \
492 template <typename Type> \
493 using RowVector##SizeSuffix = Matrix<Type, 1, Size>;
495#define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \
498 template <typename Type> \
499 using Matrix##Size##X = Matrix<Type, Size, Dynamic>; \
502 template <typename Type> \
503 using Matrix##X##Size = Matrix<Type, Dynamic, Size>;
505EIGEN_MAKE_TYPEDEFS(2, 2)
506EIGEN_MAKE_TYPEDEFS(3, 3)
507EIGEN_MAKE_TYPEDEFS(4, 4)
508EIGEN_MAKE_TYPEDEFS(Dynamic, X)
509EIGEN_MAKE_FIXED_TYPEDEFS(2)
510EIGEN_MAKE_FIXED_TYPEDEFS(3)
511EIGEN_MAKE_FIXED_TYPEDEFS(4)
515template <typename Type,
int Size>
520template <typename Type,
int Size>
523#undef EIGEN_MAKE_TYPEDEFS
524#undef EIGEN_MAKE_FIXED_TYPEDEFS
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:44
internal::traits< Derived >::Scalar Scalar
Definition DenseBase.h:62
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:186
constexpr Matrix(const std::initializer_list< std::initializer_list< Scalar > > &list)
Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by ro...
Definition Matrix.h:305
Matrix(const Scalar &x, const Scalar &y, const Scalar &z)
Constructs an initialized 3D vector with given coefficients.
Definition Matrix.h:364
Matrix(Index dim)
Constructs a vector or row-vector with given dimension. This is only for vectors (either row-vectors ...
Matrix(const EigenBase< OtherDerived > &other)
Copy constructor for generic expressions.
Definition Matrix.h:388
Matrix(Index rows, Index cols)
Constructs an uninitialized matrix with rows rows and cols columns.
Matrix(const Scalar &a0, const Scalar &a1, const Scalar &a2, const Scalar &a3, const ArgTypes &... args)
Definition Matrix.h:278
Matrix(const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &w)
Constructs an initialized 4D vector with given coefficients.
Definition Matrix.h:373
Matrix(const Matrix &other)
Copy constructor.
Definition Matrix.h:382
Matrix(const Scalar &x)
Constructs an initialized 1x1 matrix with the given coefficient.
Matrix(const Scalar *data)
Constructs a fixed-sized matrix initialized with coefficients starting at data.
constexpr Matrix()
Default constructor.
Definition Matrix.h:253
PlainObjectBase< Matrix > Base
Base class typedef.
Definition Matrix.h:191
constexpr Matrix & operator=(const Matrix &other)
Assigns matrices to each other.
Definition Matrix.h:210
Matrix(const Scalar &x, const Scalar &y)
Constructs an initialized 2D vector with given coefficients.
Matrix & operator=(const EigenBase< OtherDerived > &other)
Copies the generic expression other into *this.
Definition Matrix.h:234
Dense storage base class for matrices and arrays.
Definition PlainObjectBase.h:121
@ DontAlign
Definition Constants.h:324
@ RowMajor
Definition Constants.h:320
const unsigned int LinearAccessBit
Definition Constants.h:133
const unsigned int DirectAccessBit
Definition Constants.h:159
const unsigned int RowMajorBit
Definition Constants.h:70
Namespace containing all symbols from the Eigen library.
Definition Core:137
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:83
const int Dynamic
Definition Constants.h:25
Definition EigenBase.h:33