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) 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>
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
192 : m_data(
internal::constructor_without_unaligned_array_assert()) {}
200 if (
this != &other) m_data = other.
m_data;
211 EIGEN_DEVICE_FUNC
static Index rows(
void) {
return _Rows;}
212 EIGEN_DEVICE_FUNC
static Index cols(
void) {
return _Cols;}
215 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
226 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage&) {
return *
this; }
228 EIGEN_DEVICE_FUNC
void swap(DenseStorage& ) {}
229 EIGEN_DEVICE_FUNC
static Index rows(
void) {
return _Rows;}
230 EIGEN_DEVICE_FUNC
static Index cols(
void) {
return _Cols;}
233 EIGEN_DEVICE_FUNC
const T *
data()
const {
return 0; }
234 EIGEN_DEVICE_FUNC
T *
data() {
return 0; }
256 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {}
257 EIGEN_DEVICE_FUNC
DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {}
258 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
263 m_rows = other.m_rows;
264 m_cols = other.m_cols;
269 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
275 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
287 : m_data(
internal::constructor_without_unaligned_array_assert()), m_rows(0) {}
288 EIGEN_DEVICE_FUNC
DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {}
289 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
294 m_rows = other.m_rows;
300 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return m_rows;}
301 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return _Cols;}
304 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
316 : m_data(
internal::constructor_without_unaligned_array_assert()), m_cols(0) {}
317 EIGEN_DEVICE_FUNC
DenseStorage(
const DenseStorage& other) : m_data(other.m_data), m_cols(other.m_cols) {}
318 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
323 m_cols = other.m_cols;
329 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return _Rows;}
330 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return m_cols;}
333 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data.
array; }
346 : m_data(0), m_rows(0), m_cols(0) {}
355 , m_rows(other.m_rows)
356 , m_cols(other.m_cols)
361 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
365 DenseStorage tmp(other);
370 #if EIGEN_HAS_RVALUE_REFERENCES 373 : m_data(std::move(other.m_data))
374 , m_rows(std::move(other.m_rows))
375 , m_cols(std::move(other.m_cols))
377 other.m_data =
nullptr;
385 swap(m_data, other.m_data);
386 swap(m_rows, other.m_rows);
387 swap(m_cols, other.m_cols);
391 EIGEN_DEVICE_FUNC
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols); }
392 EIGEN_DEVICE_FUNC
void swap(DenseStorage& other)
394 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return m_rows;}
395 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return m_cols;}
398 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, m_rows*m_cols);
404 if(size != m_rows*m_cols)
406 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, m_rows*m_cols);
408 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
416 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data; }
417 EIGEN_DEVICE_FUNC
T *
data() {
return m_data; }
436 , m_cols(other.m_cols)
441 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
445 DenseStorage tmp(other);
450 #if EIGEN_HAS_RVALUE_REFERENCES 453 : m_data(std::move(other.m_data))
454 , m_cols(std::move(other.m_cols))
456 other.m_data =
nullptr;
463 swap(m_data, other.m_data);
464 swap(m_cols, other.m_cols);
468 EIGEN_DEVICE_FUNC
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols); }
470 EIGEN_DEVICE_FUNC
static Index rows(
void) {
return _Rows;}
471 EIGEN_DEVICE_FUNC
Index cols(
void)
const {
return m_cols;}
474 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, _Rows*m_cols);
479 if(size != _Rows*m_cols)
481 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Rows*m_cols);
483 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
490 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data; }
491 EIGEN_DEVICE_FUNC
T *
data() {
return m_data; }
510 , m_rows(other.m_rows)
515 EIGEN_DEVICE_FUNC DenseStorage&
operator=(
const DenseStorage& other)
519 DenseStorage tmp(other);
524 #if EIGEN_HAS_RVALUE_REFERENCES 527 : m_data(std::move(other.m_data))
528 , m_rows(std::move(other.m_rows))
530 other.m_data =
nullptr;
537 swap(m_data, other.m_data);
538 swap(m_rows, other.m_rows);
542 EIGEN_DEVICE_FUNC
~DenseStorage() { internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows); }
544 EIGEN_DEVICE_FUNC
Index rows(
void)
const {
return m_rows;}
545 EIGEN_DEVICE_FUNC
static Index cols(
void) {
return _Cols;}
548 m_data = internal::conditional_aligned_realloc_new_auto<T,(_Options&DontAlign)==0>(m_data,
size, m_rows*_Cols);
553 if(size != m_rows*_Cols)
555 internal::conditional_aligned_delete_auto<T,(_Options&DontAlign)==0>(m_data, _Cols*m_rows);
557 m_data = internal::conditional_aligned_new_auto<T,(_Options&DontAlign)==0>(
size);
564 EIGEN_DEVICE_FUNC
const T *
data()
const {
return m_data; }
565 EIGEN_DEVICE_FUNC
T *
data() {
return m_data; }
570 #endif // EIGEN_MATRIX_H EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC T * conditional_aligned_new_auto(std::size_t size)
#define EIGEN_ALWAYS_INLINE
EIGEN_DEVICE_FUNC Index rows(void) const
EIGEN_DEVICE_FUNC plain_array()
EIGEN_DEVICE_FUNC const T * data() const
#define EIGEN_STRONG_INLINE
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 DenseStorage(internal::constructor_without_unaligned_array_assert)
void resize(Index, Index, Index cols)
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC void resize(Index, Index, Index)
EIGEN_DEVICE_FUNC const T * data() const
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
void conservativeResize(Index, Index, Index cols)
Namespace containing all symbols from the Eigen library.
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC Index cols(void) const
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 DenseStorage()
EIGEN_DEVICE_FUNC plain_array()
static EIGEN_DEVICE_FUNC Index rows(void)
EIGEN_DEVICE_FUNC Index cols(void) const
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC const T * data() const
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 ~DenseStorage()
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
internal::plain_array< T, Size, _Options > m_data
EIGEN_DEVICE_FUNC const T * data() const
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 Index cols() const
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC void resize(Index, Index, Index)
EIGEN_DEVICE_FUNC void resize(Index size, Index rows, Index cols)
#define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X)
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 void swap(DenseStorage &)
EIGEN_DEVICE_FUNC Index rows(void) const
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::Triplet< double > T
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
EIGEN_DEVICE_FUNC const T * data() const
EIGEN_DEVICE_FUNC DenseStorage()
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
EIGEN_DEVICE_FUNC void swap(DenseStorage &other)
EIGEN_DEVICE_FUNC const T * data() const
#define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask)
EIGEN_DEVICE_FUNC T * data()
EIGEN_DEVICE_FUNC Index rows() const
EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC DenseStorage & operator=(const DenseStorage &other)
void conservativeResize(Index size, Index rows, Index cols)
EIGEN_DEVICE_FUNC DenseStorage(internal::constructor_without_unaligned_array_assert)
A small structure to hold a non zero as a triplet (i,j,value).
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 Index rows(void) const
EIGEN_DEVICE_FUNC T * data()
static EIGEN_DEVICE_FUNC Index rows(void)
EIGEN_DEVICE_FUNC Index cols(void) const
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 Index cols(void) const
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 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)
EIGEN_DEVICE_FUNC const T * data() const
static EIGEN_DEVICE_FUNC Index cols(void)
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 Index rows(void) const
void swap(mpfr::mpreal &x, mpfr::mpreal &y)
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()
EIGEN_DEVICE_FUNC const T * data() const