template<typename ExpressionType, int Direction>
class Eigen::VectorwiseOp< ExpressionType, Direction >
Pseudo expression providing partial reduction operations.
- 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:
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
- 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 |
|
HomogeneousReturnType | homogeneous () const |
|
const HypotNormReturnType | hypotNorm () 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 >, 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 >, 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 |
|
const ReverseReturnType | reverse () const |
|
void | reverseInPlace () |
|
const SquaredNormReturnType | squaredNorm () const |
|
const StableNormReturnType | stableNorm () const |
|
const SumReturnType | sum () const |
|
template<typename ExpressionType , int Direction>
template<typename OtherDerived >
- Returns
- a matrix expression of the cross product of each column or row of the referenced expression with the other vector.
The referenced matrix must have one dimension equal to 3. The result matrix has the same dimensions than the referenced one.
This is defined in the Geometry module.
#include <Eigen/Geometry>
- See also
- MatrixBase::cross()
References Eigen::Vertical.
template<typename ExpressionType , int Direction>
This is defined in the Geometry module.
#include <Eigen/Geometry>
- Returns
- an expression of the homogeneous normalized vector of
*this
Example:
cout << "The matrix M is:" << endl << M << endl << endl;
cout << "M.colwise().hnormalized():" << endl << M.colwise().hnormalized() << endl << endl;
cout << "P*M:" << endl << P*M << endl << endl;
cout << "(P*M).colwise().hnormalized():" << endl << (P*M).colwise().hnormalized() << endl << endl;
Output:
The matrix M is:
0.68 0.823 -0.444 -0.27 0.271
-0.211 -0.605 0.108 0.0268 0.435
0.566 -0.33 -0.0452 0.904 -0.717
0.597 0.536 0.258 0.832 0.214
M.colwise().hnormalized():
1.14 1.53 -1.72 -0.325 1.27
-0.354 -1.13 0.419 0.0322 2.03
0.949 -0.614 -0.175 1.09 -3.35
P*M:
0.186 -0.589 0.369 1.33 -1.23
-0.871 -0.337 0.127 -0.715 0.091
-0.158 -0.0104 0.312 0.429 -0.478
0.992 0.777 -0.373 0.468 -0.651
(P*M).colwise().hnormalized():
0.188 -0.759 -0.989 2.85 1.89
-0.877 -0.433 -0.342 -1.53 -0.14
-0.16 -0.0134 -0.837 0.915 0.735
- See also
- MatrixBase::hnormalized()
References Eigen::Horizontal, and Eigen::Vertical.
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()