You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
958 B

  1. namespace StormEigen {
  2. namespace internal {
  3. template<typename ArgType>
  4. struct evaluator<Circulant<ArgType> >
  5. : evaluator_base<Circulant<ArgType> >
  6. {
  7. typedef Circulant<ArgType> XprType;
  8. typedef typename nested_eval<ArgType, XprType::ColsAtCompileTime>::type ArgTypeNested;
  9. typedef typename remove_all<ArgTypeNested>::type ArgTypeNestedCleaned;
  10. typedef typename XprType::CoeffReturnType CoeffReturnType;
  11. enum {
  12. CoeffReadCost = evaluator<ArgTypeNestedCleaned>::CoeffReadCost,
  13. Flags = StormEigen::ColMajor
  14. };
  15. evaluator(const XprType& xpr)
  16. : m_argImpl(xpr.m_arg), m_rows(xpr.rows())
  17. { }
  18. CoeffReturnType coeff(Index row, Index col) const
  19. {
  20. Index index = row - col;
  21. if (index < 0) index += m_rows;
  22. return m_argImpl.coeff(index);
  23. }
  24. evaluator<ArgTypeNestedCleaned> m_argImpl;
  25. const Index m_rows;
  26. };
  27. }
  28. }