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> >
22 typedef typename find_best_packet<_Scalar,size>::type PacketScalar;
26 max_size = is_dynamic_size_storage ?
Dynamic : _MaxRows*_MaxCols,
28 actual_alignment = ((_Options&
DontAlign)==0) ? default_alignment : 0,
34 typedef _Scalar Scalar;
39 RowsAtCompileTime = _Rows,
40 ColsAtCompileTime = _Cols,
41 MaxRowsAtCompileTime = _MaxRows,
42 MaxColsAtCompileTime = _MaxCols,
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;
221 template<
typename OtherDerived>
234 template<
typename OtherDerived>
241 template<
typename OtherDerived>
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
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
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);
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;
420 template<
typename OtherDerived>
423 :
Base(other.derived())
426 EIGEN_DEVICE_FUNC
inline Index innerStride()
const {
return 1; }
427 EIGEN_DEVICE_FUNC
inline Index outerStride()
const {
return this->innerSize(); }
431 template<
typename OtherDerived>
433 explicit Matrix(
const RotationBase<OtherDerived,ColsAtCompileTime>& r);
434 template<
typename OtherDerived>
436 Matrix&
operator=(
const RotationBase<OtherDerived,ColsAtCompileTime>& r);
439 #ifdef EIGEN_MATRIX_PLUGIN
440 #include EIGEN_MATRIX_PLUGIN
444 template <
typename Derived,
typename OtherDerived,
bool IsVector>
445 friend struct internal::conservative_resize_like_impl;
447 using Base::m_storage;
479 #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
481 typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \
483 typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; \
485 typedef Matrix<Type, 1, Size> RowVector##SizeSuffix##TypeSuffix;
487 #define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \
489 typedef Matrix<Type, Size, Dynamic> Matrix##Size##X##TypeSuffix; \
491 typedef Matrix<Type, Dynamic, Size> Matrix##X##Size##TypeSuffix;
493 #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
494 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
495 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
496 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
497 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \
498 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \
499 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \
500 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4)
502 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
int, i)
503 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
float, f)
504 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
double, d)
505 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf)
506 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
508 #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
509 #undef EIGEN_MAKE_TYPEDEFS
510 #undef EIGEN_MAKE_FIXED_TYPEDEFS
514 #define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \
517 template <typename Type> \
518 using Matrix##SizeSuffix = Matrix<Type, Size, Size>; \
521 template <typename Type> \
522 using Vector##SizeSuffix = Matrix<Type, Size, 1>; \
525 template <typename Type> \
526 using RowVector##SizeSuffix = Matrix<Type, 1, Size>;
528 #define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \
531 template <typename Type> \
532 using Matrix##Size##X = Matrix<Type, Size, Dynamic>; \
535 template <typename Type> \
536 using Matrix##X##Size = Matrix<Type, Dynamic, Size>;
538 EIGEN_MAKE_TYPEDEFS(2, 2)
539 EIGEN_MAKE_TYPEDEFS(3, 3)
540 EIGEN_MAKE_TYPEDEFS(4, 4)
541 EIGEN_MAKE_TYPEDEFS(
Dynamic, X)
542 EIGEN_MAKE_FIXED_TYPEDEFS(2)
543 EIGEN_MAKE_FIXED_TYPEDEFS(3)
544 EIGEN_MAKE_FIXED_TYPEDEFS(4)
548 template <typename Type,
int Size>
549 using Vector = Matrix<Type, Size, 1>;
553 template <typename Type,
int Size>
554 using RowVector = Matrix<Type, 1, Size>;
556 #undef EIGEN_MAKE_TYPEDEFS
557 #undef EIGEN_MAKE_FIXED_TYPEDEFS
559 #endif // EIGEN_HAS_CXX11
563 #endif // EIGEN_MATRIX_H