W3cubDocs

/Eigen3

Eigen::ArrayBase

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

Base class for all 1D and 2D array, and related expressions.

An array is similar to a dense vector or matrix. While matrices are mathematical objects with well defined linear algebra operators, an array is just a collection of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, all operations applied to an array are performed coefficient wise. Furthermore, arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient constructors allowing to easily write generic code working for both scalar values and arrays.

This class is the base that is inherited by all array expression types.

Template Parameters
Derived is the derived type, e.g., an array or an expression type.

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

See also
class MatrixBase, The class hierarchy
MatrixWrapper< Derived > matrix ()
template<typename OtherDerived >
Derived & operator*= (const ArrayBase< OtherDerived > &other)
template<typename OtherDerived >
Derived & operator+= (const ArrayBase< OtherDerived > &other)
template<typename OtherDerived >
Derived & operator-= (const ArrayBase< OtherDerived > &other)
template<typename OtherDerived >
Derived & operator/= (const ArrayBase< OtherDerived > &other)
Derived & operator= (const ArrayBase &other)
Derived & operator= (const Scalar &value)
- Public Member Functions inherited from Eigen::DenseBase< Derived >
bool all () const
bool allFinite () const
bool any () const
iterator begin ()
const_iterator begin () const
const_iterator cbegin () const
const_iterator cend () const
ColwiseReturnType colwise ()
ConstColwiseReturnType colwise () const
Index count () const
iterator end ()
const_iterator end () const
EvalReturnType eval () const
void fill (const Scalar &value)
template<unsigned int Added, unsigned int Removed>
EIGEN_DEPRECATED const Derived & flagged () const
const WithFormat< Derived > format (const IOFormat &fmt) const
bool hasNaN () const
EIGEN_CONSTEXPR Index innerSize () const
template<typename OtherDerived >
bool isApprox (const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
bool isApproxToConstant (const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
bool isConstant (const Scalar &value, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
template<typename OtherDerived >
bool isMuchSmallerThan (const DenseBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
template<typename Derived >
bool isMuchSmallerThan (const typename NumTraits< Scalar >::Real &other, const RealScalar &prec) const
bool isOnes (const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
bool isZero (const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
template<typename OtherDerived >
EIGEN_DEPRECATED Derived & lazyAssign (const DenseBase< OtherDerived > &other)
template<int NaNPropagation>
internal::traits< Derived >::Scalar maxCoeff () const
template<int NaNPropagation, typename IndexType >
internal::traits< Derived >::Scalar maxCoeff (IndexType *index) const
template<int NaNPropagation, typename IndexType >
internal::traits< Derived >::Scalar maxCoeff (IndexType *row, IndexType *col) const
Scalar mean () const
template<int NaNPropagation>
internal::traits< Derived >::Scalar minCoeff () const
template<int NaNPropagation, typename IndexType >
internal::traits< Derived >::Scalar minCoeff (IndexType *index) const
template<int NaNPropagation, typename IndexType >
internal::traits< Derived >::Scalar minCoeff (IndexType *row, IndexType *col) const
const NestByValue< Derived > nestByValue () const
EIGEN_CONSTEXPR Index nonZeros () const
template<typename OtherDerived >
CommaInitializer< Derived > operator<< (const DenseBase< OtherDerived > &other)
CommaInitializer< Derived > operator<< (const Scalar &s)
Derived & operator= (const DenseBase &other)
template<typename OtherDerived >
Derived & operator= (const DenseBase< OtherDerived > &other)
template<typename OtherDerived >
Derived & operator= (const EigenBase< OtherDerived > &other)
Copies the generic expression other into *this. More...
EIGEN_CONSTEXPR Index outerSize () const
Scalar prod () const
template<typename Func >
internal::traits< Derived >::Scalar redux (const Func &func) const
template<int RowFactor, int ColFactor>
const Replicate< Derived, RowFactor, ColFactor > replicate () const
const Replicate< Derived, Dynamic, Dynamic > replicate (Index rowFactor, Index colFactor) const
void resize (Index newSize)
void resize (Index rows, Index cols)
ReverseReturnType reverse ()
ConstReverseReturnType reverse () const
void reverseInPlace ()
RowwiseReturnType rowwise ()
ConstRowwiseReturnType rowwise () const
template<typename ThenDerived , typename ElseDerived >
const Select< Derived, ThenDerived, ElseDerived > select (const DenseBase< ThenDerived > &thenMatrix, const DenseBase< ElseDerived > &elseMatrix) const
template<typename ThenDerived >
const Select< Derived, ThenDerived, typename ThenDerived::ConstantReturnType > select (const DenseBase< ThenDerived > &thenMatrix, const typename ThenDerived::Scalar &elseScalar) const
template<typename ElseDerived >
const Select< Derived, typename ElseDerived::ConstantReturnType, ElseDerived > select (const typename ElseDerived::Scalar &thenScalar, const DenseBase< ElseDerived > &elseMatrix) const
Derived & setConstant (const Scalar &value)
Derived & setLinSpaced (const Scalar &low, const Scalar &high)
Sets a linearly spaced vector. More...
Derived & setLinSpaced (Index size, const Scalar &low, const Scalar &high)
Sets a linearly spaced vector. More...
Derived & setOnes ()
Derived & setRandom ()
Derived & setZero ()
Scalar sum () const
template<typename OtherDerived >
void swap (const DenseBase< OtherDerived > &other)
template<typename OtherDerived >
void swap (PlainObjectBase< OtherDerived > &other)
TransposeReturnType transpose ()
ConstTransposeReturnType transpose () const
void transposeInPlace ()
CoeffReturnType value () const
template<typename Visitor >
void visit (Visitor &func) const
- Public Member Functions inherited from Eigen::DenseCoeffsBase< Derived, DirectWriteAccessors >
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index colStride () const EIGEN_NOEXCEPT
Derived & derived ()
const Derived & derived () const
EIGEN_CONSTEXPR Index innerStride () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index outerStride () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index rowStride () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
- Public Member Functions inherited from Eigen::DenseCoeffsBase< Derived, WriteAccessors >
Scalar & coeffRef (Index index)
Scalar & coeffRef (Index row, Index col)
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
Derived & derived ()
const Derived & derived () const
Scalar & operator() (Index index)
Scalar & operator() (Index row, Index col)
Scalar & operator[] (Index index)
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
Scalar & w ()
Scalar & x ()
Scalar & y ()
Scalar & z ()
- Public Member Functions inherited from Eigen::DenseCoeffsBase< Derived, ReadOnlyAccessors >
CoeffReturnType coeff (Index index) const
CoeffReturnType coeff (Index row, Index col) const
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
Derived & derived ()
const Derived & derived () const
CoeffReturnType operator() (Index index) const
CoeffReturnType operator() (Index row, Index col) const
CoeffReturnType operator[] (Index index) const
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT
CoeffReturnType w () const
CoeffReturnType x () const
CoeffReturnType y () const
CoeffReturnType z () const
- Public Member Functions inherited from Eigen::EigenBase< Derived >
EIGEN_CONSTEXPR Index cols () const EIGEN_NOEXCEPT
Derived & derived ()
const Derived & derived () const
EIGEN_CONSTEXPR Index rows () const EIGEN_NOEXCEPT
EIGEN_CONSTEXPR Index size () const EIGEN_NOEXCEPT

(Note that these are not member functions.)

template<typename Derived , typename ExponentDerived >
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_pow_op< typename Derived::Scalar, typename ExponentDerived::Scalar >, const Derived, const ExponentDerived > pow (const Eigen::ArrayBase< Derived > &x, const Eigen::ArrayBase< ExponentDerived > &exponents)
template<typename Derived , typename ScalarExponent >
const CwiseBinaryOp< internal::scalar_pow_op< Derived::Scalar, ScalarExponent >, Derived, Constant< ScalarExponent > > pow (const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)
template<typename Scalar , typename Derived >
const CwiseBinaryOp< internal::scalar_pow_op< Scalar, Derived::Scalar >, Constant< Scalar >, Derived > pow (const Scalar &x, const Eigen::ArrayBase< Derived > &x)
- Related Functions inherited from Eigen::DenseBase< Derived >
template<typename Derived >
std::ostream & operator<< (std::ostream &s, const DenseBase< Derived > &m)
- Public Types inherited from Eigen::DenseBase< Derived >
enum {
RowsAtCompileTime ,
ColsAtCompileTime ,
SizeAtCompileTime ,
MaxRowsAtCompileTime ,
MaxColsAtCompileTime ,
MaxSizeAtCompileTime ,
IsVectorAtCompileTime ,
NumDimensions ,
Flags ,
IsRowMajor ,
InnerSizeAtCompileTime ,
InnerStrideAtCompileTime ,
OuterStrideAtCompileTime
}
typedef random_access_iterator_type const_iterator
typedef random_access_iterator_type iterator
typedef Array< typename internal::traits< Derived >::Scalar, internal::traits< Derived >::RowsAtCompileTime, internal::traits< Derived >::ColsAtCompileTime, AutoAlign|(internal::traits< Derived >::Flags &RowMajorBit ? RowMajor :ColMajor), internal::traits< Derived >::MaxRowsAtCompileTime, internal::traits< Derived >::MaxColsAtCompileTime > PlainArray
typedef Matrix< typename internal::traits< Derived >::Scalar, internal::traits< Derived >::RowsAtCompileTime, internal::traits< Derived >::ColsAtCompileTime, AutoAlign|(internal::traits< Derived >::Flags &RowMajorBit ? RowMajor :ColMajor), internal::traits< Derived >::MaxRowsAtCompileTime, internal::traits< Derived >::MaxColsAtCompileTime > PlainMatrix
typedef internal::conditional< internal::is_same< typename internal::traits< Derived >::XprKind, MatrixXpr >::value, PlainMatrix, PlainArray >::type PlainObject
The plain matrix or array type corresponding to this expression. More...
typedef internal::traits< Derived >::Scalar Scalar
typedef internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices. More...
typedef Scalar value_type
- Public Types inherited from Eigen::EigenBase< Derived >
typedef Eigen::Index Index
The interface type of indices. More...
- Static Public Member Functions inherited from Eigen::DenseBase< Derived >
static const ConstantReturnType Constant (const Scalar &value)
static const ConstantReturnType Constant (Index rows, Index cols, const Scalar &value)
static const ConstantReturnType Constant (Index size, const Scalar &value)
static const RandomAccessLinSpacedReturnType LinSpaced (const Scalar &low, const Scalar &high)
Sets a linearly spaced vector. More...
static const RandomAccessLinSpacedReturnType LinSpaced (Index size, const Scalar &low, const Scalar &high)
Sets a linearly spaced vector. More...
static EIGEN_DEPRECATED const RandomAccessLinSpacedReturnType LinSpaced (Sequential_t, const Scalar &low, const Scalar &high)
static EIGEN_DEPRECATED const RandomAccessLinSpacedReturnType LinSpaced (Sequential_t, Index size, const Scalar &low, const Scalar &high)
template<typename CustomNullaryOp >
static const CwiseNullaryOp< CustomNullaryOp, PlainObject > NullaryExpr (const CustomNullaryOp &func)
template<typename CustomNullaryOp >
static const CwiseNullaryOp< CustomNullaryOp, PlainObject > NullaryExpr (Index rows, Index cols, const CustomNullaryOp &func)
template<typename CustomNullaryOp >
static const CwiseNullaryOp< CustomNullaryOp, PlainObject > NullaryExpr (Index size, const CustomNullaryOp &func)
static const ConstantReturnType Ones ()
static const ConstantReturnType Ones (Index rows, Index cols)
static const ConstantReturnType Ones (Index size)
static const RandomReturnType Random ()
static const RandomReturnType Random (Index rows, Index cols)
static const RandomReturnType Random (Index size)
static const ConstantReturnType Zero ()
static const ConstantReturnType Zero (Index rows, Index cols)
static const ConstantReturnType Zero (Index size)
- Protected Member Functions inherited from Eigen::DenseBase< Derived >
DenseBase ()

matrix()

template<typename Derived >
MatrixWrapper<Derived> Eigen::ArrayBase< Derived >::matrix ( )
inline
Returns
an Matrix expression of this array
See also
MatrixBase::array()

operator*=()

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

replaces *this by *this * other coefficient wise.

Returns
a reference to *this

operator+=()

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

replaces *this by *this + other.

Returns
a reference to *this

operator-=()

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

replaces *this by *this - other.

Returns
a reference to *this

operator/=()

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

replaces *this by *this / other coefficient wise.

Returns
a reference to *this

operator=() [1/2]

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

Special case of the template operator=, in order to prevent the compiler from generating a default operator= (issue hit with g++ 4.1)

operator=() [2/2]

template<typename Derived >
Derived& Eigen::ArrayBase< Derived >::operator= ( const Scalar & value )
inline

Set all the entries to value.

See also
DenseBase::setConstant(), DenseBase::fill()

pow() [1/3]

template<typename Derived , typename ExponentDerived >
const Eigen::CwiseBinaryOp< Eigen::internal::scalar_pow_op< typename Derived::Scalar, typename ExponentDerived::Scalar >, const Derived, const ExponentDerived > pow ( const Eigen::ArrayBase< Derived > & x,
const Eigen::ArrayBase< ExponentDerived > & exponents
)
related
Returns
an expression of the coefficient-wise power of x to the given array of exponents.

This function computes the coefficient-wise power.

Example:

Array<double,1,3> x(8,25,3),
                  e(1./3.,0.5,2.);
cout << "[" << x << "]^[" << e << "] = " << x.pow(e) << endl; // using ArrayBase::pow
cout << "[" << x << "]^[" << e << "] = " << pow(x,e) << endl; // using Eigen::pow

Output:

[ 8 25  3]^[0.333   0.5     2] = 2 5 9
[ 8 25  3]^[0.333   0.5     2] = 2 5 9
See also
ArrayBase::pow()

pow() [2/3]

template<typename Derived , typename ScalarExponent >
const CwiseBinaryOp< internal::scalar_pow_op< Derived::Scalar, ScalarExponent >, Derived, Constant< ScalarExponent > > pow ( const Eigen::ArrayBase< Derived > & x,
const ScalarExponent & exponent
)
related
Returns
an expression of the coefficient-wise power of x to the given constant exponent.
Template Parameters
ScalarExponent is the scalar type of exponent. It must be compatible with the scalar type of the given expression (Derived::Scalar).
See also
ArrayBase::pow()

pow() [3/3]

template<typename Scalar , typename Derived >
const CwiseBinaryOp< internal::scalar_pow_op< Scalar, Derived::Scalar >, Constant< Scalar >, Derived > pow ( const Scalar & x,
const Eigen::ArrayBase< Derived > & x
)
related
Returns
an expression of the coefficient-wise power of the scalar x to the given array of exponents.

This function computes the coefficient-wise power between a scalar and an array of exponents.

Template Parameters
Scalar is the scalar type of x. It must be compatible with the scalar type of the given array expression (Derived::Scalar).

Example:

Array<double,1,3> e(2,-3,1./3.);
cout << "10^[" << e << "] = " << pow(10,e) << endl;

Output:

10^[    2    -3 0.333] =   100 0.001  2.15
See also
ArrayBase::pow()

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

© Eigen.
Licensed under the MPL2 License.
https://eigen.tuxfamily.org/dox/classEigen_1_1ArrayBase.html