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 EIGEN_DENSE_STORAGE_CTOR_PLUGIN; 18 #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN 27 template<
typename T,
int Size>
32 #if EIGEN_STACK_ALLOCATION_LIMIT 41 template <
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 !!! ****"); 82 template <
typename T,
int Size,
int MatrixOrArrayOptions>
85 EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size];
91 check_static_allocation_size<T,Size>();
97 check_static_allocation_size<T,Size>();
101 template <
typename T,
int Size,
int MatrixOrArrayOptions>
104 EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size];
110 check_static_allocation_size<T,Size>();
116 check_static_allocation_size<T,Size>();
120 template <
typename T,
int Size,
int MatrixOrArrayOptions>
123 EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size];
129 check_static_allocation_size<T,Size>();
135 check_static_allocation_size<T,Size>();
139 template <
typename T,
int Size,
int MatrixOrArrayOptions>
142 EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size];
148 check_static_allocation_size<T,Size>();
154 check_static_allocation_size<T,Size>();
158 template <
typename T,
int MatrixOrArrayOptions,
int Alignment>
180 template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage;
183 template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage
190 : m_data(
internal::constructor_without_unaligned_array_assert()) {}
196 if (
this != &other) m_data = other.
m_data;
207 EIGEN_DEVICE_FUNC
static Index rows(
void) {
return _Rows;}
208 EIGEN_DEVICE_FUNC
static Index cols(
void) {
return _Cols;}
211 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
222 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage&) {
return *
this; }
224 EIGEN_DEVICE_FUNC
void swap(DenseStorage& ) {}
225 EIGEN_DEVICE_FUNC
static Index rows(
void) {
return _Rows;}
226 EIGEN_DEVICE_FUNC
static Index cols(
void) {
return _Cols;}
229 EIGEN_DEVICE_FUNC
const T *
data()
const {
return 0; }
230 EIGEN_DEVICE_FUNC T *
data() {
return 0; }
252 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
253 EIGEN_DEVICE_FUNC
DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {}
254 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
259 m_rows = other.m_rows;
260 m_cols = other.m_cols;
265 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
271 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
283 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
284 EIGEN_DEVICE_FUNC
DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {}
285 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
290 m_rows = other.m_rows;
296 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return m_rows;}
297 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return _Cols;}
300 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
312 : m_data(
internal::constructor_without_unaligned_array_assert()), m_cols(0) {}
313 EIGEN_DEVICE_FUNC
DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_cols(other.m_cols) {}
314 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
319 m_cols = other.m_cols;
325 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return _Rows;}
326 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return m_cols;}
329 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
342 : m_data(0), m_rows(0), m_cols(0) {}
351 , m_rows(other.m_rows)
352 , m_cols(other.m_cols)
356 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
360 DenseStorage tmp(other);
365 #if EIGEN_HAS_RVALUE_REFERENCES 368 : m_data(std::move(other.m_data))
369 , m_rows(std::move(other.m_rows))
370 , m_cols(std::move(other.m_cols))
372 other.m_data =
nullptr;
380 swap(m_data, other.m_data);
381 swap(m_rows, other.m_rows);
382 swap(m_cols, other.m_cols);
386 EIGEN_DEVICE_FUNC
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols); }
387 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
389 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return m_rows;}
390 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return m_cols;}
393 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*m_cols);
399 if(size != m_rows*m_cols)
401 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
403 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
411 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data; }
412 EIGEN_DEVICE_FUNC T *
data() {
return m_data; }
431 , m_cols(other.m_cols)
435 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
439 DenseStorage tmp(other);
444 #if EIGEN_HAS_RVALUE_REFERENCES 447 : m_data(std::move(other.m_data))
448 , m_cols(std::move(other.m_cols))
450 other.m_data =
nullptr;
457 swap(m_data, other.m_data);
458 swap(m_cols, other.m_cols);
462 EIGEN_DEVICE_FUNC
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
464 EIGEN_DEVICE_FUNC
static Index rows(
void) {
return _Rows;}
465 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return m_cols;}
468 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, _Rows*m_cols);
473 if(size != _Rows*m_cols)
475 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
477 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
484 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data; }
485 EIGEN_DEVICE_FUNC T *
data() {
return m_data; }
504 , m_rows(other.m_rows)
508 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
512 DenseStorage tmp(other);
517 #if EIGEN_HAS_RVALUE_REFERENCES 520 : m_data(std::move(other.m_data))
521 , m_rows(std::move(other.m_rows))
523 other.m_data =
nullptr;
530 swap(m_data, other.m_data);
531 swap(m_rows, other.m_rows);
535 EIGEN_DEVICE_FUNC
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
537 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return m_rows;}
538 EIGEN_DEVICE_FUNC
static Index cols(
void) {
return _Cols;}
541 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data, size, m_rows*_Cols);
546 if(size != m_rows*_Cols)
548 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
550 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(size);
557 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data; }
558 EIGEN_DEVICE_FUNC T *
data() {
return m_data; }
563 #endif // EIGEN_MATRIX_H EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC const T * data() const
#define EIGEN_ALWAYS_INLINE
EIGEN_DEVICE_FUNC plain_array()
EIGEN_DEVICE_FUNC const T * data() const
#define EIGEN_STRONG_INLINE
EIGEN_DEVICE_FUNC Index rows(void) const
EIGEN_DEVICE_FUNC Index rows(void) const
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC T * data()
internal::plain_array< T, Size, _Options > m_data
EIGEN_DEVICE_FUNC plain_array()
EIGEN_DEVICE_FUNC Index cols(void) const
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
void resize(Index, Index, Index cols)
EIGEN_DEVICE_FUNC Index cols(void) const
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC const T * data() const
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC void resize(Index, Index, Index)
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
void conservativeResize(Index, Index, Index cols)
EIGEN_DEVICE_FUNC Index cols() const
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC DenseStorage()
DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC DenseStorage()
#define EIGEN_STATIC_ASSERT(CONDITION, MSG)
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC Index cols(void) const
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC plain_array()
static EIGEN_DEVICE_FUNC Index rows(void)
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
static EIGEN_DEVICE_FUNC Index cols(void)
EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index cols)
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
EIGEN_DEVICE_FUNC const T * data() const
EIGEN_DEVICE_FUNC ~DenseStorage()
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
internal::plain_array< T, Size, _Options > m_data
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index, Index cols)
EIGEN_DEVICE_FUNC void smart_copy(const T *start, const T *end, T *target)
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC ~DenseStorage()
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC void resize(Index, Index, Index)
EIGEN_DEVICE_FUNC void resize(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
static EIGEN_DEVICE_FUNC Index cols(void)
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index)
EIGEN_DEVICE_FUNC const T * data() const
EIGEN_DEVICE_FUNC void swap(DenseStorage &)
EIGEN_DEVICE_FUNC const T * data() const
#define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index cols)
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC const T * data() const
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
#define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
EIGEN_DEVICE_FUNC const T * data() const
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
EIGEN_DEVICE_FUNC Index rows() const
void conservativeResize(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index)
static EIGEN_DEVICE_FUNC Index rows(void)
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC T * conditional_aligned_new_auto(size_t size)
static EIGEN_DEVICE_FUNC Index rows(void)
EIGEN_DEVICE_FUNC plain_array()
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index)
EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index)
EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index)
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
internal::plain_array< T, Size, _Options > m_data
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index rows, Index)
EIGEN_DEVICE_FUNC ~DenseStorage()
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
#define EIGEN_STACK_ALLOCATION_LIMIT
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC Index cols(void) const
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols)
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &)
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols)
#define eigen_internal_assert(x)
static EIGEN_DEVICE_FUNC Index cols(void)
EIGEN_DEVICE_FUNC Index rows(void) const
EIGEN_DEVICE_FUNC Index rows(void) const
internal::plain_array< T, Size, _Options > m_data
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &)
EIGEN_DEVICE_FUNC void check_static_allocation_size()
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage &other)
void conservativeResize(Index size, Index rows, Index)
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
#define EIGEN_UNUSED_VARIABLE(var)
EIGEN_DEVICE_FUNC plain_array()
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index)
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
void swap(scoped_array< T > &a, scoped_array< T > &b)
EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index cols)
EIGEN_DEVICE_FUNC plain_array()