12#ifndef EIGEN_MATRIXSTORAGE_H
13#define EIGEN_MATRIXSTORAGE_H
15#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN
16 #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) X; EIGEN_DENSE_STORAGE_CTOR_PLUGIN;
18 #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X)
27template<
typename T,
int Size>
32 #if EIGEN_STACK_ALLOCATION_LIMIT
41template <
typename T,
int Size,
int MatrixOrArrayOptions,
42 int Alignment = (MatrixOrArrayOptions&
DontAlign) ? 0
51 check_static_allocation_size<T,Size>();
57 check_static_allocation_size<T,Size>();
61#if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
62 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
63#elif EIGEN_GNUC_AT_LEAST(4,7)
67 template<
typename PtrType>
68 EIGEN_ALWAYS_INLINE PtrType eigen_unaligned_array_assert_workaround_gcc47(PtrType array) {
return array; }
69 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \
70 eigen_assert((internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (sizemask)) == 0 \
71 && "this assertion is explained here: " \
72 "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \
73 " **** READ THIS WEB PAGE !!! ****");
75 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \
76 eigen_assert((internal::UIntPtr(array) & (sizemask)) == 0 \
77 && "this assertion is explained here: " \
78 "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \
79 " **** READ THIS WEB PAGE !!! ****");
82template <
typename T,
int Size,
int MatrixOrArrayOptions>
91 check_static_allocation_size<T,Size>();
97 check_static_allocation_size<T,Size>();
101template <
typename T,
int Size,
int MatrixOrArrayOptions>
110 check_static_allocation_size<T,Size>();
116 check_static_allocation_size<T,Size>();
120template <
typename T,
int Size,
int MatrixOrArrayOptions>
129 check_static_allocation_size<T,Size>();
135 check_static_allocation_size<T,Size>();
139template <
typename T,
int Size,
int MatrixOrArrayOptions>
148 check_static_allocation_size<T,Size>();
154 check_static_allocation_size<T,Size>();
158template <
typename T,
int MatrixOrArrayOptions,
int Alignment>
167 template<
typename T,
int Size,
int MatrixOrArrayOptions,
int Alignment>
174 template<
typename T,
int Size,
int MatrixOrArrayOptions,
int Alignment>
178 if (a_size < b_size) {
179 std::swap_ranges(
b.array,
b.array + a_size, a.
array);
181 }
else if (a_size > b_size) {
182 std::swap_ranges(a.
array, a.
array + b_size,
b.array);
185 std::swap_ranges(a.
array, a.
array + a_size,
b.array);
204template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage;
207template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage
216 : m_data(
internal::constructor_without_unaligned_array_assert()) {}
217#if !EIGEN_HAS_CXX11 || defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN)
229 if (
this != &other) m_data = other.m_data;
235#if EIGEN_HAS_RVALUE_REFERENCES
238 : m_data(std::move(other.m_data))
244 m_data = std::move(other.m_data);
307 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
309 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows), m_cols(other.m_cols)
317 m_rows = other.m_rows;
318 m_cols = other.m_cols;
346 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
348 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows)
357 m_rows = other.m_rows;
384 : m_data(
internal::constructor_without_unaligned_array_assert()), m_cols(0) {}
386 : m_data(
internal::constructor_without_unaligned_array_assert()), m_cols(other.m_cols)
394 m_cols = other.m_cols;
421 : m_data(0), m_rows(0), m_cols(0) {}
430 , m_rows(other.m_rows)
431 , m_cols(other.m_cols)
445#if EIGEN_HAS_RVALUE_REFERENCES
448 : m_data(std::move(other.m_data))
449 , m_rows(std::move(other.m_rows))
450 , m_cols(std::move(other.m_cols))
452 other.m_data =
nullptr;
476 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, m_rows*m_cols);
482 if(
size != m_rows*m_cols)
484 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
486 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
514 , m_cols(other.m_cols)
528#if EIGEN_HAS_RVALUE_REFERENCES
531 : m_data(std::move(other.m_data))
532 , m_cols(std::move(other.m_cols))
534 other.m_data =
nullptr;
554 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, _Rows*m_cols);
559 if(
size != _Rows*m_cols)
561 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
563 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
590 , m_rows(other.m_rows)
604#if EIGEN_HAS_RVALUE_REFERENCES
607 : m_data(std::move(other.m_data))
608 , m_rows(std::move(other.m_rows))
610 other.m_data =
nullptr;
630 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, m_rows*_Cols);
635 if(
size != m_rows*_Cols)
637 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
639 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
#define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
Definition: DenseStorage.h:75
#define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X)
Definition: DenseStorage.h:18
#define EIGEN_ALWAYS_INLINE
Definition: Macros.h:942
#define eigen_internal_assert(x)
Definition: Macros.h:1053
#define EIGEN_NOEXCEPT
Definition: Macros.h:1428
#define EIGEN_CONSTEXPR
Definition: Macros.h:797
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:1086
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define EIGEN_STACK_ALLOCATION_LIMIT
Definition: Macros.h:54
#define EIGEN_STRONG_INLINE
Definition: Macros.h:927
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
Definition: StaticAssert.h:127
Definition: DenseStorage.h:272
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &)
Definition: DenseStorage.h:276
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:285
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:274
EIGEN_DEVICE_FUNC void swap(DenseStorage &)
Definition: DenseStorage.h:279
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index)
Definition: DenseStorage.h:282
EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index)
Definition: DenseStorage.h:278
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &)
Definition: DenseStorage.h:277
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:284
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT
Definition: DenseStorage.h:280
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:275
EIGEN_DEVICE_FUNC void resize(Index, Index, Index)
Definition: DenseStorage.h:283
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT
Definition: DenseStorage.h:281
Definition: DenseStorage.h:293
Definition: DenseStorage.h:296
Definition: DenseStorage.h:290
Definition: DenseStorage.h:500
EIGEN_DEVICE_FUNC ~DenseStorage()
Definition: DenseStorage.h:545
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
Definition: DenseStorage.h:519
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
Definition: DenseStorage.h:546
EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:551
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT
Definition: DenseStorage.h:550
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:504
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:571
EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols)
Definition: DenseStorage.h:552
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:570
DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:505
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
Definition: DenseStorage.h:512
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index, Index cols)
Definition: DenseStorage.h:557
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
Definition: DenseStorage.h:506
Definition: DenseStorage.h:576
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index rows, Index)
Definition: DenseStorage.h:633
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
Definition: DenseStorage.h:622
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:646
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void)
Definition: DenseStorage.h:627
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:580
DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:581
void conservativeResize(Index size, Index rows, Index)
Definition: DenseStorage.h:628
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
Definition: DenseStorage.h:588
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
Definition: DenseStorage.h:582
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
Definition: DenseStorage.h:595
EIGEN_DEVICE_FUNC ~DenseStorage()
Definition: DenseStorage.h:621
EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:626
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:647
Definition: DenseStorage.h:414
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
Definition: DenseStorage.h:466
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:494
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:419
EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:472
EIGEN_DEVICE_FUNC void resize(Index size, Index rows, Index cols)
Definition: DenseStorage.h:480
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
Definition: DenseStorage.h:428
void conservativeResize(Index size, Index rows, Index cols)
Definition: DenseStorage.h:474
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:420
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:495
EIGEN_DEVICE_FUNC ~DenseStorage()
Definition: DenseStorage.h:465
EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:473
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
Definition: DenseStorage.h:422
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
Definition: DenseStorage.h:436
Definition: DenseStorage.h:378
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index cols)
Definition: DenseStorage.h:406
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
Definition: DenseStorage.h:400
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:383
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
Definition: DenseStorage.h:390
EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index cols)
Definition: DenseStorage.h:399
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:404
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:409
EIGEN_DEVICE_FUNC void resize(Index, Index, Index cols)
Definition: DenseStorage.h:407
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:408
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
Definition: DenseStorage.h:385
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:382
EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:405
Definition: DenseStorage.h:340
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:344
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
Definition: DenseStorage.h:353
EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index)
Definition: DenseStorage.h:371
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:372
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
Definition: DenseStorage.h:347
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:373
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:345
EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:368
EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index)
Definition: DenseStorage.h:362
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index)
Definition: DenseStorage.h:370
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
Definition: DenseStorage.h:363
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void) const EIGEN_NOEXCEPT
Definition: DenseStorage.h:369
Definition: DenseStorage.h:300
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
Definition: DenseStorage.h:313
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index cols)
Definition: DenseStorage.h:332
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:335
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
Definition: DenseStorage.h:324
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
Definition: DenseStorage.h:308
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:305
EIGEN_DEVICE_FUNC Index rows() const
Definition: DenseStorage.h:330
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:306
EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols)
Definition: DenseStorage.h:323
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:334
EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index cols)
Definition: DenseStorage.h:333
EIGEN_DEVICE_FUNC Index cols() const
Definition: DenseStorage.h:331
Definition: DenseStorage.h:208
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT
Definition: DenseStorage.h:262
EIGEN_DEVICE_FUNC void resize(Index, Index, Index)
Definition: DenseStorage.h:265
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
Definition: DenseStorage.h:227
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:215
EIGEN_DEVICE_FUNC T * data()
Definition: DenseStorage.h:267
static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT
Definition: DenseStorage.h:263
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
Definition: DenseStorage.h:259
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index)
Definition: DenseStorage.h:264
EIGEN_DEVICE_FUNC const T * data() const
Definition: DenseStorage.h:266
EIGEN_DEVICE_FUNC DenseStorage()
Definition: DenseStorage.h:211
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
Definition: DenseStorage.h:219
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
Definition: DenseStorage.h:252
@ DontAlign
Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated,...
Definition: Constants.h:325
EIGEN_DEVICE_FUNC T * smart_move(T *start, T *end, T *target)
Definition: Memory.h:575
EIGEN_DEVICE_FUNC T * conditional_aligned_new_auto(std::size_t size)
Definition: Memory.h:399
EIGEN_DEVICE_FUNC void check_static_allocation_size()
Definition: DenseStorage.h:29
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
EIGEN_DEVICE_FUNC void smart_copy(const T *start, const T *end, T *target)
Definition: Memory.h:515
EIGEN_STRONG_INLINE void swap(T &a, T &b)
Definition: Meta.h:766
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
Definition: Eigen_Colamd.h:50
@ value
Definition: XprHelper.h:243
Definition: DenseStorage.h:25
Definition: DenseStorage.h:160
EIGEN_DEVICE_FUNC plain_array()
Definition: DenseStorage.h:162
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:163
Definition: DenseStorage.h:103
EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size]
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:114
Definition: DenseStorage.h:122
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:133
EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size]
Definition: DenseStorage.h:141
EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size]
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:152
Definition: DenseStorage.h:84
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:95
EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size]
Definition: DenseStorage.h:166
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void swap(plain_array< T, Size, MatrixOrArrayOptions, Alignment > &a, const Eigen::Index a_size, plain_array< T, Size, MatrixOrArrayOptions, Alignment > &b, const Eigen::Index b_size)
Definition: DenseStorage.h:176
EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void copy(const plain_array< T, Size, MatrixOrArrayOptions, Alignment > &src, const Eigen::Index size, plain_array< T, Size, MatrixOrArrayOptions, Alignment > &dst)
Definition: DenseStorage.h:169
Definition: DenseStorage.h:45
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
Definition: DenseStorage.h:55
EIGEN_DEVICE_FUNC plain_array()
Definition: DenseStorage.h:49
T array[Size]
Definition: DenseStorage.h:46