VectorwiseOp.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008-2019 Gael Guennebaud <gael.guennebaud@inria.fr>
5 // Copyright (C) 2006-2008 Benoit Jacob <jacob.benoit.1@gmail.com>
6 //
7 // This Source Code Form is subject to the terms of the Mozilla
8 // Public License v. 2.0. If a copy of the MPL was not distributed
9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 
11 #ifndef EIGEN_PARTIAL_REDUX_H
12 #define EIGEN_PARTIAL_REDUX_H
13 
14 #include "./InternalHeaderCheck.h"
15 
16 namespace Eigen {
17 
34 template< typename MatrixType, typename MemberOp, int Direction>
35 class PartialReduxExpr;
36 
37 namespace internal {
38 template<typename MatrixType, typename MemberOp, int Direction>
39 struct traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
40  : traits<MatrixType>
41 {
42  typedef typename MemberOp::result_type Scalar;
43  typedef typename traits<MatrixType>::StorageKind StorageKind;
44  typedef typename traits<MatrixType>::XprKind XprKind;
45  typedef typename MatrixType::Scalar InputScalar;
46  enum {
47  RowsAtCompileTime = Direction==Vertical ? 1 : MatrixType::RowsAtCompileTime,
48  ColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::ColsAtCompileTime,
49  MaxRowsAtCompileTime = Direction==Vertical ? 1 : MatrixType::MaxRowsAtCompileTime,
50  MaxColsAtCompileTime = Direction==Horizontal ? 1 : MatrixType::MaxColsAtCompileTime,
51  Flags = RowsAtCompileTime == 1 ? RowMajorBit : 0,
52  TraversalSize = Direction==Vertical ? MatrixType::RowsAtCompileTime : MatrixType::ColsAtCompileTime
53  };
54 };
55 }
56 
57 template< typename MatrixType, typename MemberOp, int Direction>
58 class PartialReduxExpr : public internal::dense_xpr_base< PartialReduxExpr<MatrixType, MemberOp, Direction> >::type,
59  internal::no_assignment_operator
60 {
61  public:
62 
63  typedef typename internal::dense_xpr_base<PartialReduxExpr>::type Base;
65 
67  explicit PartialReduxExpr(const MatrixType& mat, const MemberOp& func = MemberOp())
68  : m_matrix(mat), m_functor(func) {}
69 
71  Index rows() const EIGEN_NOEXCEPT { return (Direction==Vertical ? 1 : m_matrix.rows()); }
73  Index cols() const EIGEN_NOEXCEPT { return (Direction==Horizontal ? 1 : m_matrix.cols()); }
74 
76  typename MatrixType::Nested nestedExpression() const { return m_matrix; }
77 
79  const MemberOp& functor() const { return m_functor; }
80 
81  protected:
82  typename MatrixType::Nested m_matrix;
83  const MemberOp m_functor;
84 };
85 
86 template<typename A,typename B> struct partial_redux_dummy_func;
87 
88 #define EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(MEMBER,COST,VECTORIZABLE,BINARYOP) \
89  template <typename ResultType,typename Scalar> \
90  struct member_##MEMBER { \
91  typedef ResultType result_type; \
92  typedef BINARYOP<Scalar,Scalar> BinaryOp; \
93  template<int Size> struct Cost { enum { value = COST }; }; \
94  enum { Vectorizable = VECTORIZABLE }; \
95  template<typename XprType> \
96  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE \
97  ResultType operator()(const XprType& mat) const \
98  { return mat.MEMBER(); } \
99  BinaryOp binaryFunc() const { return BinaryOp(); } \
100  }
101 
102 #define EIGEN_MEMBER_FUNCTOR(MEMBER,COST) \
103  EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(MEMBER,COST,0,partial_redux_dummy_func)
104 
105 namespace internal {
106 
110 EIGEN_MEMBER_FUNCTOR(hypotNorm, (Size-1) * functor_traits<scalar_hypot_op<Scalar> >::Cost );
114 
115 EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(sum, (Size-1)*NumTraits<Scalar>::AddCost, 1, internal::scalar_sum_op);
116 EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(minCoeff, (Size-1)*NumTraits<Scalar>::AddCost, 1, internal::scalar_min_op);
117 EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(maxCoeff, (Size-1)*NumTraits<Scalar>::AddCost, 1, internal::scalar_max_op);
118 EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(prod, (Size-1)*NumTraits<Scalar>::MulCost, 1, internal::scalar_product_op);
119 
120 template <int p, typename ResultType,typename Scalar>
121 struct member_lpnorm {
122  typedef ResultType result_type;
123  enum { Vectorizable = 0 };
124  template<int Size> struct Cost
125  { enum { value = (Size+5) * NumTraits<Scalar>::MulCost + (Size-1)*NumTraits<Scalar>::AddCost }; };
126  EIGEN_DEVICE_FUNC member_lpnorm() {}
127  template<typename XprType>
128  EIGEN_DEVICE_FUNC inline ResultType operator()(const XprType& mat) const
129  { return mat.template lpNorm<p>(); }
130 };
131 
132 template <typename BinaryOpT, typename Scalar>
133 struct member_redux {
134  typedef BinaryOpT BinaryOp;
135  typedef typename result_of<
136  BinaryOp(const Scalar&,const Scalar&)
137  >::type result_type;
138 
139  enum { Vectorizable = functor_traits<BinaryOp>::PacketAccess };
140  template<int Size> struct Cost { enum { value = (Size-1) * functor_traits<BinaryOp>::Cost }; };
141  EIGEN_DEVICE_FUNC explicit member_redux(const BinaryOp func) : m_functor(func) {}
142  template<typename Derived>
143  EIGEN_DEVICE_FUNC inline result_type operator()(const DenseBase<Derived>& mat) const
144  { return mat.redux(m_functor); }
145  const BinaryOp& binaryFunc() const { return m_functor; }
146  const BinaryOp m_functor;
147 };
148 }
149 
187 template<typename ExpressionType, int Direction> class VectorwiseOp
188 {
189  public:
190 
191  typedef typename ExpressionType::Scalar Scalar;
192  typedef typename ExpressionType::RealScalar RealScalar;
193  typedef Eigen::Index Index;
194  typedef typename internal::ref_selector<ExpressionType>::non_const_type ExpressionTypeNested;
196 
197  template<template<typename OutScalar,typename InputScalar> class Functor,
198  typename ReturnScalar=Scalar> struct ReturnType
199  {
200  typedef PartialReduxExpr<ExpressionType,
201  Functor<ReturnScalar,Scalar>,
202  Direction
203  > Type;
204  };
205 
206  template<typename BinaryOp> struct ReduxReturnType
207  {
208  typedef PartialReduxExpr<ExpressionType,
209  internal::member_redux<BinaryOp,Scalar>,
210  Direction
211  > Type;
212  };
213 
214  enum {
215  isVertical = (Direction==Vertical) ? 1 : 0,
216  isHorizontal = (Direction==Horizontal) ? 1 : 0
217  };
218 
219  protected:
220 
221  template<typename OtherDerived> struct ExtendedType {
222  typedef Replicate<OtherDerived,
223  isVertical ? 1 : ExpressionType::RowsAtCompileTime,
224  isHorizontal ? 1 : ExpressionType::ColsAtCompileTime> Type;
225  };
226 
229  template<typename OtherDerived>
233  {
234  EIGEN_STATIC_ASSERT(internal::check_implication(isVertical, OtherDerived::MaxColsAtCompileTime==1),
235  YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED)
236  EIGEN_STATIC_ASSERT(internal::check_implication(isHorizontal, OtherDerived::MaxRowsAtCompileTime==1),
237  YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED)
238  return typename ExtendedType<OtherDerived>::Type
239  (other.derived(),
240  isVertical ? 1 : m_matrix.rows(),
241  isHorizontal ? 1 : m_matrix.cols());
242  }
243 
244  template<typename OtherDerived> struct OppositeExtendedType {
245  typedef Replicate<OtherDerived,
246  isHorizontal ? 1 : ExpressionType::RowsAtCompileTime,
247  isVertical ? 1 : ExpressionType::ColsAtCompileTime> Type;
248  };
249 
252  template<typename OtherDerived>
256  {
257  EIGEN_STATIC_ASSERT(internal::check_implication(isHorizontal, OtherDerived::MaxColsAtCompileTime==1),
258  YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED)
259  EIGEN_STATIC_ASSERT(internal::check_implication(isVertical, OtherDerived::MaxRowsAtCompileTime==1),
260  YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED)
262  (other.derived(),
263  isHorizontal ? 1 : m_matrix.rows(),
264  isVertical ? 1 : m_matrix.cols());
265  }
266 
267  public:
269  explicit inline VectorwiseOp(ExpressionType& matrix) : m_matrix(matrix) {}
270 
273  inline const ExpressionType& _expression() const { return m_matrix; }
274 
275  #ifdef EIGEN_PARSED_BY_DOXYGEN
279  random_access_iterator_type iterator;
281  random_access_iterator_type const_iterator;
282  #else
283  typedef internal::subvector_stl_iterator<ExpressionType, DirectionType(Direction)> iterator;
284  typedef internal::subvector_stl_iterator<const ExpressionType, DirectionType(Direction)> const_iterator;
285  typedef internal::subvector_stl_reverse_iterator<ExpressionType, DirectionType(Direction)> reverse_iterator;
286  typedef internal::subvector_stl_reverse_iterator<const ExpressionType, DirectionType(Direction)> const_reverse_iterator;
287  #endif
288 
292  iterator begin() { return iterator (m_matrix, 0); }
294  const_iterator begin() const { return const_iterator(m_matrix, 0); }
297 
301  reverse_iterator rbegin() { return reverse_iterator (m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()-1); }
303  const_reverse_iterator rbegin() const { return const_reverse_iterator (m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()-1); }
305  const_reverse_iterator crbegin() const { return const_reverse_iterator (m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()-1); }
306 
310  iterator end() { return iterator (m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()); }
312  const_iterator end() const { return const_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()); }
314  const_iterator cend() const { return const_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()); }
315 
319  reverse_iterator rend() { return reverse_iterator (m_matrix, -1); }
321  const_reverse_iterator rend() const { return const_reverse_iterator (m_matrix, -1); }
323  const_reverse_iterator crend() const { return const_reverse_iterator (m_matrix, -1); }
324 
335  template<typename BinaryOp>
337  const typename ReduxReturnType<BinaryOp>::Type
338  redux(const BinaryOp& func = BinaryOp()) const
339  {
340  eigen_assert(redux_length()>0 && "you are using an empty matrix");
341  return typename ReduxReturnType<BinaryOp>::Type(_expression(), internal::member_redux<BinaryOp,Scalar>(func));
342  }
343 
359 
360  template<int p> struct LpNormReturnType {
362  };
363 
378  {
379  eigen_assert(redux_length()>0 && "you are using an empty matrix");
381  }
382 
397  {
398  eigen_assert(redux_length()>0 && "you are using an empty matrix");
400  }
401 
412  { return SquaredNormReturnType(m_matrix.cwiseAbs2()); }
413 
423  const NormReturnType norm() const
424  { return NormReturnType(squaredNorm()); }
425 
434  template<int p>
436  const typename LpNormReturnType<p>::Type lpNorm() const
437  { return typename LpNormReturnType<p>::Type(_expression()); }
438 
439 
448  { return BlueNormReturnType(_expression()); }
449 
450 
459  { return StableNormReturnType(_expression()); }
460 
461 
470  { return HypotNormReturnType(_expression()); }
471 
480  const SumReturnType sum() const
481  { return SumReturnType(_expression()); }
482 
488  const MeanReturnType mean() const
489  { return sum() / Scalar(Direction==Vertical?m_matrix.rows():m_matrix.cols()); }
490 
497  const AllReturnType all() const
498  { return AllReturnType(_expression()); }
499 
506  const AnyReturnType any() const
507  { return AnyReturnType(_expression()); }
508 
519  const CountReturnType count() const
520  { return CountReturnType(_expression()); }
521 
530  const ProdReturnType prod() const
531  { return ProdReturnType(_expression()); }
532 
533 
543  { return ConstReverseReturnType( _expression() ); }
544 
552 
555  const ReplicateReturnType replicate(Index factor) const;
556 
565  // NOTE implemented here because of sunstudio's compilation errors
566  // isVertical*Factor+isHorizontal instead of (isVertical?Factor:1) to handle CUDA bug with ternary operator
569  replicate(Index factor = Factor) const
570  {
572  (_expression(),isVertical?factor:1,isHorizontal?factor:1);
573  }
574 
576 
578  template<typename OtherDerived>
580  ExpressionType& operator=(const DenseBase<OtherDerived>& other)
581  {
582  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
583  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
584  //eigen_assert((m_matrix.isNull()) == (other.isNull())); FIXME
585  return m_matrix = extendedTo(other.derived());
586  }
587 
589  template<typename OtherDerived>
591  ExpressionType& operator+=(const DenseBase<OtherDerived>& other)
592  {
593  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
594  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
595  return m_matrix += extendedTo(other.derived());
596  }
597 
599  template<typename OtherDerived>
601  ExpressionType& operator-=(const DenseBase<OtherDerived>& other)
602  {
603  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
604  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
605  return m_matrix -= extendedTo(other.derived());
606  }
607 
609  template<typename OtherDerived>
611  ExpressionType& operator*=(const DenseBase<OtherDerived>& other)
612  {
613  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
614  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
615  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
616  m_matrix *= extendedTo(other.derived());
617  return m_matrix;
618  }
619 
621  template<typename OtherDerived>
623  ExpressionType& operator/=(const DenseBase<OtherDerived>& other)
624  {
625  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
626  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
627  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
628  m_matrix /= extendedTo(other.derived());
629  return m_matrix;
630  }
631 
633  template<typename OtherDerived> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
636  const typename ExtendedType<OtherDerived>::Type>
637  operator+(const DenseBase<OtherDerived>& other) const
638  {
639  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
640  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
641  return m_matrix + extendedTo(other.derived());
642  }
643 
645  template<typename OtherDerived>
649  const typename ExtendedType<OtherDerived>::Type>
650  operator-(const DenseBase<OtherDerived>& other) const
651  {
652  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
653  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
654  return m_matrix - extendedTo(other.derived());
655  }
656 
659  template<typename OtherDerived> EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC
662  const typename ExtendedType<OtherDerived>::Type>
664  operator*(const DenseBase<OtherDerived>& other) const
665  {
666  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
667  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
668  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
669  return m_matrix * extendedTo(other.derived());
670  }
671 
674  template<typename OtherDerived>
678  const typename ExtendedType<OtherDerived>::Type>
679  operator/(const DenseBase<OtherDerived>& other) const
680  {
681  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
682  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
683  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
684  return m_matrix / extendedTo(other.derived());
685  }
686 
695  normalized() const { return m_matrix.cwiseQuotient(extendedToOpposite(this->norm())); }
696 
697 
702  m_matrix = this->normalized();
703  }
704 
705  EIGEN_DEVICE_FUNC inline void reverseInPlace();
706 
708 
712 
713  typedef typename ExpressionType::PlainObject CrossReturnType;
714  template<typename OtherDerived>
716  const CrossReturnType cross(const MatrixBase<OtherDerived>& other) const;
717 
718  enum {
719  HNormalized_Size = Direction==Vertical ? internal::traits<ExpressionType>::RowsAtCompileTime
720  : internal::traits<ExpressionType>::ColsAtCompileTime,
722  };
723  typedef Block<const ExpressionType,
724  Direction==Vertical ? int(HNormalized_SizeMinusOne)
725  : int(internal::traits<ExpressionType>::RowsAtCompileTime),
726  Direction==Horizontal ? int(HNormalized_SizeMinusOne)
727  : int(internal::traits<ExpressionType>::ColsAtCompileTime)>
729  typedef Block<const ExpressionType,
730  Direction==Vertical ? 1 : int(internal::traits<ExpressionType>::RowsAtCompileTime),
731  Direction==Horizontal ? 1 : int(internal::traits<ExpressionType>::ColsAtCompileTime)>
734  const HNormalized_Block,
736  Direction==Vertical ? HNormalized_SizeMinusOne : 1,
737  Direction==Horizontal ? HNormalized_SizeMinusOne : 1> >
739 
741  const HNormalizedReturnType hnormalized() const;
742 
743 # ifdef EIGEN_VECTORWISEOP_PLUGIN
744 # include EIGEN_VECTORWISEOP_PLUGIN
745 # endif
746 
747  protected:
749  {
750  return Direction==Vertical ? m_matrix.rows() : m_matrix.cols();
751  }
753 };
754 
755 //const colwise moved to DenseBase.h due to CUDA compiler bug
756 
757 
762 template<typename Derived>
765 {
766  return ColwiseReturnType(derived());
767 }
768 
769 //const rowwise moved to DenseBase.h due to CUDA compiler bug
770 
771 
776 template<typename Derived>
779 {
780  return RowwiseReturnType(derived());
781 }
782 
783 } // end namespace Eigen
784 
785 #endif // EIGEN_PARTIAL_REDUX_H
EIGEN_CONSTEXPR Index subVectors() const
IndexedView_or_Block operator()(const RowIndices &rowIndices, const ColIndices &colIndices)
#define EIGEN_NOEXCEPT
Definition: Macros.h:1260
#define EIGEN_CONSTEXPR
Definition: Macros.h:747
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:883
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1168
#define eigen_assert(x)
Definition: Macros.h:902
#define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived)
Definition: StaticAssert.h:100
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
#define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2)
Definition: StaticAssert.h:104
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition: StaticAssert.h:36
Matrix< float, 1, Dynamic > MatrixType
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:107
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:86
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:58
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:42
ConstColwiseReturnType colwise() const
Definition: DenseBase.h:560
internal::traits< Derived >::Scalar Scalar
Definition: DenseBase.h:61
ConstRowwiseReturnType rowwise() const
Definition: DenseBase.h:548
Expression of one (or a set of) homogeneous vector(s)
Definition: Homogeneous.h:64
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:182
Generic expression of a partially reduxed matrix.
Definition: VectorwiseOp.h:60
EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: VectorwiseOp.h:73
EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: VectorwiseOp.h:71
MatrixType::Nested m_matrix
Definition: VectorwiseOp.h:82
const MemberOp m_functor
Definition: VectorwiseOp.h:83
internal::dense_xpr_base< PartialReduxExpr >::type Base
Definition: VectorwiseOp.h:63
MatrixType::Nested nestedExpression() const
Definition: VectorwiseOp.h:76
PartialReduxExpr(const MatrixType &mat, const MemberOp &func=MemberOp())
Definition: VectorwiseOp.h:67
const MemberOp & functor() const
Definition: VectorwiseOp.h:79
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:65
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:67
Pseudo expression providing broadcasting and partial reduction operations.
Definition: VectorwiseOp.h:188
const HypotNormReturnType hypotNorm() const
Definition: VectorwiseOp.h:469
const SquaredNormReturnType squaredNorm() const
Definition: VectorwiseOp.h:411
const ProdReturnType prod() const
Definition: VectorwiseOp.h:530
VectorwiseOp(ExpressionType &matrix)
Definition: VectorwiseOp.h:269
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
Definition: VectorwiseOp.h:738
ReturnType< internal::member_maxCoeff >::Type MaxCoeffReturnType
Definition: VectorwiseOp.h:345
ReturnType< internal::member_hypotNorm, RealScalar >::Type HypotNormReturnType
Definition: VectorwiseOp.h:350
Reverse< ExpressionType, Direction > ReverseReturnType
Definition: VectorwiseOp.h:358
OppositeExtendedType< OtherDerived >::Type extendedToOpposite(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:255
ExpressionType::PlainObject CrossReturnType
Definition: VectorwiseOp.h:713
ExpressionType & operator+=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:591
const_reverse_iterator crend() const
Definition: VectorwiseOp.h:323
CwiseBinaryOp< internal::scalar_product_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > operator*(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:664
Index redux_length() const
Definition: VectorwiseOp.h:748
ExpressionTypeNested m_matrix
Definition: VectorwiseOp.h:752
ReturnType< internal::member_minCoeff >::Type MinCoeffReturnType
Definition: VectorwiseOp.h:344
Eigen::Index Index
Definition: VectorwiseOp.h:193
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
Definition: VectorwiseOp.h:728
ExpressionType::Scalar Scalar
Definition: VectorwiseOp.h:191
const BlueNormReturnType blueNorm() const
Definition: VectorwiseOp.h:447
ExtendedType< OtherDerived >::Type extendedTo(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:232
ReturnType< internal::member_any, bool >::Type AnyReturnType
Definition: VectorwiseOp.h:354
const_iterator cend() const
Definition: VectorwiseOp.h:314
random_access_iterator_type const_iterator
Definition: VectorwiseOp.h:281
const CountReturnType count() const
Definition: VectorwiseOp.h:519
CwiseBinaryOp< internal::scalar_difference_op< Scalar, typename OtherDerived::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > operator-(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:650
const ReplicateReturnType replicate(Index factor) const
Definition: Replicate.h:136
const MaxCoeffReturnType maxCoeff() const
Definition: VectorwiseOp.h:396
ExpressionType & operator-=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:601
const SumReturnType sum() const
Definition: VectorwiseOp.h:480
ReturnType< internal::member_blueNorm, RealScalar >::Type BlueNormReturnType
Definition: VectorwiseOp.h:348
CwiseBinaryOp< internal::scalar_sum_op< Scalar, typename OtherDerived::Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > operator+(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:637
typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(SumReturnType, Scalar, quotient) MeanReturnType
PartialReduxExpr< ExpressionType, internal::member_count< Index, Scalar >, Direction > CountReturnType
Definition: VectorwiseOp.h:355
Reverse< const ExpressionType, Direction > ConstReverseReturnType
Definition: VectorwiseOp.h:357
ExpressionType & operator=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:580
const_iterator cbegin() const
Definition: VectorwiseOp.h:296
const MinCoeffReturnType minCoeff() const
Definition: VectorwiseOp.h:377
const Replicate< ExpressionType, isVertical *Factor+isHorizontal, isHorizontal *Factor+isVertical > replicate(Index factor=Factor) const
Definition: VectorwiseOp.h:569
ReturnType< internal::member_stableNorm, RealScalar >::Type StableNormReturnType
Definition: VectorwiseOp.h:349
internal::ref_selector< ExpressionType >::non_const_type ExpressionTypeNested
Definition: VectorwiseOp.h:194
reverse_iterator rbegin()
Definition: VectorwiseOp.h:301
const AnyReturnType any() const
Definition: VectorwiseOp.h:506
ReturnType< internal::member_sum >::Type SumReturnType
Definition: VectorwiseOp.h:351
Homogeneous< ExpressionType, Direction > HomogeneousReturnType
Definition: VectorwiseOp.h:709
const AllReturnType all() const
Definition: VectorwiseOp.h:497
ExpressionType & operator/=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:623
random_access_iterator_type iterator
Definition: VectorwiseOp.h:279
CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > operator/(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:679
const_reverse_iterator rbegin() const
Definition: VectorwiseOp.h:303
const ExpressionType & _expression() const
Definition: VectorwiseOp.h:273
ExpressionType::RealScalar RealScalar
Definition: VectorwiseOp.h:192
reverse_iterator rend()
Definition: VectorwiseOp.h:319
const LpNormReturnType< p >::Type lpNorm() const
Definition: VectorwiseOp.h:436
const MeanReturnType mean() const
Definition: VectorwiseOp.h:488
const_iterator begin() const
Definition: VectorwiseOp.h:294
ReturnType< internal::member_prod >::Type ProdReturnType
Definition: VectorwiseOp.h:356
ReverseReturnType reverse()
Definition: VectorwiseOp.h:550
void reverseInPlace()
Definition: Reverse.h:212
Replicate< ExpressionType,(isVertical?Dynamic:1),(isHorizontal?Dynamic:1)> ReplicateReturnType
Definition: VectorwiseOp.h:553
internal::remove_all_t< ExpressionTypeNested > ExpressionTypeNestedCleaned
Definition: VectorwiseOp.h:195
CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename OppositeExtendedType< NormReturnType >::Type > normalized() const
Definition: VectorwiseOp.h:695
Block< const ExpressionType, Direction==Vertical ? 1 :int(internal::traits< ExpressionType >::RowsAtCompileTime), Direction==Horizontal ? 1 :int(internal::traits< ExpressionType >::ColsAtCompileTime)> HNormalized_Factors
Definition: VectorwiseOp.h:732
ExpressionType & operator*=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:611
const_iterator end() const
Definition: VectorwiseOp.h:312
ReturnType< internal::member_all, bool >::Type AllReturnType
Definition: VectorwiseOp.h:353
const StableNormReturnType stableNorm() const
Definition: VectorwiseOp.h:458
CwiseUnaryOp< internal::scalar_sqrt_op< RealScalar >, const SquaredNormReturnType > NormReturnType
Definition: VectorwiseOp.h:347
const ReduxReturnType< BinaryOp >::Type redux(const BinaryOp &func=BinaryOp()) const
Definition: VectorwiseOp.h:338
const ConstReverseReturnType reverse() const
Definition: VectorwiseOp.h:542
const_reverse_iterator crbegin() const
Definition: VectorwiseOp.h:305
PartialReduxExpr< const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const ExpressionTypeNestedCleaned >, internal::member_sum< RealScalar, RealScalar >, Direction > SquaredNormReturnType
Definition: VectorwiseOp.h:346
const NormReturnType norm() const
Definition: VectorwiseOp.h:423
const_reverse_iterator rend() const
Definition: VectorwiseOp.h:321
const HNormalizedReturnType hnormalized() const
column or row-wise homogeneous normalization
Definition: Homogeneous.h:200
const CrossReturnType cross(const MatrixBase< OtherDerived > &other) const
Definition: OrthoMethods.h:157
HomogeneousReturnType homogeneous() const
Definition: Homogeneous.h:152
DirectionType
Definition: Constants.h:263
@ Horizontal
Definition: Constants.h:269
@ Vertical
Definition: Constants.h:266
const unsigned int RowMajorBit
Definition: Constants.h:68
bool all()
Definition: Macros.h:1270
EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(sum,(Size-1) *NumTraits< Scalar >::AddCost, 1, internal::scalar_sum_op)
constexpr bool check_implication(bool a, bool b)
Definition: Meta.h:579
typename remove_all< T >::type remove_all_t
Definition: Meta.h:119
EIGEN_MEMBER_FUNCTOR(norm,(Size+5) *NumTraits< Scalar >::MulCost+(Size-1) *NumTraits< Scalar >::AddCost)
: InteropHeaders
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
const int Dynamic
Definition: Constants.h:24
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:231
Replicate< OtherDerived, isVertical ? 1 :ExpressionType::RowsAtCompileTime, isHorizontal ? 1 :ExpressionType::ColsAtCompileTime > Type
Definition: VectorwiseOp.h:224
PartialReduxExpr< ExpressionType, internal::member_lpnorm< p, RealScalar, Scalar >, Direction > Type
Definition: VectorwiseOp.h:361
Replicate< OtherDerived, isHorizontal ? 1 :ExpressionType::RowsAtCompileTime, isVertical ? 1 :ExpressionType::ColsAtCompileTime > Type
Definition: VectorwiseOp.h:247
PartialReduxExpr< ExpressionType, internal::member_redux< BinaryOp, Scalar >, Direction > Type
Definition: VectorwiseOp.h:211
PartialReduxExpr< ExpressionType, Functor< ReturnScalar, Scalar >, Direction > Type
Definition: VectorwiseOp.h:203