11 #ifndef EIGEN_DENSESTORAGEBASE_H
12 #define EIGEN_DENSESTORAGEBASE_H
14 #if defined(EIGEN_INITIALIZE_MATRICES_BY_ZERO)
15 # define EIGEN_INITIALIZE_COEFFS
16 # define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(int i=0;i<base().size();++i) coeffRef(i)=Scalar(0);
17 #elif defined(EIGEN_INITIALIZE_MATRICES_BY_NAN)
18 # define EIGEN_INITIALIZE_COEFFS
19 # define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(int i=0;i<base().size();++i) coeffRef(i)=std::numeric_limits<Scalar>::quiet_NaN();
21 # undef EIGEN_INITIALIZE_COEFFS
22 # define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
29 template<
int MaxSizeAtCompileTime>
struct check_rows_cols_for_overflow {
30 template<
typename Index>
31 static EIGEN_ALWAYS_INLINE
void run(Index, Index)
36 template<>
struct check_rows_cols_for_overflow<
Dynamic> {
37 template<
typename Index>
38 static EIGEN_ALWAYS_INLINE
void run(Index rows, Index cols)
42 Index max_index = (size_t(1) << (8 *
sizeof(Index) - 1)) - 1;
43 bool error = (rows == 0 || cols == 0) ?
false
44 : (rows > max_index / cols);
46 throw_std_bad_alloc();
50 template <
typename Derived,
typename OtherDerived = Derived,
bool IsVector =
bool(Derived::IsVectorAtCompileTime)>
struct conservative_resize_like_impl;
52 template<
typename MatrixTypeA,
typename MatrixTypeB,
bool SwapPo
inters>
struct matrix_swap_impl;
64 #ifdef EIGEN_PARSED_BY_DOXYGEN
69 template<
typename Derived>
struct dense_xpr_base_dispatcher_for_doxygen;
71 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
72 struct dense_xpr_base_dispatcher_for_doxygen<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
73 :
public MatrixBase<Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > {};
75 template<
typename _Scalar,
int _Rows,
int _Cols,
int _Options,
int _MaxRows,
int _MaxCols>
76 struct dense_xpr_base_dispatcher_for_doxygen<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> >
77 :
public ArrayBase<Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> > {};
81 template<
typename Derived>
82 class PlainObjectBase :
public internal::dense_xpr_base_dispatcher_for_doxygen<Derived>
84 template<typename Derived>
89 enum { Options = internal::traits<Derived>::Options };
90 typedef typename internal::dense_xpr_base<Derived>::type Base;
92 typedef typename internal::traits<Derived>::StorageKind StorageKind;
93 typedef typename internal::traits<Derived>::Index Index;
94 typedef typename internal::traits<Derived>::Scalar Scalar;
95 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
97 typedef Derived DenseType;
99 using Base::RowsAtCompileTime;
100 using Base::ColsAtCompileTime;
101 using Base::SizeAtCompileTime;
102 using Base::MaxRowsAtCompileTime;
103 using Base::MaxColsAtCompileTime;
104 using Base::MaxSizeAtCompileTime;
105 using Base::IsVectorAtCompileTime;
108 template<
typename PlainObjectType,
int MapOptions,
typename Str
ideType>
friend class Eigen::Map;
111 friend class Eigen::Map<const Derived, Unaligned>;
115 friend class Eigen::Map<const Derived, Aligned>;
123 DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> m_storage;
126 enum { NeedsToAlign = SizeAtCompileTime !=
Dynamic && (internal::traits<Derived>::Flags &
AlignedBit) != 0 };
127 EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign)
129 Base& base() {
return *
static_cast<Base*
>(
this); }
130 const Base& base()
const {
return *
static_cast<const Base*
>(
this); }
132 EIGEN_STRONG_INLINE Index rows()
const {
return m_storage.rows(); }
133 EIGEN_STRONG_INLINE Index cols()
const {
return m_storage.cols(); }
135 EIGEN_STRONG_INLINE
const Scalar& coeff(Index rowId, Index colId)
const
138 return m_storage.data()[colId + rowId * m_storage.cols()];
140 return m_storage.data()[rowId + colId * m_storage.rows()];
143 EIGEN_STRONG_INLINE
const Scalar& coeff(Index index)
const
145 return m_storage.data()[index];
148 EIGEN_STRONG_INLINE Scalar& coeffRef(Index rowId, Index colId)
151 return m_storage.data()[colId + rowId * m_storage.cols()];
153 return m_storage.data()[rowId + colId * m_storage.rows()];
156 EIGEN_STRONG_INLINE Scalar& coeffRef(Index index)
158 return m_storage.data()[index];
161 EIGEN_STRONG_INLINE
const Scalar& coeffRef(Index rowId, Index colId)
const
164 return m_storage.data()[colId + rowId * m_storage.cols()];
166 return m_storage.data()[rowId + colId * m_storage.rows()];
169 EIGEN_STRONG_INLINE
const Scalar& coeffRef(Index index)
const
171 return m_storage.data()[index];
175 template<
int LoadMode>
176 EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId)
const
178 return internal::ploadt<PacketScalar, LoadMode>
180 ? colId + rowId * m_storage.cols()
181 : rowId + colId * m_storage.rows()));
185 template<
int LoadMode>
186 EIGEN_STRONG_INLINE PacketScalar packet(Index index)
const
188 return internal::ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
192 template<
int StoreMode>
193 EIGEN_STRONG_INLINE
void writePacket(Index rowId, Index colId,
const PacketScalar& val)
195 internal::pstoret<Scalar, PacketScalar, StoreMode>
197 ? colId + rowId * m_storage.cols()
198 : rowId + colId * m_storage.rows()), val);
202 template<
int StoreMode>
203 EIGEN_STRONG_INLINE
void writePacket(Index index,
const PacketScalar& val)
205 internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, val);
209 EIGEN_STRONG_INLINE
const Scalar *
data()
const
210 {
return m_storage.data(); }
213 EIGEN_STRONG_INLINE Scalar *
data()
214 {
return m_storage.data(); }
234 eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=
Dynamic,nbRows==RowsAtCompileTime)
235 && EIGEN_IMPLIES(ColsAtCompileTime!=
Dynamic,nbCols==ColsAtCompileTime)
236 && EIGEN_IMPLIES(RowsAtCompileTime==
Dynamic && MaxRowsAtCompileTime!=
Dynamic,nbRows<=MaxRowsAtCompileTime)
237 && EIGEN_IMPLIES(ColsAtCompileTime==
Dynamic && MaxColsAtCompileTime!=
Dynamic,nbCols<=MaxColsAtCompileTime)
238 && nbRows>=0 && nbCols>=0 &&
"Invalid sizes when resizing a matrix or array.");
239 internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(nbRows, nbCols);
240 #ifdef EIGEN_INITIALIZE_COEFFS
241 Index size = nbRows*nbCols;
242 bool size_changed = size != this->size();
243 m_storage.resize(size, nbRows, nbCols);
244 if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
246 internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(nbRows, nbCols);
247 m_storage.resize(nbRows*nbCols, nbRows, nbCols);
265 eigen_assert(((SizeAtCompileTime ==
Dynamic && (MaxSizeAtCompileTime==
Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0);
266 #ifdef EIGEN_INITIALIZE_COEFFS
267 bool size_changed = size != this->size();
269 if(RowsAtCompileTime == 1)
270 m_storage.resize(size, 1, size);
272 m_storage.resize(size, size, 1);
273 #ifdef EIGEN_INITIALIZE_COEFFS
274 if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
311 template<
typename OtherDerived>
314 const OtherDerived& other = _other.
derived();
315 internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.rows(), other.cols());
316 const Index othersize = other.rows()*other.cols();
317 if(RowsAtCompileTime == 1)
319 eigen_assert(other.rows() == 1 || other.cols() == 1);
322 else if(ColsAtCompileTime == 1)
324 eigen_assert(other.rows() == 1 || other.cols() == 1);
327 else resize(other.rows(), other.cols());
341 internal::conservative_resize_like_impl<Derived>::run(*
this, nbRows, nbCols);
380 internal::conservative_resize_like_impl<Derived>::run(*
this, size);
392 template<
typename OtherDerived>
395 internal::conservative_resize_like_impl<Derived,OtherDerived>::run(*
this, other);
407 template<
typename OtherDerived>
410 _resize_to_match(other);
411 return Base::lazyAssign(other.derived());
414 template<
typename OtherDerived>
415 EIGEN_STRONG_INLINE Derived&
operator=(
const ReturnByValue<OtherDerived>& func)
417 resize(func.rows(), func.cols());
418 return Base::operator=(func);
421 EIGEN_STRONG_INLINE PlainObjectBase() : m_storage()
427 #ifndef EIGEN_PARSED_BY_DOXYGEN
430 PlainObjectBase(internal::constructor_without_unaligned_array_assert)
431 : m_storage(internal::constructor_without_unaligned_array_assert())
437 EIGEN_STRONG_INLINE PlainObjectBase(Index a_size, Index nbRows, Index nbCols)
438 : m_storage(a_size, nbRows, nbCols)
446 template<
typename OtherDerived>
449 _resize_to_match(other);
450 Base::operator=(other.
derived());
451 return this->derived();
455 template<
typename OtherDerived>
457 : m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
459 _check_template_params();
460 internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.
derived().rows(), other.
derived().cols());
461 Base::operator=(other.
derived());
472 static inline ConstMapType
Map(
const Scalar*
data)
473 {
return ConstMapType(data); }
474 static inline MapType Map(Scalar*
data)
475 {
return MapType(data); }
476 static inline ConstMapType Map(
const Scalar*
data, Index size)
477 {
return ConstMapType(data, size); }
478 static inline MapType Map(Scalar*
data, Index size)
479 {
return MapType(data, size); }
480 static inline ConstMapType Map(
const Scalar*
data, Index rows, Index cols)
481 {
return ConstMapType(data, rows, cols); }
482 static inline MapType Map(Scalar*
data, Index rows, Index cols)
483 {
return MapType(data, rows, cols); }
485 static inline ConstAlignedMapType MapAligned(
const Scalar*
data)
486 {
return ConstAlignedMapType(data); }
487 static inline AlignedMapType MapAligned(Scalar*
data)
488 {
return AlignedMapType(data); }
489 static inline ConstAlignedMapType MapAligned(
const Scalar*
data, Index size)
490 {
return ConstAlignedMapType(data, size); }
491 static inline AlignedMapType MapAligned(Scalar*
data, Index size)
492 {
return AlignedMapType(data, size); }
493 static inline ConstAlignedMapType MapAligned(
const Scalar*
data, Index rows, Index cols)
494 {
return ConstAlignedMapType(data, rows, cols); }
495 static inline AlignedMapType MapAligned(Scalar*
data, Index rows, Index cols)
496 {
return AlignedMapType(data, rows, cols); }
498 template<
int Outer,
int Inner>
499 static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(
const Scalar*
data,
const Stride<Outer, Inner>& stride)
500 {
return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, stride); }
501 template<
int Outer,
int Inner>
502 static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar*
data,
const Stride<Outer, Inner>& stride)
503 {
return typename StridedMapType<Stride<Outer, Inner> >::type(data, stride); }
504 template<
int Outer,
int Inner>
505 static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(
const Scalar*
data, Index size,
const Stride<Outer, Inner>& stride)
506 {
return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, size, stride); }
507 template<
int Outer,
int Inner>
508 static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar*
data, Index size,
const Stride<Outer, Inner>& stride)
509 {
return typename StridedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
510 template<
int Outer,
int Inner>
511 static inline typename StridedConstMapType<Stride<Outer, Inner> >::type Map(
const Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride)
512 {
return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
513 template<
int Outer,
int Inner>
514 static inline typename StridedMapType<Stride<Outer, Inner> >::type Map(Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride)
515 {
return typename StridedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
517 template<
int Outer,
int Inner>
518 static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(
const Scalar*
data,
const Stride<Outer, Inner>& stride)
519 {
return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
520 template<
int Outer,
int Inner>
521 static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar*
data,
const Stride<Outer, Inner>& stride)
522 {
return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }
523 template<
int Outer,
int Inner>
524 static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(
const Scalar*
data, Index size,
const Stride<Outer, Inner>& stride)
525 {
return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
526 template<
int Outer,
int Inner>
527 static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar*
data, Index size,
const Stride<Outer, Inner>& stride)
528 {
return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }
529 template<
int Outer,
int Inner>
530 static inline typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type MapAligned(
const Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride)
531 {
return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
532 template<
int Outer,
int Inner>
533 static inline typename StridedAlignedMapType<Stride<Outer, Inner> >::type MapAligned(Scalar*
data, Index rows, Index cols,
const Stride<Outer, Inner>& stride)
534 {
return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }
537 using Base::setConstant;
538 Derived&
setConstant(Index size,
const Scalar& value);
539 Derived&
setConstant(Index rows, Index cols,
const Scalar& value);
543 Derived&
setZero(Index rows, Index cols);
547 Derived&
setOnes(Index rows, Index cols);
549 using Base::setRandom;
551 Derived&
setRandom(Index rows, Index cols);
553 #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN
554 #include EIGEN_PLAINOBJECTBASE_PLUGIN
565 template<
typename OtherDerived>
566 EIGEN_STRONG_INLINE
void _resize_to_match(
const EigenBase<OtherDerived>& other)
568 #ifdef EIGEN_NO_AUTOMATIC_RESIZING
569 eigen_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size())
570 : (rows() == other.rows() && cols() == other.cols())))
571 &&
"Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
572 EIGEN_ONLY_USED_FOR_DEBUG(other);
592 template<
typename OtherDerived>
595 _set_selector(other.derived(),
typename internal::conditional<static_cast<bool>(int(OtherDerived::Flags) &
EvalBeforeAssigningBit), internal::true_type, internal::false_type>::type());
596 return this->derived();
599 template<
typename OtherDerived>
600 EIGEN_STRONG_INLINE
void _set_selector(
const OtherDerived& other,
const internal::true_type&) { _set_noalias(other.eval()); }
602 template<
typename OtherDerived>
603 EIGEN_STRONG_INLINE
void _set_selector(
const OtherDerived& other,
const internal::false_type&) { _set_noalias(other); }
610 template<
typename OtherDerived>
611 EIGEN_STRONG_INLINE Derived& _set_noalias(
const DenseBase<OtherDerived>& other)
618 return internal::assign_selector<Derived,OtherDerived,false>::run(this->derived(), other.derived());
621 template<
typename T0,
typename T1>
622 EIGEN_STRONG_INLINE
void _init2(Index nbRows, Index nbCols,
typename internal::enable_if<Base::SizeAtCompileTime!=2,T0>::type* = 0)
624 EIGEN_STATIC_ASSERT(
bool(NumTraits<T0>::IsInteger) &&
625 bool(NumTraits<T1>::IsInteger),
626 FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
629 template<typename T0, typename T1>
630 EIGEN_STRONG_INLINE
void _init2(const Scalar& val0, const Scalar& val1, typename internal::enable_if<Base::SizeAtCompileTime==2,T0>::type* = 0)
632 EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2)
633 m_storage.
data()[0] = val0;
634 m_storage.
data()[1] = val1;
637 template<typename MatrixTypeA, typename MatrixTypeB,
bool SwapPointers>
638 friend struct internal::matrix_swap_impl;
643 template<typename OtherDerived>
644 void _swap(DenseBase<OtherDerived> const & other)
646 enum { SwapPointers = internal::is_same<Derived, OtherDerived>::value && Base::SizeAtCompileTime==
Dynamic };
647 internal::matrix_swap_impl<Derived, OtherDerived, bool(SwapPointers)>::run(this->derived(), other.const_cast_derived());
651 #ifndef EIGEN_PARSED_BY_DOXYGEN
652 static EIGEN_STRONG_INLINE
void _check_template_params()
654 EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&
RowMajor)==RowMajor)
655 && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0)
656 && ((RowsAtCompileTime ==
Dynamic) || (RowsAtCompileTime >= 0))
657 && ((ColsAtCompileTime ==
Dynamic) || (ColsAtCompileTime >= 0))
658 && ((MaxRowsAtCompileTime ==
Dynamic) || (MaxRowsAtCompileTime >= 0))
659 && ((MaxColsAtCompileTime ==
Dynamic) || (MaxColsAtCompileTime >= 0))
660 && (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==
Dynamic)
661 && (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==
Dynamic)
662 && (Options & (
DontAlign|RowMajor)) == Options),
663 INVALID_MATRIX_TEMPLATE_PARAMETERS)
668 enum { ThisConstantIsPrivateInPlainObjectBase };
671 template <
typename Derived,
typename OtherDerived,
bool IsVector>
672 struct internal::conservative_resize_like_impl
674 typedef typename Derived::Index Index;
675 static void run(DenseBase<Derived>& _this, Index rows, Index cols)
677 if (_this.rows() == rows && _this.cols() == cols)
return;
678 EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived)
680 if ( ( Derived::IsRowMajor && _this.cols() == cols) ||
681 (!Derived::IsRowMajor && _this.rows() == rows) )
683 internal::check_rows_cols_for_overflow<Derived::MaxSizeAtCompileTime>::run(rows, cols);
684 _this.derived().m_storage.conservativeResize(rows*cols,rows,cols);
689 typename Derived::PlainObject tmp(rows,cols);
690 const Index common_rows = (std::min)(rows, _this.rows());
691 const Index common_cols = (std::min)(cols, _this.cols());
692 tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols);
693 _this.derived().swap(tmp);
697 static void run(DenseBase<Derived>& _this,
const DenseBase<OtherDerived>& other)
699 if (_this.rows() == other.rows() && _this.cols() == other.cols())
return;
706 EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived)
707 EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived)
709 if ( ( Derived::IsRowMajor && _this.cols() == other.cols()) ||
710 (!Derived::IsRowMajor && _this.rows() == other.rows()) )
712 const Index new_rows = other.rows() - _this.rows();
713 const Index new_cols = other.cols() - _this.cols();
714 _this.derived().m_storage.conservativeResize(other.size(),other.rows(),other.cols());
716 _this.bottomRightCorner(new_rows, other.cols()) = other.bottomRows(new_rows);
718 _this.bottomRightCorner(other.rows(), new_cols) = other.rightCols(new_cols);
723 typename Derived::PlainObject tmp(other);
724 const Index common_rows = (std::min)(tmp.rows(), _this.rows());
725 const Index common_cols = (std::min)(tmp.cols(), _this.cols());
726 tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols);
727 _this.derived().swap(tmp);
734 template <
typename Derived,
typename OtherDerived>
735 struct conservative_resize_like_impl<Derived,OtherDerived,true>
737 typedef typename Derived::Index Index;
738 static void run(DenseBase<Derived>& _this, Index size)
740 const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size;
741 const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1;
742 _this.derived().m_storage.conservativeResize(size,new_rows,new_cols);
745 static void run(DenseBase<Derived>& _this,
const DenseBase<OtherDerived>& other)
747 if (_this.rows() == other.rows() && _this.cols() == other.cols())
return;
749 const Index num_new_elements = other.size() - _this.size();
751 const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows();
752 const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1;
753 _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols);
755 if (num_new_elements > 0)
756 _this.tail(num_new_elements) = other.tail(num_new_elements);
760 template<
typename MatrixTypeA,
typename MatrixTypeB,
bool SwapPo
inters>
761 struct matrix_swap_impl
763 static inline void run(MatrixTypeA& a, MatrixTypeB& b)
769 template<
typename MatrixTypeA,
typename MatrixTypeB>
770 struct matrix_swap_impl<MatrixTypeA, MatrixTypeB, true>
772 static inline void run(MatrixTypeA& a, MatrixTypeB& b)
774 static_cast<typename MatrixTypeA::Base&
>(a).m_storage.swap(static_cast<typename MatrixTypeB::Base&>(b).m_storage);
782 #endif // EIGEN_DENSESTORAGEBASE_H
Derived & setOnes(Index size)
Definition: CwiseNullaryOp.h:641
const Scalar * data() const
Definition: PlainObjectBase.h:209
Derived & operator=(const EigenBase< OtherDerived > &other)
Definition: PlainObjectBase.h:447
Derived & lazyAssign(const DenseBase< OtherDerived > &other)
Definition: PlainObjectBase.h:408
Definition: Constants.h:266
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:104
void conservativeResize(Index size)
Definition: PlainObjectBase.h:378
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
Definition: NumTraits.h:88
const int Dynamic
Definition: Constants.h:21
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:41
void resize(Index size)
Definition: PlainObjectBase.h:262
Scalar * data()
Definition: PlainObjectBase.h:213
Definition: EigenBase.h:26
void conservativeResizeLike(const DenseBase< OtherDerived > &other)
Definition: PlainObjectBase.h:393
void conservativeResize(Index nbRows, Index nbCols)
Definition: PlainObjectBase.h:339
Derived & setRandom(Index size)
Definition: Random.h:126
void resize(Index nbRows, NoChange_t)
Definition: PlainObjectBase.h:299
Derived & derived()
Definition: EigenBase.h:34
void conservativeResize(Index nbRows, NoChange_t)
Definition: PlainObjectBase.h:351
Dense storage base class for matrices and arrays.
Definition: PlainObjectBase.h:82
Definition: Constants.h:270
Derived & setConstant(Index size, const Scalar &value)
Definition: CwiseNullaryOp.h:348
Derived & _set(const DenseBase< OtherDerived > &other)
Copies the value of the expression other into *this with automatic resizing.
Definition: PlainObjectBase.h:593
internal::traits< Derived >::Index Index
The type of indices.
Definition: DenseBase.h:61
const unsigned int EvalBeforeAssigningBit
Definition: Constants.h:63
Derived & operator=(const PlainObjectBase &other)
Definition: PlainObjectBase.h:401
const unsigned int RowMajorBit
Definition: Constants.h:53
void resize(Index nbRows, Index nbCols)
Definition: PlainObjectBase.h:232
void resizeLike(const EigenBase< OtherDerived > &_other)
Definition: PlainObjectBase.h:312
const unsigned int AlignedBit
Definition: Constants.h:147
void resize(NoChange_t, Index nbCols)
Definition: PlainObjectBase.h:286
PlainObjectBase(const EigenBase< OtherDerived > &other)
Definition: PlainObjectBase.h:456
void conservativeResize(NoChange_t, Index nbCols)
Definition: PlainObjectBase.h:364
Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:515