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()); }
360 template <
typename OtherDerived>
362 const OtherDerived& other = _other.
derived();
363#ifndef EIGEN_NO_DEBUG
364 internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(
365 other.rows(), other.cols());
367 const Index othersize = other.rows() * other.cols();
368 EIGEN_IF_CONSTEXPR (RowsAtCompileTime == 1) {
369 eigen_assert(other.rows() == 1 || other.cols() == 1);
371 }
else EIGEN_IF_CONSTEXPR (ColsAtCompileTime == 1) {
372 eigen_assert(other.rows() == 1 || other.cols() == 1);
375 resize(other.rows(), other.cols());
389 internal::conservative_resize_like_impl<Derived>::run(*
this, rows, cols);
425 internal::conservative_resize_like_impl<Derived>::run(*
this, size);
437 template <
typename OtherDerived>
439 internal::conservative_resize_like_impl<Derived, OtherDerived>::run(*
this, other);
445 EIGEN_DEVICE_FUNC
constexpr Derived&
operator=(
const PlainObjectBase& other) {
return _set(other); }
448 template <
typename OtherDerived>
450 _resize_to_match(other);
451 return Base::lazyAssign(other.derived());
454 template <
typename OtherDerived>
455 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived&
operator=(
const ReturnByValue<OtherDerived>& func) {
456 resize(func.rows(), func.cols());
457 return Base::operator=(func);
463 EIGEN_DEVICE_FUNC
constexpr PlainObjectBase() =
default;
467 EIGEN_DEVICE_FUNC
constexpr PlainObjectBase&
operator=(PlainObjectBase&& other)
noexcept {
468 m_storage = std::move(other.m_storage);
474 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols)
475 : m_storage(size, rows, cols) {}
486 template <
typename... ArgTypes>
487 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
PlainObjectBase(
const Scalar& a0,
const Scalar& a1,
const Scalar& a2,
488 const Scalar& a3,
const ArgTypes&... args) {
489 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase,
sizeof...(args) + 4);
490 m_storage.data()[0] = a0;
491 m_storage.data()[1] = a1;
492 m_storage.data()[2] = a2;
493 m_storage.data()[3] = a3;
495 auto x = {(m_storage.data()[i++] = args, 0)...};
496 static_cast<void>(x);
503 const std::initializer_list<std::initializer_list<Scalar>>& list) {
504 size_t list_size = 0;
505 if (list.begin() != list.end()) {
506 list_size = list.begin()->size();
510 EIGEN_IF_CONSTEXPR (ColsAtCompileTime == 1) {
511 if (list.size() == 1) {
512 eigen_assert(list_size ==
static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
513 resize(list_size, ColsAtCompileTime);
514 if (list.begin()->begin() !=
nullptr) {
516 for (
const Scalar& e : *list.begin()) {
524 eigen_assert(list.size() ==
static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
525 eigen_assert(list_size ==
static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic);
526 resize(list.size(), list_size);
529 for (
const std::initializer_list<Scalar>& row : list) {
530 eigen_assert(list_size == row.size());
532 for (
const Scalar& e : row) {
541 template <
typename OtherDerived>
548 template <
typename OtherDerived>
554 template <
typename OtherDerived>
555 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
PlainObjectBase(
const ReturnByValue<OtherDerived>& other) {
557 resize(other.rows(), other.cols());
558 other.evalTo(this->derived());
565 template <
typename OtherDerived>
567 _resize_to_match(other);
568 Base::operator=(other.
derived());
569 return this->derived();
584 static inline ConstMapType
Map(
const Scalar*
data) {
return ConstMapType(
data); }
585 static inline MapType Map(Scalar*
data) {
return MapType(
data); }
586 static inline ConstMapType Map(
const Scalar*
data, Index size) {
return ConstMapType(
data, size); }
587 static inline MapType Map(Scalar*
data, Index size) {
return MapType(
data, size); }
588 static inline ConstMapType Map(
const Scalar*
data, Index rows, Index cols) {
return ConstMapType(
data, rows, cols); }
589 static inline MapType Map(Scalar*
data, Index rows, Index cols) {
return MapType(
data, rows, cols); }
591 static inline ConstAlignedMapType MapAligned(
const Scalar*
data) {
return ConstAlignedMapType(
data); }
592 static inline AlignedMapType MapAligned(Scalar*
data) {
return AlignedMapType(
data); }
593 static inline ConstAlignedMapType MapAligned(
const Scalar*
data, Index size) {
594 return ConstAlignedMapType(
data, size);
596 static inline AlignedMapType MapAligned(Scalar*
data, Index size) {
return AlignedMapType(
data, size); }
597 static inline ConstAlignedMapType MapAligned(
const Scalar*
data, Index rows, Index cols) {
598 return ConstAlignedMapType(
data, rows, cols);
600 static inline AlignedMapType MapAligned(Scalar*
data, Index rows, Index cols) {
601 return AlignedMapType(
data, rows, cols);
604 template <
int Outer,
int Inner>
605 static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(
const Scalar*
data,
606 const Stride<Outer, Inner>& stride) {
607 return typename StridedConstMapType<Stride<Outer, Inner>>::type(
data, stride);
609 template <
int Outer,
int Inner>
610 static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar*
data,
611 const Stride<Outer, Inner>& stride) {
612 return typename StridedMapType<Stride<Outer, Inner>>::type(
data, stride);
614 template <
int Outer,
int Inner>
615 static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(
const Scalar*
data, Index size,
616 const Stride<Outer, Inner>& stride) {
617 return typename StridedConstMapType<Stride<Outer, Inner>>::type(
data, size, stride);
619 template <
int Outer,
int Inner>
620 static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar*
data, Index size,
621 const Stride<Outer, Inner>& stride) {
622 return typename StridedMapType<Stride<Outer, Inner>>::type(
data, size, stride);
624 template <
int Outer,
int Inner>
625 static inline typename StridedConstMapType<Stride<Outer, Inner>>::type Map(
const Scalar*
data, Index rows, Index cols,
626 const Stride<Outer, Inner>& stride) {
627 return typename StridedConstMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
629 template <
int Outer,
int Inner>
630 static inline typename StridedMapType<Stride<Outer, Inner>>::type Map(Scalar*
data, Index rows, Index cols,
631 const Stride<Outer, Inner>& stride) {
632 return typename StridedMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
635 template <
int Outer,
int Inner>
636 static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
637 const Scalar*
data,
const Stride<Outer, Inner>& stride) {
638 return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(
data, stride);
640 template <
int Outer,
int Inner>
641 static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
642 Scalar*
data,
const Stride<Outer, Inner>& stride) {
643 return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(
data, stride);
645 template <
int Outer,
int Inner>
646 static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
647 const Scalar*
data, Index size,
const Stride<Outer, Inner>& stride) {
648 return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(
data, size, stride);
650 template <
int Outer,
int Inner>
651 static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
652 Scalar*
data, Index size,
const Stride<Outer, Inner>& stride) {
653 return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(
data, size, stride);
655 template <
int Outer,
int Inner>
656 static inline typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
657 const Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride) {
658 return typename StridedConstAlignedMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
660 template <
int Outer,
int Inner>
661 static inline typename StridedAlignedMapType<Stride<Outer, Inner>>::type MapAligned(
662 Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride) {
663 return typename StridedAlignedMapType<Stride<Outer, Inner>>::type(
data, rows, cols, stride);
667 using Base::setConstant;
668 EIGEN_DEVICE_FUNC Derived&
setConstant(Index size,
const Scalar& val);
669 EIGEN_DEVICE_FUNC Derived&
setConstant(Index rows, Index cols,
const Scalar& val);
670 EIGEN_DEVICE_FUNC Derived&
setConstant(NoChange_t, Index cols,
const Scalar& val);
671 EIGEN_DEVICE_FUNC Derived&
setConstant(Index rows, NoChange_t,
const Scalar& val);
674 EIGEN_DEVICE_FUNC Derived&
setZero(Index size);
675 EIGEN_DEVICE_FUNC Derived&
setZero(Index rows, Index cols);
676 EIGEN_DEVICE_FUNC Derived&
setZero(NoChange_t, Index cols);
677 EIGEN_DEVICE_FUNC Derived&
setZero(Index rows, NoChange_t);
680 EIGEN_DEVICE_FUNC Derived&
setOnes(Index size);
681 EIGEN_DEVICE_FUNC Derived&
setOnes(Index rows, Index cols);
682 EIGEN_DEVICE_FUNC Derived&
setOnes(NoChange_t, Index cols);
683 EIGEN_DEVICE_FUNC Derived&
setOnes(Index rows, NoChange_t);
685 using Base::setRandom;
691#ifdef EIGEN_PLAINOBJECTBASE_PLUGIN
692#include EIGEN_PLAINOBJECTBASE_PLUGIN
703 template <
typename OtherDerived>
705#ifdef EIGEN_NO_AUTOMATIC_RESIZING
706 eigen_assert((this->size() == 0 ||
707 (IsVectorAtCompileTime ? ((other.
rows() == 1 || other.
cols() == 1) && this->size() == other.
size())
708 : (rows() == other.
rows() && cols() == other.
cols()))) &&
709 "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
711 EIGEN_ONLY_USED_FOR_DEBUG(other);
733 template <
typename OtherDerived>
735 internal::call_assignment(this->derived(), other.derived());
736 return this->derived();
744 template <
typename OtherDerived>
751 internal::call_assignment_no_alias(this->derived(), other.derived(),
752 internal::assign_op<Scalar, typename OtherDerived::Scalar>());
753 return this->derived();
756 template <
typename T0,
typename T1, std::enable_if_t<Base::SizeAtCompileTime != 2, T0>* =
nullptr>
757 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init2(Index rows, Index cols) {
758 EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T0>::value && internal::is_valid_index_type<T1>::value,
759 T0 AND T1 MUST BE INTEGER TYPES)
763 template <
typename T0,
typename T1, std::enable_if_t<Base::SizeAtCompileTime == 2, T0>* =
nullptr>
764 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init2(
const T0& val0,
const T1& val1) {
765 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
766 m_storage.
data()[0] = Scalar(val0);
767 m_storage.
data()[1] = Scalar(val1);
770 template <typename T0, typename T1,
771 std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<T0, Index>::value) &&
772 (std::is_same<T1, Index>::value) && Base::SizeAtCompileTime == 2,
774 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init2(const Index& val0, const Index& val1) {
775 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
776 m_storage.
data()[0] = Scalar(val0);
777 m_storage.
data()[1] = Scalar(val1);
782 template <typename T,
783 std::enable_if_t<(Base::SizeAtCompileTime != 1 || !std::is_convertible<T, Scalar>::value) &&
784 ((!std::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value ||
785 Base::SizeAtCompileTime == Dynamic)),
787 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init1(Index size) {
788 EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T>::value, FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
794 template <
typename T,
795 std::enable_if_t<Base::SizeAtCompileTime == 1 && std::is_convertible<T, Scalar>::value,
int> = 0>
796 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Scalar& val0) {
797 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
798 m_storage.
data()[0] = val0;
803 template <typename T, std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<Index, T>::value) &&
804 Base::SizeAtCompileTime == 1 && std::is_convertible<T, Scalar>::value,
806 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init1(const Index& val0) {
807 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1)
808 m_storage.
data()[0] = Scalar(val0);
812 template <typename T>
813 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE
void _init1(const Scalar*
data) {
814 this->_set_noalias(ConstMapType(
data));
818 template <
typename T,
typename OtherDerived>
819 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const DenseBase<OtherDerived>& other) {
820 this->_set_noalias(other);
824 template <
typename T>
825 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Derived& other) {
826 this->_set_noalias(other);
830 template <
typename T,
typename OtherDerived>
831 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const EigenBase<OtherDerived>& other) {
832 this->derived() = other;
835 template <
typename T,
typename OtherDerived>
836 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const ReturnByValue<OtherDerived>& other) {
837 resize(other.rows(), other.cols());
838 other.evalTo(this->derived());
841 template <
typename T,
typename OtherDerived,
int ColsAtCompileTime>
842 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const RotationBase<OtherDerived, ColsAtCompileTime>& r) {
847 template <
typename T, std::enable_if_t<Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
848 std::is_convertible<T, Scalar>::value &&
849 std::is_same<typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
851 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Scalar& val0) {
852 Base::setConstant(val0);
856 template <
typename T, std::enable_if_t<(!std::is_same<Index, Scalar>::value) && (std::is_same<Index, T>::value) &&
857 Base::SizeAtCompileTime != Dynamic && Base::SizeAtCompileTime != 1 &&
858 std::is_convertible<T, Scalar>::value &&
859 std::is_same<
typename internal::traits<Derived>::XprKind, ArrayXpr>::value,
861 EIGEN_DEVICE_FUNC
constexpr EIGEN_STRONG_INLINE
void _init1(
const Index& val0) {
862 Base::setConstant(val0);
865 template <
typename MatrixTypeA,
typename MatrixTypeB,
bool SwapPo
inters>
866 friend struct internal::matrix_swap_impl;
869#ifndef EIGEN_PARSED_BY_DOXYGEN
874 template <
typename OtherDerived>
875 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void swap(DenseBase<OtherDerived>& other) {
876 enum {SwapPointers = std::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime == Dynamic};
877 internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.derived());
883 template <
typename OtherDerived>
884 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
void swap(DenseBase<OtherDerived>
const& other) {
885 Base::swap(other.derived());
888 enum {IsPlainObjectBase = 1};
893 template <
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
894 friend class Eigen::Map;
895 friend class Eigen::Map<Derived,
Unaligned>;
896 friend class Eigen::Map<const Derived,
Unaligned>;
897#if EIGEN_MAX_ALIGN_BYTES > 0
900 friend class Eigen::Map<Derived, AlignedMax>;
901 friend class Eigen::Map<const Derived, AlignedMax>;