110class PlainObjectBase :
public internal::dense_xpr_base<Derived>::type {
112 enum { Options = internal::traits<Derived>::Options };
113 using Base =
typename internal::dense_xpr_base<Derived>::type;
115 using StorageKind =
typename internal::traits<Derived>::StorageKind;
116 using Scalar =
typename internal::traits<Derived>::Scalar;
118 using PacketScalar =
typename internal::packet_traits<Scalar>::type;
119 using RealScalar =
typename NumTraits<Scalar>::Real;
120 using DenseType = Derived;
122 using Base::ColsAtCompileTime;
124 using Base::IsVectorAtCompileTime;
125 using Base::MaxColsAtCompileTime;
126 using Base::MaxRowsAtCompileTime;
127 using Base::MaxSizeAtCompileTime;
128 using Base::RowsAtCompileTime;
129 using Base::SizeAtCompileTime;
135 template <
typename Str
ideType>
136 struct StridedMapType {
139 template <
typename Str
ideType>
140 struct StridedConstMapType {
143 template <
typename Str
ideType>
144 struct StridedAlignedMapType {
147 template <
typename Str
ideType>
148 struct StridedConstAlignedMapType {
153 DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
156 enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits<Derived>::Alignment > 0) };
157 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
159 EIGEN_STATIC_ASSERT(internal::check_implication(MaxRowsAtCompileTime == 1 && MaxColsAtCompileTime != 1,
161 INVALID_MATRIX_TEMPLATE_PARAMETERS)
162 EIGEN_STATIC_ASSERT(internal::check_implication(MaxColsAtCompileTime == 1 && MaxRowsAtCompileTime != 1,
164 INVALID_MATRIX_TEMPLATE_PARAMETERS)
165 EIGEN_STATIC_ASSERT((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS)
166 EIGEN_STATIC_ASSERT((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0), INVALID_MATRIX_TEMPLATE_PARAMETERS)
167 EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0),
168 INVALID_MATRIX_TEMPLATE_PARAMETERS)
169 EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0),
170 INVALID_MATRIX_TEMPLATE_PARAMETERS)
171 EIGEN_STATIC_ASSERT((MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime == Dynamic),
172 INVALID_MATRIX_TEMPLATE_PARAMETERS)
173 EIGEN_STATIC_ASSERT((MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime == Dynamic),
174 INVALID_MATRIX_TEMPLATE_PARAMETERS)
175 EIGEN_STATIC_ASSERT(((Options & (
DontAlign |
RowMajor)) == Options), INVALID_MATRIX_TEMPLATE_PARAMETERS)
177 EIGEN_DEVICE_FUNC
constexpr Base& base() {
return *
static_cast<Base*
>(
this); }
178 EIGEN_DEVICE_FUNC
constexpr const Base& base()
const {
return *
static_cast<const Base*
>(
this); }
180 EIGEN_DEVICE_FUNC
constexpr Index rows()
const noexcept {
return m_storage.rows(); }
181 EIGEN_DEVICE_FUNC
constexpr Index cols()
const noexcept {
return m_storage.cols(); }
187 EIGEN_DEVICE_FUNC
constexpr const Scalar&
coeff(Index rowId, Index colId)
const {
189 return m_storage.data()[colId + rowId * m_storage.cols()];
191 return m_storage.data()[rowId + colId * m_storage.rows()];
199 EIGEN_DEVICE_FUNC
constexpr const Scalar&
coeff(Index index)
const {
return m_storage.data()[index]; }
205 EIGEN_DEVICE_FUNC
constexpr Scalar&
coeffRef(Index rowId, Index colId) {
207 return m_storage.data()[colId + rowId * m_storage.cols()];
209 return m_storage.data()[rowId + colId * m_storage.rows()];
217 EIGEN_DEVICE_FUNC
constexpr Scalar&
coeffRef(Index index) {
return m_storage.data()[index]; }
221 EIGEN_DEVICE_FUNC
constexpr const Scalar&
coeffRef(Index rowId, Index colId)
const {
223 return m_storage.data()[colId + rowId * m_storage.cols()];
225 return m_storage.data()[rowId + colId * m_storage.rows()];
231 EIGEN_DEVICE_FUNC
constexpr const Scalar&
coeffRef(Index index)
const {
return m_storage.data()[index]; }
234 template <
int LoadMode>
235 EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId)
const {
236 return internal::ploadt<PacketScalar, LoadMode>(
237 m_storage.data() + (Flags &
RowMajorBit ? colId + rowId * m_storage.cols() : rowId + colId * m_storage.rows()));
241 template <
int LoadMode>
242 EIGEN_STRONG_INLINE PacketScalar packet(Index index)
const {
243 return internal::ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
247 template <
int StoreMode>
248 EIGEN_STRONG_INLINE
void writePacket(Index rowId, Index colId,
const PacketScalar& val) {
249 internal::pstoret<Scalar, PacketScalar, StoreMode>(
250 m_storage.data() + (Flags &
RowMajorBit ? colId + rowId * m_storage.cols() : rowId + colId * m_storage.rows()),
255 template <
int StoreMode>
256 EIGEN_STRONG_INLINE
void writePacket(Index index,
const PacketScalar& val) {
257 internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, val);
261 EIGEN_DEVICE_FUNC
constexpr const Scalar*
data()
const {
return m_storage.data(); }
264 EIGEN_DEVICE_FUNC
constexpr Scalar*
data() {
return m_storage.data(); }
282 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
constexpr void resize(Index rows, Index cols) {
283 eigen_assert(internal::check_implication(RowsAtCompileTime != Dynamic, rows == RowsAtCompileTime) &&
284 internal::check_implication(ColsAtCompileTime != Dynamic, cols == ColsAtCompileTime) &&
285 internal::check_implication(RowsAtCompileTime == Dynamic && MaxRowsAtCompileTime != Dynamic,
286 rows <= MaxRowsAtCompileTime) &&
287 internal::check_implication(ColsAtCompileTime == Dynamic && MaxColsAtCompileTime != Dynamic,
288 cols <= MaxColsAtCompileTime) &&
289 rows >= 0 && cols >= 0 &&
"Invalid sizes when resizing a matrix or array.");
290#ifndef EIGEN_NO_DEBUG
291 internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(rows,
294#ifdef EIGEN_INITIALIZE_COEFFS
295 Index size = rows * cols;
296 bool size_changed = size != this->size();
297 m_storage.resize(size, rows, cols);
298 if (size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
300 m_storage.resize(rows * cols, rows, cols);
315 EIGEN_DEVICE_FUNC
constexpr void resize(Index size) {
316 EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase)
317 eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime == Dynamic || size <= MaxSizeAtCompileTime)) ||
318 SizeAtCompileTime == size) &&
320#ifdef EIGEN_INITIALIZE_COEFFS
321 bool size_changed = size != this->size();
323 EIGEN_IF_CONSTEXPR (RowsAtCompileTime == 1) {
324 m_storage.resize(size, 1, size);
326 m_storage.resize(size, size, 1);
328#ifdef EIGEN_INITIALIZE_COEFFS
329 if (size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
341 EIGEN_DEVICE_FUNC
constexpr void resize(NoChange_t, Index cols) {
resize(rows(), cols); }
351 EIGEN_DEVICE_FUNC
constexpr void resize(Index rows, NoChange_t) {
resize(rows, cols()); }
363 template <
typename OtherDerived>
365 const OtherDerived& other = _other.
derived();
366 EIGEN_INTERNAL_ASSERT_VECTOR_IF(IsVectorAtCompileTime, other);
367#ifndef EIGEN_NO_DEBUG
368 internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(
369 other.rows(), other.cols());
371 const Index othersize = other.rows() * other.cols();
372 EIGEN_IF_CONSTEXPR (RowsAtCompileTime == 1) {
374 }
else EIGEN_IF_CONSTEXPR (ColsAtCompileTime == 1) {
377 resize(other.rows(), other.cols());
391 eigen_assert(internal::check_implication(MaxRowsAtCompileTime != Dynamic, rows <= MaxRowsAtCompileTime) &&
392 internal::check_implication(MaxColsAtCompileTime != Dynamic, cols <= MaxColsAtCompileTime) &&
393 "Invalid sizes when resizing a matrix or array.");
394 internal::conservative_resize_like_impl<Derived>::run(*
this, rows, cols);
430 eigen_assert((MaxSizeAtCompileTime == Dynamic || size <= MaxSizeAtCompileTime) &&
431 "Invalid sizes when resizing a matrix or array.");
432 internal::conservative_resize_like_impl<Derived>::run(*
this, size);
444 template <
typename OtherDerived>
448 (IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime
449 ? MaxSizeAtCompileTime == Dynamic || other.size() <= MaxSizeAtCompileTime
450 : internal::check_implication(MaxRowsAtCompileTime != Dynamic, other.rows() <= MaxRowsAtCompileTime) &&
451 internal::check_implication(MaxColsAtCompileTime != Dynamic,
452 other.cols() <= MaxColsAtCompileTime)) &&
453 "Invalid sizes when resizing a matrix or array.");
454 internal::conservative_resize_like_impl<Derived, OtherDerived>::run(*
this, other);
460 EIGEN_DEVICE_FUNC
constexpr Derived&
operator=(
const PlainObjectBase& other) {
return _set(other); }
463 template <
typename OtherDerived>
465 _resize_to_match(other);
466 return Base::lazyAssign(other.derived());
469 template <
typename OtherDerived>
470 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
operator=(
const ReturnByValue<OtherDerived>& func) {
471 resize(func.rows(), func.cols());
472 return Base::operator=(func);
478 EIGEN_DEVICE_FUNC
constexpr PlainObjectBase() =
default;
482 EIGEN_DEVICE_FUNC
constexpr PlainObjectBase&
operator=(PlainObjectBase&& other)
noexcept {
483 m_storage = std::move(other.m_storage);
489 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
490 : m_storage(size, rows, cols) {}
501 template <
typename... ArgTypes>
502 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
PlainObjectBase(
const Scalar& a0,
const Scalar& a1,
const Scalar& a2,
503 const Scalar& a3,
const ArgTypes&... args) {
504 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase,
sizeof...(args) + 4);
505 m_storage.data()[0] = a0;
506 m_storage.data()[1] = a1;
507 m_storage.data()[2] = a2;
508 m_storage.data()[3] = a3;
510 auto x = {(m_storage.data()[i++] = args, 0)...};
511 static_cast<void>(x);
518 const std::initializer_list<std::initializer_list<Scalar>>& list) {
519 size_t list_size = 0;
520 if (list.begin() != list.end()) {
521 list_size = list.begin()->size();
525 EIGEN_IF_CONSTEXPR (ColsAtCompileTime == 1) {
526 if (list.size() == 1) {
527 eigen_assert(list_size ==
static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
528 resize(list_size, ColsAtCompileTime);
529 if (list.begin()->begin() !=
nullptr) {
531 for (
const Scalar& e : *list.begin()) {
539 eigen_assert(list.size() ==
static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
540 eigen_assert(list_size ==
static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic);
541 resize(list.size(), list_size);
544 for (
const std::initializer_list<Scalar>& row : list) {
545 eigen_assert(list_size == row.size());
547 for (
const Scalar& e : row) {
556 template <
typename OtherDerived>
563 template <
typename OtherDerived>
569 template <
typename OtherDerived>
570 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
PlainObjectBase(
const ReturnByValue<OtherDerived>& other) {
572 resize(other.rows(), other.cols());
573 other.evalTo(this->derived());
580 template <
typename OtherDerived>
582 _resize_to_match(other);
583 Base::operator=(other.
derived());
584 return this->derived();
599 EIGEN_DEVICE_FUNC
static inline ConstMapType
Map(
const Scalar*
data) {
return ConstMapType(
data); }
600 EIGEN_DEVICE_FUNC
static inline MapType Map(Scalar*
data) {
return MapType(
data); }
601 EIGEN_DEVICE_FUNC
static inline ConstMapType Map(
const Scalar*
data, Index size) {
return ConstMapType(
data, size); }
602 EIGEN_DEVICE_FUNC
static inline MapType Map(Scalar*
data, Index size) {
return MapType(
data, size); }
603 EIGEN_DEVICE_FUNC
static inline ConstMapType Map(
const Scalar*
data, Index rows, Index cols) {
604 return ConstMapType(
data, rows, cols);
606 EIGEN_DEVICE_FUNC
static inline MapType Map(Scalar*
data, Index rows, Index cols) {
607 return MapType(
data, rows, cols);
610 EIGEN_DEVICE_FUNC
static inline ConstAlignedMapType MapAligned(
const Scalar*
data) {
611 return ConstAlignedMapType(
data);
613 EIGEN_DEVICE_FUNC
static inline AlignedMapType MapAligned(Scalar*
data) {
return AlignedMapType(
data); }
614 EIGEN_DEVICE_FUNC
static inline ConstAlignedMapType MapAligned(
const Scalar*
data, Index size) {
615 return ConstAlignedMapType(
data, size);
617 EIGEN_DEVICE_FUNC
static inline AlignedMapType MapAligned(Scalar*
data, Index size) {
618 return AlignedMapType(
data, size);
620 EIGEN_DEVICE_FUNC
static inline ConstAlignedMapType MapAligned(
const Scalar*
data, Index rows, Index cols) {
621 return ConstAlignedMapType(
data, rows, cols);
623 EIGEN_DEVICE_FUNC
static inline AlignedMapType MapAligned(Scalar*
data, Index rows, Index cols) {
624 return AlignedMapType(
data, rows, cols);
627 template <
int Outer,
int Inner>
628 EIGEN_DEVICE_FUNC
static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(
629 const Scalar*
data,
const Stride<Outer, Inner>& stride) {
630 return typename StridedConstMapType<Stride<Outer, Inner>>::type(
data, stride);
632 template <
int Outer,
int Inner>
633 EIGEN_DEVICE_FUNC
static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(
634 Scalar*
data,
const Stride<Outer, Inner>& stride) {
635 return typename StridedMapType<Stride<Outer, Inner>>::type(
data, stride);
637 template <
int Outer,
int Inner>
638 EIGEN_DEVICE_FUNC
static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(
639 const Scalar*
data, Index size,
const Stride<Outer, Inner>& stride) {
640 return typename StridedConstMapType<Stride<Outer, Inner>>::type(
data, size, stride);
642 template <
int Outer,
int Inner>
643 EIGEN_DEVICE_FUNC
static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(
644 Scalar*
data, Index size,
const Stride<Outer, Inner>& stride) {
645 return typename StridedMapType<Stride<Outer, Inner>>::type(
data, size, stride);
647 template <
int Outer,
int Inner>
648 EIGEN_DEVICE_FUNC
static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(
649 const Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride) {
650 return typename StridedConstMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
652 template <
int Outer,
int Inner>
653 EIGEN_DEVICE_FUNC
static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(
654 Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride) {
655 return typename StridedMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
658 template <
int Outer,
int Inner>
659 EIGEN_DEVICE_FUNC
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
660 const Scalar*
data,
const Stride<Outer, Inner>& stride) {
661 return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(
data, stride);
663 template <
int Outer,
int Inner>
664 EIGEN_DEVICE_FUNC
static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
665 Scalar*
data,
const Stride<Outer, Inner>& stride) {
666 return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(
data, stride);
668 template <
int Outer,
int Inner>
669 EIGEN_DEVICE_FUNC
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
670 const Scalar*
data, Index size,
const Stride<Outer, Inner>& stride) {
671 return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(
data, size, stride);
673 template <
int Outer,
int Inner>
674 EIGEN_DEVICE_FUNC
static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
675 Scalar*
data, Index size,
const Stride<Outer, Inner>& stride) {
676 return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(
data, size, stride);
678 template <
int Outer,
int Inner>
679 EIGEN_DEVICE_FUNC
static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
680 const Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride) {
681 return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
683 template <
int Outer,
int Inner>
684 EIGEN_DEVICE_FUNC
static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
685 Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride) {
686 return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
690 using Base::setConstant;
691 EIGEN_DEVICE_FUNC Derived&
setConstant(Index size,
const Scalar& val);
692 EIGEN_DEVICE_FUNC Derived&
setConstant(Index rows, Index cols,
const Scalar& val);
693 EIGEN_DEVICE_FUNC Derived&
setConstant(NoChange_t, Index cols,
const Scalar& val);
694 EIGEN_DEVICE_FUNC Derived&
setConstant(Index rows, NoChange_t,
const Scalar& val);
697 EIGEN_DEVICE_FUNC Derived&
setZero(Index size);
698 EIGEN_DEVICE_FUNC Derived&
setZero(Index rows, Index cols);
699 EIGEN_DEVICE_FUNC Derived&
setZero(NoChange_t, Index cols);
700 EIGEN_DEVICE_FUNC Derived&
setZero(Index rows, NoChange_t);
703 EIGEN_DEVICE_FUNC Derived&
setOnes(Index size);
704 EIGEN_DEVICE_FUNC Derived&
setOnes(Index rows, Index cols);
705 EIGEN_DEVICE_FUNC Derived&
setOnes(NoChange_t, Index cols);
706 EIGEN_DEVICE_FUNC Derived&
setOnes(Index rows, NoChange_t);
708 using Base::setRandom;
714#ifdef EIGEN_PLAINOBJECTBASE_PLUGIN
715#include EIGEN_PLAINOBJECTBASE_PLUGIN
726 template <
typename OtherDerived>
728#ifdef EIGEN_NO_AUTOMATIC_RESIZING
729 constexpr bool shape_is_proven = IsVectorAtCompileTime ? (internal::vector_dimensions<OtherDerived>::Proven &&
730 internal::matching_sizes<Derived, OtherDerived>::Proven)
731 : internal::matching_shapes<Derived, OtherDerived>::Proven;
732 EIGEN_INTERNAL_SHAPE_ASSERT(
734 (this->size() == 0 ||
735 (IsVectorAtCompileTime ? ((other.
rows() == 1 || other.
cols() == 1) && this->size() == other.
size())
736 : (rows() == other.
rows() && cols() == other.
cols()))) &&
737 "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
739 EIGEN_ONLY_USED_FOR_DEBUG(other);
761 template <
typename OtherDerived>
763 internal::call_assignment(this->derived(), other.derived());
764 return this->derived();
772 template <
typename OtherDerived>
779 internal::call_assignment_no_alias(this->derived(), other.derived(),
780 internal::assign_op<Scalar, typename OtherDerived::Scalar>());
781 return this->derived();
784 template <
typename T0,
typename T1, std::enable_if_t<Base::SizeAtCompileTime != 2, T0>* =
nullptr>
785 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init2(Index rows, Index cols) {
786 EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T0>::value && internal::is_valid_index_type<T1>::value,
787 T0 AND T1 MUST BE INTEGER TYPES)
791 template <
typename T0,
typename T1, std::enable_if_t<Base::SizeAtCompileTime == 2, T0>* =
nullptr>
792 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init2(
const T0& val0,
const T1& val1) {
793 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
794 m_storage.
data()[0] = Scalar(val0);
795 m_storage.
data()[1] = Scalar(val1);
798 template <typename T0, typename T1,
799 std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<T0, Index>::value) &&
800 (std::is_same<T1, Index>::value) && Base::SizeAtCompileTime == 2,
802 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init2(const Index& val0, const Index& val1) {
803 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
804 m_storage.
data()[0] = Scalar(val0);
805 m_storage.
data()[1] = Scalar(val1);
810 template <typename T,
811 std::enable_if_t<(Base::SizeAtCompileTime != 1 || !std::is_convertible<T, Scalar>::value) &&
812 ((!std::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value ||
813 Base::SizeAtCompileTime == Dynamic)),
815 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init1(Index size) {
816 EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T>::value, FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
822 template <
typename T,
823 std::enable_if_t<Base::SizeAtCompileTime == 1 && std::is_convertible<T, Scalar>::value,
int> = 0>
824 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Scalar& val0) {
825 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
826 m_storage.
data()[0] = val0;
831 template <typename T, std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<Index, T>::value) &&
832 Base::SizeAtCompileTime == 1 && std::is_convertible<T, Scalar>::value,
834 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init1(const Index& val0) {
835 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
836 m_storage.
data()[0] = Scalar(val0);
840 template <typename T>
841 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init1(const Scalar*
data) {
842 this->_set_noalias(ConstMapType(
data));
846 template <
typename T,
typename OtherDerived>
847 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const DenseBase<OtherDerived>& other) {
848 this->_set_noalias(other);
852 template <
typename T>
853 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Derived& other) {
854 this->_set_noalias(other);
858 template <
typename T,
typename OtherDerived>
859 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const EigenBase<OtherDerived>& other) {
860 this->derived() = other;
863 template <
typename T,
typename OtherDerived>
864 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const ReturnByValue<OtherDerived>& other) {
865 resize(other.rows(), other.cols());
866 other.evalTo(this->derived());
869 template <
typename T,
typename OtherDerived,
int ColsAtCompileTime>
870 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const RotationBase<OtherDerived, ColsAtCompileTime>& r) {
875 template <
typename T, std::enable_if_t<Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
876 std::is_convertible<T, Scalar>::value &&
877 std::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
879 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Scalar& val0) {
880 Base::setConstant(val0);
884 template <
typename T, std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<Index, T>::value) &&
885 Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
886 std::is_convertible<T, Scalar>::value &&
887 std::is_same<
typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
889 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Index& val0) {
890 Base::setConstant(val0);
893 template <
typename MatrixTypeA,
typename MatrixTypeB,
bool SwapPo
inters>
894 friend struct internal::matrix_swap_impl;
897#ifndef EIGEN_PARSED_BY_DOXYGEN
902 template <
typename OtherDerived>
903 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void swap(DenseBase<OtherDerived>& other) {
904 enum {SwapPointers = std::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime == Dynamic};
905 internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.derived());
911 template <
typename OtherDerived>
912 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void swap(DenseBase<OtherDerived>
const& other) {
913 Base::swap(other.derived());
916 enum {IsPlainObjectBase = 1};
921 template <
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
922 friend class Eigen::Map;
923 friend class Eigen::Map<Derived,
Unaligned>;
924 friend class Eigen::Map<const Derived,
Unaligned>;
925#if EIGEN_MAX_ALIGN_BYTES > 0
928 friend class Eigen::Map<Derived, AlignedMax>;
929 friend class Eigen::Map<const Derived, AlignedMax>;