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) 25 struct constructor_without_unaligned_array_assert {};
27 template<
typename T,
int Size>
29 void check_static_allocation_size()
32 #if EIGEN_STACK_ALLOCATION_LIMIT 33 EIGEN_STATIC_ASSERT(Size *
sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
41 template <
typename T,
int Size,
int MatrixOrArrayOptions,
42 int Alignment = (MatrixOrArrayOptions&
DontAlign) ? 0
43 : compute_default_alignment<T,Size>::value >
51 check_static_allocation_size<T,Size>();
55 plain_array(constructor_without_unaligned_array_assert)
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 !!! ****"); 82 template <
typename T,
int Size,
int MatrixOrArrayOptions>
83 struct plain_array<T, Size, MatrixOrArrayOptions, 8>
85 EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size];
90 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7);
91 check_static_allocation_size<T,Size>();
95 plain_array(constructor_without_unaligned_array_assert)
97 check_static_allocation_size<T,Size>();
101 template <
typename T,
int Size,
int MatrixOrArrayOptions>
102 struct plain_array<T, Size, MatrixOrArrayOptions, 16>
104 EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size];
109 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15);
110 check_static_allocation_size<T,Size>();
114 plain_array(constructor_without_unaligned_array_assert)
116 check_static_allocation_size<T,Size>();
120 template <
typename T,
int Size,
int MatrixOrArrayOptions>
121 struct plain_array<T, Size, MatrixOrArrayOptions, 32>
123 EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size];
128 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31);
129 check_static_allocation_size<T,Size>();
133 plain_array(constructor_without_unaligned_array_assert)
135 check_static_allocation_size<T,Size>();
139 template <
typename T,
int Size,
int MatrixOrArrayOptions>
140 struct plain_array<T, Size, MatrixOrArrayOptions, 64>
142 EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size];
147 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63);
148 check_static_allocation_size<T,Size>();
152 plain_array(constructor_without_unaligned_array_assert)
154 check_static_allocation_size<T,Size>();
158 template <
typename T,
int MatrixOrArrayOptions,
int Alignment>
159 struct plain_array<T, 0, MatrixOrArrayOptions, Alignment>
162 EIGEN_DEVICE_FUNC plain_array() {}
163 EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert) {}
166 struct plain_array_helper {
167 template<
typename T,
int Size,
int MatrixOrArrayOptions,
int Alignment>
168 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
169 static void copy(
const plain_array<T, Size, MatrixOrArrayOptions, Alignment>& src,
const Eigen::Index size,
170 plain_array<T, Size, MatrixOrArrayOptions, Alignment>& dst) {
171 smart_copy(src.array, src.array + size, dst.array);
174 template<
typename T,
int Size,
int MatrixOrArrayOptions,
int Alignment>
175 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
176 static void swap(plain_array<T, Size, MatrixOrArrayOptions, Alignment>& a,
const Eigen::Index a_size,
177 plain_array<T, Size, MatrixOrArrayOptions, Alignment>& b,
const Eigen::Index b_size) {
178 if (a_size < b_size) {
179 std::swap_ranges(b.array, b.array + a_size, a.array);
180 smart_move(b.array + a_size, b.array + b_size, a.array + a_size);
181 }
else if (a_size > b_size) {
182 std::swap_ranges(a.array, a.array + b_size, b.array);
183 smart_move(a.array + b_size, a.array + a_size, b.array + b_size);
185 std::swap_ranges(a.array, a.array + a_size, b.array);
204 template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage;
207 template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage
209 internal::plain_array<T,Size,_Options> m_data;
211 EIGEN_DEVICE_FUNC DenseStorage() {
212 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = Size)
215 explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
216 : m_data(
internal::constructor_without_unaligned_array_assert()) {}
217 #if !EIGEN_HAS_CXX11 || defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN) 219 DenseStorage(
const DenseStorage& other) : m_data(other.m_data) {
220 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = Size)
223 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage&) =
default;
227 DenseStorage& operator=(
const DenseStorage& other)
229 if (
this != &other) m_data = other.m_data;
233 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage&) =
default;
235 #if EIGEN_HAS_RVALUE_REFERENCES 237 EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
238 : m_data(std::move(other.m_data))
241 EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
244 m_data = std::move(other.m_data);
248 EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&&) =
default;
249 EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&&) =
default;
253 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
254 eigen_internal_assert(size==rows*cols && rows==_Rows && cols==_Cols);
255 EIGEN_UNUSED_VARIABLE(size);
256 EIGEN_UNUSED_VARIABLE(rows);
257 EIGEN_UNUSED_VARIABLE(cols);
259 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
260 numext::swap(m_data, other.m_data);
262 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index rows(
void) EIGEN_NOEXCEPT {
return _Rows;}
263 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index cols(
void) EIGEN_NOEXCEPT {
return _Cols;}
266 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
267 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
271 template<
typename T,
int _Rows,
int _Cols,
int _Options>
class DenseStorage<T, 0, _Rows, _Cols, _Options>
274 EIGEN_DEVICE_FUNC DenseStorage() {}
275 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert) {}
276 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage&) {}
277 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage&) {
return *
this; }
279 EIGEN_DEVICE_FUNC
void swap(DenseStorage& ) {}
280 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index rows(
void) EIGEN_NOEXCEPT {
return _Rows;}
281 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index cols(
void) EIGEN_NOEXCEPT {
return _Cols;}
284 EIGEN_DEVICE_FUNC
const T *data()
const {
return 0; }
285 EIGEN_DEVICE_FUNC T *data() {
return 0; }
289 template<
typename T,
int _Options>
class DenseStorage<T, 0, Dynamic, Dynamic, _Options>
290 :
public DenseStorage<T, 0, 0, 0, _Options> { };
292 template<
typename T,
int _Rows,
int _Options>
class DenseStorage<T, 0, _Rows, Dynamic, _Options>
293 :
public DenseStorage<T, 0, 0, 0, _Options> { };
295 template<
typename T,
int _Cols,
int _Options>
class DenseStorage<T, 0, Dynamic, _Cols, _Options>
296 :
public DenseStorage<T, 0, 0, 0, _Options> { };
299 template<
typename T,
int Size,
int _Options>
class DenseStorage<T, Size, Dynamic, Dynamic, _Options>
301 internal::plain_array<T,Size,_Options> m_data;
305 EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0), m_cols(0) {}
306 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
307 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
308 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
309 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows), m_cols(other.m_cols)
311 internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data);
313 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
317 m_rows = other.m_rows;
318 m_cols = other.m_cols;
319 internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data);
323 EIGEN_DEVICE_FUNC DenseStorage(
Index,
Index rows,
Index cols) : m_rows(rows), m_cols(cols) {}
324 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
326 internal::plain_array_helper::swap(m_data, m_rows * m_cols, other.m_data, other.m_rows * other.m_cols);
327 numext::swap(m_rows,other.m_rows);
328 numext::swap(m_cols,other.m_cols);
330 EIGEN_DEVICE_FUNC
Index rows()
const {
return m_rows;}
331 EIGEN_DEVICE_FUNC
Index cols()
const {
return m_cols;}
332 EIGEN_DEVICE_FUNC
void conservativeResize(
Index,
Index rows,
Index cols) { m_rows = rows; m_cols = cols; }
333 EIGEN_DEVICE_FUNC
void resize(
Index,
Index rows,
Index cols) { m_rows = rows; m_cols = cols; }
334 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
335 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
339 template<
typename T,
int Size,
int _Cols,
int _Options>
class DenseStorage<T, Size, Dynamic, _Cols, _Options>
341 internal::plain_array<T,Size,_Options> m_data;
344 EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0) {}
345 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
346 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
347 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
348 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows)
350 internal::plain_array_helper::copy(other.m_data, m_rows * _Cols, m_data);
353 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
357 m_rows = other.m_rows;
358 internal::plain_array_helper::copy(other.m_data, m_rows * _Cols, m_data);
362 EIGEN_DEVICE_FUNC DenseStorage(
Index,
Index rows,
Index) : m_rows(rows) {}
363 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
365 internal::plain_array_helper::swap(m_data, m_rows * _Cols, other.m_data, other.m_rows * _Cols);
366 numext::swap(m_rows, other.m_rows);
368 EIGEN_DEVICE_FUNC
Index rows(
void)
const EIGEN_NOEXCEPT {
return m_rows;}
369 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index cols(
void)
const EIGEN_NOEXCEPT {
return _Cols;}
370 EIGEN_DEVICE_FUNC
void conservativeResize(
Index,
Index rows,
Index) { m_rows = rows; }
371 EIGEN_DEVICE_FUNC
void resize(
Index,
Index rows,
Index) { m_rows = rows; }
372 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
373 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
377 template<
typename T,
int Size,
int _Rows,
int _Options>
class DenseStorage<T, Size, _Rows, Dynamic, _Options>
379 internal::plain_array<T,Size,_Options> m_data;
382 EIGEN_DEVICE_FUNC DenseStorage() : m_cols(0) {}
383 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
384 : m_data(
internal::constructor_without_unaligned_array_assert()), m_cols(0) {}
385 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
386 : m_data(
internal::constructor_without_unaligned_array_assert()), m_cols(other.m_cols)
388 internal::plain_array_helper::copy(other.m_data, _Rows * m_cols, m_data);
390 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
394 m_cols = other.m_cols;
395 internal::plain_array_helper::copy(other.m_data, _Rows * m_cols, m_data);
399 EIGEN_DEVICE_FUNC DenseStorage(
Index,
Index,
Index cols) : m_cols(cols) {}
400 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
401 internal::plain_array_helper::swap(m_data, _Rows * m_cols, other.m_data, _Rows * other.m_cols);
402 numext::swap(m_cols, other.m_cols);
404 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index rows(
void)
const EIGEN_NOEXCEPT {
return _Rows;}
405 EIGEN_DEVICE_FUNC
Index cols(
void)
const EIGEN_NOEXCEPT {
return m_cols;}
406 EIGEN_DEVICE_FUNC
void conservativeResize(
Index,
Index,
Index cols) { m_cols = cols; }
407 EIGEN_DEVICE_FUNC
void resize(
Index,
Index,
Index cols) { m_cols = cols; }
408 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
409 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
413 template<
typename T,
int _Options>
class DenseStorage<T, Dynamic, Dynamic, Dynamic, _Options>
419 EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0), m_cols(0) {}
420 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
421 : m_data(0), m_rows(0), m_cols(0) {}
423 : m_data(
internal::conditional_aligned_new_auto<T,(_Options&
DontAlign)==0>(size)), m_rows(rows), m_cols(cols)
425 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
426 eigen_internal_assert(size==rows*cols && rows>=0 && cols >=0);
428 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
429 : m_data(
internal::conditional_aligned_new_auto<T,(_Options&
DontAlign)==0>(other.m_rows*other.m_cols))
430 , m_rows(other.m_rows)
431 , m_cols(other.m_cols)
433 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = m_rows*m_cols)
434 internal::smart_copy(other.m_data, other.m_data+other.m_rows*other.m_cols, m_data);
436 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
440 DenseStorage tmp(other);
445 #if EIGEN_HAS_RVALUE_REFERENCES 447 DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
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;
457 DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
459 numext::swap(m_data, other.m_data);
460 numext::swap(m_rows, other.m_rows);
461 numext::swap(m_cols, other.m_cols);
465 EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols); }
466 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
468 numext::swap(m_data,other.m_data);
469 numext::swap(m_rows,other.m_rows);
470 numext::swap(m_cols,other.m_cols);
472 EIGEN_DEVICE_FUNC
Index rows(
void)
const EIGEN_NOEXCEPT {
return m_rows;}
473 EIGEN_DEVICE_FUNC
Index cols(
void)
const EIGEN_NOEXCEPT {
return m_cols;}
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);
489 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
494 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data; }
495 EIGEN_DEVICE_FUNC T *data() {
return m_data; }
499 template<
typename T,
int _Rows,
int _Options>
class DenseStorage<T, Dynamic, _Rows, Dynamic, _Options>
504 EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_cols(0) {}
505 explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {}
506 EIGEN_DEVICE_FUNC DenseStorage(
Index size,
Index rows,
Index cols) : m_data(
internal::conditional_aligned_new_auto<T,(_Options&
DontAlign)==0>(size)), m_cols(cols)
508 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
509 eigen_internal_assert(size==rows*cols && rows==_Rows && cols >=0);
510 EIGEN_UNUSED_VARIABLE(rows);
512 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
513 : m_data(
internal::conditional_aligned_new_auto<T,(_Options&
DontAlign)==0>(_Rows*other.m_cols))
514 , m_cols(other.m_cols)
516 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = m_cols*_Rows)
517 internal::smart_copy(other.m_data, other.m_data+_Rows*m_cols, m_data);
519 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
523 DenseStorage tmp(other);
528 #if EIGEN_HAS_RVALUE_REFERENCES 530 DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
531 : m_data(std::move(other.m_data))
532 , m_cols(std::move(other.m_cols))
534 other.m_data =
nullptr;
538 DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
540 numext::swap(m_data, other.m_data);
541 numext::swap(m_cols, other.m_cols);
545 EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
546 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
547 numext::swap(m_data,other.m_data);
548 numext::swap(m_cols,other.m_cols);
550 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index rows(
void) EIGEN_NOEXCEPT {
return _Rows;}
551 EIGEN_DEVICE_FUNC
Index cols(
void)
const EIGEN_NOEXCEPT {
return m_cols;}
552 EIGEN_DEVICE_FUNC
void conservativeResize(
Index size,
Index,
Index cols)
554 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
557 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void resize(
Index size,
Index,
Index 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);
566 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
570 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data; }
571 EIGEN_DEVICE_FUNC T *data() {
return m_data; }
575 template<
typename T,
int _Cols,
int _Options>
class DenseStorage<T, Dynamic, Dynamic, _Cols, _Options>
580 EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0) {}
581 explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {}
582 EIGEN_DEVICE_FUNC DenseStorage(
Index size,
Index rows,
Index cols) : m_data(
internal::conditional_aligned_new_auto<T,(_Options&
DontAlign)==0>(size)), m_rows(rows)
584 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
585 eigen_internal_assert(size==rows*cols && rows>=0 && cols == _Cols);
586 EIGEN_UNUSED_VARIABLE(cols);
588 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
589 : m_data(
internal::conditional_aligned_new_auto<T,(_Options&
DontAlign)==0>(other.m_rows*_Cols))
590 , m_rows(other.m_rows)
592 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = m_rows*_Cols)
593 internal::smart_copy(other.m_data, other.m_data+other.m_rows*_Cols, m_data);
595 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
599 DenseStorage tmp(other);
604 #if EIGEN_HAS_RVALUE_REFERENCES 606 DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
607 : m_data(std::move(other.m_data))
608 , m_rows(std::move(other.m_rows))
610 other.m_data =
nullptr;
614 DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
616 numext::swap(m_data, other.m_data);
617 numext::swap(m_rows, other.m_rows);
621 EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
622 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
623 numext::swap(m_data,other.m_data);
624 numext::swap(m_rows,other.m_rows);
626 EIGEN_DEVICE_FUNC
Index rows(
void)
const EIGEN_NOEXCEPT {
return m_rows;}
627 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index cols(
void) {
return _Cols;}
630 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
633 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void resize(
Index size,
Index rows,
Index)
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);
642 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
646 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data; }
647 EIGEN_DEVICE_FUNC T *data() {
return m_data; }
652 #endif // EIGEN_MATRIX_H Definition: Constants.h:325
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