2014-09-28 06:25:58 +08:00
|
|
|
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;
|
2022-03-17 00:43:40 +08:00
|
|
|
typedef remove_all_t<ArgTypeNested> ArgTypeNestedCleaned;
|
2014-09-28 06:25:58 +08:00
|
|
|
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);
|
|
|
|
|
}
|
2023-12-06 05:22:55 +08:00
|
|
|
|
2015-09-03 20:14:14 +08:00
|
|
|
evaluator<ArgTypeNestedCleaned> m_argImpl;
|
2014-09-28 06:25:58 +08:00
|
|
|
const Index m_rows;
|
2023-12-06 05:22:55 +08:00
|
|
|
};
|
2014-09-28 06:25:58 +08:00
|
|
|
} // namespace internal
|
|
|
|
|
} // namespace Eigen
|