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
25 static inline void run(
const Derived &mat, Visitor& visitor)
32 template<
typename Visitor,
typename Derived>
35 static inline void run(
const Derived &mat, Visitor& visitor)
37 return visitor.init(mat.coeff(0, 0), 0, 0);
41 template<
typename Visitor,
typename Derived>
44 typedef typename Derived::Index
Index;
45 static inline void run(
const Derived& mat, Visitor& visitor)
47 visitor.init(mat.coeff(0,0), 0, 0);
48 for(Index i = 1; i < mat.rows(); ++i)
49 visitor(mat.coeff(i, 0), i, 0);
50 for(Index j = 1; j < mat.cols(); ++j)
51 for(Index i = 0; i < mat.rows(); ++i)
52 visitor(mat.coeff(i, j), i, j);
75 template<
typename Derived>
76 template<
typename Visitor>
79 enum { unroll = SizeAtCompileTime !=
Dynamic 85 unroll ? int(SizeAtCompileTime) :
Dynamic 86 >
::run(derived(), visitor);
94 template <
typename Derived>
97 typedef typename Derived::Index
Index;
98 typedef typename Derived::Scalar
Scalar;
101 inline void init(
const Scalar& value, Index i, Index j)
114 template <
typename Derived>
117 typedef typename Derived::Index
Index;
119 void operator() (
const Scalar& value, Index i, Index j)
121 if(value < this->res)
130 template<
typename Scalar>
142 template <
typename Derived>
145 typedef typename Derived::Index
Index;
147 void operator() (
const Scalar& value, Index i, Index j)
149 if(value > this->res)
158 template<
typename Scalar>
172 template<
typename Derived>
173 template<
typename IndexType>
178 this->visit(minVisitor);
179 *rowId = minVisitor.
row;
180 if (colId) *colId = minVisitor.
col;
181 return minVisitor.
res;
189 template<
typename Derived>
190 template<
typename IndexType>
196 this->visit(minVisitor);
197 *index = (RowsAtCompileTime==1) ? minVisitor.
col : minVisitor.
row;
198 return minVisitor.
res;
206 template<
typename Derived>
207 template<
typename IndexType>
212 this->visit(maxVisitor);
213 *rowPtr = maxVisitor.
row;
214 if (colPtr) *colPtr = maxVisitor.
col;
215 return maxVisitor.
res;
223 template<
typename Derived>
224 template<
typename IndexType>
230 this->visit(maxVisitor);
231 *index = (RowsAtCompileTime==1) ? maxVisitor.
col : maxVisitor.
row;
232 return maxVisitor.
res;
237 #endif // EIGEN_VISITOR_H
void visit(Visitor &func) const
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
static void run(const Derived &mat, Visitor &visitor)
internal::traits< Derived >::Scalar maxCoeff() const
static void run(const Derived &mat, Visitor &visitor)
internal::traits< Derived >::Scalar minCoeff() const
static void run(const Derived &mat, Visitor &visitor)
#define EIGEN_STATIC_ASSERT_VECTOR_ONLY(TYPE)
void init(const Scalar &value, Index i, Index j)
#define EIGEN_UNROLLING_LIMIT