xref: /aosp_15_r20/external/eigen/doc/examples/make_circulant.cpp.expression (revision bf2c37156dfe67e5dfebd6d394bad8b2ab5804d4)
1*bf2c3715SXin Litemplate <class ArgType>
2*bf2c3715SXin Liclass Circulant : public Eigen::MatrixBase<Circulant<ArgType> >
3*bf2c3715SXin Li{
4*bf2c3715SXin Lipublic:
5*bf2c3715SXin Li  Circulant(const ArgType& arg)
6*bf2c3715SXin Li    : m_arg(arg)
7*bf2c3715SXin Li  {
8*bf2c3715SXin Li    EIGEN_STATIC_ASSERT(ArgType::ColsAtCompileTime == 1,
9*bf2c3715SXin Li                        YOU_TRIED_CALLING_A_VECTOR_METHOD_ON_A_MATRIX);
10*bf2c3715SXin Li  }
11*bf2c3715SXin Li
12*bf2c3715SXin Li  typedef typename Eigen::internal::ref_selector<Circulant>::type Nested;
13*bf2c3715SXin Li
14*bf2c3715SXin Li  typedef Eigen::Index Index;
15*bf2c3715SXin Li  Index rows() const { return m_arg.rows(); }
16*bf2c3715SXin Li  Index cols() const { return m_arg.rows(); }
17*bf2c3715SXin Li
18*bf2c3715SXin Li  typedef typename Eigen::internal::ref_selector<ArgType>::type ArgTypeNested;
19*bf2c3715SXin Li  ArgTypeNested m_arg;
20*bf2c3715SXin Li};
21