Public Types | Public Member Functions | Protected Attributes
PartialRedux Class Reference

Pseudo expression providing partial reduction operations. More...

List of all members.

Public Types

typedef
ExpressionType::PlainMatrixType 
CrossReturnType
typedef ei_meta_if
< ei_must_nest_by_value
< ExpressionType >::ret,
ExpressionType, const
ExpressionType & >::ret 
ExpressionTypeNested
typedef NumTraits< Scalar >::Real RealScalar
typedef ei_traits
< ExpressionType >::Scalar 
Scalar

Public Member Functions

const ExpressionType & _expression () const
const ReturnType
< ei_member_all >::Type 
all () const
const ReturnType
< ei_member_any >::Type 
any () const
const PartialReduxExpr
< ExpressionType,
ei_member_count< int >
, Direction > 
count () const
template<typename OtherDerived >
const CrossReturnType cross (const MatrixBase< OtherDerived > &other) const
const ReturnType
< ei_member_maxCoeff >::Type 
maxCoeff () const
const ReturnType
< ei_member_minCoeff >::Type 
minCoeff () const
const ReturnType
< ei_member_norm, RealScalar >
::Type 
norm () const
 PartialRedux (const ExpressionType &matrix)
template<typename BinaryOp >
const ReduxReturnType
< BinaryOp >::Type 
redux (const BinaryOp &func=BinaryOp()) const
const ReturnType
< ei_member_squaredNorm,
RealScalar >::Type 
squaredNorm () const
const ReturnType
< ei_member_sum >::Type 
sum () const

Protected Attributes

ExpressionTypeNested m_matrix

Detailed Description

Pseudo expression providing partial reduction operations.

This is defined in the Array module.

 #include <Eigen/Array> 
Parameters:
ExpressionTypethe type of the object on which to do partial reductions
Directionindicates the direction of the redux (Vertical or Horizontal)

This class represents a pseudo expression with partial reduction features. It is the return type of MatrixBase::colwise() and MatrixBase::rowwise() and most of the time this is the only way it is used.

Example:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each column:" << endl << m.colwise().sum() << endl;
cout << "Here is the maximum absolute value of each column:"
     << endl << m.cwise().abs().colwise().maxCoeff() << endl;

Output:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the sum of each column:
  1.04  0.815 -0.238
Here is the maximum absolute value of each column:
 0.68 0.823 0.536
See also:
MatrixBase::colwise(), MatrixBase::rowwise(), class PartialReduxExpr

Member Function Documentation

const ReturnType<ei_member_all>::Type all ( ) const [inline]
Returns:
a row (or column) vector expression representing whether all coefficients of each respective column (or row) are true.
See also:
MatrixBase::all()
const ReturnType<ei_member_any>::Type any ( ) const [inline]
Returns:
a row (or column) vector expression representing whether at least one coefficient of each respective column (or row) is true.
See also:
MatrixBase::any()
const PartialReduxExpr<ExpressionType, ei_member_count<int>, Direction> count ( ) const [inline]
Returns:
a row (or column) vector expression representing the number of true coefficients of each respective column (or row).

Example:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the count of elements larger or equal than 0.5 of each row:" << endl << (m.cwise() >= 0.5).rowwise().count() << endl;

Output:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the count of elements larger or equal than 0.5 of each row:
2
2
1
See also:
MatrixBase::count()
const CrossReturnType cross ( const MatrixBase< OtherDerived > &  other) const [inline]
Returns:
a 3x3 matrix expression of the cross product of each column or row of the referenced expression with the other vector.

This is defined in the Geometry module.

 #include <Eigen/Geometry> 
See also:
MatrixBase::cross()
const ReturnType<ei_member_maxCoeff>::Type maxCoeff ( ) const [inline]
Returns:
a row (or column) vector expression of the largest coefficient of each column (or row) of the referenced expression.

Example:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the maximum of each column:" << endl << m.colwise().maxCoeff() << endl;

Output:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the maximum of each column:
 0.68 0.823 0.536
See also:
MatrixBase::maxCoeff()
const ReturnType<ei_member_minCoeff>::Type minCoeff ( ) const [inline]
Returns:
a row (or column) vector expression of the smallest coefficient of each column (or row) of the referenced expression.

Example:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the minimum of each column:" << endl << m.colwise().minCoeff() << endl;

Output:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the minimum of each column:
-0.211 -0.605 -0.444
See also:
MatrixBase::minCoeff()
const ReturnType<ei_member_norm,RealScalar>::Type norm ( ) const [inline]
Returns:
a row (or column) vector expression of the norm of each column (or row) of the referenced expression.

Example:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the norm of each column:" << endl << m.colwise().norm() << endl;

Output:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the norm of each column:
 0.91  1.18 0.771
See also:
MatrixBase::norm()
const PartialRedux< ExpressionType, Direction >::template ReduxReturnType< BinaryOp >::Type redux ( const BinaryOp &  func = BinaryOp()) const
Returns:
a row or column vector expression of *this reduxed by func

The template parameter BinaryOp is the type of the functor of the custom redux operator. Note that func must be an associative operator.

See also:
class PartialRedux, MatrixBase::colwise(), MatrixBase::rowwise()
const ReturnType<ei_member_squaredNorm,RealScalar>::Type squaredNorm ( ) const [inline]
Returns:
a row (or column) vector expression of the squared norm of each column (or row) of the referenced expression.

Example:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the square norm of each row:" << endl << m.rowwise().squaredNorm() << endl;

Output:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the square norm of each row:
0.928
1.01
0.884
See also:
MatrixBase::squaredNorm()
const ReturnType<ei_member_sum>::Type sum ( ) const [inline]
Returns:
a row (or column) vector expression of the sum of each column (or row) of the referenced expression.

Example:

Matrix3d m = Matrix3d::Random();
cout << "Here is the matrix m:" << endl << m << endl;
cout << "Here is the sum of each row:" << endl << m.rowwise().sum() << endl;

Output:

Here is the matrix m:
  0.68  0.597  -0.33
-0.211  0.823  0.536
 0.566 -0.605 -0.444
Here is the sum of each row:
0.948
1.15
-0.483
See also:
MatrixBase::sum()

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