Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends
Eigen::PlainObjectBase< Derived > Class Template Reference

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

#include <PlainObjectBase.h>

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

Classes

struct  StridedAlignedMapType
 
struct  StridedConstAlignedMapType
 
struct  StridedConstMapType
 
struct  StridedMapType
 

Public Types

enum  { Options = internal::traits<Derived>::Options }
 
enum  { NeedsToAlign = SizeAtCompileTime != Dynamic && (internal::traits<Derived>::Flags & AlignedBit) != 0 }
 
typedef internal::dense_xpr_base< Derived >::type Base
 
typedef internal::traits< Derived >::StorageKind StorageKind
 
typedef internal::traits< Derived >::Index Index
 
typedef internal::traits< Derived >::Scalar Scalar
 
typedef internal::packet_traits< Scalar >::type PacketScalar
 
typedef NumTraits< Scalar >::Real RealScalar
 
typedef Derived DenseType
 
typedef Eigen::Map< Derived, Unaligned > MapType
 
typedef const Eigen::Map< const Derived, Unaligned > ConstMapType
 
typedef Eigen::Map< Derived, Aligned > AlignedMapType
 
typedef const Eigen::Map< const Derived, Aligned > ConstAlignedMapType
 

Public Member Functions

Base & base ()
 
const Base & base () const
 
EIGEN_STRONG_INLINE Index rows () const
 
EIGEN_STRONG_INLINE Index cols () const
 
EIGEN_STRONG_INLINE const Scalar & coeff (Index rowId, Index colId) const
 
EIGEN_STRONG_INLINE const Scalar & coeff (Index index) const
 
EIGEN_STRONG_INLINE Scalar & coeffRef (Index rowId, Index colId)
 
EIGEN_STRONG_INLINE Scalar & coeffRef (Index index)
 
EIGEN_STRONG_INLINE const Scalar & coeffRef (Index rowId, Index colId) const
 
EIGEN_STRONG_INLINE const Scalar & coeffRef (Index index) const
 
template<int LoadMode>
EIGEN_STRONG_INLINE PacketScalar packet (Index rowId, Index colId) const
 
template<int LoadMode>
EIGEN_STRONG_INLINE PacketScalar packet (Index index) const
 
template<int StoreMode>
EIGEN_STRONG_INLINE void writePacket (Index rowId, Index colId, const PacketScalar &val)
 
template<int StoreMode>
EIGEN_STRONG_INLINE void writePacket (Index index, const PacketScalar &val)
 
EIGEN_STRONG_INLINE const Scalar * data () const
 
EIGEN_STRONG_INLINE Scalar * data ()
 
EIGEN_STRONG_INLINE void resize (Index nbRows, Index nbCols)
 
void resize (Index size)
 
void resize (NoChange_t, Index nbCols)
 
void resize (Index nbRows, NoChange_t)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE void resizeLike (const EigenBase< OtherDerived > &_other)
 
EIGEN_STRONG_INLINE void conservativeResize (Index nbRows, Index nbCols)
 
EIGEN_STRONG_INLINE void conservativeResize (Index nbRows, NoChange_t)
 
EIGEN_STRONG_INLINE void conservativeResize (NoChange_t, Index nbCols)
 
EIGEN_STRONG_INLINE void conservativeResize (Index size)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE void conservativeResizeLike (const DenseBase< OtherDerived > &other)
 
EIGEN_STRONG_INLINE Derived & operator= (const PlainObjectBase &other)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & lazyAssign (const DenseBase< OtherDerived > &other)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & operator= (const ReturnByValue< OtherDerived > &func)
 
 PlainObjectBase (internal::constructor_without_unaligned_array_assert)
 
EIGEN_STRONG_INLINE PlainObjectBase (Index a_size, Index nbRows, Index nbCols)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & operator= (const EigenBase< OtherDerived > &other)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE PlainObjectBase (const EigenBase< OtherDerived > &other)
 
Derived & setConstant (Index size, const Scalar &value)
 
Derived & setConstant (Index rows, Index cols, const Scalar &value)
 
