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)
28 visitor(mat.coeff(row, col), row, col);
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>
80 typename Derived::Nested thisNested(derived());
82 enum { unroll = SizeAtCompileTime !=
Dynamic 86 <= EIGEN_UNROLLING_LIMIT };
88 unroll ? int(SizeAtCompileTime) :
Dynamic 89 >::run(thisNested, visitor);
97 template <
typename Derived>
100 typedef typename Derived::Index Index;
104 inline void init(
const Scalar& value, Index i, Index j)
117 template <
typename Derived>
120 typedef typename Derived::Index Index;
122 void operator() (
const Scalar& value, Index i, Index j)
124 if(value < this->res)
133 template<
typename Scalar>
145 template <
typename Derived>
148 typedef typename Derived::Index Index;
150 void operator() (
const Scalar& value, Index i, Index j)
152 if(value > this->res)
161 template<
typename Scalar>
175 template<
typename Derived>
176 template<
typename IndexType>
181 this->visit(minVisitor);
182 *rowId = minVisitor.row;
183 if (colId) *colId = minVisitor.col;
184 return minVisitor.res;
192 template<
typename Derived>
193 template<
typename IndexType>
197 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
199 this->visit(minVisitor);
200 *index = (RowsAtCompileTime==1) ? minVisitor.col : minVisitor.row;
201 return minVisitor.res;
209 template<
typename Derived>
210 template<
typename IndexType>
215 this->visit(maxVisitor);
216 *rowPtr = maxVisitor.row;
217 if (colPtr) *colPtr = maxVisitor.col;
218 return maxVisitor.res;
226 template<
typename Derived>
227 template<
typename IndexType>
231 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
233 this->visit(maxVisitor);
234 *index = (RowsAtCompileTime==1) ? maxVisitor.col : maxVisitor.row;
235 return maxVisitor.res;
240 #endif // EIGEN_VISITOR_H internal::traits< Derived >::Scalar maxCoeff() const
Definition: Redux.h:349
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Definition: Visitor.h:146
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
void visit(Visitor &func) const
Applies the visitor visitor to the whole coefficients of the matrix or vector.
Definition: Visitor.h:77
internal::traits< Derived >::Scalar minCoeff() const
Definition: Redux.h:339
Definition: Visitor.h:118
Definition: BandTriangularSolver.h:13
Definition: XprHelper.h:89
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
Definition: ForwardDeclarations.h:17
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48