template<typename ExpressionType, int Direction>
class Eigen::VectorwiseOp< ExpressionType, Direction >
Pseudo expression providing partial reduction operations.
- Template Parameters
-
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 DenseBase::colwise() and DenseBase::rowwise() and most of the time this is the only way it is used.
Example:
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.cwiseAbs().colwise().maxCoeff() << endl;
Output:
Here is the matrix m:
-1 -0.0827 -0.906
-0.737 0.0655 0.358
0.511 -0.562 0.359
Here is the sum of each column:
-1.23 -0.579 -0.19
Here is the maximum absolute value of each column:
1 0.562 0.906
- See also
- DenseBase::colwise(), DenseBase::rowwise(), class PartialReduxExpr
|
const AllReturnType | all () const |
|
const AnyReturnType | any () const |
|
const BlueNormReturnType | blueNorm () const |
|
const CountReturnType | count () const |
|
template<typename OtherDerived > |
const CrossReturnType | cross (const MatrixBase< OtherDerived > &other) const |
|
const HNormalizedReturnType | hnormalized () const |
| column or row-wise homogeneous normalization More...
|
|
HomogeneousReturnType | homogeneous () const |
|
const HypotNormReturnType | hypotNorm () const |
|
template<int p> |
const LpNormReturnType< p >::Type | lpNorm () const |
|
const MaxCoeffReturnType | maxCoeff () const |
|
const MeanReturnType | mean () const |
|
const MinCoeffReturnType | minCoeff () const |
|
const NormReturnType | norm () const |
|
void | normalize () |
|
CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename OppositeExtendedType< typename ReturnType< internal::member_norm, RealScalar >::Type >::Type > | normalized () const |
|
template<typename OtherDerived > |
CwiseBinaryOp< internal::scalar_product_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > | operator* (const DenseBase< OtherDerived > &other) const |
|
template<typename OtherDerived > |
ExpressionType & | operator*= (const DenseBase< OtherDerived > &other) |
|
template<typename OtherDerived > |
CwiseBinaryOp< internal::scalar_sum_op< Scalar, typename OtherDerived::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > | operator+ (const DenseBase< OtherDerived > &other) const |
|
template<typename OtherDerived > |
ExpressionType & | operator+= (const DenseBase< OtherDerived > &other) |
|
template<typename OtherDerived > |
CwiseBinaryOp< internal::scalar_difference_op< Scalar, typename OtherDerived::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > | operator- (const DenseBase< OtherDerived > &other) const |
|
template<typename OtherDerived > |
ExpressionType & | operator-= (const DenseBase< OtherDerived > &other) |
|
template<typename OtherDerived > |
CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > | operator/ (const DenseBase< OtherDerived > &other) const |
|
template<typename OtherDerived > |
ExpressionType & | operator/= (const DenseBase< OtherDerived > &other) |
|
template<typename OtherDerived > |
ExpressionType & | operator= (const DenseBase< OtherDerived > &other) |
|
const ProdReturnType | prod () const |
|
template<typename BinaryOp > |
const ReduxReturnType< BinaryOp >::Type | redux (const BinaryOp &func=BinaryOp()) const |
|
const ReplicateReturnType | replicate (Index factor) const |
|
template<int Factor> |
const Replicate< ExpressionType, isVertical *Factor+isHorizontal, isHorizontal *Factor+isVertical > | replicate (Index factor=Factor) const |
|
ReverseReturnType | reverse () |
|
const ConstReverseReturnType | reverse () const |
|
void | reverseInPlace () |
|
const SquaredNormReturnType | squaredNorm () const |
|
const StableNormReturnType | stableNorm () const |
|
const SumReturnType | sum () const |
|
template<typename ExpressionType , int Direction>
This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of *this
.
In most cases it is probably better to simply use the reversed expression of a matrix. However, when reversing the matrix data itself is really needed, then this "in-place" version is probably the right choice because it provides the following additional benefits:
- less error prone: doing the same operation with .reverse() requires special care:
- this API enables reverse operations without the need for a temporary
- See also
- DenseBase::reverseInPlace(), reverse()