27 #ifndef MPBLOCKS_POLYNOMIAL_POLYNOMIAL_H_
28 #define MPBLOCKS_POLYNOMIAL_POLYNOMIAL_H_
36 namespace polynomial {
39 template <
typename Scalar,
int Degree>
41 public LValue< Scalar, Polynomial<Scalar,Degree> >,
42 public RValue< Scalar, Polynomial<Scalar,Degree> >
106 for(
int i=0; i <
size(); i++)
111 template <
typename Exp>
114 for(
int i=0; i <
size(); i++)
121 for(
int i=0; i <= Degree; i++)
127 assert( Degree == 1 );
134 assert( Degree == 2 );
143 Scalar r = (*this)[0];
145 for(
int i=1; i <
size(); ++i)
157 template <
typename Scalar>
159 public std::vector<Scalar>,
160 public LValue< Scalar, Polynomial<Scalar,Dynamic> >,
161 public RValue< Scalar, Polynomial<Scalar,Dynamic> >
197 template <
typename Exp>
200 Vector_t::reserve(exp.
size());
201 for(
int i=0; i < exp.
size(); i++)
202 Vector_t::push_back(exp[i]);
229 return (*
this)[iter.idx];
234 return (*
this)[iter.idx];
240 Scalar r = (*this)[0];
242 for(
int i=1; i <
size(); ++i)
252 using Vector_t::size;
253 using Vector_t::resize;
254 using Vector_t::operator[];
272 #endif // POLYNOMIAL_H_
Polynomial(Scalar a0, Scalar a1)
Polynomial(Scalar a0, Scalar a1, Scalar a2)
Scalar const & operator[](int i) const
vector accessor
Scalar & operator[](int i)
vector accessor
expression template for rvalues
Scalar const & operator()(const iterator iter) const
Polynomial(int size=0)
Default constructor.
Scalar const & operator()(const iterator iter) const
Size_t size() const
return the size for a vector
bool operator()(const Polynomial_t &poly)
Size_t size() const
return the size for a vector
Polynomial(const RValue< Scalar, Exp > &exp)
Construct from any PolynomialExpression:
Polynomial()
Default constructor.
Polynomial< Scalar, Degree > Polynomial_t
LValue< Scalar, Polynomial_t > LValue_t
expression template for rvalues
Polynomial(Scalar a0, Scalar a1)
LValue< Scalar, Polynomial_t > LValue_t
Polynomial(Scalar a0)
fixed size construction
A dense, dynamically sized polynomial.
A dense, statically sized polynomial.
Scalar & operator()(const iterator iter)
Polynomial< Scalar, Dynamic > Polynomial_t
std::vector< Scalar > Vector_t
bool operator()(const Polynomial_t &poly)
Scalar & operator()(const iterator iter)
Polynomial(const RValue< Scalar, Exp > &exp)
Polynomial(Scalar a0, Scalar a1, Scalar a2)
Polynomial(Scalar a0)
fixed size construction