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) |
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;
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
Public Types | |
typedef ExpressionType::PlainMatrixType | CrossReturnType |
typedef ei_meta_if < ei_must_nest_by_value < ExpressionType >::ret, ExpressionType, const ExpressionType & >::ret | ExpressionTypeNested |
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 >::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 > ::Type | squaredNorm () const |
const ReturnType < ei_member_sum >::Type | sum () const |
Protected Attributes | |
ExpressionTypeNested | m_matrix |
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).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;
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] |
#include <Eigen/Geometry>
const ReturnType<ei_member_maxCoeff>::Type maxCoeff | ( | ) | const [inline] |
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;
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] |
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;
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>::Type norm | ( | ) | const [inline] |
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;
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
const ReturnType<ei_member_squaredNorm>::Type squaredNorm | ( | ) | const [inline] |
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;
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] |
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;
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