Pseudo expression providing partial reduction operations. More...
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 |
Pseudo expression providing partial reduction operations.
This is defined in the Array module.
#include <Eigen/Array>
ExpressionType | the type of the object on which to do partial reductions | |
Direction | indicates 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
const ReturnType<ei_member_all>::Type all | ( | ) | const [inline] |
true
.const ReturnType<ei_member_any>::Type any | ( | ) | const [inline] |
true
.const PartialReduxExpr<ExpressionType, ei_member_count<int>, Direction> count | ( | ) | const [inline] |
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
const CrossReturnType cross | ( | const MatrixBase< OtherDerived > & | other | ) | const [inline] |
This is defined in the Geometry module.
#include <Eigen/Geometry>
const ReturnType<ei_member_maxCoeff>::Type maxCoeff | ( | ) | const [inline] |
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
const ReturnType<ei_member_minCoeff>::Type minCoeff | ( | ) | const [inline] |
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
const ReturnType<ei_member_norm,RealScalar>::Type norm | ( | ) | const [inline] |
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
const PartialRedux< ExpressionType, Direction >::template ReduxReturnType< BinaryOp >::Type redux | ( | const BinaryOp & | func = BinaryOp() |
) | const [inline] |
*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.
const ReturnType<ei_member_squaredNorm,RealScalar>::Type squaredNorm | ( | ) | const [inline] |
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
const ReturnType<ei_member_sum>::Type sum | ( | ) | const [inline] |
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