11 #ifndef EIGEN_MATRIX_H 12 #define EIGEN_MATRIX_H 17 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
18 struct traits<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
21 enum { size = internal::size_at_compile_time<_Rows,_Cols>::ret };
22 typedef typename find_best_packet<_Scalar,size>::type PacketScalar;
26 max_size = is_dynamic_size_storage ?
Dynamic : _MaxRows*_MaxCols,
27 default_alignment = compute_default_alignment<_Scalar,max_size>::value,
28 actual_alignment = ((_Options&
DontAlign)==0) ? default_alignment : 0,
29 required_alignment = unpacket_traits<PacketScalar>::alignment,
30 packet_access_bit = (packet_traits<_Scalar>::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ?
PacketAccessBit : 0
34 typedef _Scalar Scalar;
35 typedef Dense StorageKind;
37 typedef MatrixXpr XprKind;
39 RowsAtCompileTime = _Rows,
40 ColsAtCompileTime = _Cols,
41 MaxRowsAtCompileTime = _MaxRows,
42 MaxColsAtCompileTime = _MaxCols,
43 Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret,
45 InnerStrideAtCompileTime = 1,
46 OuterStrideAtCompileTime = (Options&
RowMajor) ? ColsAtCompileTime : RowsAtCompileTime,
50 Alignment = actual_alignment
177 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
179 :
public PlainObjectBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
188 enum { Options = _Options };
190 EIGEN_DENSE_PUBLIC_INTERFACE(
Matrix)
192 typedef typename Base::PlainObject PlainObject;
195 using Base::coeffRef;
208 return Base::_set(other);
221 template<
typename OtherDerived>
225 return Base::_set(other);
234 template<
typename OtherDerived>
238 return Base::operator=(other);
241 template<
typename OtherDerived>
243 EIGEN_STRONG_INLINE
Matrix& operator=(
const ReturnByValue<OtherDerived>& func)
245 return Base::operator=(func);
258 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
261 Base::_check_template_params();
262 EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
266 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
267 explicit Matrix(internal::constructor_without_unaligned_array_assert)
268 : Base(internal::constructor_without_unaligned_array_assert())
269 { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED }
271 #if EIGEN_HAS_RVALUE_REFERENCES 272 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
273 Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
274 : Base(std::move(other))
276 Base::_check_template_params();
278 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
279 Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
281 Base::operator=(std::move(other));
294 template <
typename... ArgTypes>
295 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
296 Matrix(
const Scalar& a0,
const Scalar& a1,
const Scalar& a2,
const Scalar& a3,
const ArgTypes&... args)
297 : Base(a0, a1, a2, a3, args...) {}
321 explicit EIGEN_STRONG_INLINE
Matrix(
const std::initializer_list<std::initializer_list<Scalar>>& list) : Base(list) {}
322 #endif // end EIGEN_HAS_CXX11 324 #ifndef EIGEN_PARSED_BY_DOXYGEN 328 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
329 explicit Matrix(
const T& x)
331 Base::_check_template_params();
332 Base::template _init1<T>(x);
335 template<
typename T0,
typename T1>
336 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
337 Matrix(
const T0& x,
const T1& y)
339 Base::_check_template_params();
340 Base::template _init2<T0,T1>(x, y);
347 explicit Matrix(
const Scalar *data);
361 EIGEN_STRONG_INLINE
explicit Matrix(
Index dim);
364 Matrix(
const Scalar& x);
382 Matrix(
const Scalar& x,
const Scalar& y);
383 #endif // end EIGEN_PARSED_BY_DOXYGEN 389 EIGEN_STRONG_INLINE
Matrix(
const Scalar& x,
const Scalar& y,
const Scalar& z)
391 Base::_check_template_params();
392 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3)
393 m_storage.data()[0] = x;
394 m_storage.data()[1] = y;
395 m_storage.data()[2] = z;
401 EIGEN_STRONG_INLINE
Matrix(
const Scalar& x,
const Scalar& y,
const Scalar& z,
const Scalar& w)
403 Base::_check_template_params();
404 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4)
405 m_storage.data()[0] = x;
406 m_storage.data()[1] = y;
407 m_storage.data()[2] = z;
408 m_storage.data()[3] = w;
414 EIGEN_STRONG_INLINE
Matrix(
const Matrix& other) : Base(other)
420 template<
typename OtherDerived>
423 : Base(other.derived())
426 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
427 inline Index innerStride()
const EIGEN_NOEXCEPT {
return 1; }
428 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
429 inline Index outerStride()
const EIGEN_NOEXCEPT {
return this->innerSize(); }
433 template<
typename OtherDerived>
436 template<
typename OtherDerived>
441 #ifdef EIGEN_MATRIX_PLUGIN 442 #include EIGEN_MATRIX_PLUGIN 446 template <
typename Derived,
typename OtherDerived,
bool IsVector>
447 friend struct internal::conservative_resize_like_impl;
449 using Base::m_storage;
481 #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ 483 typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \ 485 typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; \ 487 typedef Matrix<Type, 1, Size> RowVector##SizeSuffix##TypeSuffix; 489 #define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ 491 typedef Matrix<Type, Size, Dynamic> Matrix##Size##X##TypeSuffix; \ 493 typedef Matrix<Type, Dynamic, Size> Matrix##X##Size##TypeSuffix; 495 #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ 496 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ 497 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ 498 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ 499 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ 500 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ 501 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ 502 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4) 504 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
int, i)
505 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
float, f)
506 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
double, d)
507 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
std::complex<
float>, cf)
508 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
std::complex<
double>, cd)
510 #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES 511 #undef EIGEN_MAKE_TYPEDEFS 512 #undef EIGEN_MAKE_FIXED_TYPEDEFS 516 #define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \ 519 template <typename Type> \ 520 using Matrix##SizeSuffix = Matrix<Type, Size, Size>; \ 523 template <typename Type> \ 524 using Vector##SizeSuffix = Matrix<Type, Size, 1>; \ 527 template <typename Type> \ 528 using RowVector##SizeSuffix = Matrix<Type, 1, Size>; 530 #define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \ 533 template <typename Type> \ 534 using Matrix##Size##X = Matrix<Type, Size, Dynamic>; \ 537 template <typename Type> \ 538 using Matrix##X##Size = Matrix<Type, Dynamic, Size>; 540 EIGEN_MAKE_TYPEDEFS(2, 2)
541 EIGEN_MAKE_TYPEDEFS(3, 3)
542 EIGEN_MAKE_TYPEDEFS(4, 4)
544 EIGEN_MAKE_FIXED_TYPEDEFS(2)
545 EIGEN_MAKE_FIXED_TYPEDEFS(3)
546 EIGEN_MAKE_FIXED_TYPEDEFS(4)
550 template <typename Type,
int Size>
555 template <typename Type,
int Size>
558 #undef EIGEN_MAKE_TYPEDEFS 559 #undef EIGEN_MAKE_FIXED_TYPEDEFS 561 #endif // EIGEN_HAS_CXX11 565 #endif // EIGEN_MATRIX_H Definition: Constants.h:325
const unsigned int DirectAccessBit
Definition: Constants.h:155
Matrix(const Scalar &x, const Scalar &y, const Scalar &z)
Constructs an initialized 3D vector with given coefficients.
Definition: Matrix.h:389
Namespace containing all symbols from the Eigen library.
Definition: Core:141
Definition: BFloat16.h:88
const unsigned int RowMajorBit
Definition: Constants.h:66
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
const unsigned int PacketAccessBit
Definition: Constants.h:94
Definition: EigenBase.h:29
Matrix & operator=(const EigenBase< OtherDerived > &other)
Copies the generic expression other into *this.
Definition: Matrix.h:236
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:95
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. [c++11]
Definition: Matrix.h:296
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:321
Common base class for compact rotation representations.
Definition: RotationBase.h:29
Matrix(const EigenBase< OtherDerived > &other)
Copy constructor for generic expressions.
Definition: Matrix.h:422
Definition: Eigen_Colamd.h:50
Definition: Constants.h:321
Matrix & operator=(const Matrix &other)
Assigns matrices to each other.
Definition: Matrix.h:206
const int Dynamic
Definition: Constants.h:22
Matrix(const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &w)
Constructs an initialized 4D vector with given coefficients.
Definition: Matrix.h:401
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:178
Matrix()
Default constructor.
Definition: Matrix.h:259
PlainObjectBase< Matrix > Base
Base class typedef.
Definition: Matrix.h:186
const unsigned int LinearAccessBit
Definition: Constants.h:130
Matrix(const Matrix &other)
Copy constructor.
Definition: Matrix.h:414