/** * @file polynomial.hpp * @author Julian Iseringhausen * @date Mon Nov 21 13:26:56 2011 * * @brief Class to represent and evaluate a polynomial. * */ #ifndef POLYNOMIAL_HPP_ #define POLYNOMIAL_HPP_ #include #include namespace VMG { class Polynomial { public: Polynomial() {} Polynomial(const int& degree,...) : coeff(degree+1) { va_list vl; va_start(vl, degree); for (int i=0; i<=degree; ++i) coeff[i] = va_arg(vl, vmg_float); va_end(vl); } Polynomial(const Polynomial& rhs) : coeff(rhs.coeff.size()) { for (unsigned int i=0; i=0; --i) result = coeff[i] + result * val; return result; } Polynomial& operator=(const Polynomial& rhs) { coeff.resize(rhs.coeff.size()); for (unsigned int i=0; i coeff; }; } #endif /* POLYNOMIAL_HPP_ */