10#ifndef EIGEN_VISITOR_H
11#define EIGEN_VISITOR_H
17template<
typename Visitor,
typename Derived,
int UnrollCount>
21 col = (UnrollCount-1) / Derived::RowsAtCompileTime,
22 row = (UnrollCount-1) % Derived::RowsAtCompileTime
26 static inline void run(
const Derived &mat, Visitor& visitor)
33template<
typename Visitor,
typename Derived>
37 static inline void run(
const Derived &mat, Visitor& visitor)
39 return visitor.init(mat.coeff(0, 0), 0, 0);
44template<
typename Visitor,
typename Derived>
47 static inline void run(
const Derived &, Visitor& )
51template<
typename Visitor,
typename Derived>
55 static inline void run(
const Derived& mat, Visitor& visitor)
57 visitor.init(mat.coeff(0,0), 0, 0);
58 for(
Index i = 1; i < mat.rows(); ++i)
59 visitor(mat.coeff(i, 0), i, 0);
60 for(
Index j = 1; j < mat.cols(); ++j)
61 for(
Index i = 0; i < mat.rows(); ++i)
62 visitor(mat.coeff(i, j), i, j);
67template<
typename XprType>
74 typedef typename XprType::Scalar
Scalar;
114template<
typename Derived>
115template<
typename Visitor>
123 ThisEvaluator thisEval(derived());
126 unroll = SizeAtCompileTime !=
Dynamic
137template <
typename Derived>
160template <
typename Derived,
int NaNPropagation>
176template <
typename Derived>
192template <
typename Derived>
208template<
typename Scalar,
int NaNPropagation>
220template <
typename Derived,
int NaNPropagation>
236template <
typename Derived>
252template <
typename Derived>
268template<
typename Scalar,
int NaNPropagation>
288template<
typename Derived>
289template<
int NaNPropagation,
typename IndexType>
291typename internal::traits<Derived>::Scalar
294 eigen_assert(this->rows()>0 && this->cols()>0 &&
"you are using an empty matrix");
297 this->visit(minVisitor);
298 *rowId = minVisitor.
row;
299 if (colId) *colId = minVisitor.
col;
300 return minVisitor.
res;
313template<
typename Derived>
314template<
int NaNPropagation,
typename IndexType>
319 eigen_assert(this->rows()>0 && this->cols()>0 &&
"you are using an empty matrix");
323 this->visit(minVisitor);
324 *
index = IndexType((RowsAtCompileTime==1) ? minVisitor.
col : minVisitor.
row);
325 return minVisitor.
res;
339template<
typename Derived>
340template<
int NaNPropagation,
typename IndexType>
345 eigen_assert(this->rows()>0 && this->cols()>0 &&
"you are using an empty matrix");
348 this->visit(maxVisitor);
349 *rowPtr = maxVisitor.
row;
350 if (colPtr) *colPtr = maxVisitor.
col;
351 return maxVisitor.
res;
364template<
typename Derived>
365template<
int NaNPropagation,
typename IndexType>
370 eigen_assert(this->rows()>0 && this->cols()>0 &&
"you are using an empty matrix");
374 this->visit(maxVisitor);
375 *
index = (RowsAtCompileTime==1) ? maxVisitor.
col : maxVisitor.
row;
376 return maxVisitor.
res;
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ColXpr col(Index i)
This is the const version of col().
Definition: BlockMethods.h:1097
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE RowXpr row(Index i)
This is the const version of row(). */.
Definition: BlockMethods.h:1118
#define EIGEN_NOEXCEPT
Definition: Macros.h:1428
#define EIGEN_CONSTEXPR
Definition: Macros.h:797
#define EIGEN_DEVICE_FUNC
Definition: Macros.h:986
#define eigen_assert(x)
Definition: Macros.h:1047
#define EIGEN_UNROLLING_LIMIT
Defines the maximal loop size to enable meta unrolling of loops.
Definition: Settings.h:24
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
Definition: StaticAssert.h:142
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar minCoeff() const
EIGEN_DEVICE_FUNC void visit(Visitor &func) const
Applies the visitor visitor to the whole coefficients of the matrix or vector.
Definition: Visitor.h:117
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar maxCoeff() const
@ CoeffReadCost
Definition: Visitor.h:79
@ RowsAtCompileTime
Definition: Visitor.h:78
XprType::Scalar Scalar
Definition: Visitor.h:74
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT
Definition: Visitor.h:84
EIGEN_DEVICE_FUNC visitor_evaluator(const XprType &xpr)
Definition: Visitor.h:72
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: Visitor.h:82
internal::evaluator< XprType > m_evaluator
Definition: Visitor.h:90
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const
Definition: Visitor.h:86
const XprType & m_xpr
Definition: Visitor.h:91
EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: Visitor.h:83
XprType::CoeffReturnType CoeffReturnType
Definition: Visitor.h:75
@ PropagateNaN
Always propagate NaNs.
Definition: Constants.h:343
@ PropagateNumbers
Always propagate not-NaNs.
Definition: Constants.h:345
EIGEN_CONSTEXPR Index size(const T &x)
Definition: Meta.h:479
EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE bool() isnan(const Eigen::bfloat16 &h)
Definition: BFloat16.h:659
Namespace containing all symbols from the Eigen library.
Definition: Core:141
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:74
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time,...
Definition: Constants.h:22
Definition: Eigen_Colamd.h:50
Holds information about the various numeric (i.e.
Definition: NumTraits.h:233
Definition: Visitor.h:139
EIGEN_DEVICE_FUNC void init(const Scalar &value, Index i, Index j)
Definition: Visitor.h:147
EIGEN_DEVICE_FUNC coeff_visitor()
Definition: Visitor.h:142
Scalar res
Definition: Visitor.h:145
Index col
Definition: Visitor.h:144
Index row
Definition: Visitor.h:144
Derived::Scalar Scalar
Definition: Visitor.h:143
Definition: CoreEvaluators.h:91
Definition: XprHelper.h:176
@ Cost
Definition: XprHelper.h:179
Derived::Scalar Scalar
Definition: Visitor.h:255
Derived::Scalar Scalar
Definition: Visitor.h:239
Definition: Visitor.h:222
Derived::Scalar Scalar
Definition: Visitor.h:223
EIGEN_DEVICE_FUNC void operator()(const Scalar &value, Index i, Index j)
Definition: Visitor.h:225
Derived::Scalar Scalar
Definition: Visitor.h:195
Derived::Scalar Scalar
Definition: Visitor.h:179
Definition: Visitor.h:162
Derived::Scalar Scalar
Definition: Visitor.h:163
EIGEN_DEVICE_FUNC void operator()(const Scalar &value, Index i, Index j)
Definition: Visitor.h:165
Definition: ForwardDeclarations.h:17
static EIGEN_DEVICE_FUNC void run(const Derived &, Visitor &)
Definition: Visitor.h:47
static EIGEN_DEVICE_FUNC void run(const Derived &mat, Visitor &visitor)
Definition: Visitor.h:37
static EIGEN_DEVICE_FUNC void run(const Derived &mat, Visitor &visitor)
Definition: Visitor.h:55
static EIGEN_DEVICE_FUNC void run(const Derived &mat, Visitor &visitor)
Definition: Visitor.h:26
@ col
Definition: Visitor.h:21
@ row
Definition: Visitor.h:22