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 // IWYU pragma: private
15 #include "./InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
35 template <typename MatrixType, typename MemberOp, int Direction>
36 class PartialReduxExpr;
37 
38 namespace internal {
39 template <typename MatrixType, typename MemberOp, int Direction>
40 struct traits<PartialReduxExpr<MatrixType, MemberOp, Direction> > : traits<MatrixType> {
41  typedef typename MemberOp::result_type Scalar;
44  typedef typename MatrixType::Scalar InputScalar;
45  enum {
46  RowsAtCompileTime = Direction == Vertical ? 1 : MatrixType::RowsAtCompileTime,
47  ColsAtCompileTime = Direction == Horizontal ? 1 : MatrixType::ColsAtCompileTime,
48  MaxRowsAtCompileTime = Direction == Vertical ? 1 : MatrixType::MaxRowsAtCompileTime,
49  MaxColsAtCompileTime = Direction == Horizontal ? 1 : MatrixType::MaxColsAtCompileTime,
50  Flags = RowsAtCompileTime == 1 ? RowMajorBit : 0,
51  TraversalSize = Direction == Vertical ? MatrixType::RowsAtCompileTime : MatrixType::ColsAtCompileTime
52  };
53 };
54 } // namespace internal
55 
56 template <typename MatrixType, typename MemberOp, int Direction>
57 class PartialReduxExpr : public internal::dense_xpr_base<PartialReduxExpr<MatrixType, MemberOp, Direction> >::type,
59  public:
62 
63  EIGEN_DEVICE_FUNC explicit PartialReduxExpr(const MatrixType& mat, const MemberOp& func = MemberOp())
64  : m_matrix(mat), m_functor(func) {}
65 
67  return (Direction == Vertical ? 1 : m_matrix.rows());
68  }
70  return (Direction == Horizontal ? 1 : m_matrix.cols());
71  }
72 
73  EIGEN_DEVICE_FUNC typename MatrixType::Nested nestedExpression() const { return m_matrix; }
74 
75  EIGEN_DEVICE_FUNC const MemberOp& functor() const { return m_functor; }
76 
77  protected:
78  typename MatrixType::Nested m_matrix;
79  const MemberOp m_functor;
80 };
81 
82 template <typename A, typename B>
84 
85 #define EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(MEMBER, COST, VECTORIZABLE, BINARYOP) \
86  template <typename ResultType, typename Scalar> \
87  struct member_##MEMBER { \
88  typedef ResultType result_type; \
89  typedef BINARYOP<Scalar, Scalar> BinaryOp; \
90  template <int Size> \
91  struct Cost { \
92  enum { value = COST }; \
93  }; \
94  enum { Vectorizable = VECTORIZABLE }; \
95  template <typename XprType> \
96  EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ResultType operator()(const XprType& mat) const { \
97  return mat.MEMBER(); \
98  } \
99  BinaryOp binaryFunc() const { return BinaryOp(); } \
100  }
101 
102 #define EIGEN_MEMBER_FUNCTOR(MEMBER, COST) EIGEN_MAKE_PARTIAL_REDUX_FUNCTOR(MEMBER, COST, 0, partial_redux_dummy_func)
103 
104 namespace internal {
105 
113 
118 
119 template <int p, typename ResultType, typename Scalar>
121  typedef ResultType result_type;
122  enum { Vectorizable = 0 };
123  template <int Size>
124  struct Cost {
125  enum { value = (Size + 5) * NumTraits<Scalar>::MulCost + (Size - 1) * NumTraits<Scalar>::AddCost };
126  };
128  template <typename XprType>
129  EIGEN_DEVICE_FUNC inline ResultType operator()(const XprType& mat) const {
130  return mat.template lpNorm<p>();
131  }
132 };
133 
134 template <typename BinaryOpT, typename Scalar>
135 struct member_redux {
136  typedef BinaryOpT BinaryOp;
137  typedef typename result_of<BinaryOp(const Scalar&, const Scalar&)>::type result_type;
138 
140  template <int Size>
141  struct Cost {
142  enum { value = (Size - 1) * functor_traits<BinaryOp>::Cost };
143  };
145  template <typename Derived>
147  return mat.redux(m_functor);
148  }
149  const BinaryOp& binaryFunc() const { return m_functor; }
151 };
152 } // namespace internal
153 
191 template <typename ExpressionType, int Direction>
193  public:
194  typedef typename ExpressionType::Scalar Scalar;
196  typedef Eigen::Index Index;
199 
200  template <template <typename OutScalar, typename InputScalar> class Functor, typename ReturnScalar = Scalar>
201  struct ReturnType {
203  };
204 
205  template <typename BinaryOp>
208  };
209 
210  enum { isVertical = (Direction == Vertical) ? 1 : 0, isHorizontal = (Direction == Horizontal) ? 1 : 0 };
211 
212  protected:
213  template <typename OtherDerived>
214  struct ExtendedType {
215  typedef Replicate<OtherDerived, isVertical ? 1 : ExpressionType::RowsAtCompileTime,
216  isHorizontal ? 1 : ExpressionType::ColsAtCompileTime>
218  };
219 
222  template <typename OtherDerived>
224  EIGEN_STATIC_ASSERT(internal::check_implication(isVertical, OtherDerived::MaxColsAtCompileTime == 1),
225  YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED)
226  EIGEN_STATIC_ASSERT(internal::check_implication(isHorizontal, OtherDerived::MaxRowsAtCompileTime == 1),
227  YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED)
228  return typename ExtendedType<OtherDerived>::Type(other.derived(), isVertical ? 1 : m_matrix.rows(),
229  isHorizontal ? 1 : m_matrix.cols());
230  }
231 
232  template <typename OtherDerived>
234  typedef Replicate<OtherDerived, isHorizontal ? 1 : ExpressionType::RowsAtCompileTime,
235  isVertical ? 1 : ExpressionType::ColsAtCompileTime>
237  };
238 
241  template <typename OtherDerived>
243  const DenseBase<OtherDerived>& other) const {
244  EIGEN_STATIC_ASSERT(internal::check_implication(isHorizontal, OtherDerived::MaxColsAtCompileTime == 1),
245  YOU_PASSED_A_ROW_VECTOR_BUT_A_COLUMN_VECTOR_WAS_EXPECTED)
246  EIGEN_STATIC_ASSERT(internal::check_implication(isVertical, OtherDerived::MaxRowsAtCompileTime == 1),
247  YOU_PASSED_A_COLUMN_VECTOR_BUT_A_ROW_VECTOR_WAS_EXPECTED)
248  return typename OppositeExtendedType<OtherDerived>::Type(other.derived(), isHorizontal ? 1 : m_matrix.rows(),
249  isVertical ? 1 : m_matrix.cols());
250  }
251 
252  public:
253  EIGEN_DEVICE_FUNC explicit inline VectorwiseOp(ExpressionType& matrix) : m_matrix(matrix) {}
254 
256  EIGEN_DEVICE_FUNC inline const ExpressionType& _expression() const { return m_matrix; }
257 
258 #ifdef EIGEN_PARSED_BY_DOXYGEN
262  random_access_iterator_type iterator;
264  random_access_iterator_type const_iterator;
265 #else
271 #endif
272 
276  iterator begin() { return iterator(m_matrix, 0); }
278  const_iterator begin() const { return const_iterator(m_matrix, 0); }
281 
286  return reverse_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>() - 1);
287  }
290  return const_reverse_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>() - 1);
291  }
294  return const_reverse_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>() - 1);
295  }
296 
300  iterator end() { return iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>()); }
302  const_iterator end() const {
303  return const_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>());
304  }
307  return const_iterator(m_matrix, m_matrix.template subVectors<DirectionType(Direction)>());
308  }
309 
318 
329  template <typename BinaryOp>
330  EIGEN_DEVICE_FUNC const typename ReduxReturnType<BinaryOp>::Type redux(const BinaryOp& func = BinaryOp()) const {
331  eigen_assert(redux_length() > 0 && "you are using an empty matrix");
333  }
334 
338  internal::member_sum<RealScalar, RealScalar>, Direction>
345  typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(SumReturnType, Scalar, quotient) MeanReturnType;
352 
353  template <int p>
356  };
357 
371  eigen_assert(redux_length() > 0 && "you are using an empty matrix");
373  }
374 
388  eigen_assert(redux_length() > 0 && "you are using an empty matrix");
390  }
391 
401  return SquaredNormReturnType(m_matrix.cwiseAbs2());
402  }
403 
413 
422  template <int p>
424  return typename LpNormReturnType<p>::Type(_expression());
425  }
426 
434 
442 
450 
459 
464  EIGEN_DEVICE_FUNC const MeanReturnType mean() const {
465  return sum() / Scalar(Direction == Vertical ? m_matrix.rows() : m_matrix.cols());
466  }
467 
474 
481 
492 
501 
510 
516 
517  typedef Replicate<ExpressionType, (isVertical ? Dynamic : 1), (isHorizontal ? Dynamic : 1)> ReplicateReturnType;
519 
528  // NOTE implemented here because of sunstudio's compilation errors
529  // isVertical*Factor+isHorizontal instead of (isVertical?Factor:1) to handle CUDA bug with ternary operator
530  template <int Factor>
531  const Replicate<ExpressionType, isVertical * Factor + isHorizontal,
533  replicate(Index factor = Factor) const {
535  _expression(), isVertical ? factor : 1, isHorizontal ? factor : 1);
536  }
537 
539 
541  template <typename OtherDerived>
542  EIGEN_DEVICE_FUNC ExpressionType& operator=(const DenseBase<OtherDerived>& other) {
543  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
544  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
545  // eigen_assert((m_matrix.isNull()) == (other.isNull())); FIXME
546  return m_matrix = extendedTo(other.derived());
547  }
548 
550  template <typename OtherDerived>
551  EIGEN_DEVICE_FUNC ExpressionType& operator+=(const DenseBase<OtherDerived>& other) {
552  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
553  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
554  return m_matrix += extendedTo(other.derived());
555  }
556 
558  template <typename OtherDerived>
559  EIGEN_DEVICE_FUNC ExpressionType& operator-=(const DenseBase<OtherDerived>& other) {
560  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
561  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
562  return m_matrix -= extendedTo(other.derived());
563  }
564 
566  template <typename OtherDerived>
567  EIGEN_DEVICE_FUNC ExpressionType& operator*=(const DenseBase<OtherDerived>& other) {
568  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
569  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
570  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
571  m_matrix *= extendedTo(other.derived());
572  return m_matrix;
573  }
574 
576  template <typename OtherDerived>
577  EIGEN_DEVICE_FUNC ExpressionType& operator/=(const DenseBase<OtherDerived>& other) {
578  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
579  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
580  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
581  m_matrix /= extendedTo(other.derived());
582  return m_matrix;
583  }
584 
586  template <typename OtherDerived>
589  const typename ExtendedType<OtherDerived>::Type>
590  operator+(const DenseBase<OtherDerived>& other) const {
591  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
592  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
593  return m_matrix + extendedTo(other.derived());
594  }
595 
597  template <typename OtherDerived>
600  operator-(const DenseBase<OtherDerived>& other) const {
601  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
602  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
603  return m_matrix - extendedTo(other.derived());
604  }
605 
608  template <typename OtherDerived>
612  operator*(const DenseBase<OtherDerived>& other) const {
613  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
614  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
615  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
616  return m_matrix * extendedTo(other.derived());
617  }
618 
621  template <typename OtherDerived>
623  const typename ExtendedType<OtherDerived>::Type>
624  operator/(const DenseBase<OtherDerived>& other) const {
625  EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived)
626  EIGEN_STATIC_ASSERT_ARRAYXPR(ExpressionType)
627  EIGEN_STATIC_ASSERT_SAME_XPR_KIND(ExpressionType, OtherDerived)
628  return m_matrix / extendedTo(other.derived());
629  }
630 
637  normalized() const {
638  return m_matrix.cwiseQuotient(extendedToOpposite(this->norm()));
639  }
640 
645 
646  EIGEN_DEVICE_FUNC inline void reverseInPlace();
647 
649 
652 
653  typedef typename ExpressionType::PlainObject CrossReturnType;
654  template <typename OtherDerived>
656 
657  enum {
661  };
662  typedef Block<const ExpressionType,
664  : int(internal::traits<ExpressionType>::RowsAtCompileTime),
666  : int(internal::traits<ExpressionType>::ColsAtCompileTime)>
668  typedef Block<const ExpressionType,
673  const HNormalized_Block,
677 
679 
680 #ifdef EIGEN_VECTORWISEOP_PLUGIN
681 #include EIGEN_VECTORWISEOP_PLUGIN
682 #endif
683 
684  protected:
685  EIGEN_DEVICE_FUNC Index redux_length() const { return Direction == Vertical ? m_matrix.rows() : m_matrix.cols(); }
687 };
688 
689 // const colwise moved to DenseBase.h due to CUDA compiler bug
690 
695 template <typename Derived>
697  return ColwiseReturnType(derived());
698 }
699 
700 // const rowwise moved to DenseBase.h due to CUDA compiler bug
701 
706 template <typename Derived>
708  return RowwiseReturnType(derived());
709 }
710 
711 } // end namespace Eigen
712 
713 #endif // EIGEN_PARTIAL_REDUX_H
Direction
An enum that indicates the direction in Cartesian coordinates.
Definition: GeneralDefine.h:56
#define EIGEN_NOEXCEPT
Definition: Macros.h:1267
#define EIGEN_CONSTEXPR
Definition: Macros.h:758
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:892
#define EIGEN_DENSE_PUBLIC_INTERFACE(Derived)
Definition: Macros.h:1171
#define eigen_assert(x)
Definition: Macros.h:910
#define EIGEN_STRONG_INLINE
Definition: Macros.h:834
#define EIGEN_STATIC_ASSERT_ARRAYXPR(Derived)
Definition: StaticAssert.h:90
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
#define EIGEN_STATIC_ASSERT_SAME_XPR_KIND(Derived1, Derived2)
Definition: StaticAssert.h:94
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition: StaticAssert.h:36
SCALAR Scalar
Definition: bench_gemm.cpp:45
NumTraits< Scalar >::Real RealScalar
Definition: bench_gemm.cpp:46
EIGEN_DONT_INLINE T::Scalar blueNorm(T &v)
Definition: bench_norm.cpp:24
EIGEN_DONT_INLINE T::Scalar hypotNorm(T &v)
Definition: bench_norm.cpp:19
EIGEN_DONT_INLINE T::Scalar stableNorm(T &v)
Definition: bench_norm.cpp:14
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Expression of a fixed-size or dynamic-size block.
Definition: Block.h:110
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition: CwiseUnaryOp.h:53
Base class for all dense matrices, vectors, and arrays.
Definition: DenseBase.h:44
EIGEN_DEVICE_FUNC ConstColwiseReturnType colwise() const
Definition: DenseBase.h:513
EIGEN_DEVICE_FUNC ConstRowwiseReturnType rowwise() const
Definition: DenseBase.h:503
Expression of one (or a set of) homogeneous vector(s)
Definition: Homogeneous.h:62
Base class for all dense matrices, vectors, and expressions.
Definition: MatrixBase.h:52
Generic expression of a partially reduxed matrix.
Definition: VectorwiseOp.h:58
MatrixType::Nested m_matrix
Definition: VectorwiseOp.h:78
const MemberOp m_functor
Definition: VectorwiseOp.h:79
EIGEN_DEVICE_FUNC MatrixType::Nested nestedExpression() const
Definition: VectorwiseOp.h:73
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: VectorwiseOp.h:69
internal::dense_xpr_base< PartialReduxExpr >::type Base
Definition: VectorwiseOp.h:60
EIGEN_DEVICE_FUNC const MemberOp & functor() const
Definition: VectorwiseOp.h:75
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: VectorwiseOp.h:66
Expression of the multiple replication of a matrix or vector.
Definition: Replicate.h:64
Expression of the reverse of a vector or matrix.
Definition: Reverse.h:65
Pseudo expression providing broadcasting and partial reduction operations.
Definition: VectorwiseOp.h:192
internal::subvector_stl_iterator< const ExpressionType, DirectionType(Direction)> const_iterator
Definition: VectorwiseOp.h:267
EIGEN_DEVICE_FUNC const ConstReverseReturnType reverse() const
Definition: VectorwiseOp.h:509
EIGEN_DEVICE_FUNC const MinCoeffReturnType minCoeff() const
Definition: VectorwiseOp.h:370
EIGEN_DEVICE_FUNC ReverseReturnType reverse()
Definition: VectorwiseOp.h:515
ReturnType< internal::member_maxCoeff >::Type MaxCoeffReturnType
Definition: VectorwiseOp.h:336
Reverse< ExpressionType, Direction > ReverseReturnType
Definition: VectorwiseOp.h:351
EIGEN_DEVICE_FUNC const NormReturnType norm() const
Definition: VectorwiseOp.h:412
EIGEN_DEVICE_FUNC void normalize()
Definition: VectorwiseOp.h:644
ExpressionType::PlainObject CrossReturnType
Definition: VectorwiseOp.h:653
EIGEN_DEVICE_FUNC const SumReturnType sum() const
Definition: VectorwiseOp.h:458
Replicate< ExpressionType,(isVertical ? Dynamic :1),(isHorizontal ? Dynamic :1)> ReplicateReturnType
Definition: VectorwiseOp.h:517
const_reverse_iterator crend() const
Definition: VectorwiseOp.h:317
EIGEN_DEVICE_FUNC const AllReturnType all() const
Definition: VectorwiseOp.h:473
EIGEN_DEVICE_FUNC void reverseInPlace()
Definition: Reverse.h:196
ExpressionTypeNested m_matrix
Definition: VectorwiseOp.h:686
internal::subvector_stl_reverse_iterator< const ExpressionType, DirectionType(Direction)> const_reverse_iterator
Definition: VectorwiseOp.h:270
Homogeneous< ExpressionType, Direction > HomogeneousReturnType
Definition: VectorwiseOp.h:650
PartialReduxExpr< ExpressionType, internal::member_count< Index, Scalar >, Direction > CountReturnType
Definition: VectorwiseOp.h:348
ReturnType< internal::member_hypotNorm, RealScalar >::Type HypotNormReturnType
Definition: VectorwiseOp.h:343
ReturnType< internal::member_minCoeff >::Type MinCoeffReturnType
Definition: VectorwiseOp.h:335
EIGEN_DEVICE_FUNC const MaxCoeffReturnType maxCoeff() const
Definition: VectorwiseOp.h:387
Eigen::Index Index
Definition: VectorwiseOp.h:196
ExpressionType::Scalar Scalar
Definition: VectorwiseOp.h:194
ReturnType< internal::member_any, bool >::Type AnyReturnType
Definition: VectorwiseOp.h:347
EIGEN_DEVICE_FUNC const ExpressionType & _expression() const
Definition: VectorwiseOp.h:256
const_iterator cend() const
Definition: VectorwiseOp.h:306
ReturnType< internal::member_stableNorm, RealScalar >::Type StableNormReturnType
Definition: VectorwiseOp.h:342
EIGEN_DEVICE_FUNC ExpressionType & operator=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:542
EIGEN_DEVICE_FUNC const ProdReturnType prod() const
Definition: VectorwiseOp.h:500
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:676
EIGEN_DEVICE_FUNC const SquaredNormReturnType squaredNorm() const
Definition: VectorwiseOp.h:400
EIGEN_DEVICE_FUNC const ReplicateReturnType replicate(Index factor) const
Definition: Replicate.h:123
typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(SumReturnType, Scalar, quotient) MeanReturnType
const Replicate< ExpressionType, isVertical *Factor+isHorizontal, isHorizontal *Factor+isVertical > EIGEN_DEVICE_FUNC replicate(Index factor=Factor) const
Definition: VectorwiseOp.h:533
EIGEN_DEVICE_FUNC OppositeExtendedType< OtherDerived >::Type extendedToOpposite(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:242
Reverse< const ExpressionType, Direction > ConstReverseReturnType
Definition: VectorwiseOp.h:350
EIGEN_DEVICE_FUNC const ReduxReturnType< BinaryOp >::Type redux(const BinaryOp &func=BinaryOp()) const
Definition: VectorwiseOp.h:330
EIGEN_DEVICE_FUNC const AnyReturnType any() const
Definition: VectorwiseOp.h:480
const_iterator cbegin() const
Definition: VectorwiseOp.h:280
EIGEN_DEVICE_FUNC const LpNormReturnType< p >::Type lpNorm() const
Definition: VectorwiseOp.h:423
internal::ref_selector< ExpressionType >::non_const_type ExpressionTypeNested
Definition: VectorwiseOp.h:197
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
Definition: VectorwiseOp.h:600
reverse_iterator rbegin()
Definition: VectorwiseOp.h:285
PartialReduxExpr< const CwiseUnaryOp< internal::scalar_abs2_op< Scalar >, const ExpressionTypeNestedCleaned >, internal::member_sum< RealScalar, RealScalar >, Direction > SquaredNormReturnType
Definition: VectorwiseOp.h:339
ReturnType< internal::member_blueNorm, RealScalar >::Type BlueNormReturnType
Definition: VectorwiseOp.h:341
ReturnType< internal::member_sum >::Type SumReturnType
Definition: VectorwiseOp.h:344
EIGEN_DEVICE_FUNC const HypotNormReturnType hypotNorm() const
Definition: VectorwiseOp.h:449
iterator end()
Definition: VectorwiseOp.h:300
@ HNormalized_Size
Definition: VectorwiseOp.h:658
@ HNormalized_SizeMinusOne
Definition: VectorwiseOp.h:660
EIGEN_DEVICE_FUNC ExtendedType< OtherDerived >::Type extendedTo(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:223
const_reverse_iterator rbegin() const
Definition: VectorwiseOp.h:289
ExpressionType::RealScalar RealScalar
Definition: VectorwiseOp.h:195
reverse_iterator rend()
Definition: VectorwiseOp.h:313
const_iterator begin() const
Definition: VectorwiseOp.h:278
Block< const ExpressionType, Direction==Vertical ? 1 :int(internal::traits< ExpressionType >::RowsAtCompileTime), Direction==Horizontal ? 1 :int(internal::traits< ExpressionType >::ColsAtCompileTime)> HNormalized_Factors
Definition: VectorwiseOp.h:671
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
Definition: VectorwiseOp.h:612
ReturnType< internal::member_prod >::Type ProdReturnType
Definition: VectorwiseOp.h:349
iterator begin()
Definition: VectorwiseOp.h:276
EIGEN_DEVICE_FUNC const CountReturnType count() const
Definition: VectorwiseOp.h:491
EIGEN_DEVICE_FUNC ExpressionType & operator/=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:577
internal::remove_all_t< ExpressionTypeNested > ExpressionTypeNestedCleaned
Definition: VectorwiseOp.h:198
EIGEN_DEVICE_FUNC ExpressionType & operator-=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:559
internal::subvector_stl_iterator< ExpressionType, DirectionType(Direction)> iterator
Definition: VectorwiseOp.h:266
internal::subvector_stl_reverse_iterator< ExpressionType, DirectionType(Direction)> reverse_iterator
Definition: VectorwiseOp.h:268
EIGEN_DEVICE_FUNC VectorwiseOp(ExpressionType &matrix)
Definition: VectorwiseOp.h:253
const_iterator end() const
Definition: VectorwiseOp.h:302
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:667
EIGEN_DEVICE_FUNC ExpressionType & operator*=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:567
EIGEN_DEVICE_FUNC ExpressionType & operator+=(const DenseBase< OtherDerived > &other)
Definition: VectorwiseOp.h:551
ReturnType< internal::member_all, bool >::Type AllReturnType
Definition: VectorwiseOp.h:346
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
Definition: VectorwiseOp.h:590
EIGEN_DEVICE_FUNC const StableNormReturnType stableNorm() const
Definition: VectorwiseOp.h:441
CwiseUnaryOp< internal::scalar_sqrt_op< RealScalar >, const SquaredNormReturnType > NormReturnType
Definition: VectorwiseOp.h:340
EIGEN_DEVICE_FUNC const BlueNormReturnType blueNorm() const
Definition: VectorwiseOp.h:433
EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename ExtendedType< OtherDerived >::Type > operator/(const DenseBase< OtherDerived > &other) const
Definition: VectorwiseOp.h:624
EIGEN_DEVICE_FUNC const MeanReturnType mean() const
Definition: VectorwiseOp.h:464
const_reverse_iterator crbegin() const
Definition: VectorwiseOp.h:293
EIGEN_DEVICE_FUNC Index redux_length() const
Definition: VectorwiseOp.h:685
@ isVertical
Definition: VectorwiseOp.h:210
@ isHorizontal
Definition: VectorwiseOp.h:210
EIGEN_DEVICE_FUNC CwiseBinaryOp< internal::scalar_quotient_op< Scalar >, const ExpressionTypeNestedCleaned, const typename OppositeExtendedType< NormReturnType >::Type > normalized() const
Definition: VectorwiseOp.h:637
const_reverse_iterator rend() const
Definition: VectorwiseOp.h:315
Definition: XprHelper.h:134
Definition: StlIterators.h:481
Eigen::Map< Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic, Eigen::ColMajor >, 0, Eigen::OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Definition: common.h:85
EIGEN_DEVICE_FUNC HomogeneousReturnType homogeneous() const
Definition: Homogeneous.h:143
EIGEN_DEVICE_FUNC const HNormalizedReturnType hnormalized() const
column or row-wise homogeneous normalization
Definition: Homogeneous.h:191
EIGEN_DEVICE_FUNC const CrossReturnType cross(const MatrixBase< OtherDerived > &other) const
Definition: OrthoMethods.h:153
DirectionType
Definition: Constants.h:263
@ Horizontal
Definition: Constants.h:269
@ Vertical
Definition: Constants.h:266
const unsigned int RowMajorBit
Definition: Constants.h:70
return int(ret)+1
EIGEN_DEVICE_FUNC bool all()
Definition: Macros.h:1276
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:740
typename remove_all< T >::type remove_all_t
Definition: Meta.h:142
EIGEN_MEMBER_FUNCTOR(norm,(Size+5) *NumTraits< Scalar >::MulCost+(Size - 1) *NumTraits< Scalar >::AddCost)
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const int Dynamic
Definition: Constants.h:25
const Product< Lhs, Rhs > prod(const Lhs &lhs, const Rhs &rhs)
Definition: evaluators.cpp:7
Extend namespace for flags.
Definition: fsi_chan_precond_driver.cc:56
type
Definition: compute_granudrum_aor.py:141
Definition: Eigen_Colamd.h:49
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: VectorwiseOp.h:214
Replicate< OtherDerived, isVertical ? 1 :ExpressionType::RowsAtCompileTime, isHorizontal ? 1 :ExpressionType::ColsAtCompileTime > Type
Definition: VectorwiseOp.h:217
Definition: VectorwiseOp.h:354
PartialReduxExpr< ExpressionType, internal::member_lpnorm< p, RealScalar, Scalar >, Direction > Type
Definition: VectorwiseOp.h:355
Definition: VectorwiseOp.h:233
Replicate< OtherDerived, isHorizontal ? 1 :ExpressionType::RowsAtCompileTime, isVertical ? 1 :ExpressionType::ColsAtCompileTime > Type
Definition: VectorwiseOp.h:236
Definition: VectorwiseOp.h:206
PartialReduxExpr< ExpressionType, internal::member_redux< BinaryOp, Scalar >, Direction > Type
Definition: VectorwiseOp.h:207
Definition: VectorwiseOp.h:201
PartialReduxExpr< ExpressionType, Functor< ReturnScalar, Scalar >, Direction > Type
Definition: VectorwiseOp.h:202
Definition: XprHelper.h:558
Definition: XprHelper.h:205
Definition: VectorwiseOp.h:124
@ value
Definition: VectorwiseOp.h:125
Definition: VectorwiseOp.h:120
EIGEN_DEVICE_FUNC member_lpnorm()
Definition: VectorwiseOp.h:127
EIGEN_DEVICE_FUNC ResultType operator()(const XprType &mat) const
Definition: VectorwiseOp.h:129
ResultType result_type
Definition: VectorwiseOp.h:121
@ Vectorizable
Definition: VectorwiseOp.h:122
Definition: VectorwiseOp.h:141
@ value
Definition: VectorwiseOp.h:142
Definition: VectorwiseOp.h:135
@ Vectorizable
Definition: VectorwiseOp.h:139
const BinaryOp & binaryFunc() const
Definition: VectorwiseOp.h:149
EIGEN_DEVICE_FUNC member_redux(const BinaryOp func)
Definition: VectorwiseOp.h:144
EIGEN_DEVICE_FUNC result_type operator()(const DenseBase< Derived > &mat) const
Definition: VectorwiseOp.h:146
BinaryOpT BinaryOp
Definition: VectorwiseOp.h:136
const BinaryOp m_functor
Definition: VectorwiseOp.h:150
result_of< BinaryOp(const Scalar &, const Scalar &)>::type result_type
Definition: VectorwiseOp.h:137
std::conditional_t< bool(traits< T >::Flags &NestByRefBit), T &, T > non_const_type
Definition: XprHelper.h:509
Definition: Meta.h:388
Definition: ForwardDeclarations.h:320
Template functor to compute the max of two scalars.
Definition: BinaryFunctors.h:171
Template functor to compute the min of two scalars.
Definition: BinaryFunctors.h:142
Template functor to compute the product of two scalars.
Definition: BinaryFunctors.h:73
Template functor to compute the sum of two scalars.
Definition: BinaryFunctors.h:34
traits< MatrixType >::XprKind XprKind
Definition: VectorwiseOp.h:43
traits< MatrixType >::StorageKind StorageKind
Definition: VectorwiseOp.h:42
Definition: ForwardDeclarations.h:21
Definition: VectorwiseOp.h:83
Definition: NonLinearOptimization.cpp:97
Definition: benchGeometry.cpp:21