Eigen  3.3.7
Eigen::ArrayBase< Derived > Class Template Reference

Detailed Description

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

Public Member Functions

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
 
ColwiseReturnType colwise ()
 
ConstColwiseReturnType colwise () const
 
Index count () const
 
EvalReturnType eval () const
 
void fill (const Scalar &value)
 
template<unsigned int Added, unsigned int Removed>
const EIGEN_DEPRECATED Derived & flagged () const
 
const WithFormat< Derived > format (const IOFormat &fmt) const
 
bool hasNaN () const
 
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
 
internal::traits< Derived >::Scalar maxCoeff () const
 
template<typename IndexType >
internal::traits< Derived >::Scalar maxCoeff (IndexType *index) const
 
template<typename IndexType >
internal::traits< Derived >::Scalar maxCoeff (IndexType *row, IndexType *col) const
 
Scalar mean () const
 
internal::traits< Derived >::Scalar minCoeff () const
 
template<typename IndexType >
internal::traits< Derived >::Scalar minCoeff (IndexType *index) const
 
template<typename IndexType >
internal::traits< Derived >::Scalar minCoeff (IndexType *row, IndexType *col) const
 
const NestByValue< Derived > nestByValue () const
 
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...
 
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, Dynamicreplicate (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 >
Index cols () const
 
Index colStride () const
 
Derived & derived ()
 
const Derived & derived () const
 
Index innerStride () const
 
Index outerStride () const
 
Index rows () const
 
Index rowStride () const
 
Index size () const
 
- Public Member Functions inherited from Eigen::DenseCoeffsBase< Derived, WriteAccessors >
Scalar & coeffRef (Index index)
 
Scalar & coeffRef (Index row, Index col)
 
Index cols () const
 
Derived & derived ()
 
const Derived & derived () const
 
Scalar & operator() (Index index)
 
Scalar & operator() (Index row, Index col)
 
Scalar & operator[] (Index index)
 
Index rows () const
 
Index size () const
 
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
 
Index cols () const
 
Derived & derived ()
 
const Derived & derived () const
 
CoeffReturnType operator() (Index index) const
 
CoeffReturnType operator() (Index row, Index col) const
 
CoeffReturnType operator[] (Index index) const
 
Index rows () const
 
Index size () const
 
CoeffReturnType w () const
 
CoeffReturnType x () const
 
CoeffReturnType y () const
 
CoeffReturnType z () const
 
- Public Member Functions inherited from Eigen::EigenBase< Derived >
Index cols () const
 
Derived & derived ()
 
const Derived & derived () const
 
Index rows () const
 
Index size () const
 

Related Functions

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

Additional Inherited Members

- Public Types inherited from Eigen::DenseBase< Derived >
enum  {
  RowsAtCompileTime,
  ColsAtCompileTime,
  SizeAtCompileTime,
  MaxRowsAtCompileTime,
  MaxColsAtCompileTime,
  MaxSizeAtCompileTime,
  IsVectorAtCompileTime,
  Flags,
  IsRowMajor
}
 
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 >::MaxColsAtCompileTimePlainArray
 
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 >::MaxColsAtCompileTimePlainMatrix
 
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 const SequentialLinSpacedReturnType LinSpaced (Sequential_t, const Scalar &low, const Scalar &high)
 
static const SequentialLinSpacedReturnType LinSpaced (Sequential_t, Index size, const Scalar &low, const Scalar &high)
 
template<typename CustomNullaryOp >
const CwiseNullaryOp< CustomNullaryOp, typename DenseBase< Derived >::PlainObjectNullaryExpr (const CustomNullaryOp &func)
 
template<typename CustomNullaryOp >
const CwiseNullaryOp< CustomNullaryOp, typename DenseBase< Derived >::PlainObjectNullaryExpr (Index rows, Index cols, const CustomNullaryOp &func)
 
template<typename CustomNullaryOp >
const CwiseNullaryOp< CustomNullaryOp, typename DenseBase< Derived >::PlainObjectNullaryExpr (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 ()
 

Member Function Documentation

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

Friends And Related Function Documentation

◆ 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
ScalarExponentis 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
Scalaris 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::DenseCoeffsBase< Derived, WriteAccessors >::x
Scalar & x()
Definition: DenseCoeffsBase.h:433
Eigen::ArrayBase::pow
const CwiseBinaryOp< internal::scalar_pow_op< Derived::Scalar, ScalarExponent >, Derived, Constant< ScalarExponent > > pow(const Eigen::ArrayBase< Derived > &x, const ScalarExponent &exponent)