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_>
186class Matrix :
public PlainObjectBase<Matrix<Scalar_, Rows_, Cols_, Options_, MaxRows_, MaxCols_>> {
191 typedef PlainObjectBase<Matrix>
Base;
193 enum { Options = Options_ };
195 EIGEN_DENSE_PUBLIC_INTERFACE(
Matrix)
197 typedef typename Base::PlainObject PlainObject;
200 using Base::coeffRef;
222 template <
typename OtherDerived>
224 return Base::_set(other);
231 template <
typename OtherDerived>
236 template <
typename OtherDerived>
237 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Matrix& operator=(
const ReturnByValue<OtherDerived>& func) {
238 return Base::operator=(func);
251#if defined(EIGEN_INITIALIZE_COEFFS)
252 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix() { EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
254 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix() =
default;
257 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix(
Matrix&&) =
default;
262 std::is_nothrow_move_assignable<Scalar>::value) {
282 template <
typename... ArgTypes>
283 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Matrix(
const Scalar& a0,
const Scalar& a1,
const Scalar& a2,
const Scalar& a3,
284 const ArgTypes&... args)
285 :
Base(a0, a1, a2, a3, args...) {}
311 EIGEN_DEVICE_FUNC
explicit constexpr EIGEN_STRONG_INLINE
Matrix(
312 const std::initializer_list<std::initializer_list<Scalar>>& list)
315#ifndef EIGEN_PARSED_BY_DOXYGEN
318 template <
typename T>
319 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
explicit Matrix(
const T& x) {
320 Base::template _init1<T>(x);
323 template <
typename T0,
typename T1>
324 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(
const T0& x,
const T1& y) {
325 Base::template _init2<T0, T1>(x, y);
364 Matrix(
const Scalar& x,
const Scalar& y);
370 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Matrix(
const Scalar& x,
const Scalar& y,
const Scalar& z) {
371 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Matrix, 3)
372 m_storage.data()[0] = x;
373 m_storage.data()[1] = y;
374 m_storage.data()[2] = z;
379 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
Matrix(
const Scalar& x,
const Scalar& y,
const Scalar& z,
const Scalar& w) {
380 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Matrix, 4)
381 m_storage.data()[0] = x;
382 m_storage.data()[1] = y;
383 m_storage.data()[2] = z;
384 m_storage.data()[3] = w;
388 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr Matrix(
const Matrix&) =
default;
393 template <
typename OtherDerived>
396 EIGEN_DEVICE_FUNC
constexpr Index innerStride() const noexcept {
return 1; }
397 EIGEN_DEVICE_FUNC
constexpr Index outerStride() const noexcept {
return this->innerSize(); }
401 template <
typename OtherDerived>
403 template <
typename OtherDerived>
407#ifdef EIGEN_MATRIX_PLUGIN
408#include EIGEN_MATRIX_PLUGIN
412 template <
typename Derived,
typename OtherDerived,
bool IsVector>
413 friend struct internal::conservative_resize_like_impl;
415 using Base::m_storage;
449#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
452 typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \
455 typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; \
458 typedef Matrix<Type, 1, Size> RowVector##SizeSuffix##TypeSuffix;
460#define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \
463 typedef Matrix<Type, Size, Dynamic> Matrix##Size##X##TypeSuffix; \
466 typedef Matrix<Type, Dynamic, Size> Matrix##X##Size##TypeSuffix;
468#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
469 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
470 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
471 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
472 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \
473 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \
474 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \
475 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4)
477EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
int, i)
478EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
float, f)
479EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
double, d)
480EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<
float>, cf)
481EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<
double>, cd)
483#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
484#undef EIGEN_MAKE_TYPEDEFS
485#undef EIGEN_MAKE_FIXED_TYPEDEFS
487#define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \
490 template <typename Type> \
491 using Matrix##SizeSuffix = Matrix<Type, Size, Size>; \
494 template <typename Type> \
495 using Vector##SizeSuffix = Matrix<Type, Size, 1>; \
498 template <typename Type> \
499 using RowVector##SizeSuffix = Matrix<Type, 1, Size>;
501#define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \
504 template <typename Type> \
505 using Matrix##Size##X = Matrix<Type, Size, Dynamic>; \
508 template <typename Type> \
509 using Matrix##X##Size = Matrix<Type, Dynamic, Size>;
511EIGEN_MAKE_TYPEDEFS(2, 2)
512EIGEN_MAKE_TYPEDEFS(3, 3)
513EIGEN_MAKE_TYPEDEFS(4, 4)
515EIGEN_MAKE_FIXED_TYPEDEFS(2)
516EIGEN_MAKE_FIXED_TYPEDEFS(3)
517EIGEN_MAKE_FIXED_TYPEDEFS(4)
521template <typename Type,
int Size>
526template <typename Type,
int Size>
529#undef EIGEN_MAKE_TYPEDEFS
530#undef EIGEN_MAKE_FIXED_TYPEDEFS
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:44
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:311
Matrix(const Scalar &x, const Scalar &y, const Scalar &z)
Constructs an initialized 3D vector with given coefficients.
Definition Matrix.h:370
Matrix(Index dim)
Constructs a vector or row-vector with given dimension. This is only for vectors (either row-vectors ...
constexpr Matrix()=default
Default constructor.
Matrix(const EigenBase< OtherDerived > &other)
Copy constructor for generic expressions.
Definition Matrix.h:394
constexpr Matrix(Matrix &&)=default
Move constructor.
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)
Construct a row of column vector with fixed size from an arbitrary number of coefficients.
Definition Matrix.h:283
Matrix(const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &w)
Constructs an initialized 4D vector with given coefficients.
Definition Matrix.h:379
constexpr Matrix & operator=(Matrix &&other) noexcept(std::is_nothrow_move_assignable< Scalar >::value)
Moves the matrix into the other one.
Definition Matrix.h:261
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.
Matrix(const RotationBase< OtherDerived, ColsAtCompileTime > &r)
Constructs a Dim x Dim rotation matrix from the rotation r.
Definition RotationBase.h:148
PlainObjectBase< Matrix > Base
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:232
constexpr Matrix(const Matrix &)=default
Copy constructor.
constexpr Matrix & _set(const DenseBase< OtherDerived > &other)
Definition PlainObjectBase.h:717
constexpr const Scalar * data() const
Definition PlainObjectBase.h:247
constexpr Matrix & operator=(const PlainObjectBase &other)
Definition PlainObjectBase.h:429
Common base class for compact rotation representations.
Definition RotationBase.h:32
@ DontAlign
Definition Constants.h:324
@ RowMajor
Definition Constants.h:320
const unsigned int PacketAccessBit
Definition Constants.h:97
const unsigned int LinearAccessBit
Definition Constants.h:133
const unsigned int DirectAccessBit
Definition Constants.h:159
const unsigned int RowMajorBit
Definition Constants.h:70
Matrix< Type, 1, Size > RowVector
[c++11] 1×Size vector of type Type.
Definition Matrix.h:527
Matrix< Type, Size, 1 > Vector
[c++11] Size×1 vector of type Type.
Definition Matrix.h:522
Namespace containing all symbols from the Eigen library.
Definition B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:82
const int Dynamic
Definition Constants.h:25
Definition EigenBase.h:33