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;
221 template<
typename OtherDerived>
234 template<
typename OtherDerived>
241 template<
typename OtherDerived>
243 EIGEN_STRONG_INLINE
Matrix&
operator=(
const ReturnByValue<OtherDerived>& func)
261 Base::_check_template_params();
262 EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
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
273 Matrix(
Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible<Scalar>::value)
274 :
Base(std::move(other))
276 Base::_check_template_params();
286 #ifndef EIGEN_PARSED_BY_DOXYGEN
291 EIGEN_STRONG_INLINE
explicit Matrix(
const T&
x)
293 Base::_check_template_params();
294 Base::template _init1<T>(
x);
297 template<
typename T0,
typename T1>
299 EIGEN_STRONG_INLINE
Matrix(
const T0&
x,
const T1&
y)
301 Base::_check_template_params();
302 Base::template _init2<T0,T1>(
x,
y);
347 Base::_check_template_params();
348 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Matrix, 3)
349 m_storage.data()[0] =
x;
350 m_storage.data()[1] =
y;
351 m_storage.data()[2] =
z;
357 Base::_check_template_params();
358 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(
Matrix, 4)
359 m_storage.data()[0] =
x;
360 m_storage.data()[1] =
y;
361 m_storage.data()[2] =
z;
362 m_storage.data()[3] =
w;
374 template<
typename OtherDerived>
380 EIGEN_DEVICE_FUNC
inline Index innerStride()
const {
return 1; }
381 EIGEN_DEVICE_FUNC
inline Index outerStride()
const {
return this->
innerSize(); }
385 template<
typename OtherDerived>
387 explicit Matrix(
const RotationBase<OtherDerived,ColsAtCompileTime>& r);
388 template<
typename OtherDerived>
390 Matrix&
operator=(
const RotationBase<OtherDerived,ColsAtCompileTime>& r);
393 #ifdef EIGEN_MATRIX_PLUGIN
394 #include EIGEN_MATRIX_PLUGIN
398 template <
typename Derived,
typename OtherDerived,
bool IsVector>
399 friend struct internal::conservative_resize_like_impl;
401 using Base::m_storage;
424 #define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \
426 typedef Matrix<Type, Size, Size> Matrix##SizeSuffix##TypeSuffix; \
428 typedef Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; \
430 typedef Matrix<Type, 1, Size> RowVector##SizeSuffix##TypeSuffix;
432 #define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \
434 typedef Matrix<Type, Size, Dynamic> Matrix##Size##X##TypeSuffix; \
436 typedef Matrix<Type, Dynamic, Size> Matrix##X##Size##TypeSuffix;
438 #define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \
439 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \
440 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \
441 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \
442 EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \
443 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \
444 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \
445 EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4)
447 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
int, i)
448 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
float, f)
449 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(
double, d)
450 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<float>, cf)
451 EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex<double>, cd)
453 #undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES
454 #undef EIGEN_MAKE_TYPEDEFS
455 #undef EIGEN_MAKE_FIXED_TYPEDEFS
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:47
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:66
Index innerSize() const
Definition: DenseBase.h:230
Derived & derived()
Definition: EigenBase.h:45
Scalar & z()
Definition: DenseCoeffsBase.h:449
Scalar & x()
Definition: DenseCoeffsBase.h:433
Scalar & w()
Definition: DenseCoeffsBase.h:459
Scalar & y()
Definition: DenseCoeffsBase.h:439
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:180
Matrix & operator=(const Matrix &other)
Assigns matrices to each other.
Definition: Matrix.h:206
Matrix(const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &w)
Constructs an initialized 4D vector with given coefficients.
Definition: Matrix.h:355
Matrix(Index dim)
Constructs a vector or row-vector with given dimension. This is only for vectors (either row-vectors ...
Matrix & operator=(const EigenBase< OtherDerived > &other)
Copies the generic expression other into *this.
Definition: Matrix.h:236
Matrix(const Scalar &x, const Scalar &y)
Constructs an initialized 2D vector with given coefficients.
Matrix(const Scalar &x, const Scalar &y, const Scalar &z)
Constructs an initialized 3D vector with given coefficients.
Definition: Matrix.h:345
Matrix(const Matrix &other)
Copy constructor.
Definition: Matrix.h:368
Matrix()
Default constructor.
Definition: Matrix.h:259
Matrix(const Scalar &x)
Constructs an initialized 1x1 matrix with the given coefficient.
PlainObjectBase< Matrix > Base
Base class typedef.
Definition: Matrix.h:186
Matrix(const EigenBase< OtherDerived > &other)
Copy constructor for generic expressions.
Definition: Matrix.h:376
Matrix(const Scalar *data)
Constructs a fixed-sized matrix initialized with coefficients starting at data.
Matrix(Index rows, Index cols)
Constructs an uninitialized matrix with rows rows and cols columns.
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:100
Derived & _set(const DenseBase< OtherDerived > &other)
Copies the value of the expression other into *this with automatic resizing.
Definition: PlainObjectBase.h:712
Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:183
const Scalar * data() const
Definition: PlainObjectBase.h:255
Derived & operator=(const PlainObjectBase &other)
Definition: PlainObjectBase.h:457
@ DontAlign
Definition: Constants.h:326
@ RowMajor
Definition: Constants.h:322
const unsigned int PacketAccessBit
Definition: Constants.h:89
const unsigned int LinearAccessBit
Definition: Constants.h:125
const unsigned int DirectAccessBit
Definition: Constants.h:150
const unsigned int RowMajorBit
Definition: Constants.h:61
Namespace containing all symbols from the Eigen library.
Definition: Core:309
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
const int Dynamic
Definition: Constants.h:21
Definition: EigenBase.h:30
Eigen::Index Index
The interface type of indices.
Definition: EigenBase.h:38