Derived & setZero (Index size)
 
Derived & setZero (Index rows, Index cols)
 
Derived & setOnes (Index size)
 
Derived & setOnes (Index rows, Index cols)
 
Derived & setRandom (Index size)
 
Derived & setRandom (Index rows, Index cols)
 

Static Public Member Functions

static EIGEN_STRONG_INLINE void _check_template_params ()
 
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.

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 OtherDerived >
EIGEN_STRONG_INLINE void _resize_to_match (const EigenBase< OtherDerived > &other)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & _set (const DenseBase< OtherDerived > &other)
 Copies the value of the expression other into *this with automatic resizing. More...
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE void _set_selector (const OtherDerived &other, const internal::true_type &)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE void _set_selector (const OtherDerived &other, const internal::false_type &)
 
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived & _set_noalias (const DenseBase< OtherDerived > &other)
 
template<typename T0 , typename T1 >
EIGEN_STRONG_INLINE void _init2 (Index nbRows, Index nbCols, typename internal::enable_if< Base::SizeAtCompileTime!=2, T0 >::type *=0)
 
template<typename T0 , typename T1 >
EIGEN_STRONG_INLINE void _init2 (const Scalar &val0, const Scalar &val1, typename internal::enable_if< Base::SizeAtCompileTime==2, T0 >::type *=0)
 
template<typename OtherDerived >
void _swap (DenseBase< OtherDerived > const &other)
 

Protected Attributes

DenseStorage< Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options > m_storage
 

Friends

template<typename PlainObjectType , int MapOptions, typename StrideType >
class Eigen::Map
 
class Eigen::Map< Derived, Unaligned >
 
class Eigen::Map< const Derived, Unaligned >
 
class Eigen::Map< Derived, Aligned >
 
class Eigen::Map< const Derived, Aligned >
 
template<typename MatrixTypeA , typename MatrixTypeB , bool SwapPointers>
struct internal::matrix_swap_impl
 

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 TopicCustomizingEigen by defining the preprocessor symbol EIGEN_PLAINOBJECTBASE_PLUGIN.

See also
TopicClassHierarchy

Definition at line 85 of file PlainObjectBase.h.

Constructor & Destructor Documentation

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

Definition at line 456 of file PlainObjectBase.h.

457  : m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols())
458  {
459  _check_template_params();
460  internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.derived().rows(), other.derived().cols());
461  Base::operator=(other.derived());
462  }

Member Function Documentation

template<typename Derived>
template<typename OtherDerived >
EIGEN_STRONG_INLINE 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 593 of file PlainObjectBase.h.

594  {
595  _set_selector(other.derived(), typename internal::conditional<static_cast<bool>(int(OtherDerived::Flags) & EvalBeforeAssigningBit), internal::true_type, internal::false_type>::type());
596  return this->derived();
597  }
const unsigned int EvalBeforeAssigningBit
Definition: Constants.h:63
template<typename Derived>
EIGEN_STRONG_INLINE void Eigen::PlainObjectBase< Derived >::conservativeResize ( Index  nbRows,
Index  nbCols 
)
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 339 of file PlainObjectBase.h.

