Eigen::PlainObjectBase< Derived > Class Template Reference

Dense storage base class for matrices and arrays. More...

+ Inheritance diagram for Eigen::PlainObjectBase< Derived >:

Classes

struct  StridedAlignedMapType
 
struct  StridedConstAlignedMapType
 
struct  StridedConstMapType
 
struct  StridedMapType
 

Public Types

enum  { Options }
 
enum  { NeedsToAlign }
 
typedef Eigen::Map< Derived, AlignedMaxAlignedMapType
 
typedef internal::dense_xpr_base< Derived >::type Base
 
typedef const Eigen::Map< const Derived, AlignedMaxConstAlignedMapType
 
typedef const Eigen::Map< const Derived, UnalignedConstMapType
 
typedef Derived DenseType
 
typedef Eigen::Map< Derived, UnalignedMapType
 
typedef internal::packet_traits< Scalar >::type PacketScalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef internal::traits< Derived >::Scalar Scalar
 
typedef internal::traits< Derived >::StorageKind StorageKind
 

Public Member Functions

const Basebase () const
 
const Scalarcoeff (Index index) const
 
constexpr const Scalarcoeff (Index rowId, Index colId) const
 
constexpr ScalarcoeffRef (Index index)
 
constexpr const ScalarcoeffRef (Index index) const
 
constexpr ScalarcoeffRef (Index rowId, Index colId)
 
constexpr const ScalarcoeffRef (Index rowId, Index colId) const
 
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
 
void conservativeResize (Index rows, Index cols)
 
void conservativeResize (Index rows, NoChange_t)
 
void conservativeResize (Index size)
 
void conservativeResize (NoChange_t, Index cols)
 
template<typename OtherDerived >
void conservativeResizeLike (const DenseBase< OtherDerived > &other)
 
Scalardata ()
 
