33#ifndef _GEOM_SL_POLYNOMIAL_H_
34#define _GEOM_SL_POLYNOMIAL_H_
47namespace Geom {
namespace SL {
59template<
typename CoeffT >
65 typedef typename coeff_container_t::iterator
iterator;
129 THROW_INVARIANTSVIOLATION (0);
146 THROW_INVARIANTSVIOLATION (0);
149 for (; it !=
begin(); --it)
153 size_t i =
static_cast<size_t>(it -
begin());
160 THROW_INVARIANTSVIOLATION (0);
234 template <
typename T>
254 for(
size_t i = 0; i <
size(); ++i)
256 r.
m_coeff.push_back( -(*
this)[i] );
267 size_t sz = std::min(
size(), p.
size());
268 for (
size_t i = 0; i < sz; ++i)
281 size_t sz = std::min(
size(), p.
size());
282 for (
size_t i = 0; i < sz; ++i)
287 for(
size_t i = sz; i < p.
size(); ++i)
299 for (
size_t i = 0; i <
size(); ++i)
301 for (
size_t j = 0; j < p.
size(); ++j)
303 r[i+j] += (*this)[i] * p[j];
343 for (
size_t i = 0; i <
size(); ++i)
351 std::string
str()
const;
367template<
typename CoeffT >
378template<
typename CoeffT >
394template<
typename CoeffT >
396 = zero<typename Polynomial<CoeffT>::coeff_type>()();
402template<
typename CoeffT >
408 for (
size_t i = 0; i <= d; ++i)
410 if (p[i] != q[i])
return false;
415template<
typename CoeffT >
422template<
typename CoeffT >
432template<
typename CoeffT >
442template<
typename CoeffT >
452template<
typename CoeffT >
454Polynomial<CoeffT>
operator<<(Polynomial<CoeffT>
const& p,
size_t n)
456 Polynomial<CoeffT> r(p);
466template<
typename CoeffT >
476template<
typename CoeffT >
484template<
typename CoeffT >
494template<
typename CoeffT >
502template<
typename CoeffT >
512template<
typename CoeffT >
526template<
typename charT,
typename CoeffT >
528std::basic_ostream<charT> &
529operator<< (std::basic_ostream<charT> & os,
const Polynomial<CoeffT> & p)
531 if (p.size() == 0)
return os;
533 for (
size_t i = 1; i < p.size(); ++i)
542template<
typename CoeffT >
546 std::ostringstream oss;
Defines the different types of exceptions that 2geom can throw.
Polynomial & operator*=(coeff_type const &c)
coeff_type const & operator[](size_t i) const
coeff_type const & leading_coefficient() const
Polynomial & operator<<=(size_t n)
void max_degree(size_t n)
coeff_container_t::const_iterator const_iterator
static const coeff_type zero_coeff
coeff_type & leading_coefficient()
const_iterator end() const
coeff_container_t::iterator iterator
void coefficient(size_t i, coeff_type const &c)
coeff_container_t m_coeff
Polynomial & operator+=(coeff_type const &c)
Polynomial operator-() const
Polynomial & operator+=(Polynomial const &p)
T operator()(T const &x) const
Polynomial & operator*=(Polynomial const &p)
Polynomial(CoeffT const &c, size_t i=0)
Polynomial & operator=(coeff_type const &c)
std::vector< coeff_type > coeff_container_t
const_iterator begin() const
Polynomial & operator-=(coeff_type const &c)
size_t real_degree() const
size_t max_degree() const
Polynomial & operator-=(Polynomial const &p)
coeff_type const & coefficient(size_t i) const
std::enable_if_t<(M > 0) &&(M<=N), MultiPoly< N, CoeffT > > operator-(MultiPoly< N, CoeffT > const &p, MultiPoly< M, CoeffT > const &q)
std::enable_if_t<(M > 0) &&(M<=N), MultiPoly< N, CoeffT > > operator+(MultiPoly< N, CoeffT > const &p, MultiPoly< M, CoeffT > const &q)
bool operator!=(Polynomial< CoeffT > const &p, Polynomial< CoeffT > const &q)
std::enable_if_t<(M > 0) &&(M<=N), MultiPoly< N, CoeffT > > operator*(MultiPoly< N, CoeffT > const &p, MultiPoly< M, CoeffT > const &q)
Various utility functions.
std::ostream & operator<<(std::ostream &os, const Bezier &b)
bool operator==(D2< T > const &a, D2< T > const &b)