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)
21 #include "./InternalHeaderCheck.h"
27 struct constructor_without_unaligned_array_assert {};
29 template<
typename T,
int Size>
31 void check_static_allocation_size()
34 #if EIGEN_STACK_ALLOCATION_LIMIT
35 EIGEN_STATIC_ASSERT(Size *
sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
43 template <
typename T,
int Size,
int MatrixOrArrayOptions,
44 int Alignment = (MatrixOrArrayOptions&
DontAlign) ? 0
45 : compute_default_alignment<T,Size>::value >
53 check_static_allocation_size<T,Size>();
57 plain_array(constructor_without_unaligned_array_assert)
59 check_static_allocation_size<T,Size>();
63 #if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT)
64 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
69 template<
typename PtrType>
70 EIGEN_ALWAYS_INLINE PtrType eigen_unaligned_array_assert_workaround_gcc47(PtrType array) {
return array; }
71 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \
72 eigen_assert((internal::is_constant_evaluated() \
73 || (internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (sizemask)) == 0) \
74 && "this assertion is explained here: " \
75 "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \
76 " **** READ THIS WEB PAGE !!! ****");
78 #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \
79 eigen_assert((internal::is_constant_evaluated() || (internal::UIntPtr(array) & (sizemask)) == 0) \
80 && "this assertion is explained here: " \
81 "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \
82 " **** READ THIS WEB PAGE !!! ****");
85 template <
typename T,
int Size,
int MatrixOrArrayOptions>
86 struct plain_array<T, Size, MatrixOrArrayOptions, 8>
88 EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size];
93 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7);
94 check_static_allocation_size<T,Size>();
98 plain_array(constructor_without_unaligned_array_assert)
100 check_static_allocation_size<T,Size>();
104 template <
typename T,
int Size,
int MatrixOrArrayOptions>
105 struct plain_array<T, Size, MatrixOrArrayOptions, 16>
107 EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size];
112 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15);
113 check_static_allocation_size<T,Size>();
117 plain_array(constructor_without_unaligned_array_assert)
119 check_static_allocation_size<T,Size>();
123 template <
typename T,
int Size,
int MatrixOrArrayOptions>
124 struct plain_array<T, Size, MatrixOrArrayOptions, 32>
126 EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size];
131 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31);
132 check_static_allocation_size<T,Size>();
136 plain_array(constructor_without_unaligned_array_assert)
138 check_static_allocation_size<T,Size>();
142 template <
typename T,
int Size,
int MatrixOrArrayOptions>
143 struct plain_array<T, Size, MatrixOrArrayOptions, 64>
145 EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size];
150 EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63);
151 check_static_allocation_size<T,Size>();
155 plain_array(constructor_without_unaligned_array_assert)
157 check_static_allocation_size<T,Size>();
161 template <
typename T,
int MatrixOrArrayOptions,
int Alignment>
162 struct plain_array<T, 0, MatrixOrArrayOptions, Alignment>
165 EIGEN_DEVICE_FUNC plain_array() {}
166 EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert) {}
169 struct plain_array_helper {
170 template<
typename T,
int Size,
int MatrixOrArrayOptions,
int Alignment>
171 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
172 static void copy(
const plain_array<T, Size, MatrixOrArrayOptions, Alignment>& src,
const Eigen::Index size,
173 plain_array<T, Size, MatrixOrArrayOptions, Alignment>& dst) {
174 smart_copy(src.array, src.array + size, dst.array);
177 template<
typename T,
int Size,
int MatrixOrArrayOptions,
int Alignment>
178 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
179 static void swap(plain_array<T, Size, MatrixOrArrayOptions, Alignment>& a,
const Eigen::Index a_size,
180 plain_array<T, Size, MatrixOrArrayOptions, Alignment>& b,
const Eigen::Index b_size) {
181 if (a_size < b_size) {
182 std::swap_ranges(b.array, b.array + a_size, a.array);
183 smart_move(b.array + a_size, b.array + b_size, a.array + a_size);
184 }
else if (a_size > b_size) {
185 std::swap_ranges(a.array, a.array + b_size, b.array);
186 smart_move(a.array + b_size, a.array + a_size, b.array + b_size);
188 std::swap_ranges(a.array, a.array + a_size, b.array);
207 template<
typename T,
int Size,
int Rows_,
int Cols_,
int Options_>
class DenseStorage;
210 template<
typename T,
int Size,
int Rows_,
int Cols_,
int Options_>
class DenseStorage
212 internal::plain_array<T,Size,Options_> m_data;
214 EIGEN_DEVICE_FUNC DenseStorage() {
215 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = Size)
218 explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
219 : m_data(internal::constructor_without_unaligned_array_assert()) {}
220 #if defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN)
222 DenseStorage(
const DenseStorage& other) : m_data(other.m_data) {
223 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = Size)
226 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage&) =
default;
228 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage&) =
default;
229 EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&&) =
default;
230 EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&&) =
default;
232 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
233 eigen_internal_assert(size==rows*cols && rows==Rows_ && cols==Cols_);
234 EIGEN_UNUSED_VARIABLE(size);
235 EIGEN_UNUSED_VARIABLE(rows);
236 EIGEN_UNUSED_VARIABLE(cols);
238 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
239 numext::swap(m_data, other.m_data);
241 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index rows(
void) EIGEN_NOEXCEPT {
return Rows_;}
242 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index cols(
void) EIGEN_NOEXCEPT {
return Cols_;}
245 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
246 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
250 template<
typename T,
int Rows_,
int Cols_,
int Options_>
class DenseStorage<T, 0, Rows_, Cols_, Options_>
253 EIGEN_DEVICE_FUNC DenseStorage() {}
254 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert) {}
255 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage&) {}
256 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage&) {
return *
this; }
258 EIGEN_DEVICE_FUNC
void swap(DenseStorage& ) {}
259 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index rows(
void) EIGEN_NOEXCEPT {
return Rows_;}
260 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index cols(
void) EIGEN_NOEXCEPT {
return Cols_;}
263 EIGEN_DEVICE_FUNC
const T *data()
const {
return 0; }
264 EIGEN_DEVICE_FUNC T *data() {
return 0; }
268 template<
typename T,
int Options_>
class DenseStorage<T, 0, Dynamic, Dynamic, Options_>
269 :
public DenseStorage<T, 0, 0, 0, Options_> { };
271 template<
typename T,
int Rows_,
int Options_>
class DenseStorage<T, 0, Rows_, Dynamic, Options_>
272 :
public DenseStorage<T, 0, 0, 0, Options_> { };
274 template<
typename T,
int Cols_,
int Options_>
class DenseStorage<T, 0, Dynamic, Cols_, Options_>
275 :
public DenseStorage<T, 0, 0, 0, Options_> { };
278 template<
typename T,
int Size,
int Options_>
class DenseStorage<T, Size, Dynamic, Dynamic, Options_>
280 internal::plain_array<T,Size,Options_> m_data;
284 EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0), m_cols(0) {}
285 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
286 : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
287 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
288 : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows), m_cols(other.m_cols)
290 internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data);
292 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
296 m_rows = other.m_rows;
297 m_cols = other.m_cols;
298 internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data);
302 EIGEN_DEVICE_FUNC DenseStorage(
Index,
Index rows,
Index cols) : m_rows(rows), m_cols(cols) {}
303 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
305 internal::plain_array_helper::swap(m_data, m_rows * m_cols, other.m_data, other.m_rows * other.m_cols);
306 numext::swap(m_rows,other.m_rows);
307 numext::swap(m_cols,other.m_cols);
309 EIGEN_DEVICE_FUNC
Index rows()
const {
return m_rows;}
310 EIGEN_DEVICE_FUNC
Index cols()
const {
return m_cols;}
311 EIGEN_DEVICE_FUNC
void conservativeResize(
Index,
Index rows,
Index cols) { m_rows = rows; m_cols = cols; }
312 EIGEN_DEVICE_FUNC
void resize(
Index,
Index rows,
Index cols) { m_rows = rows; m_cols = cols; }
313 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
314 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
318 template<
typename T,
int Size,
int Cols_,
int Options_>
class DenseStorage<T, Size, Dynamic, Cols_, Options_>
320 internal::plain_array<T,Size,Options_> m_data;
323 EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0) {}
324 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
325 : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
326 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
327 : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows)
329 internal::plain_array_helper::copy(other.m_data, m_rows * Cols_, m_data);
332 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
336 m_rows = other.m_rows;
337 internal::plain_array_helper::copy(other.m_data, m_rows * Cols_, m_data);
341 EIGEN_DEVICE_FUNC DenseStorage(
Index,
Index rows,
Index) : m_rows(rows) {}
342 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
344 internal::plain_array_helper::swap(m_data, m_rows * Cols_, other.m_data, other.m_rows * Cols_);
345 numext::swap(m_rows, other.m_rows);
347 EIGEN_DEVICE_FUNC
Index rows(
void)
const EIGEN_NOEXCEPT {
return m_rows;}
348 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index cols(
void)
const EIGEN_NOEXCEPT {
return Cols_;}
349 EIGEN_DEVICE_FUNC
void conservativeResize(
Index,
Index rows,
Index) { m_rows = rows; }
350 EIGEN_DEVICE_FUNC
void resize(
Index,
Index rows,
Index) { m_rows = rows; }
351 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
352 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
356 template<
typename T,
int Size,
int Rows_,
int Options_>
class DenseStorage<T, Size, Rows_, Dynamic, Options_>
358 internal::plain_array<T,Size,Options_> m_data;
361 EIGEN_DEVICE_FUNC DenseStorage() : m_cols(0) {}
362 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
363 : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {}
364 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
365 : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(other.m_cols)
367 internal::plain_array_helper::copy(other.m_data, Rows_ * m_cols, m_data);
369 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
373 m_cols = other.m_cols;
374 internal::plain_array_helper::copy(other.m_data, Rows_ * m_cols, m_data);
378 EIGEN_DEVICE_FUNC DenseStorage(
Index,
Index,
Index cols) : m_cols(cols) {}
379 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
380 internal::plain_array_helper::swap(m_data, Rows_ * m_cols, other.m_data, Rows_ * other.m_cols);
381 numext::swap(m_cols, other.m_cols);
383 EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR
Index rows(
void)
const EIGEN_NOEXCEPT {
return Rows_;}
384 EIGEN_DEVICE_FUNC
Index cols(
void)
const EIGEN_NOEXCEPT {
return m_cols;}
385 EIGEN_DEVICE_FUNC
void conservativeResize(
Index,
Index,
Index cols) { m_cols = cols; }
386 EIGEN_DEVICE_FUNC
void resize(
Index,
Index,
Index cols) { m_cols = cols; }
387 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data.array; }
388 EIGEN_DEVICE_FUNC T *data() {
return m_data.array; }
392 template<
typename T,
int Options_>
class DenseStorage<T, Dynamic, Dynamic, Dynamic, Options_>
398 EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0), m_cols(0) {}
399 EIGEN_DEVICE_FUNC
explicit DenseStorage(internal::constructor_without_unaligned_array_assert)
400 : m_data(0), m_rows(0), m_cols(0) {}
402 : m_data(internal::conditional_aligned_new_auto<T,(Options_&
DontAlign)==0>(size)), m_rows(rows), m_cols(cols)
404 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
405 eigen_internal_assert(size==rows*cols && rows>=0 && cols >=0);
407 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
408 : m_data(internal::conditional_aligned_new_auto<T,(Options_&
DontAlign)==0>(other.m_rows*other.m_cols))
409 , m_rows(other.m_rows)
410 , m_cols(other.m_cols)
412 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = m_rows*m_cols)
413 internal::smart_copy(other.m_data, other.m_data+other.m_rows*other.m_cols, m_data);
415 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
419 DenseStorage tmp(other);
425 DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
426 : m_data(std::move(other.m_data))
427 , m_rows(std::move(other.m_rows))
428 , m_cols(std::move(other.m_cols))
430 other.m_data =
nullptr;
435 DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
437 numext::swap(m_data, other.m_data);
438 numext::swap(m_rows, other.m_rows);
439 numext::swap(m_cols, other.m_cols);
442 EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(Options_&DontAlign)==0>(m_data, m_rows*m_cols); }
443 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
445 numext::swap(m_data,other.m_data);
446 numext::swap(m_rows,other.m_rows);
447 numext::swap(m_cols,other.m_cols);
449 EIGEN_DEVICE_FUNC
Index rows(
void)
const EIGEN_NOEXCEPT {
return m_rows;}
450 EIGEN_DEVICE_FUNC
Index cols(
void)
const EIGEN_NOEXCEPT {
return m_cols;}
453 m_data = internal::conditional_aligned_realloc_new_auto<T,(Options_&DontAlign)==0>(m_data, size, m_rows*m_cols);
459 if(size != m_rows*m_cols)
461 internal::conditional_aligned_delete_auto<T,(Options_&DontAlign)==0>(m_data, m_rows*m_cols);
463 m_data = internal::conditional_aligned_new_auto<T,(Options_&DontAlign)==0>(size);
466 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
471 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data; }
472 EIGEN_DEVICE_FUNC T *data() {
return m_data; }
476 template<
typename T,
int Rows_,
int Options_>
class DenseStorage<T, Dynamic, Rows_, Dynamic, Options_>
481 EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_cols(0) {}
482 explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {}
483 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)
485 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
486 eigen_internal_assert(size==rows*cols && rows==Rows_ && cols >=0);
487 EIGEN_UNUSED_VARIABLE(rows);
489 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
490 : m_data(internal::conditional_aligned_new_auto<T,(Options_&
DontAlign)==0>(Rows_*other.m_cols))
491 , m_cols(other.m_cols)
493 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = m_cols*Rows_)
494 internal::smart_copy(other.m_data, other.m_data+Rows_*m_cols, m_data);
496 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
500 DenseStorage tmp(other);
506 DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
507 : m_data(std::move(other.m_data))
508 , m_cols(std::move(other.m_cols))
510 other.m_data =
nullptr;
514 DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
516 numext::swap(m_data, other.m_data);
517 numext::swap(m_cols, other.m_cols);
520 EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(Options_&DontAlign)==0>(m_data, Rows_*m_cols); }
521 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
522 numext::swap(m_data,other.m_data);
523 numext::swap(m_cols,other.m_cols);
525 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index rows(
void) EIGEN_NOEXCEPT {
return Rows_;}
526 EIGEN_DEVICE_FUNC
Index cols(
void)
const EIGEN_NOEXCEPT {
return m_cols;}
527 EIGEN_DEVICE_FUNC
void conservativeResize(
Index size,
Index,
Index cols)
529 m_data = internal::conditional_aligned_realloc_new_auto<T,(Options_&DontAlign)==0>(m_data, size, Rows_*m_cols);
532 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void resize(
Index size,
Index,
Index cols)
534 if(size != Rows_*m_cols)
536 internal::conditional_aligned_delete_auto<T,(Options_&DontAlign)==0>(m_data, Rows_*m_cols);
538 m_data = internal::conditional_aligned_new_auto<T,(Options_&DontAlign)==0>(size);
541 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
545 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data; }
546 EIGEN_DEVICE_FUNC T *data() {
return m_data; }
550 template<
typename T,
int Cols_,
int Options_>
class DenseStorage<T, Dynamic, Dynamic, Cols_, Options_>
555 EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0) {}
556 explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {}
557 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)
559 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
560 eigen_internal_assert(size==rows*cols && rows>=0 && cols == Cols_);
561 EIGEN_UNUSED_VARIABLE(cols);
563 EIGEN_DEVICE_FUNC DenseStorage(
const DenseStorage& other)
564 : m_data(internal::conditional_aligned_new_auto<T,(Options_&
DontAlign)==0>(other.m_rows*Cols_))
565 , m_rows(other.m_rows)
567 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = m_rows*Cols_)
568 internal::smart_copy(other.m_data, other.m_data+other.m_rows*Cols_, m_data);
570 EIGEN_DEVICE_FUNC DenseStorage& operator=(
const DenseStorage& other)
574 DenseStorage tmp(other);
580 DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT
581 : m_data(std::move(other.m_data))
582 , m_rows(std::move(other.m_rows))
584 other.m_data =
nullptr;
588 DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT
590 numext::swap(m_data, other.m_data);
591 numext::swap(m_rows, other.m_rows);
594 EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto<T,(Options_&DontAlign)==0>(m_data, Cols_*m_rows); }
595 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other) {
596 numext::swap(m_data,other.m_data);
597 numext::swap(m_rows,other.m_rows);
599 EIGEN_DEVICE_FUNC
Index rows(
void)
const EIGEN_NOEXCEPT {
return m_rows;}
600 EIGEN_DEVICE_FUNC
static EIGEN_CONSTEXPR
Index cols(
void) {
return Cols_;}
603 m_data = internal::conditional_aligned_realloc_new_auto<T,(Options_&DontAlign)==0>(m_data, size, m_rows*Cols_);
606 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void resize(
Index size,
Index rows,
Index)
608 if(size != m_rows*Cols_)
610 internal::conditional_aligned_delete_auto<T,(Options_&DontAlign)==0>(m_data, Cols_*m_rows);
612 m_data = internal::conditional_aligned_new_auto<T,(Options_&DontAlign)==0>(size);
615 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
619 EIGEN_DEVICE_FUNC
const T *data()
const {
return m_data; }
620 EIGEN_DEVICE_FUNC T *data() {
return m_data; }
@ DontAlign
Definition: Constants.h:327
Namespace containing all symbols from the Eigen library.
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:59