Eigen  3.4.90 (git rev a4098ac676528a83cfb73d4d26ce1b42ec05f47c)
Eigen::PlainObjectBase< Derived > Class Template Reference

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
+ Inheritance diagram for Eigen::PlainObjectBase< Derived >:

Public Member Functions

const Scalar & coeff (Index index) const
 
const Scalar & coeff (Index rowId, Index colId) const
 
Scalar & coeffRef (Index index)
 
const Scalar & coeffRef (Index index) const
 
Scalar & coeffRef (Index rowId, Index colId)
 
const Scalar & coeffRef (Index rowId, Index colId) const
 
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)
 
Scalar * data ()
 
const Scalar * data () const
 
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)
 
void resize (Index rows, Index cols)
 
void resize (Index rows, NoChange_t)
 
void resize (Index size)
 
void resize (NoChange_t, Index cols)
 
template<typename OtherDerived >
void resizeLike (const EigenBase< OtherDerived > &_other)
 

Protected Member Functions

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.
 
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. [c++11] More...
 
 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 [c++11]
 

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:

Matrix4i A;
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;

Output:

 6  8
14 16
See also
class Map
Derived & setConstant (Index size, const Scalar &val)
 
Derived & setConstant (Index rows, Index cols, const Scalar &val)
 
Derived & setConstant (NoChange_t, Index cols, const Scalar &val)
 
Derived & setConstant (Index rows, NoChange_t, const Scalar &val)
 
Derived & setZero (Index size)
 
Derived & setZero (Index rows, Index cols)
 
Derived & setZero (NoChange_t, Index cols)
 
Derived & setZero (Index rows, NoChange_t)
 
Derived & setOnes (Index size)
 
Derived & setOnes (Index rows, Index cols)
 
Derived & setOnes (NoChange_t, Index cols)
 
Derived & setOnes (Index rows, NoChange_t)
 
Derived & setRandom (Index size)
 
Derived & setRandom (Index rows, Index cols)
 
Derived & setRandom (NoChange_t, Index cols)
 
Derived & setRandom (Index rows, NoChange_t)
 
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)
 
template<typename T0 , typename T1 >
void _init2 (Index rows, Index cols, typename internal::enable_if< Base::SizeAtCompileTime!=2, T0 >::type *=0)
 
template<typename T0 , typename T1 >
void _init2 (const T0 &val0, const T1 &val1, typename internal::enable_if< Base::SizeAtCompileTime==2, T0 >::type *=0)
 
template<typename T0 , typename T1 >
void _init2 (const Index &val0, const Index &val1, typename internal::enable_if<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< T0, Index >::value) &&(internal::is_same< T1, Index >::value) &&Base::SizeAtCompileTime==2, T1 >::type *=0)
 
template<typename T >
void _init1 (Index size, typename internal::enable_if<(Base::SizeAtCompileTime!=1||!internal::is_convertible< T, Scalar >::value) &&((!internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value||Base::SizeAtCompileTime==Dynamic)), T >::type *=0)
 
template<typename T >
void _init1 (const Scalar &val0, typename internal::enable_if< Base::SizeAtCompileTime==1 &&internal::is_convertible< T, Scalar >::value, T >::type *=0)
 
template<typename T >
void _init1 (const Index &val0, typename internal::enable_if<(!internal::is_same< Index, Scalar >::value) &&(internal::is_same< Index, T >::value) &&Base::SizeAtCompileTime==1 &&internal::is_convertible< T, Scalar >::value, T * >::type *=0)
 
template<typename T >
void _init1 (const Scalar *data)
 
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 , 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, typename internal::enable_if< Base::SizeAtCompileTime!=Dynamic &&Base::SizeAtCompileTime!=1 &&internal::is_convertible< T, Scalar >::value &&internal::is_same< typename internal::traits< Derived >::XprKind, ArrayXpr >::value, T >::type *=0)
 
template<typename T >
void _init1 (const Index &val0, typename internal::enable_if<(!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 * >::type *=0)
 
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)
 

Constructor & Destructor Documentation

◆ PlainObjectBase() [1/4]

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

Copy constructor

◆ PlainObjectBase() [2/4]

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. [c++11]

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. There exists C++98 analogue constructors for fixed-size array/vector having 1, 2, 3, or 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.

◆ PlainObjectBase() [3/4]

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

◆ PlainObjectBase() [4/4]

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

Member Function Documentation

◆ _init1() [1/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [2/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [3/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [4/11]

template<typename Derived >
template<typename T >
void Eigen::PlainObjectBase< Derived >::_init1 ( const Index val0,
typename internal::enable_if<(!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 * >::type *  = 0 
)
inlineprotected

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [5/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [6/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [7/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [8/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [9/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [10/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init1() [11/11]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init2() [1/3]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init2() [2/3]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _init2() [3/3]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _resize_to_match()

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ _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()

◆ _set_noalias()

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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.

◆ coeff() [2/2]

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

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.

◆ coeffRef() [1/4]

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

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.

◆ coeffRef() [2/4]

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

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

◆ coeffRef() [3/4]

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

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.

◆ coeffRef() [4/4]

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

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

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ 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.

◆ data() [1/2]

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

◆ 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

◆ lazyAssign()

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

◆ Map() [1/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ Map() [3/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ Map() [5/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ Map() [7/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ Map() [9/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ Map() [11/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ MapAligned() [1/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ MapAligned() [3/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ MapAligned() [5/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ MapAligned() [7/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ MapAligned() [9/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ MapAligned() [11/12]

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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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

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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ operator=() [1/2]

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

Copies the generic expression other into *this.

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.

◆ operator=() [2/2]

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=.

◆ resize() [1/4]

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

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;

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)

◆ resize() [2/4]

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

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;

Output:

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

◆ resize() [3/4]

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

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);
RowVector3d w;
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;

Output:

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

◆ resize() [4/4]

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

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)

◆ 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.

◆ 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:

MatrixXf m;
m.setConstant(3, 3, 5);
cout << m << endl;

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&)

◆ 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&)

◆ 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:

VectorXf v;
v.setConstant(3, 5);
cout << v << endl;

Output:

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

◆ 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&)

◆ 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:

MatrixXf m;
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()

◆ 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()

◆ 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:

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

Output:

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

◆ 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()

◆ 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:

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

Output:

     -1 -0.0827  -0.906
 -0.737  0.0655   0.358
  0.511  -0.562   0.359
See also
DenseBase::setRandom(), setRandom(Index), class CwiseNullaryOp, DenseBase::Random()

◆ 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()

◆ 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:

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

Output:

    -1
-0.737
 0.511
See also
DenseBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, DenseBase::Random()

◆ 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()

◆ 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:

MatrixXf m;
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()

◆ 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()

◆ 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:

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

Output:

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

◆ 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()

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