diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-25 14:17:07 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-03-25 14:17:07 +0100 |
commit | 35f7829af10c61e33dd2e2a7a015058e11a11ea0 (patch) | |
tree | 7135010dcf8fd0a49f3020d52112709bcb883bd6 /eigen/doc/examples/make_circulant.cpp.evaluator | |
parent | 6e8724193e40a932faf9064b664b529e7301c578 (diff) |
update
Diffstat (limited to 'eigen/doc/examples/make_circulant.cpp.evaluator')
-rw-r--r-- | eigen/doc/examples/make_circulant.cpp.evaluator | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/eigen/doc/examples/make_circulant.cpp.evaluator b/eigen/doc/examples/make_circulant.cpp.evaluator new file mode 100644 index 0000000..2ba79e7 --- /dev/null +++ b/eigen/doc/examples/make_circulant.cpp.evaluator @@ -0,0 +1,32 @@ +namespace Eigen { + namespace internal { + template<typename ArgType> + struct evaluator<Circulant<ArgType> > + : evaluator_base<Circulant<ArgType> > + { + typedef Circulant<ArgType> XprType; + typedef typename nested_eval<ArgType, XprType::ColsAtCompileTime>::type ArgTypeNested; + typedef typename remove_all<ArgTypeNested>::type ArgTypeNestedCleaned; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + CoeffReadCost = evaluator<ArgTypeNestedCleaned>::CoeffReadCost, + Flags = Eigen::ColMajor + }; + + evaluator(const XprType& xpr) + : m_argImpl(xpr.m_arg), m_rows(xpr.rows()) + { } + + CoeffReturnType coeff(Index row, Index col) const + { + Index index = row - col; + if (index < 0) index += m_rows; + return m_argImpl.coeff(index); + } + + evaluator<ArgTypeNestedCleaned> m_argImpl; + const Index m_rows; + }; + } +} |