|
enum | { isVertical = (Direction==Vertical) ? 1 : 0
, isHorizontal = (Direction==Horizontal) ? 1 : 0
} |
|
enum | { HNormalized_Size
, HNormalized_SizeMinusOne = HNormalized_Size==Dynamic ? Dynamic : HNormalized_Size-1
} |
|
typedef ExpressionType::Scalar | Scalar |
|
typedef ExpressionType::RealScalar | RealScalar |
|
typedef Eigen::Index | Index |
|
typedef internal::ref_selector< ExpressionType >::non_const_type | ExpressionTypeNested |
|
typedef internal::remove_all< ExpressionTypeNested >::type | ExpressionTypeNestedCleaned |
|
typedef internal::subvector_stl_iterator< ExpressionType, DirectionType(Direction)> | iterator |
|
typedef internal::subvector_stl_iterator< const ExpressionType, DirectionType(Direction)> | const_iterator |
|
typedef internal::subvector_stl_reverse_iterator< ExpressionType, DirectionType(Direction)> | reverse_iterator |
|
typedef internal::subvector_stl_reverse_iterator< const ExpressionType, DirectionType(Direction)> | const_reverse_iterator |
|
typedef ReturnType< internal::member_minCoeff >::Type | MinCoeffReturnType |
|
typedef ReturnType< internal::member_maxCoeff >::Type | MaxCoeffReturnType |
|
typedef PartialReduxExpr< const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const ExpressionTypeNestedCleaned >, internal::member_sum< RealScalar, RealScalar >, Direction > | SquaredNormReturnType |
|
typedef CwiseUnaryOp< internal::scalar_sqrt_op< RealScalar >, const SquaredNormReturnType > | NormReturnType |
|
typedef ReturnType< internal::member_blueNorm, RealScalar >::Type | BlueNormReturnType |
|
typedef ReturnType< internal::member_stableNorm, RealScalar >::Type | StableNormReturnType |
|
typedef ReturnType< internal::member_hypotNorm, RealScalar >::Type | HypotNormReturnType |
|
typedef ReturnType< internal::member_sum >::Type | SumReturnType |
|
typedef ReturnType< internal::member_all >::Type | AllReturnType |
|
typedef ReturnType< internal::member_any >::Type | AnyReturnType |
|
typedef PartialReduxExpr< ExpressionType, internal::member_count< Index, Scalar >, Direction > | CountReturnType |
|
typedef ReturnType< internal::member_prod >::Type | ProdReturnType |
|
typedef Reverse< const ExpressionType, Direction > | ConstReverseReturnType |
|
typedef Reverse< ExpressionType, Direction > | ReverseReturnType |
|
typedef Replicate< ExpressionType,(isVertical?Dynamic:1),(isHorizontal?Dynamic:1)> | ReplicateReturnType |
|
typedef Homogeneous< ExpressionType, Direction > | HomogeneousReturnType |
|
typedef ExpressionType::PlainObject | CrossReturnType |
|
typedef Block< const ExpressionType, Direction==Vertical ? int(HNormalized_SizeMinusOne) :int(internal::traits< ExpressionType >::RowsAtCompileTime), Direction==Horizontal ? int(HNormalized_SizeMinusOne) :int(internal::traits< ExpressionType >::ColsAtCompileTime)> | HNormalized_Block |
|
typedef Block< const ExpressionType, Direction==Vertical ? 1 :int(internal::traits< ExpressionType >::RowsAtCompileTime), Direction==Horizontal ? 1 :int(internal::traits< ExpressionType >::ColsAtCompileTime)> | HNormalized_Factors |
|
typedef CwiseBinaryOp< internal::scalar_quotient_op< typename internal::traits< ExpressionType >::Scalar >, const HNormalized_Block, const Replicate< HNormalized_Factors, Direction==Vertical ? HNormalized_SizeMinusOne :1, Direction==Horizontal ? HNormalized_SizeMinusOne :1 > > | HNormalizedReturnType |
|
|
EIGEN_DEVICE_FUNC | VectorwiseOp (ExpressionType &matrix) |
|
EIGEN_DEVICE_FUNC const ExpressionType & | _expression () const |
|
iterator | begin () |
| returns an iterator to the first row (rowwise) or column (colwise) of the nested expression. More...
|
|
const_iterator | begin () const |
| const version of begin() More...
|
|
const_iterator | cbegin () const |
| const version of begin() More...
|
|
reverse_iterator | rbegin () |
| returns a reverse iterator to the last row (rowwise) or column (colwise) of the nested expression. More...
|
|
const_reverse_iterator | rbegin () const |
| const version of rbegin() More...
|
|
const_reverse_iterator | crbegin () const |
| const version of rbegin() More...
|
|
iterator | end () |
| returns an iterator to the row (resp. More...
|
|
const_iterator | end () const |
| const version of end() More...
|
|
const_iterator | cend () const |
| const version of end() More...
|
|
reverse_iterator | rend () |
| returns a reverse iterator to the row (resp. More...
|
|
const_reverse_iterator | rend () const |
| const version of rend() More...
|
|
const_reverse_iterator | crend () const |
| const version of rend() More...
|
|
template<typename BinaryOp > |
EIGEN_DEVICE_FUNC const ReduxReturnType< BinaryOp >::Type | redux (const BinaryOp &func=BinaryOp()) const |
|
typedef | EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE (SumReturnType, Scalar, quotient) MeanReturnType |
|
EIGEN_DEVICE_FUNC const MinCoeffReturnType | minCoeff () const |
|
EIGEN_DEVICE_FUNC const MaxCoeffReturnType | maxCoeff () const |
|
EIGEN_DEVICE_FUNC const SquaredNormReturnType | squaredNorm () const |
|
EIGEN_DEVICE_FUNC const NormReturnType | norm () const |
|
template<int p> |
EIGEN_DEVICE_FUNC const LpNormReturnType< p >::Type | lpNorm () const |
|
EIGEN_DEVICE_FUNC const BlueNormReturnType | blueNorm () const |
|
EIGEN_DEVICE_FUNC const StableNormReturnType | stableNorm () const |
|
EIGEN_DEVICE_FUNC const HypotNormReturnType | hypotNorm () const |
|
EIGEN_DEVICE_FUNC const SumReturnType | sum () const |
|
EIGEN_DEVICE_FUNC const MeanReturnType | mean () const |
|
EIGEN_DEVICE_FUNC const AllReturnType | all () const |
|
EIGEN_DEVICE_FUNC const AnyReturnType | any () const |
|
EIGEN_DEVICE_FUNC const CountReturnType | count () const |
|
EIGEN_DEVICE_FUNC const ProdReturnType | prod () const |
|
EIGEN_DEVICE_FUNC const ConstReverseReturnType | reverse () const |
|
EIGEN_DEVICE_FUNC ReverseReturnType | reverse () |
|
EIGEN_DEVICE_FUNC const ReplicateReturnType | replicate (Index factor) const |
|
template<int Factor> |
const Replicate< ExpressionType, isVertical *Factor+isHorizontal, isHorizontal *Factor+isVertical > EIGEN_DEVICE_FUNC | replicate (Index factor=Factor) const |
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC ExpressionType & | operator= (const DenseBase< OtherDerived > &other) |
| Copies the vector other to each subvector of *this . More...
|
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC ExpressionType & | operator+= (const DenseBase< OtherDerived > &other) |
| Adds the vector other to each subvector of *this . More...
|
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC ExpressionType & | operator-= (const DenseBase< OtherDerived > &other) |
| Substracts the vector other to each subvector of *this . More...
|
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC ExpressionType & | operator*= (const DenseBase< OtherDerived > &other) |
| Multiples each subvector of *this by the vector other. More...
|
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC ExpressionType & | operator/= (const DenseBase< OtherDerived > &other) |
| Divides each subvector of *this by the vector other. More...
|
|
template<typename OtherDerived > |
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_sum_op< Scalar, typename OtherDerived::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > | operator+ (const DenseBase< OtherDerived > &other) const |
| Returns the expression of the sum of the vector other to each subvector of *this . More...
|
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_difference_op< Scalar, typename OtherDerived::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > | operator- (const DenseBase< OtherDerived > &other) const |
| Returns the expression of the difference between each subvector of *this and the vector other. More...
|
|
template<typename OtherDerived > |
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_product_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > EIGEN_DEVICE_FUNC | operator* (const DenseBase< OtherDerived > &other) const |
| Returns the expression where each subvector is the product of the vector other by the corresponding subvector of *this . More...
|
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > | operator/ (const DenseBase< OtherDerived > &other) const |
| Returns the expression where each subvector is the quotient of the corresponding subvector of *this by the vector other. More...
|
|
EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename OppositeExtendedType< NormReturnType >::Type > | normalized () const |
|
EIGEN_DEVICE_FUNC void | normalize () |
| Normalize in-place each row or columns of the referenced matrix. More...
|
|
EIGEN_DEVICE_FUNC void | reverseInPlace () |
| This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of *this . More...
|
|
EIGEN_DEVICE_FUNC HomogeneousReturnType | homogeneous () const |
|
template<typename OtherDerived > |
EIGEN_DEVICE_FUNC const CrossReturnType | cross (const MatrixBase< OtherDerived > &other) const |
|
EIGEN_DEVICE_FUNC const HNormalizedReturnType | hnormalized () const |
|
template<typename ExpressionType, int Direction>
class Eigen::VectorwiseOp< ExpressionType, Direction >
Pseudo expression providing broadcasting and partial reduction operations.
- Template Parameters
-
ExpressionType | the type of the object on which to do partial reductions |
Direction | indicates whether to operate on columns (Vertical) or rows (Horizontal) |
This class represents a pseudo expression with broadcasting and 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 explicitly used.
To understand the logic of rowwise/colwise expression, let's consider a generic case A.colwise().foo()
where foo
is any method of VectorwiseOp
. This expression is equivalent to applying foo()
to each column of A
and then re-assemble the outputs in a matrix expression:
[A.col(0).foo(), A.col(1).foo(), ..., A.col(A.cols()-1).foo()]
Example:
Output:
The begin() and end() methods are obviously exceptions to the previous rule as they return STL-compatible begin/end iterators to the rows or columns of the nested expression. Typical use cases include for-range-loop and calls to STL algorithms:
Example:
Output:
For a partial reduction on an empty input, some rules apply. For the sake of clarity, let's consider a vertical reduction:
- If the number of columns is zero, then a 1x0 row-major vector expression is returned.
- Otherwise, if the number of rows is zero, then
- a row vector of zeros is returned for sum-like reductions (sum, squaredNorm, norm, etc.)
- a row vector of ones is returned for a product reduction (e.g.,
MatrixXd(n,0).colwise().prod()
)
- an assert is triggered for all other reductions (minCoeff,maxCoeff,redux(bin_op))
- See also
- DenseBase::colwise(), DenseBase::rowwise(), class PartialReduxExpr