General-purpose arrays with easy API for coefficient-wise operations.
The Array class is very similar to the Matrix class. It provides general-purpose one- and two-dimensional arrays. The difference between the Array and the Matrix class is primarily in the API: the API for the Array class provides easy access to coefficient-wise operations, while the API for the Matrix class provides easy access to linear-algebra operations.
This class can be extended with the help of the plugin mechanism described on the page TopicCustomizingEigen by defining the preprocessor symbol EIGEN_ARRAY_PLUGIN.

Public Types | |
| enum | { Options = _Options } |
| enum | { NeedsToAlign } |
| typedef PlainObjectBase< Array > | Base |
| typedef Base::PlainObject | PlainObject |
| enum | |
| enum | |
| 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 | |
| template<typename OtherDerived > | |
| EIGEN_STRONG_INLINE Array & | operator= (const EigenBase< OtherDerived > &other) |
| The usage of using Base::operator=; fails on MSVC. | |
| template<typename OtherDerived > | |
| EIGEN_STRONG_INLINE Array & | operator= (const ArrayBase< OtherDerived > &other) |
Copies the value of the expression other into *this with automatic resizing. | |
| EIGEN_STRONG_INLINE Array & | operator= (const Array &other) |
| This is a special case of the templated operator=. | |
| EIGEN_STRONG_INLINE | Array () |
| Default constructor. | |
| EIGEN_STRONG_INLINE | Array (Index dim) |
| Constructs a vector or row-vector with given dimension. | |
| Array (Index rows, Index cols) | |
| constructs an uninitialized matrix with rows rows and cols columns. | |
| Array (const Scalar &x, const Scalar &y) | |
| constructs an initialized 2D vector with given coefficients | |
| EIGEN_STRONG_INLINE | Array (const Scalar &x, const Scalar &y, const Scalar &z) |
| constructs an initialized 3D vector with given coefficients | |
| EIGEN_STRONG_INLINE | Array (const Scalar &x, const Scalar &y, const Scalar &z, const Scalar &w) |
| constructs an initialized 4D vector with given coefficients | |
| Array (const Scalar *data) | |
| template<typename OtherDerived > | |
| EIGEN_STRONG_INLINE | Array (const ArrayBase< OtherDerived > &other) |
| Constructor copying the value of the expression other. | |
| EIGEN_STRONG_INLINE | Array (const Array &other) |
| Copy constructor. | |
| template<typename OtherDerived > | |
| EIGEN_STRONG_INLINE | Array (const ReturnByValue< OtherDerived > &other) |
| Copy constructor with in-place evaluation. | |
| template<typename OtherDerived > | |
| EIGEN_STRONG_INLINE | Array (const EigenBase< OtherDerived > &other) |
| template<typename OtherDerived > | |
| void | swap (ArrayBase< OtherDerived > const &other) |
| Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the data pointers. | |
| Index | innerStride () const |
| Index | outerStride () const |
| 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 row, Index col) const |
| EIGEN_STRONG_INLINE const Scalar & | coeff (Index index) const |
| EIGEN_STRONG_INLINE Scalar & | coeffRef (Index row, Index col) |
| EIGEN_STRONG_INLINE Scalar & | coeffRef (Index index) |
| EIGEN_STRONG_INLINE const Scalar & | coeffRef (Index row, Index col) const |
| EIGEN_STRONG_INLINE const Scalar & | coeffRef (Index index) const |
| EIGEN_STRONG_INLINE PacketScalar | packet (Index row, Index col) const |
| EIGEN_STRONG_INLINE PacketScalar | packet (Index index) const |
| EIGEN_STRONG_INLINE void | writePacket (Index row, Index col, const PacketScalar &x) |
| EIGEN_STRONG_INLINE void | writePacket (Index index, const PacketScalar &x) |
| EIGEN_STRONG_INLINE const Scalar * | data () const |
| EIGEN_STRONG_INLINE Scalar * | data () |
| EIGEN_STRONG_INLINE void | resize (Index rows, Index cols) |
Resizes *this to a rows x cols matrix. | |
| void | resize (Index size) |
Resizes *this to a vector of length size. | |
| void | resize (NoChange_t, Index cols) |
| Resizes the matrix, changing only the number of columns. | |
| void | resize (Index rows, NoChange_t) |
| Resizes the matrix, changing only the number of rows. | |
| EIGEN_STRONG_INLINE void | resizeLike (const EigenBase< OtherDerived > &_other) |
Resizes *this to have the same dimensions as other. | |
| EIGEN_STRONG_INLINE void | conservativeResize (Index rows, Index cols) |
| Resizes the matrix to rows x cols while leaving old values untouched. | |
| EIGEN_STRONG_INLINE void | conservativeResize (Index rows, NoChange_t) |
| Resizes the matrix to rows x cols while leaving old values untouched. | |
| EIGEN_STRONG_INLINE void | conservativeResize (NoChange_t, Index cols) |
| Resizes the matrix to rows x cols while leaving old values untouched. | |
| EIGEN_STRONG_INLINE void | conservativeResize (Index size) |
| Resizes the vector to size while retaining old values. | |
| EIGEN_STRONG_INLINE void | conservativeResizeLike (const DenseBase< OtherDerived > &other) |
Resizes the matrix to rows x cols of other, while leaving old values untouched. | |
| EIGEN_STRONG_INLINE Derived & | lazyAssign (const DenseBase< 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 | |
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. These methods do not allow to specify strides. If you need to specify strides, you have to use the Map class directly.
| |
| 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 StridedConstMapType < Stride< Outer, Inner > >::type | Map (const Scalar *data, const Stride< Outer, Inner > &stride) |
| static StridedMapType< Stride < Outer, Inner > >::type | Map (Scalar *data, const Stride< Outer, Inner > &stride) |
| static StridedConstMapType < Stride< Outer, Inner > >::type | Map (const Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
| static StridedMapType< Stride < Outer, Inner > >::type | Map (Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
| static StridedConstMapType < Stride< Outer, Inner > >::type | Map (const Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
| static StridedMapType< Stride < Outer, Inner > >::type | Map (Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
| 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) |
| static StridedConstAlignedMapType < Stride< Outer, Inner > >::type | MapAligned (const Scalar *data, const Stride< Outer, Inner > &stride) |
| static StridedAlignedMapType < Stride< Outer, Inner > >::type | MapAligned (Scalar *data, const Stride< Outer, Inner > &stride) |
| static StridedConstAlignedMapType < Stride< Outer, Inner > >::type | MapAligned (const Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
| static StridedAlignedMapType < Stride< Outer, Inner > >::type | MapAligned (Scalar *data, Index size, const Stride< Outer, Inner > &stride) |
| static StridedConstAlignedMapType < Stride< Outer, Inner > >::type | MapAligned (const Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
| static StridedAlignedMapType < Stride< Outer, Inner > >::type | MapAligned (Scalar *data, Index rows, Index cols, const Stride< Outer, Inner > &stride) |
Protected Member Functions | |
| EIGEN_STRONG_INLINE void | _resize_to_match (const EigenBase< OtherDerived > &other) |
| EIGEN_STRONG_INLINE Derived & | _set (const DenseBase< OtherDerived > &other) |
Copies the value of the expression other into *this with automatic resizing. | |
| EIGEN_STRONG_INLINE void | _set_selector (const OtherDerived &other, const internal::true_type &) |
| EIGEN_STRONG_INLINE void | _set_selector (const OtherDerived &other, const internal::false_type &) |
| EIGEN_STRONG_INLINE Derived & | _set_noalias (const DenseBase< OtherDerived > &other) |
| EIGEN_STRONG_INLINE void | _init2 (Index rows, Index cols, typename internal::enable_if< Base::SizeAtCompileTime!=2, T0 >::type *=0) |
| EIGEN_STRONG_INLINE void | _init2 (const Scalar &x, const Scalar &y, typename internal::enable_if< Base::SizeAtCompileTime==2, T0 >::type *=0) |
| void | _swap (DenseBase< OtherDerived > const &other) |
Protected Attributes | |
| DenseStorage< Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options > | m_storage |
Friends | |
| struct | internal::conservative_resize_like_impl |
| struct | internal::matrix_swap_impl |
| 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 > |
typedef Eigen::Map<Derived, Aligned> Eigen::PlainObjectBase::AlignedMapType [inherited] |
| typedef PlainObjectBase<Array> Eigen::Array::Base |
typedef const Eigen::Map<const Derived, Aligned> Eigen::PlainObjectBase::ConstAlignedMapType [inherited] |
typedef const Eigen::Map<const Derived, Unaligned> Eigen::PlainObjectBase::ConstMapType [inherited] |
typedef Derived Eigen::PlainObjectBase::DenseType [inherited] |
typedef internal::traits<Derived>::Index Eigen::PlainObjectBase::Index [inherited] |
typedef Eigen::Map<Derived, Unaligned> Eigen::PlainObjectBase::MapType [inherited] |
typedef internal::packet_traits<Scalar>::type Eigen::PlainObjectBase::PacketScalar [inherited] |
| typedef Base::PlainObject Eigen::Array::PlainObject |
typedef NumTraits<Scalar>::Real Eigen::PlainObjectBase::RealScalar [inherited] |
typedef internal::traits<Derived>::Scalar Eigen::PlainObjectBase::Scalar [inherited] |
typedef internal::traits<Derived>::StorageKind Eigen::PlainObjectBase::StorageKind [inherited] |
| EIGEN_STRONG_INLINE Eigen::Array::Array | ( | ) | [inline, explicit] |
Default constructor.
For fixed-size matrices, does nothing.
For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix is called a null matrix. This constructor is the unique way to create null matrices: resizing a matrix to 0 is not supported.
| EIGEN_STRONG_INLINE Eigen::Array::Array | ( | Index | dim | ) | [inline, explicit] |
constructs an uninitialized matrix with rows rows and cols columns.
This is useful for dynamic-size matrices. For fixed-size matrices, it is redundant to pass these parameters, so one should use the default constructor Matrix() instead.
constructs an initialized 2D vector with given coefficients
| EIGEN_STRONG_INLINE Eigen::Array::Array | ( | const ArrayBase< OtherDerived > & | other | ) | [inline] |
| EIGEN_STRONG_INLINE Eigen::Array::Array | ( | const Array & | other | ) | [inline] |
| EIGEN_STRONG_INLINE Eigen::Array::Array | ( | const ReturnByValue< OtherDerived > & | other | ) | [inline] |
| EIGEN_STRONG_INLINE Eigen::Array::Array | ( | const EigenBase< OtherDerived > & | other | ) | [inline] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::_resize_to_match | ( | const EigenBase< OtherDerived > & | other | ) | [inline, protected, inherited] |
| EIGEN_STRONG_INLINE Derived& Eigen::PlainObjectBase::_set | ( | const DenseBase< OtherDerived > & | other | ) | [inline, protected, inherited] |
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.
| EIGEN_STRONG_INLINE Derived& Eigen::PlainObjectBase::_set_noalias | ( | const DenseBase< OtherDerived > & | other | ) | [inline, protected, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::_set_selector | ( | const OtherDerived & | other, |
| const internal::true_type & | |||
| ) | [inline, protected, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::_set_selector | ( | const OtherDerived & | other, |
| const internal::false_type & | |||
| ) | [inline, protected, inherited] |
| void Eigen::PlainObjectBase::_swap | ( | DenseBase< OtherDerived > const & | other | ) | [inline, protected, inherited] |
| const Base& Eigen::PlainObjectBase::base | ( | ) | const [inline, inherited] |
| EIGEN_STRONG_INLINE Index Eigen::PlainObjectBase::cols | ( | void | ) | const [inline, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::conservativeResize | ( | Index | rows, |
| Index | cols | ||
| ) | [inline, inherited] |
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.
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::conservativeResize | ( | Index | rows, |
| NoChange_t | |||
| ) | [inline, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::conservativeResize | ( | NoChange_t | , |
| Index | cols | ||
| ) | [inline, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::conservativeResize | ( | Index | size | ) | [inline, inherited] |
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.
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::conservativeResizeLike | ( | const DenseBase< OtherDerived > & | other | ) | [inline, inherited] |
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.
| EIGEN_STRONG_INLINE const Scalar* Eigen::PlainObjectBase::data | ( | ) | const [inline, inherited] |
| EIGEN_STRONG_INLINE Scalar* Eigen::PlainObjectBase::data | ( | ) | [inline, inherited] |
| EIGEN_STRONG_INLINE Derived& Eigen::PlainObjectBase::lazyAssign | ( | const DenseBase< OtherDerived > & | other | ) | [inline, inherited] |
| static ConstMapType Eigen::PlainObjectBase::Map | ( | const Scalar * | data | ) | [inline, static, inherited] |
| static ConstMapType Eigen::PlainObjectBase::Map | ( | const Scalar * | data, |
| Index | size | ||
| ) | [inline, static, inherited] |
| static ConstMapType Eigen::PlainObjectBase::Map | ( | const Scalar * | data, |
| Index | rows, | ||
| Index | cols | ||
| ) | [inline, static, inherited] |
| static ConstAlignedMapType Eigen::PlainObjectBase::MapAligned | ( | const Scalar * | data | ) | [inline, static, inherited] |
| static AlignedMapType Eigen::PlainObjectBase::MapAligned | ( | Scalar * | data | ) | [inline, static, inherited] |
| static ConstAlignedMapType Eigen::PlainObjectBase::MapAligned | ( | const Scalar * | data, |
| Index | size | ||
| ) | [inline, static, inherited] |
| static AlignedMapType Eigen::PlainObjectBase::MapAligned | ( | Scalar * | data, |
| Index | size | ||
| ) | [inline, static, inherited] |
| static ConstAlignedMapType Eigen::PlainObjectBase::MapAligned | ( | const Scalar * | data, |
| Index | rows, | ||
| Index | cols | ||
| ) | [inline, static, inherited] |
| static AlignedMapType Eigen::PlainObjectBase::MapAligned | ( | Scalar * | data, |
| Index | rows, | ||
| Index | cols | ||
| ) | [inline, static, inherited] |
| EIGEN_STRONG_INLINE Array& Eigen::Array::operator= | ( | const EigenBase< OtherDerived > & | other | ) | [inline] |
The usage of using Base::operator=; fails on MSVC.
Since the code below is working with GCC and MSVC, we skipped the usage of 'using'. This should be done only for operator=.
Reimplemented from Eigen::PlainObjectBase< Array< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >.
| EIGEN_STRONG_INLINE Array& Eigen::Array::operator= | ( | const ArrayBase< OtherDerived > & | other | ) | [inline] |
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.
| EIGEN_STRONG_INLINE PacketScalar Eigen::PlainObjectBase::packet | ( | Index | row, |
| Index | col | ||
| ) | const [inline, inherited] |
| EIGEN_STRONG_INLINE PacketScalar Eigen::PlainObjectBase::packet | ( | Index | index | ) | const [inline, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::resize | ( | Index | rows, |
| Index | cols | ||
| ) | [inline, inherited] |
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:
| void Eigen::PlainObjectBase::resize | ( | Index | size | ) | [inline, inherited] |
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:
| void Eigen::PlainObjectBase::resize | ( | NoChange_t | , |
| Index | cols | ||
| ) | [inline, inherited] |
| void Eigen::PlainObjectBase::resize | ( | Index | rows, |
| NoChange_t | |||
| ) | [inline, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::resizeLike | ( | const EigenBase< OtherDerived > & | _other | ) | [inline, inherited] |
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.
| EIGEN_STRONG_INLINE Index Eigen::PlainObjectBase::rows | ( | void | ) | const [inline, inherited] |
Resizes to the given size, and sets all coefficients in this expression to the given value.
Example:
Output:
| Derived& Eigen::PlainObjectBase::setConstant | ( | Index | rows, |
| Index | cols, | ||
| const Scalar & | value | ||
| ) | [inherited] |
Resizes to the given size, and sets all coefficients in this expression to the given value.
| rows | the new number of rows |
| cols | the new number of columns |
| value | the value to which all coefficients are set |
Example:
Output:
| Derived& Eigen::PlainObjectBase::setOnes | ( | Index | size | ) | [inherited] |
Resizes to the given size, and sets all coefficients in this expression to one.
Example:
Output:
Resizes to the given size, and sets all coefficients in this expression to one.
| rows | the new number of rows |
| cols | the new number of columns |
Example:
Output:
| Derived& Eigen::PlainObjectBase::setRandom | ( | Index | size | ) | [inherited] |
Resizes to the given size, and sets all coefficients in this expression to random values.
Example:
Output:
Resizes to the given size, and sets all coefficients in this expression to random values.
| rows | the new number of rows |
| cols | the new number of columns |
Example:
Output:
| Derived& Eigen::PlainObjectBase::setZero | ( | Index | size | ) | [inherited] |
Resizes to the given size, and sets all coefficients in this expression to zero.
Example:
Output:
Resizes to the given size, and sets all coefficients in this expression to zero.
| rows | the new number of rows |
| cols | the new number of columns |
Example:
Output:
| void Eigen::Array::swap | ( | ArrayBase< OtherDerived > const & | other | ) | [inline] |
Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the data pointers.
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::writePacket | ( | Index | row, |
| Index | col, | ||
| const PacketScalar & | x | ||
| ) | [inline, inherited] |
| EIGEN_STRONG_INLINE void Eigen::PlainObjectBase::writePacket | ( | Index | index, |
| const PacketScalar & | x | ||
| ) | [inline, inherited] |
friend class Eigen::Map [friend, inherited] |
friend class Eigen::Map< const Derived, Aligned > [friend, inherited] |
friend class Eigen::Map< const Derived, Unaligned > [friend, inherited] |
friend class Eigen::Map< Derived, Aligned > [friend, inherited] |
friend class Eigen::Map< Derived, Unaligned > [friend, inherited] |
friend struct internal::conservative_resize_like_impl [friend] |
friend struct internal::matrix_swap_impl [friend] |
DenseStorage<Scalar, Base::MaxSizeAtCompileTime, Base::RowsAtCompileTime, Base::ColsAtCompileTime, Options> Eigen::PlainObjectBase::m_storage [protected, inherited] |
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |