33 EIGEN_STATIC_ASSERT(Size *
sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG);
207template<
typename T,
int Size,
int _Rows,
int _Cols,
int _Options>
class DenseStorage
212 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = Size)
217#if !EIGEN_HAS_CXX11 || defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN)
220 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(
Index size = Size)
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);
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);
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; }
305 EIGEN_DEVICE_FUNC
DenseStorage() : m_rows(0), m_cols(0) {}
311 internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data);
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);
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; }
350 internal::plain_array_helper::copy(other.m_data, m_rows *
_Cols, m_data);
357 m_rows = other.m_rows;
358 internal::plain_array_helper::copy(other.m_data, m_rows *
_Cols, m_data);
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; }
388 internal::plain_array_helper::copy(other.m_data,
_Rows * m_cols, m_data);
394 m_cols = other.m_cols;
395 internal::plain_array_helper::copy(other.m_data,
_Rows * m_cols, m_data);
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; }
419 EIGEN_DEVICE_FUNC
DenseStorage() : m_data(0), m_rows(0), m_cols(0) {}
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);
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);
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;
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); }
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; }
504 EIGEN_DEVICE_FUNC
DenseStorage() : m_data(0), m_cols(0) {}
508 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
509 eigen_internal_assert(size==rows*cols && rows==
_Rows && cols >=0);
510 EIGEN_UNUSED_VARIABLE(rows);
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);
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;
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); }
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; }
580 EIGEN_DEVICE_FUNC
DenseStorage() : m_data(0), m_rows(0) {}
584 EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({})
585 eigen_internal_assert(size==rows*cols && rows>=0 && cols ==
_Cols);
586 EIGEN_UNUSED_VARIABLE(cols);
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);
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;
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); }
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; }
@ DontAlign
Don't require alignment for the matrix itself (the array of coefficients, if dynamically allocated,...
Definition Constants.h:325