#ifndef POLY_MODEL_H_ #define POLY_MODEL_H_ #define OPT_HEADER #include #include #include #include namespace opt_utilities { template class poly1d :public model,std::string> { private: model >* do_clone()const { return new poly1d(*this); } const char* do_get_type_name()const { return "polynomial"; } public: poly1d() { assert(n>=0); for(int i=0;i<=n;++i) { std::ostringstream ostr; ostr<<"a"<push_param_info(param_info >(ostr.str().c_str(),1)); } } public: T do_eval(const T& x,const std::vector& param) { // return x*get_element(param,0)+get_element(param,1); T result(0); for(int i=0;i<=n;++i) { T xn(1); for(int j=0;j