const Scalardata () const
 
 EIGEN_STATIC_ASSERT (internal::check_implication(MaxRowsAtCompileTime==1 &&MaxColsAtCompileTime!=1,(int(Options)&RowMajor)==RowMajor), INVALID_MATRIX_TEMPLATE_PARAMETERS) EIGEN_STATIC_ASSERT(internal
 
template<typename OtherDerived >
Derived & lazyAssign (const DenseBase< OtherDerived > &other)
 
template<typename OtherDerived >
Derived & operator= (const EigenBase< OtherDerived > &other)
 Copies the generic expression other into *this. More...
 
Derived & operator= (const PlainObjectBase &other)
 
template<typename OtherDerived >
Derived & operator= (const ReturnByValue< OtherDerived > &func)
 
template<int LoadMode>
PacketScalar packet (Index index) const
 
template<int LoadMode>
PacketScalar packet (Index rowId, Index colId) const
 
constexpr void resize (Index rows, Index cols)
 
constexpr void resize (Index rows, NoChange_t)
 
constexpr void resize (Index size)
 
constexpr void resize (NoChange_t, Index cols)
 
template<typename OtherDerived >
void resizeLike (const EigenBase< OtherDerived > &_other)
 
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
 
Derived & setConstant (Index rows, Index cols, const Scalar &val)
 
Derived & setConstant (Index rows, NoChange_t, const Scalar &val)
 
Derived & setConstant (Index size, const Scalar &val)
 
Derived & setConstant (NoChange_t, Index cols, const Scalar &val)
 
Derived & setOnes (Index rows, Index cols)
 
Derived & setOnes (Index rows, NoChange_t)
 
Derived & setOnes (Index size)
 
Derived & setOnes (NoChange_t, Index cols)
 
Derived & setRandom (Index rows, Index cols)
 
Derived & setRandom (Index rows, NoChange_t)
 
Derived & setRandom (Index size)
 
Derived & setRandom (NoChange_t, Index cols)
 
Derived & setZero (Index rows, Index cols)
 
Derived & setZero (Index rows, NoChange_t)
 
Derived & setZero (Index size)
 
Derived & setZero (NoChange_t, Index cols)
 
template<int StoreMode>
void writePacket (Index index, const PacketScalar &val)
 
template<int StoreMode>
void writePacket (Index rowId, Index colId, const PacketScalar &val)
 

Static Public Member Functions

Map

These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects, while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned data pointers.

Here is an example using strides:

A << 1, 2, 3, 4,
5, 6, 7, 8,
9, 10, 11, 12,
13, 14, 15, 16;
std::cout << Matrix2i::Map(&A(1,1),Stride<8,2>()) << std::endl;
MatrixXcf A
Matrix< int, 4, 4 > Matrix4i
4×4 matrix of type int.
Definition: Matrix.h:500

Output:

 6  8
14 16
See also
class Map
static ConstMapType Map (const Scalar *data)
 
static MapType Map (Scalar *data)
 
static ConstMapType Map (const Scalar *data, Index size)
 
static MapType Map (Scalar *data, Index size)
 
static ConstMapType Map (const Scalar *data, Index rows, Index cols)
 
static MapType Map (Scalar *data, Index rows, Index cols)
 
static ConstAlignedMapType MapAligned (const Scalar *data)
 
static AlignedMapType MapAligned (Scalar *data)
 
static ConstAlignedMapType MapAligned (const Scalar *data, Index size)
 
static AlignedMapType MapAligned (Scalar *data, Index size)
 
static ConstAlignedMapType MapAligned (const Scalar *data, Index rows, Index cols)
 
static AlignedMapType MapAligned (Scalar *data, Index rows, Index cols)
 
template<int Outer, int Inner>
static StridedConstMapType< Stride< Outer, Inner > >::type Map (const Scalar *data, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedMapType< Stride< Outer, Inner > >::type Map (Scalar *data, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedConstMapType< Stride< Outer, Inner > >::type Map (const Scalar *data, Index size, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedMapType< Stride< Outer, Inner > >::type Map (Scalar *data, Index size, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedConstMapType< Stride< Outer, Inner > >::type Map (const Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedMapType< Stride< Outer, Inner > >::type Map (Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedConstAlignedMapType< Stride< Outer, Inner > >::type MapAligned (const Scalar *data, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedAlignedMapType< Stride< Outer, Inner > >::type MapAligned (Scalar *data, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedConstAlignedMapType< Stride< Outer, Inner > >::type MapAligned (const Scalar *data, Index size, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedAlignedMapType< Stride< Outer, Inner > >::type MapAligned (Scalar *data, Index size, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedConstAlignedMapType< Stride< Outer, Inner > >::type MapAligned (const Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride)
 
template<int Outer, int Inner>
static StridedAlignedMapType< Stride< Outer, Inner > >::type MapAligned (Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride)
 

Protected Member Functions

template<typename T , typename OtherDerived >
void _init1 (const DenseBase< OtherDerived > &other)
 
template<typename T >
void _init1 (const Derived &other)
 
template<typename T , typename OtherDerived >
void _init1 (const EigenBase< OtherDerived > &other)
 
template<typename T >
void _init1 (const Index &val0, std::enable_if_t<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< Index, T >::value) &&Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is_convertible< T, Scalar >::value &&internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value, T * > *=0)
 
template<typename T >
void _init1 (const Index &val0, std::enable_if_t<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< Index, T >::value) &&Base::SizeAtCompileTime==1 &&internal::is_convertible< T, Scalar >::value, T * > *=0)
 
template<typename T , typename OtherDerived >
void _init1 (const ReturnByValue< OtherDerived > &other)
 
template<typename T , typename OtherDerived , int ColsAtCompileTime>
void _init1 (const RotationBase< OtherDerived, ColsAtCompileTime > &r)
 
template<typename T >
void _init1 (const Scalar &val0, std::enable_if_t< Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is_convertible< T, Scalar >::value &&internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value, T > *=0)
 
template<typename T >
void _init1 (const Scalar &val0, std::enable_if_t< Base::SizeAtCompileTime==1 &&internal::is_convertible< T, Scalar >::value, T > *=0)
 
template<typename T >
void _init1 (const Scalar *data)
 
template<typename T >
void _init1 (Index size, std::enable_if_t<(Base::SizeAtCompileTime!=1||!internal::is_convertible< T, Scalar >::value) &&((!internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value||Base::SizeAtCompileTime==Dynamic)), T > *=0)
 
template<typename T0 , typename T1 >
void _init2 (const Index &val0, const Index &val1, std::enable_if_t<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< T0, Index >::value) &&(internal::is_same< T1, Index >::value) &&Base::SizeAtCompileTime==2, T1 > *=0)
 
template<typename T0 , typename T1 >
void _init2 (const T0 &val0, const T1 &val1, std::enable_if_t< Base::SizeAtCompileTime==2, T0 > *=0)
 
template<typename T0 , typename T1 >
void _init2 (Index rows, Index cols, std::enable_if_t< Base::SizeAtCompileTime!=2, T0 > *=0)
 
template<typename OtherDerived >
void _resize_to_match (const EigenBase< OtherDerived > &other)
 
template<typename OtherDerived >
Derived & _set (const DenseBase< OtherDerived > &other)
 Copies the value of the expression other into *this with automatic resizing. More...
 
template<typename OtherDerived >
Derived & _set_noalias (const DenseBase< OtherDerived > &other)
 
PlainObjectBaseoperator= (PlainObjectBase &&other) EIGEN_NOEXCEPT
 
 PlainObjectBase ()
 
template<typename OtherDerived >
 PlainObjectBase (const DenseBase< OtherDerived > &other)
 
template<typename OtherDerived >
 PlainObjectBase (const EigenBase< OtherDerived > &other)
 
 PlainObjectBase (const PlainObjectBase &other)
 
template<typename OtherDerived >
 PlainObjectBase (const ReturnByValue< OtherDerived > &other)
 Copy constructor with in-place evaluation. More...
 
template<typename... ArgTypes>
 PlainObjectBase (const Scalar &a0, const Scalar &a1, const Scalar &a2, const Scalar &a3, const ArgTypes &... args)
 Construct a row of column vector with fixed size from an arbitrary number of coefficients. More...
 
constexpr PlainObjectBase (const std::initializer_list< std::initializer_list< Scalar >> &list)
 Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer lists. More...
 
 PlainObjectBase (Index size, Index rows, Index cols)
 
 PlainObjectBase (PlainObjectBase &&other) EIGEN_NOEXCEPT
 

Protected Attributes

DenseStorage< Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Optionsm_storage
 

Detailed Description

template<typename Derived>
class Eigen::PlainObjectBase< Derived >

Dense storage base class for matrices and arrays.

This class can be extended with the help of the plugin mechanism described on the page Extending MatrixBase (and other classes) by defining the preprocessor symbol EIGEN_PLAINOBJECTBASE_PLUGIN.

Template Parameters
Derivedis the derived type, e.g., a Matrix or Array
See also
The class hierarchy

Definition at line 111 of file PlainObjectBase.h.

Member Typedef Documentation

◆ AlignedMapType

template<typename Derived >
typedef Eigen::Map<Derived, AlignedMax> Eigen::PlainObjectBase< Derived >::AlignedMapType

Definition at line 139 of file PlainObjectBase.h.

◆ Base

template<typename Derived >
typedef internal::dense_xpr_base<Derived>::type Eigen::PlainObjectBase< Derived >::Base

Definition at line 119 of file PlainObjectBase.h.

◆ ConstAlignedMapType

template<typename Derived >
typedef const Eigen::Map<const Derived, AlignedMax> Eigen::PlainObjectBase< Derived >::ConstAlignedMapType

Definition at line 140 of file PlainObjectBase.h.

◆ ConstMapType

template<typename Derived >
typedef const Eigen::Map<const Derived, Unaligned> Eigen::PlainObjectBase< Derived >::ConstMapType

Definition at line 138 of file PlainObjectBase.h.

◆ DenseType

template<typename Derived >
typedef Derived Eigen::PlainObjectBase< Derived >::DenseType

Definition at line 126 of file PlainObjectBase.h.

◆ MapType

template<typename Derived >
typedef Eigen::Map<Derived, Unaligned> Eigen::PlainObjectBase< Derived >::MapType

Definition at line 137 of file PlainObjectBase.h.

◆ PacketScalar

template<typename Derived >
typedef internal::packet_traits<Scalar>::type Eigen::PlainObjectBase< Derived >::PacketScalar

Definition at line 124 of file PlainObjectBase.h.

◆ RealScalar

template<typename Derived >
typedef NumTraits<Scalar>::Real Eigen::PlainObjectBase< Derived >::RealScalar

Definition at line 125 of file PlainObjectBase.h.

◆ Scalar

template<typename Derived >
typedef internal::traits<Derived>::Scalar Eigen::PlainObjectBase< Derived >::Scalar

Definition at line 122 of file PlainObjectBase.h.

◆ StorageKind

template<typename Derived >
typedef internal::traits<Derived>::StorageKind Eigen::PlainObjectBase< Derived >::StorageKind

Definition at line 121 of file PlainObjectBase.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename Derived >
anonymous enum
Enumerator
Options 

Definition at line 118 of file PlainObjectBase.h.

118 { Options = internal::traits<Derived>::Options };

◆ anonymous enum

template<typename Derived >
anonymous enum
Enumerator
NeedsToAlign 

Definition at line 150 of file PlainObjectBase.h.

150 { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits<Derived>::Alignment>0) };
const int Dynamic
Definition: Constants.h:24

Constructor & Destructor Documentation

◆ PlainObjectBase() [1/9]

template<typename Derived >
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( )
inlineprotected

Definition at line 481 of file PlainObjectBase.h.

481  : m_storage()
482  {
483 // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
484  }
DenseStorage< Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options > m_storage

◆ PlainObjectBase() [2/9]

template<typename Derived >
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( PlainObjectBase< Derived > &&  other)
inlineprotected

Definition at line 498 of file PlainObjectBase.h.

499  : m_storage( std::move(other.m_storage) )
500  {
501  }

◆ PlainObjectBase() [3/9]

template<typename Derived >
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( const PlainObjectBase< Derived > &  other)
inlineprotected

Copy constructor

Definition at line 512 of file PlainObjectBase.h.

513  : Base(), m_storage(other.m_storage) { }
internal::dense_xpr_base< Derived >::type Base

◆ PlainObjectBase() [4/9]

template<typename Derived >
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( Index  size,
Index  rows,
Index  cols 
)
inlineprotected

Definition at line 515 of file PlainObjectBase.h.

516  : m_storage(size, rows, cols)
517  {
518 // EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
519  }
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT

◆ PlainObjectBase() [5/9]

template<typename Derived >
template<typename... ArgTypes>
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( const Scalar a0,
const Scalar a1,
const Scalar a2,
const Scalar a3,
const ArgTypes &...  args 
)
inlineprotected

Construct a row of column vector with fixed size from an arbitrary number of coefficients.

This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.

This constructor is for 1D array or vectors with more than 4 coefficients.

Warning
To construct a column (resp. row) vector of fixed length, the number of values passed to this constructor must match the the fixed number of rows (resp. columns) of *this.

Definition at line 532 of file PlainObjectBase.h.

533  : m_storage()
534  {
536  m_storage.data()[0] = a0;
537  m_storage.data()[1] = a1;
538  m_storage.data()[2] = a2;
539  m_storage.data()[3] = a3;
540  Index i = 4;
541  auto x = {(m_storage.data()[i++] = args, 0)...};
542  static_cast<void>(x);
543  }
#define EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(TYPE, SIZE)
Definition: StaticAssert.h:51
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82

◆ PlainObjectBase() [6/9]

template<typename Derived >
constexpr Eigen::PlainObjectBase< Derived >::PlainObjectBase ( const std::initializer_list< std::initializer_list< Scalar >> &  list)
inlineexplicitconstexprprotected

Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer lists.

Definition at line 548 of file PlainObjectBase.h.

550  : m_storage() {
551  size_t list_size = 0;
552  if (list.begin() != list.end()) {
553  list_size = list.begin()->size();
554  }
555 
556  // This is to allow syntax like VectorXi {{1, 2, 3, 4}}
557  if (ColsAtCompileTime == 1 && list.size() == 1) {
558  eigen_assert(list_size == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
559  resize(list_size, ColsAtCompileTime);
560  if (list.begin()->begin() != nullptr) {
561  std::copy(list.begin()->begin(), list.begin()->end(), m_storage.data());
562  }
563  } else {
564  eigen_assert(list.size() == static_cast<size_t>(RowsAtCompileTime) || RowsAtCompileTime == Dynamic);
565  eigen_assert(list_size == static_cast<size_t>(ColsAtCompileTime) || ColsAtCompileTime == Dynamic);
566  resize(list.size(), list_size);
567 
568  Index row_index = 0;
569  for (const std::initializer_list<Scalar>& row : list) {
570  eigen_assert(list_size == row.size());
571  Index col_index = 0;
572  for (const Scalar& e : row) {
573  coeffRef(row_index, col_index) = e;
574  ++col_index;
575  }
576  ++row_index;
577  }
578  }
579  }
RowXpr row(Index i)
This is the const version of row(). *‍/.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
#define eigen_assert(x)
Definition: Macros.h:902
internal::traits< Derived >::Scalar Scalar
constexpr void resize(Index rows, Index cols)
constexpr Scalar & coeffRef(Index rowId, Index colId)

◆ PlainObjectBase() [7/9]

template<typename Derived >
template<typename OtherDerived >
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( const DenseBase< OtherDerived > &  other)
inlineprotected
See also
PlainObjectBase::operator=(const EigenBase<OtherDerived>&)

Definition at line 584 of file PlainObjectBase.h.

585  : m_storage()
586  {
587  resizeLike(other);
588  _set_noalias(other);
589  }
void resizeLike(const EigenBase< OtherDerived > &_other)
Derived & _set_noalias(const DenseBase< OtherDerived > &other)

◆ PlainObjectBase() [8/9]

template<typename Derived >
template<typename OtherDerived >
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( const EigenBase< OtherDerived > &  other)
inlineprotected
See also
PlainObjectBase::operator=(const EigenBase<OtherDerived>&)

Definition at line 594 of file PlainObjectBase.h.

595  : m_storage()
596  {
597  resizeLike(other);
598  *this = other.derived();
599  }

◆ PlainObjectBase() [9/9]

template<typename Derived >
template<typename OtherDerived >
Eigen::PlainObjectBase< Derived >::PlainObjectBase ( const ReturnByValue< OtherDerived > &  other)
inlineprotected

Copy constructor with in-place evaluation.

Definition at line 603 of file PlainObjectBase.h.

604  {
605  // FIXME this does not automatically transpose vectors if necessary
606  resize(other.rows(), other.cols());
607  other.evalTo(this->derived());
608  }

Member Function Documentation

◆ _init1() [1/11]

template<typename Derived >
template<typename T , typename OtherDerived >
void Eigen::PlainObjectBase< Derived >::_init1 ( const DenseBase< OtherDerived > &  other)
inlineprotected

Definition at line 872 of file PlainObjectBase.h.

872  {
873  this->_set_noalias(other);
874  }

◆ _init1() [2/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( const Derived &  other)
inlineprotected

Definition at line 879 of file PlainObjectBase.h.

879  {
880  this->_set_noalias(other);
881  }

◆ _init1() [3/11]

template<typename Derived >
template<typename T , typename OtherDerived >
void Eigen::PlainObjectBase< Derived >::_init1 ( const EigenBase< OtherDerived > &  other)
inlineprotected

Definition at line 886 of file PlainObjectBase.h.

886  {
887  this->derived() = other;
888  }

◆ _init1() [4/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( const Index val0,
std::enable_if_t<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< Index, T >::value) &&Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is_convertible< T, Scalar >::value &&internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value, T * > *  = 0 
)
inlineprotected

Definition at line 920 of file PlainObjectBase.h.

927  {
928  Base::setConstant(val0);
929  }
v setConstant(3, 5)

◆ _init1() [5/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( const Index val0,
std::enable_if_t<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< Index, T >::value) &&Base::SizeAtCompileTime==1 &&internal::is_convertible< T, Scalar >::value, T * > *  = 0 
)
inlineprotected

Definition at line 852 of file PlainObjectBase.h.

857  {
859  m_storage.data()[0] = Scalar(val0);
860  }
const Scalar * data() const

◆ _init1() [6/11]

template<typename Derived >
template<typename T , typename OtherDerived >
void Eigen::PlainObjectBase< Derived >::_init1 ( const ReturnByValue< OtherDerived > &  other)
inlineprotected

Definition at line 892 of file PlainObjectBase.h.

893  {
894  resize(other.rows(), other.cols());
895  other.evalTo(this->derived());
896  }

◆ _init1() [7/11]

template<typename Derived >
template<typename T , typename OtherDerived , int ColsAtCompileTime>
void Eigen::PlainObjectBase< Derived >::_init1 ( const RotationBase< OtherDerived, ColsAtCompileTime > &  r)
inlineprotected

Definition at line 900 of file PlainObjectBase.h.

901  {
902  this->derived() = r;
903  }

◆ _init1() [8/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( const Scalar val0,
std::enable_if_t< Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is_convertible< T, Scalar >::value &&internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value, T > *  = 0 
)
inlineprotected

Definition at line 908 of file PlainObjectBase.h.

913  {
914  Base::setConstant(val0);
915  }

◆ _init1() [9/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( const Scalar val0,
std::enable_if_t< Base::SizeAtCompileTime==1 &&internal::is_convertible< T, Scalar >::value, T > *  = 0 
)
inlineprotected

Definition at line 843 of file PlainObjectBase.h.

844  {
846  m_storage.data()[0] = val0;
847  }

◆ _init1() [10/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( const Scalar data)
inlineprotected

Definition at line 865 of file PlainObjectBase.h.

865  {
867  }
const Eigen::Map< const Derived, Unaligned > ConstMapType

◆ _init1() [11/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( Index  size,
std::enable_if_t<(Base::SizeAtCompileTime!=1||!internal::is_convertible< T, Scalar >::value) &&((!internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value||Base::SizeAtCompileTime==Dynamic)), T > *  = 0 
)
inlineprotected

Definition at line 829 of file PlainObjectBase.h.

831  {
832  // NOTE MSVC 2008 complains if we directly put bool(NumTraits<T>::IsInteger) as the EIGEN_STATIC_ASSERT argument.
833  const bool is_integer_alike = internal::is_valid_index_type<T>::value;
834  EIGEN_UNUSED_VARIABLE(is_integer_alike);
835  EIGEN_STATIC_ASSERT(is_integer_alike,
836  FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED)
837  resize(size);
838  }
#define EIGEN_UNUSED_VARIABLE(var)
Definition: Macros.h:957
EIGEN_STATIC_ASSERT(internal::check_implication(MaxRowsAtCompileTime==1 &&MaxColsAtCompileTime!=1,(int(Options)&RowMajor)==RowMajor), INVALID_MATRIX_TEMPLATE_PARAMETERS) EIGEN_STATIC_ASSERT(internal

◆ _init2() [1/3]

template<typename Derived >
template<typename T0 , typename T1 >
void Eigen::PlainObjectBase< Derived >::_init2 ( const Index val0,
const Index val1,
std::enable_if_t<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< T0, Index >::value) &&(internal::is_same< T1, Index >::value) &&Base::SizeAtCompileTime==2, T1 > *  = 0 
)
inlineprotected

Definition at line 814 of file PlainObjectBase.h.

819  {
821  m_storage.data()[0] = Scalar(val0);
822  m_storage.data()[1] = Scalar(val1);
823  }

◆ _init2() [2/3]

template<typename Derived >
template<typename T0 , typename T1 >
void Eigen::PlainObjectBase< Derived >::_init2 ( const T0 &  val0,
const T1 &  val1,
std::enable_if_t< Base::SizeAtCompileTime==2, T0 > *  = 0 
)
inlineprotected

Definition at line 805 of file PlainObjectBase.h.

806  {
808  m_storage.data()[0] = Scalar(val0);
809  m_storage.data()[1] = Scalar(val1);
810  }

◆ _init2() [3/3]

template<typename Derived >
template<typename T0 , typename T1 >
void Eigen::PlainObjectBase< Derived >::_init2 ( Index  rows,
Index  cols,
std::enable_if_t< Base::SizeAtCompileTime!=2, T0 > *  = 0 
)
inlineprotected

Definition at line 795 of file PlainObjectBase.h.

796  {
797  EIGEN_STATIC_ASSERT(internal::is_valid_index_type<T0>::value &&
798  internal::is_valid_index_type<T1>::value,
799  T0 AND T1 MUST BE INTEGER TYPES)
800  resize(rows,cols);
801  }

◆ _resize_to_match()

template<typename Derived >
template<typename OtherDerived >
void Eigen::PlainObjectBase< Derived >::_resize_to_match ( const EigenBase< OtherDerived > &  other)
inlineprotected

Definition at line 739 of file PlainObjectBase.h.

740  {
741  #ifdef EIGEN_NO_AUTOMATIC_RESIZING
742  eigen_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size())
743  : (rows() == other.rows() && cols() == other.cols())))
744  && "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined");
746  #else
747  resizeLike(other);
748  #endif
749  }
#define EIGEN_ONLY_USED_FOR_DEBUG(x)
Definition: Macros.h:914

◆ _set()

template<typename Derived >
template<typename OtherDerived >
Derived& Eigen::PlainObjectBase< Derived >::_set ( const DenseBase< OtherDerived > &  other)
inlineprotected

Copies the value of the expression other into *this with automatic resizing.

*this might be resized to match the dimensions of other. If *this was a null matrix (not already initialized), it will be initialized.

Note that copying a row-vector into a vector (and conversely) is allowed. The resizing, if any, is then done in the appropriate way so that row-vectors remain row-vectors and vectors remain vectors.

See also
operator=(const MatrixBase<OtherDerived>&), _set_noalias()

Definition at line 769 of file PlainObjectBase.h.

770  {
771  internal::call_assignment(this->derived(), other.derived());
772  return this->derived();
773  }
void call_assignment(Dst &dst, const Src &src)

◆ _set_noalias()

template<typename Derived >
template<typename OtherDerived >
Derived& Eigen::PlainObjectBase< Derived >::_set_noalias ( const DenseBase< OtherDerived > &  other)
inlineprotected

Definition at line 782 of file PlainObjectBase.h.

783  {
784  // I don't think we need this resize call since the lazyAssign will anyways resize
785  // and lazyAssign will be called by the assign selector.
786  //_resize_to_match(other);
787  // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because
788  // it wouldn't allow to copy a row-vector into a column-vector.
789  internal::call_assignment_no_alias(this->derived(), other.derived(), internal::assign_op<Scalar,typename OtherDerived::Scalar>());
790  return this->derived();
791  }
EIGEN_CONSTEXPR void call_assignment_no_alias(Dst &dst, const Src &src, const Func &func)

◆ base()

template<typename Derived >
const Base& Eigen::PlainObjectBase< Derived >::base ( ) const
inline

Definition at line 166 of file PlainObjectBase.h.

166 { return *static_cast<const Base*>(this); }

◆ coeff() [1/2]

template<typename Derived >
const Scalar& Eigen::PlainObjectBase< Derived >::coeff ( Index  index) const
inline

This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.

See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details.

Definition at line 189 of file PlainObjectBase.h.

190  {
191  return m_storage.data()[index];
192  }

◆ coeff() [2/2]

template<typename Derived >
constexpr const Scalar& Eigen::PlainObjectBase< Derived >::coeff ( Index  rowId,
Index  colId 
) const
inlineconstexpr

This is an overloaded version of DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index,Index) const provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.

See DenseCoeffsBase<Derived,ReadOnlyAccessors>::coeff(Index) const for details.

Definition at line 177 of file PlainObjectBase.h.

177  {
178  if (Flags & RowMajorBit)
179  return m_storage.data()[colId + rowId * m_storage.cols()];
180  else // column-major
181  return m_storage.data()[rowId + colId * m_storage.rows()];
182  }
const unsigned int RowMajorBit
Definition: Constants.h:68

◆ coeffRef() [1/4]

template<typename Derived >
constexpr Scalar& Eigen::PlainObjectBase< Derived >::coeffRef ( Index  index)
inlineconstexpr

This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.

See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index) const for details.

Definition at line 209 of file PlainObjectBase.h.

209 { return m_storage.data()[index]; }

◆ coeffRef() [2/4]

template<typename Derived >
constexpr const Scalar& Eigen::PlainObjectBase< Derived >::coeffRef ( Index  index) const
inlineconstexpr

This is the const version of coeffRef(Index) which is thus synonym of coeff(Index). It is provided for convenience.

Definition at line 222 of file PlainObjectBase.h.

222  {
223  return m_storage.data()[index];
224  }

◆ coeffRef() [3/4]

template<typename Derived >
constexpr Scalar& Eigen::PlainObjectBase< Derived >::coeffRef ( Index  rowId,
Index  colId 
)
inlineconstexpr

This is an overloaded version of DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts.

See DenseCoeffsBase<Derived,WriteAccessors>::coeffRef(Index,Index) const for details.

Definition at line 198 of file PlainObjectBase.h.

198  {
199  if (Flags & RowMajorBit)
200  return m_storage.data()[colId + rowId * m_storage.cols()];
201  else // column-major
202  return m_storage.data()[rowId + colId * m_storage.rows()];
203  }

◆ coeffRef() [4/4]

template<typename Derived >
constexpr const Scalar& Eigen::PlainObjectBase< Derived >::coeffRef ( Index  rowId,
Index  colId 
) const
inlineconstexpr

This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index). It is provided for convenience.

Definition at line 213 of file PlainObjectBase.h.

213  {
214  if (Flags & RowMajorBit)
215  return m_storage.data()[colId + rowId * m_storage.cols()];
216  else // column-major
217  return m_storage.data()[rowId + colId * m_storage.rows()];
218  }

◆ cols()

template<typename Derived >
EIGEN_CONSTEXPR Index Eigen::PlainObjectBase< Derived >::cols ( void  ) const
inline

Definition at line 171 of file PlainObjectBase.h.

171 { return m_storage.cols(); }

◆ conservativeResize() [1/4]

template<typename Derived >
void Eigen::PlainObjectBase< Derived >::conservativeResize ( Index  rows,
Index  cols 
)
inline

Resizes the matrix to rows x cols while leaving old values untouched.

The method is intended for matrices of dynamic size. If you only want to change the number of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or conservativeResize(Index, NoChange_t).

Matrices are resized relative to the top-left element. In case values need to be appended to the matrix they will be uninitialized.

Definition at line 387 of file PlainObjectBase.h.

388  {
389  internal::conservative_resize_like_impl<Derived>::run(*this, rows, cols);
390  }

◆ conservativeResize() [2/4]

template<typename Derived >
void Eigen::PlainObjectBase< Derived >::conservativeResize ( Index  rows,
NoChange_t   
)
inline

Resizes the matrix to rows x cols while leaving old values untouched.

As opposed to conservativeResize(Index rows, Index cols), this version leaves the number of columns unchanged.

In case the matrix is growing, new rows will be uninitialized.

Definition at line 400 of file PlainObjectBase.h.

401  {
402  // Note: see the comment in conservativeResize(Index,Index)
404  }
void conservativeResize(Index rows, Index cols)

◆ conservativeResize() [3/4]

template<typename Derived >
void Eigen::PlainObjectBase< Derived >::conservativeResize ( Index  size)
inline

Resizes the vector to size while retaining old values.

This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.. This method does not work for partially dynamic matrices when the static dimension is anything other than 1. For example it will not work with Matrix<double, 2, Dynamic>.

When values are appended, they will be uninitialized.

Definition at line 429 of file PlainObjectBase.h.

430  {
431  internal::conservative_resize_like_impl<Derived>::run(*this, size);
432  }

◆ conservativeResize() [4/4]

template<typename Derived >
void Eigen::PlainObjectBase< Derived >::conservativeResize ( NoChange_t  ,
Index  cols 
)
inline

Resizes the matrix to rows x cols while leaving old values untouched.

As opposed to conservativeResize(Index rows, Index cols), this version leaves the number of rows unchanged.

In case the matrix is growing, new columns will be uninitialized.

Definition at line 414 of file PlainObjectBase.h.

415  {
416  // Note: see the comment in conservativeResize(Index,Index)
418  }

◆ conservativeResizeLike()

template<typename Derived >
template<typename OtherDerived >
void Eigen::PlainObjectBase< Derived >::conservativeResizeLike ( const DenseBase< OtherDerived > &  other)
inline

Resizes the matrix to rows x cols of other, while leaving old values untouched.

The method is intended for matrices of dynamic size. If you only want to change the number of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or conservativeResize(Index, NoChange_t).

Matrices are resized relative to the top-left element. In case values need to be appended to the matrix they will copied from other.

Definition at line 445 of file PlainObjectBase.h.

446  {
447  internal::conservative_resize_like_impl<Derived,OtherDerived>::run(*this, other);
448  }

◆ data() [1/2]

template<typename Derived >
Scalar* Eigen::PlainObjectBase< Derived >::data ( )
inline
Returns
a pointer to the data array of this matrix

Definition at line 265 of file PlainObjectBase.h.

266  { return m_storage.data(); }

◆ data() [2/2]

template<typename Derived >
const Scalar* Eigen::PlainObjectBase< Derived >::data ( ) const
inline
Returns
a const pointer to the data array of this matrix

Definition at line 261 of file PlainObjectBase.h.

262  { return m_storage.data(); }

◆ EIGEN_STATIC_ASSERT()

template<typename Derived >
Eigen::PlainObjectBase< Derived >::EIGEN_STATIC_ASSERT ( internal::check_implication(MaxRowsAtCompileTime==1 &&MaxColsAtCompileTime!=1,(int(Options)&RowMajor)==RowMajor ,
INVALID_MATRIX_TEMPLATE_PARAMETERS   
)
inline

Definition at line 153 of file PlainObjectBase.h.

164  { return *static_cast<Base*>(this); }

◆ lazyAssign()

template<typename Derived >
template<typename OtherDerived >
Derived& Eigen::PlainObjectBase< Derived >::lazyAssign ( const DenseBase< OtherDerived > &  other)
inline
See also
MatrixBase::lazyAssign()

Definition at line 462 of file PlainObjectBase.h.

463  {
464  _resize_to_match(other);
465  return Base::lazyAssign(other.derived());
466  }
void _resize_to_match(const EigenBase< OtherDerived > &other)

◆ Map() [1/12]

template<typename Derived >
static ConstMapType Eigen::PlainObjectBase< Derived >::Map ( const Scalar data)
inlinestatic

Definition at line 636 of file PlainObjectBase.h.

637  { return ConstMapType(data); }

◆ Map() [2/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedConstMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::Map ( const Scalar data,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 663 of file PlainObjectBase.h.

664  { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, stride); }

◆ Map() [3/12]

template<typename Derived >
static ConstMapType Eigen::PlainObjectBase< Derived >::Map ( const Scalar data,
Index  rows,
Index  cols 
)
inlinestatic

Definition at line 644 of file PlainObjectBase.h.

645  { return ConstMapType(data, rows, cols); }

◆ Map() [4/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedConstMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::Map ( const Scalar data,
Index  rows,
Index  cols,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 675 of file PlainObjectBase.h.

676  { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }

◆ Map() [5/12]

template<typename Derived >
static ConstMapType Eigen::PlainObjectBase< Derived >::Map ( const Scalar data,
Index  size 
)
inlinestatic

Definition at line 640 of file PlainObjectBase.h.

641  { return ConstMapType(data, size); }

◆ Map() [6/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedConstMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::Map ( const Scalar data,
Index  size,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 669 of file PlainObjectBase.h.

670  { return typename StridedConstMapType<Stride<Outer, Inner> >::type(data, size, stride); }

◆ Map() [7/12]

template<typename Derived >
static MapType Eigen::PlainObjectBase< Derived >::Map ( Scalar data)
inlinestatic

Definition at line 638 of file PlainObjectBase.h.

639  { return MapType(data); }
Eigen::Map< Derived, Unaligned > MapType

◆ Map() [8/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::Map ( Scalar data,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 666 of file PlainObjectBase.h.

667  { return typename StridedMapType<Stride<Outer, Inner> >::type(data, stride); }

◆ Map() [9/12]

template<typename Derived >
static MapType Eigen::PlainObjectBase< Derived >::Map ( Scalar data,
Index  rows,
Index  cols 
)
inlinestatic

Definition at line 646 of file PlainObjectBase.h.

647  { return MapType(data, rows, cols); }

◆ Map() [10/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::Map ( Scalar data,
Index  rows,
Index  cols,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 678 of file PlainObjectBase.h.

679  { return typename StridedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }

◆ Map() [11/12]

template<typename Derived >
static MapType Eigen::PlainObjectBase< Derived >::Map ( Scalar data,
Index  size 
)
inlinestatic

Definition at line 642 of file PlainObjectBase.h.

643  { return MapType(data, size); }

◆ Map() [12/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::Map ( Scalar data,
Index  size,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 672 of file PlainObjectBase.h.

673  { return typename StridedMapType<Stride<Outer, Inner> >::type(data, size, stride); }

◆ MapAligned() [1/12]

template<typename Derived >
static ConstAlignedMapType Eigen::PlainObjectBase< Derived >::MapAligned ( const Scalar data)
inlinestatic

Definition at line 649 of file PlainObjectBase.h.

650  { return ConstAlignedMapType(data); }
const Eigen::Map< const Derived, AlignedMax > ConstAlignedMapType

◆ MapAligned() [2/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedConstAlignedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::MapAligned ( const Scalar data,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 682 of file PlainObjectBase.h.

683  { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }

◆ MapAligned() [3/12]

template<typename Derived >
static ConstAlignedMapType Eigen::PlainObjectBase< Derived >::MapAligned ( const Scalar data,
Index  rows,
Index  cols 
)
inlinestatic

Definition at line 657 of file PlainObjectBase.h.

658  { return ConstAlignedMapType(data, rows, cols); }

◆ MapAligned() [4/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedConstAlignedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::MapAligned ( const Scalar data,
Index  rows,
Index  cols,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 694 of file PlainObjectBase.h.

695  { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }

◆ MapAligned() [5/12]

template<typename Derived >
static ConstAlignedMapType Eigen::PlainObjectBase< Derived >::MapAligned ( const Scalar data,
Index  size 
)
inlinestatic

Definition at line 653 of file PlainObjectBase.h.

654  { return ConstAlignedMapType(data, size); }

◆ MapAligned() [6/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedConstAlignedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::MapAligned ( const Scalar data,
Index  size,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 688 of file PlainObjectBase.h.

689  { return typename StridedConstAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }

◆ MapAligned() [7/12]

template<typename Derived >
static AlignedMapType Eigen::PlainObjectBase< Derived >::MapAligned ( Scalar data)
inlinestatic

Definition at line 651 of file PlainObjectBase.h.

652  { return AlignedMapType(data); }
Eigen::Map< Derived, AlignedMax > AlignedMapType

◆ MapAligned() [8/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedAlignedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::MapAligned ( Scalar data,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 685 of file PlainObjectBase.h.

686  { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, stride); }

◆ MapAligned() [9/12]

template<typename Derived >
static AlignedMapType Eigen::PlainObjectBase< Derived >::MapAligned ( Scalar data,
Index  rows,
Index  cols 
)
inlinestatic

Definition at line 659 of file PlainObjectBase.h.

660  { return AlignedMapType(data, rows, cols); }

◆ MapAligned() [10/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedAlignedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::MapAligned ( Scalar data,
Index  rows,
Index  cols,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 697 of file PlainObjectBase.h.

698  { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, rows, cols, stride); }

◆ MapAligned() [11/12]

template<typename Derived >
static AlignedMapType Eigen::PlainObjectBase< Derived >::MapAligned ( Scalar data,
Index  size 
)
inlinestatic

Definition at line 655 of file PlainObjectBase.h.

656  { return AlignedMapType(data, size); }

◆ MapAligned() [12/12]

template<typename Derived >
template<int Outer, int Inner>
static StridedAlignedMapType<Stride<Outer, Inner> >::type Eigen::PlainObjectBase< Derived >::MapAligned ( Scalar data,
Index  size,
const Stride< Outer, Inner > &  stride 
)
inlinestatic

Definition at line 691 of file PlainObjectBase.h.

692  { return typename StridedAlignedMapType<Stride<Outer, Inner> >::type(data, size, stride); }

◆ operator=() [1/4]

template<typename Derived >
template<typename OtherDerived >
Derived& Eigen::PlainObjectBase< Derived >::operator= ( const EigenBase< OtherDerived > &  other)
inline

Copies the generic expression other into *this.

Implementation of matrix base methods

The expression must provide a (templated) evalTo(Derived& dst) const function which does the actual job. In practice, this allows any user to write its own special matrix without having to modify MatrixBase

Returns
a reference to *this.

Definition at line 617 of file PlainObjectBase.h.

618  {
619  _resize_to_match(other);
620  Base::operator=(other.derived());
621  return this->derived();
622  }

◆ operator=() [2/4]

template<typename Derived >
Derived& Eigen::PlainObjectBase< Derived >::operator= ( const PlainObjectBase< Derived > &  other)
inline

This is a special case of the templated operator=. Its purpose is to prevent a default operator= from hiding the templated operator=.

Definition at line 454 of file PlainObjectBase.h.

455  {
456  return _set(other);
457  }
Derived & _set(const DenseBase< OtherDerived > &other)
Copies the value of the expression other into *this with automatic resizing.

◆ operator=() [3/4]

template<typename Derived >
template<typename OtherDerived >
Derived& Eigen::PlainObjectBase< Derived >::operator= ( const ReturnByValue< OtherDerived > &  func)
inline

Definition at line 470 of file PlainObjectBase.h.

471  {
472  resize(func.rows(), func.cols());
473  return Base::operator=(func);
474  }

◆ operator=() [4/4]

template<typename Derived >
PlainObjectBase& Eigen::PlainObjectBase< Derived >::operator= ( PlainObjectBase< Derived > &&  other)
inlineprotected

Definition at line 504 of file PlainObjectBase.h.

505  {
506  m_storage = std::move(other.m_storage);
507  return *this;
508  }

◆ packet() [1/2]

template<typename Derived >
template<int LoadMode>
PacketScalar Eigen::PlainObjectBase< Derived >::packet ( Index  index) const
inline

Definition at line 238 of file PlainObjectBase.h.

239  {
240  return internal::ploadt<PacketScalar, LoadMode>(m_storage.data() + index);
241  }

◆ packet() [2/2]

template<typename Derived >
template<int LoadMode>
PacketScalar Eigen::PlainObjectBase< Derived >::packet ( Index  rowId,
Index  colId 
) const
inline

Definition at line 228 of file PlainObjectBase.h.

229  {
230  return internal::ploadt<PacketScalar, LoadMode>
231  (m_storage.data() + (Flags & RowMajorBit
232  ? colId + rowId * m_storage.cols()
233  : rowId + colId * m_storage.rows()));
234  }

◆ resize() [1/4]

template<typename Derived >
constexpr void Eigen::PlainObjectBase< Derived >::resize ( Index  rows,
Index  cols 
)
inlineconstexpr

Resizes *this to a rows x cols matrix.

This method is intended for dynamic-size matrices, although it is legal to call it on any matrix as long as fixed dimensions are left unchanged. If you only want to change the number of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t).

If the current number of coefficients of *this exactly matches the product rows * cols, then no memory allocation is performed and the current values are left unchanged. In all other cases, including shrinking, the data is reallocated and all previous values are lost.

Example:

MatrixXd m(2,3);
m << 1,2,3,4,5,6;
cout << "here's the 2x3 matrix m:" << endl << m << endl;
cout << "let's resize m to 3x2. This is a conservative resizing because 2*3==3*2." << endl;
m.resize(3,2);
cout << "here's the 3x2 matrix m:" << endl << m << endl;
cout << "now let's resize m to size 2x2. This is NOT a conservative resizing, so it becomes uninitialized:" << endl;
m.resize(2,2);
cout << m << endl;
Matrix3f m
Matrix< double, Dynamic, Dynamic > MatrixXd
Dynamic×Dynamic matrix of type double.
Definition: Matrix.h:502

Output:

here's the 2x3 matrix m:
1 2 3
4 5 6
let's resize m to 3x2. This is a conservative resizing because 2*3==3*2.
here's the 3x2 matrix m:
1 5
4 3
2 6
now let's resize m to size 2x2. This is NOT a conservative resizing, so it becomes uninitialized:
0 0
0 0
See also
resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)

Definition at line 284 of file PlainObjectBase.h.

284  {
285  eigen_assert(internal::check_implication(RowsAtCompileTime!=Dynamic, rows==RowsAtCompileTime)
286  && internal::check_implication(ColsAtCompileTime!=Dynamic, cols==ColsAtCompileTime)
287  && internal::check_implication(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic, rows<=MaxRowsAtCompileTime)
288  && internal::check_implication(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic, cols<=MaxColsAtCompileTime)
289  && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array.");
290  internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(rows, cols);
291  #ifdef EIGEN_INITIALIZE_COEFFS
292  Index size = rows*cols;
293  bool size_changed = size != this->size();
294  m_storage.resize(size, rows, cols);
296  #else
297  m_storage.resize(rows*cols, rows, cols);
298  #endif
299  }
#define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
constexpr bool check_implication(bool a, bool b)
Definition: Meta.h:579

◆ resize() [2/4]

template<typename Derived >
constexpr void Eigen::PlainObjectBase< Derived >::resize ( Index  rows,
NoChange_t   
)
inlineconstexpr

Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special value NoChange as in the example below.

Example:

MatrixXd m(3,4);
m.resize(5, NoChange);
cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl;
@ NoChange
Definition: Constants.h:362

Output:

m: 5 rows, 4 cols
See also
resize(Index,Index)

Definition at line 348 of file PlainObjectBase.h.

348 { resize(rows, cols()); }

◆ resize() [3/4]

template<typename Derived >
constexpr void Eigen::PlainObjectBase< Derived >::resize ( Index  size)
inlineconstexpr

Resizes *this to a vector of length size

This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.. This method does not work for partially dynamic matrices when the static dimension is anything other than 1. For example it will not work with Matrix<double, 2, Dynamic>.

Example:

VectorXd v(10);
v.resize(3);
w.resize(3); // this is legal, but has no effect
cout << "v: " << v.rows() << " rows, " << v.cols() << " cols" << endl;
cout << "w: " << w.rows() << " rows, " << w.cols() << " cols" << endl;
Array< int, Dynamic, 1 > v
RowVector3d w
Matrix< double, 1, 3 > RowVector3d
1×3 vector of type double.
Definition: Matrix.h:502
Matrix< double, Dynamic, 1 > VectorXd
Dynamic×1 vector of type double.
Definition: Matrix.h:502

Output:

v: 3 rows, 1 cols
w: 1 rows, 3 cols
See also
resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t)

Definition at line 312 of file PlainObjectBase.h.

312  {
314  eigen_assert(
315  ((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime == Dynamic || size <= MaxSizeAtCompileTime)) ||
316  SizeAtCompileTime == size) &&
317  size >= 0);
318 #ifdef EIGEN_INITIALIZE_COEFFS
319  bool size_changed = size != this->size();
320  #endif
321  if(RowsAtCompileTime == 1)
322  m_storage.resize(size, 1, size);
323  else
324  m_storage.resize(size, size, 1);
325  #ifdef EIGEN_INITIALIZE_COEFFS
327  #endif
328  }
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition: StaticAssert.h:36

◆ resize() [4/4]

template<typename Derived >
constexpr void Eigen::PlainObjectBase< Derived >::resize ( NoChange_t  ,
Index  cols 
)
inlineconstexpr

Resizes the matrix, changing only the number of columns. For the parameter of type NoChange_t, just pass the special value NoChange as in the example below.

Example:

MatrixXd m(3,4);
m.resize(NoChange, 5);
cout << "m: " << m.rows() << " rows, " << m.cols() << " cols" << endl;

Output:

m: 3 rows, 5 cols
See also
resize(Index,Index)

Definition at line 338 of file PlainObjectBase.h.

338 { resize(rows(), cols); }

◆ resizeLike()

template<typename Derived >
template<typename OtherDerived >
void Eigen::PlainObjectBase< Derived >::resizeLike ( const EigenBase< OtherDerived > &  _other)
inline

Resizes *this to have the same dimensions as other. Takes care of doing all the checking that's needed.

Note that copying a row-vector into a vector (and conversely) is allowed. The resizing, if any, is then done in the appropriate way so that row-vectors remain row-vectors and vectors remain vectors.

Definition at line 359 of file PlainObjectBase.h.

360  {
361  const OtherDerived& other = _other.derived();
362  internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime>::run(other.rows(), other.cols());
363  const Index othersize = other.rows()*other.cols();
364  if(RowsAtCompileTime == 1)
365  {
366  eigen_assert(other.rows() == 1 || other.cols() == 1);
367  resize(1, othersize);
368  }
369  else if(ColsAtCompileTime == 1)
370  {
371  eigen_assert(other.rows() == 1 || other.cols() == 1);
372  resize(othersize, 1);
373  }
374  else resize(other.rows(), other.cols());
375  }

◆ rows()

template<typename Derived >
EIGEN_CONSTEXPR Index Eigen::PlainObjectBase< Derived >::rows ( void  ) const
inline

Definition at line 169 of file PlainObjectBase.h.

169 { return m_storage.rows(); }

◆ setConstant() [1/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setConstant ( Index  rows,
Index  cols,
const Scalar val 
)
inline

Resizes to the given size, and sets all coefficients in this expression to the given value val.

Parameters
rowsthe new number of rows
colsthe new number of columns
valthe value to which all coefficients are set

Example:

m.setConstant(3, 3, 5);
cout << m << endl;
Matrix< float, Dynamic, Dynamic > MatrixXf
Dynamic×Dynamic matrix of type float.
Definition: Matrix.h:501

Output:

5 5 5
5 5 5
5 5 5
See also
MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)

Definition at line 396 of file CwiseNullaryOp.h.

397 {
398  resize(rows, cols);
399  return setConstant(val);
400 }
Derived & setConstant(Index size, const Scalar &val)

◆ setConstant() [2/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setConstant ( Index  rows,
NoChange_t  ,
const Scalar val 
)
inline

Resizes to the given size, changing only the number of rows, and sets all coefficients in this expression to the given value val. For the parameter of type NoChange_t, just pass the special value NoChange.

See also
MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)

Definition at line 423 of file CwiseNullaryOp.h.

424 {
425  return setConstant(rows, cols(), val);
426 }

◆ setConstant() [3/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setConstant ( Index  size,
const Scalar val 
)
inline

Resizes to the given size, and sets all coefficients in this expression to the given value val.

This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.

Example:

v.setConstant(3, 5);
cout << v << endl;
Matrix< float, Dynamic, 1 > VectorXf
Dynamic×1 vector of type float.
Definition: Matrix.h:501

Output:

5
5
5
See also
MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)

Definition at line 377 of file CwiseNullaryOp.h.

378 {
379  resize(size);
380  return setConstant(val);
381 }

◆ setConstant() [4/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setConstant ( NoChange_t  ,
Index  cols,
const Scalar val 
)
inline

Resizes to the given size, changing only the number of columns, and sets all coefficients in this expression to the given value val. For the parameter of type NoChange_t, just pass the special value NoChange.

See also
MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&)

Definition at line 410 of file CwiseNullaryOp.h.

411 {
412  return setConstant(rows(), cols, val);
413 }

◆ setOnes() [1/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setOnes ( Index  rows,
Index  cols 
)
inline

Resizes to the given size, and sets all coefficients in this expression to one.

Parameters
rowsthe new number of rows
colsthe new number of columns

Example:

m.setOnes(3, 3);
cout << m << endl;

Output:

1 1 1
1 1 1
1 1 1
See also
MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones()

Definition at line 761 of file CwiseNullaryOp.h.

762 {
763  resize(rows, cols);
764  return setConstant(Scalar(1));
765 }

◆ setOnes() [2/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setOnes ( Index  rows,
NoChange_t   
)
inline

Resizes to the given size, changing only the number of rows, and sets all coefficients in this expression to one. For the parameter of type NoChange_t, just pass the special value NoChange.

See also
MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(NoChange_t, Index), class CwiseNullaryOp, MatrixBase::Ones()

Definition at line 775 of file CwiseNullaryOp.h.

776 {
777  return setOnes(rows, cols());
778 }
Derived & setOnes(Index size)

◆ setOnes() [3/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setOnes ( Index  newSize)
inline

Resizes to the given newSize, and sets all coefficients in this expression to one.

This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.

Example:

v.setOnes(3);
cout << v << endl;

Output:

1
1
1
See also
MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones()

Definition at line 743 of file CwiseNullaryOp.h.

744 {
745  resize(newSize);
746  return setConstant(Scalar(1));
747 }

◆ setOnes() [4/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setOnes ( NoChange_t  ,
Index  cols 
)
inline

Resizes to the given size, changing only the number of columns, and sets all coefficients in this expression to one. For the parameter of type NoChange_t, just pass the special value NoChange.

See also
MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(Index, NoChange_t) class CwiseNullaryOp, MatrixBase::Ones()

Definition at line 788 of file CwiseNullaryOp.h.

789 {
790  return setOnes(rows(), cols);
791 }

◆ setRandom() [1/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setRandom ( Index  rows,
Index  cols 
)
inline

Resizes to the given size, and sets all coefficients in this expression to random values.

Numbers are uniformly spread through their whole definition range for integer types, and in the [-1:1] range for floating point scalar types.

Warning
This function is not re-entrant.
Parameters
rowsthe new number of rows
colsthe new number of columns

Example:

m.setRandom(3, 3);
cout << m << endl;

Output:

  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
See also
DenseBase::setRandom(), setRandom(Index), class CwiseNullaryOp, DenseBase::Random()

Definition at line 175 of file Random.h.

176 {
177  resize(rows, cols);
178  return setRandom();
179 }
Derived & setRandom(Index size)
Definition: Random.h:152

◆ setRandom() [2/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setRandom ( Index  rows,
NoChange_t   
)
inline

Resizes to the given size, changing only the number of rows, and sets all coefficients in this expression to random values. For the parameter of type NoChange_t, just pass the special value NoChange.

Numbers are uniformly spread through their whole definition range for integer types, and in the [-1:1] range for floating point scalar types.

Warning
This function is not re-entrant.
See also
DenseBase::setRandom(), setRandom(Index), setRandom(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Random()

Definition at line 212 of file Random.h.

213 {
214  return setRandom(rows, cols());
215 }

◆ setRandom() [3/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setRandom ( Index  newSize)
inline

Resizes to the given newSize, and sets all coefficients in this expression to random values.

Numbers are uniformly spread through their whole definition range for integer types, and in the [-1:1] range for floating point scalar types.

This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.

Warning
This function is not re-entrant.

Example:

v.setRandom(3);
cout << v << endl;

Output:

  0.68
-0.211
 0.566
See also
DenseBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, DenseBase::Random()

Definition at line 152 of file Random.h.

153 {
154  resize(newSize);
155  return setRandom();
156 }

◆ setRandom() [4/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setRandom ( NoChange_t  ,
Index  cols 
)
inline

Resizes to the given size, changing only the number of columns, and sets all coefficients in this expression to random values. For the parameter of type NoChange_t, just pass the special value NoChange.

Numbers are uniformly spread through their whole definition range for integer types, and in the [-1:1] range for floating point scalar types.

Warning
This function is not re-entrant.
See also
DenseBase::setRandom(), setRandom(Index), setRandom(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Random()

Definition at line 194 of file Random.h.

195 {
196  return setRandom(rows(), cols);
197 }

◆ setZero() [1/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setZero ( Index  rows,
Index  cols 
)
inline

Resizes to the given size, and sets all coefficients in this expression to zero.

Parameters
rowsthe new number of rows
colsthe new number of columns

Example:

m.setZero(3, 3);
cout << m << endl;

Output:

0 0 0
0 0 0
0 0 0
See also
DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero()

Definition at line 609 of file CwiseNullaryOp.h.

610 {
611  resize(rows, cols);
612  return setConstant(Scalar(0));
613 }

◆ setZero() [2/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setZero ( Index  rows,
NoChange_t   
)
inline

Resizes to the given size, changing only the number of rows, and sets all coefficients in this expression to zero. For the parameter of type NoChange_t, just pass the special value NoChange.

See also
DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Zero()

Definition at line 636 of file CwiseNullaryOp.h.

637 {
638  return setZero(rows, cols());
639 }
Derived & setZero(Index size)

◆ setZero() [3/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setZero ( Index  newSize)
inline

Resizes to the given size, and sets all coefficients in this expression to zero.

This is only for vectors (either row-vectors or column-vectors), i.e. matrices which are known at compile-time to have either one row or one column.

Example:

v.setZero(3);
cout << v << endl;

Output:

0
0
0
See also
DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero()

Definition at line 591 of file CwiseNullaryOp.h.

592 {
593  resize(newSize);
594  return setConstant(Scalar(0));
595 }

◆ setZero() [4/4]

template<typename Derived >
Derived & Eigen::PlainObjectBase< Derived >::setZero ( NoChange_t  ,
Index  cols 
)
inline

Resizes to the given size, changing only the number of columns, and sets all coefficients in this expression to zero. For the parameter of type NoChange_t, just pass the special value NoChange.

See also
DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Zero()

Definition at line 623 of file CwiseNullaryOp.h.

624 {
625  return setZero(rows(), cols);
626 }

◆ writePacket() [1/2]

template<typename Derived >
template<int StoreMode>
void Eigen::PlainObjectBase< Derived >::writePacket ( Index  index,
const PacketScalar val 
)
inline

Definition at line 255 of file PlainObjectBase.h.

256  {
257  internal::pstoret<Scalar, PacketScalar, StoreMode>(m_storage.data() + index, val);
258  }

◆ writePacket() [2/2]

template<typename Derived >
template<int StoreMode>
void Eigen::PlainObjectBase< Derived >::writePacket ( Index  rowId,
Index  colId,
const PacketScalar val 
)
inline

Definition at line 245 of file PlainObjectBase.h.

246  {
247  internal::pstoret<Scalar, PacketScalar, StoreMode>
248  (m_storage.data() + (Flags & RowMajorBit
249  ? colId + rowId * m_storage.cols()
250  : rowId + colId * m_storage.rows()), val);
251  }

Member Data Documentation

◆ m_storage

template<typename Derived >
DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> Eigen::PlainObjectBase< Derived >::m_storage
protected

Definition at line 147 of file PlainObjectBase.h.


The documentation for this class was generated from the following files: