10 #ifndef EIGEN_VISITOR_H 11 #define EIGEN_VISITOR_H 17 template<
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)
33 template<
typename Visitor,
typename Derived>
37 static inline void run(
const Derived &mat, Visitor& visitor)
39 return visitor.init(mat.coeff(0, 0), 0, 0);
43 template<
typename Visitor,
typename Derived>
47 static inline void run(
const Derived& mat, Visitor& visitor)
49 visitor.init(mat.coeff(0,0), 0, 0);
50 for(
Index i = 1; i < mat.rows(); ++i)
51 visitor(mat.coeff(i, 0), i, 0);
52 for(
Index j = 1; j < mat.cols(); ++j)
53 for(
Index i = 0; i < mat.rows(); ++i)
54 visitor(mat.coeff(i, j), i, j);
59 template<
typename XprType>
66 typedef typename XprType::Scalar
Scalar;
70 RowsAtCompileTime = XprType::RowsAtCompileTime,
74 EIGEN_DEVICE_FUNC
Index rows()
const {
return m_xpr.rows(); }
75 EIGEN_DEVICE_FUNC
Index cols()
const {
return m_xpr.cols(); }
76 EIGEN_DEVICE_FUNC
Index size()
const {
return m_xpr.size(); }
79 {
return m_evaluator.coeff(row, col); }
104 template<
typename Derived>
105 template<
typename Visitor>
110 ThisEvaluator thisEval(derived());
113 unroll = SizeAtCompileTime !=
Dynamic 124 template <
typename Derived>
144 template <
typename Derived>
151 if(value < this->res)
160 template<
typename Scalar>
172 template <
typename Derived>
179 if(value > this->res)
188 template<
typename Scalar>
203 template<
typename Derived>
204 template<
typename IndexType>
210 this->visit(minVisitor);
211 *rowId = minVisitor.
row;
212 if (colId) *colId = minVisitor.
col;
213 return minVisitor.
res;
221 template<
typename Derived>
222 template<
typename IndexType>
229 this->visit(minVisitor);
230 *index = IndexType((RowsAtCompileTime==1) ? minVisitor.
col : minVisitor.
row);
231 return minVisitor.
res;
240 template<
typename Derived>
241 template<
typename IndexType>
247 this->visit(maxVisitor);
248 *rowPtr = maxVisitor.
row;
249 if (colPtr) *colPtr = maxVisitor.
col;
250 return maxVisitor.
res;
258 template<
typename Derived>
259 template<
typename IndexType>
266 this->visit(maxVisitor);
267 *index = (RowsAtCompileTime==1) ? maxVisitor.
col : maxVisitor.
row;
268 return maxVisitor.
res;
273 #endif // EIGEN_VISITOR_H
EIGEN_DEVICE_FUNC Index rows() const
EIGEN_DEVICE_FUNC void visit(Visitor &func) const
EIGEN_DEVICE_FUNC Index cols() const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
static EIGEN_DEVICE_FUNC void run(const Derived &mat, Visitor &visitor)
EIGEN_DEVICE_FUNC CoeffReturnType coeff(Index row, Index col) const
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar maxCoeff() const
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar minCoeff() const
XprType::CoeffReturnType CoeffReturnType
static EIGEN_DEVICE_FUNC void run(const Derived &mat, Visitor &visitor)
internal::evaluator< XprType > m_evaluator
static EIGEN_DEVICE_FUNC void run(const Derived &mat, Visitor &visitor)
EIGEN_DEVICE_FUNC void init(const Scalar &value, Index i, Index j)
EIGEN_DEVICE_FUNC visitor_evaluator(const XprType &xpr)
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
#define EIGEN_UNROLLING_LIMIT
EIGEN_DEVICE_FUNC Index size() const