340  {
341  internal::conservative_resize_like_impl<Derived>::run(*this, nbRows, nbCols);
342  }
template<typename Derived>
EIGEN_STRONG_INLINE void Eigen::PlainObjectBase< Derived >::conservativeResize ( Index  nbRows,
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 351 of file PlainObjectBase.h.

352  {
353  // Note: see the comment in conservativeResize(Index,Index)
354  conservativeResize(nbRows, cols());
355  }
EIGEN_STRONG_INLINE void conservativeResize(Index nbRows, Index nbCols)
template<typename Derived>
EIGEN_STRONG_INLINE void Eigen::PlainObjectBase< Derived >::conservativeResize ( NoChange_t  ,
Index  nbCols 
)
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 364 of file PlainObjectBase.h.

365  {
366  // Note: see the comment in conservativeResize(Index,Index)
367  conservativeResize(rows(), nbCols);
368  }
EIGEN_STRONG_INLINE void conservativeResize(Index nbRows, Index nbCols)
template<typename Derived>
EIGEN_STRONG_INLINE void Eigen::PlainObjectBase< Derived >::conservativeResize ( Index  size)
inline

Resizes the vector to size while retaining old values.

. 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 378 of file PlainObjectBase.h.

379  {
380  internal::conservative_resize_like_impl<Derived>::run(*this, size);
381  }
template<typename Derived>
template<typename OtherDerived >
EIGEN_STRONG_INLINE 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 393 of file PlainObjectBase.h.

394  {
395  internal::conservative_resize_like_impl<Derived,OtherDerived>::run(*this, other);
396  }
template<typename Derived>
EIGEN_STRONG_INLINE const Scalar* Eigen::PlainObjectBase< Derived >::data ( ) const
inline
Returns
a const pointer to the data array of this matrix

Definition at line 209 of file PlainObjectBase.h.

210  { return m_storage.data(); }
template<typename Derived>
EIGEN_STRONG_INLINE Scalar* Eigen::PlainObjectBase< Derived >::data ( )
inline
Returns
a pointer to the data array of this matrix

Definition at line 213 of file PlainObjectBase.h.

214  { return m_storage.data(); }
template<typename Derived>
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived& Eigen::PlainObjectBase< Derived >::lazyAssign ( const DenseBase< OtherDerived > &  other)
inline
See also
MatrixBase::lazyAssign()

Definition at line 408 of file PlainObjectBase.h.

409  {
410  _resize_to_match(other);
411  return Base::lazyAssign(other.derived());
412  }
template<typename Derived>
EIGEN_STRONG_INLINE 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 401 of file PlainObjectBase.h.

402  {
403  return _set(other);
404  }
EIGEN_STRONG_INLINE Derived & _set(const DenseBase< OtherDerived > &other)
Copies the value of the expression other into *this with automatic resizing.
template<typename Derived>
template<typename OtherDerived >
EIGEN_STRONG_INLINE Derived& Eigen::PlainObjectBase< Derived >::operator= ( const EigenBase< OtherDerived > &  other)
inline

Definition at line 447 of file PlainObjectBase.h.

448  {
449  _resize_to_match(other);
450  Base::operator=(other.derived());
451  return this->derived();
452  }
template<typename Derived>
EIGEN_STRONG_INLINE void Eigen::PlainObjectBase< Derived >::resize ( Index  nbRows,
Index  nbCols 
)
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:

Output:

See also
resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t)

Definition at line 232 of file PlainObjectBase.h.

233  {
234  eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,nbRows==RowsAtCompileTime)
235  && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,nbCols==ColsAtCompileTime)
236  && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,nbRows<=MaxRowsAtCompileTime)
237  && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,nbCols<=MaxColsAtCompileTime)
238  && nbRows>=0 && nbCols>=0 && "Invalid sizes when resizing a matrix or array.");
239  internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(nbRows, nbCols);
240  #ifdef EIGEN_INITIALIZE_COEFFS
241  Index size = nbRows*nbCols;
242  bool size_changed = size != this->size();
243  m_storage.resize(size, nbRows, nbCols);
244  if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
245  #else
246  internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(nbRows, nbCols);
247  m_storage.resize(nbRows*nbCols, nbRows, nbCols);
248  #endif
249  }
template<typename Derived>
void Eigen::PlainObjectBase< Derived >::resize ( Index  size)
inline

Resizes *this to a vector of length size

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

Output:

See also
resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t)

Definition at line 262 of file PlainObjectBase.h.

263  {
264  EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase)
265  eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0);
266  #ifdef EIGEN_INITIALIZE_COEFFS
267  bool size_changed = size != this->size();
268  #endif
269  if(RowsAtCompileTime == 1)
270  m_storage.resize(size, 1, size);
271  else
272  m_storage.resize(size, size, 1);
273  #ifdef EIGEN_INITIALIZE_COEFFS
274  if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED
275  #endif
276  }
template<typename Derived>
void Eigen::PlainObjectBase< Derived >::resize ( NoChange_t  ,
Index  nbCols 
)
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:

