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)
29 visitor(mat.coeff(row, col), row, col);
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;
67 typedef typename XprType::CoeffReturnType CoeffReturnType;
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(); }
78 EIGEN_DEVICE_FUNC CoeffReturnType coeff(
Index row,
Index col)
const 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>
127 typedef typename Derived::Scalar Scalar;
144 template <
typename Derived>
147 typedef typename Derived::Scalar Scalar;
149 void operator() (
const Scalar& value,
Index i,
Index j)
151 if(value < this->res)
160 template<
typename Scalar>
172 template <
typename Derived>
175 typedef typename Derived::Scalar Scalar;
177 void operator() (
const Scalar& value,
Index i,
Index j)
179 if(value > this->res)
188 template<
typename Scalar>
202 template<
typename Derived>
203 template<
typename IndexType>
209 this->visit(minVisitor);
210 *rowId = minVisitor.row;
211 if (colId) *colId = minVisitor.col;
212 return minVisitor.res;
220 template<
typename Derived>
221 template<
typename IndexType>
226 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
228 this->visit(minVisitor);
229 *index = IndexType((RowsAtCompileTime==1) ? minVisitor.col : minVisitor.row);
230 return minVisitor.res;
238 template<
typename Derived>
239 template<
typename IndexType>
245 this->visit(maxVisitor);
246 *rowPtr = maxVisitor.row;
247 if (colPtr) *colPtr = maxVisitor.col;
248 return maxVisitor.res;
256 template<
typename Derived>
257 template<
typename IndexType>
262 EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived)
264 this->visit(maxVisitor);
265 *index = (RowsAtCompileTime==1) ? maxVisitor.col : maxVisitor.row;
266 return maxVisitor.res;
271 #endif // EIGEN_VISITOR_H EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar maxCoeff() const
Definition: Redux.h:436
EIGEN_DEVICE_FUNC void visit(Visitor &func) const
Applies the visitor visitor to the whole coefficients of the matrix or vector.
Definition: Visitor.h:107
Definition: CoreEvaluators.h:90
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:85
Definition: Visitor.h:173
Holds information about the various numeric (i.e.
Definition: NumTraits.h:150
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:33
EIGEN_DEVICE_FUNC internal::traits< Derived >::Scalar minCoeff() const
Definition: Redux.h:426
Definition: Visitor.h:145
Definition: BandTriangularSolver.h:13
Definition: TutorialInplaceLU.cpp:2
Definition: XprHelper.h:146
Definition: Visitor.h:125
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