Output:

See also
resize(Index,Index)

Definition at line 286 of file PlainObjectBase.h.

287  {
288  resize(rows(), nbCols);
289  }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
template<typename Derived>
void Eigen::PlainObjectBase< Derived >::resize ( Index  nbRows,
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:

Output:

See also
resize(Index,Index)

Definition at line 299 of file PlainObjectBase.h.

300  {
301  resize(nbRows, cols());
302  }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
template<typename Derived>
template<typename OtherDerived >
EIGEN_STRONG_INLINE 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 312 of file PlainObjectBase.h.

313  {
314  const OtherDerived& other = _other.derived();
315  internal::check_rows_cols_for_overflow<MaxSizeAtCompileTime>::run(other.rows(), other.cols());
316  const Index othersize = other.rows()*other.cols();
317  if(RowsAtCompileTime == 1)
318  {
319  eigen_assert(other.rows() == 1 || other.cols() == 1);
320  resize(1, othersize);
321  }
322  else if(ColsAtCompileTime == 1)
323  {
324  eigen_assert(other.rows() == 1 || other.cols() == 1);
325  resize(othersize, 1);
326  }
327  else resize(other.rows(), other.cols());
328  }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setConstant ( Index  size,
const Scalar &  val 
)

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

Example:

Output:

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

Definition at line 348 of file CwiseNullaryOp.h.

349 {
350  resize(size);
351  return setConstant(val);
352 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setConstant(Index size, const Scalar &value)
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setConstant ( Index  nbRows,
Index  nbCols,
const Scalar &  val 
)

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

Parameters
nbRowsthe new number of rows
nbColsthe new number of columns
valthe value to which all coefficients are set

Example:

Output:

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

Definition at line 367 of file CwiseNullaryOp.h.

368 {
369  resize(nbRows, nbCols);
370  return setConstant(val);
371 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setConstant(Index size, const Scalar &value)
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setOnes ( Index  newSize)

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

Example:

Output:

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

Definition at line 641 of file CwiseNullaryOp.h.

642 {
643  resize(newSize);
644  return setConstant(Scalar(1));
645 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setConstant(Index size, const Scalar &value)
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setOnes ( Index  nbRows,
Index  nbCols 
)

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

Parameters
nbRowsthe new number of rows
nbColsthe new number of columns

Example:

Output:

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

Definition at line 659 of file CwiseNullaryOp.h.

660 {
661  resize(nbRows, nbCols);
662  return setConstant(Scalar(1));
663 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setConstant(Index size, const Scalar &value)
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setRandom ( Index  newSize)

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

Example:

Output:

See also
MatrixBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, MatrixBase::Random()

Definition at line 126 of file Random.h.

127 {
128  resize(newSize);
129  return setRandom();
130 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setRandom(Index size)
Definition: Random.h:126
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setRandom ( Index  nbRows,
Index  nbCols 
)

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

Parameters
nbRowsthe new number of rows
nbColsthe new number of columns

Example:

Output:

See also
MatrixBase::setRandom(), setRandom(Index), class CwiseNullaryOp, MatrixBase::Random()

Definition at line 144 of file Random.h.

145 {
146  resize(nbRows, nbCols);
147  return setRandom();
148 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setRandom(Index size)
Definition: Random.h:126
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setZero ( Index  newSize)

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

Example:

Output:

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

Definition at line 515 of file CwiseNullaryOp.h.

516 {
517  resize(newSize);
518  return setConstant(Scalar(0));
519 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setConstant(Index size, const Scalar &value)
template<typename Derived >
EIGEN_STRONG_INLINE Derived & Eigen::PlainObjectBase< Derived >::setZero ( Index  nbRows,
Index  nbCols 
)

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

Parameters
nbRowsthe new number of rows
nbColsthe new number of columns

Example:

Output:

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

Definition at line 533 of file CwiseNullaryOp.h.

534 {
535  resize(nbRows, nbCols);
536  return setConstant(Scalar(0));
537 }
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Derived & setConstant(Index size, const Scalar &value)

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