#ifndef GAUSS_MODEL_H_ #define GAUSS_MODEL_H_ #define OPT_HEADER #include #include namespace opt_utilities { template class gauss1d :public model,std::string> { private: model >* do_clone()const { return new gauss1d(*this); } public: gauss1d() { this->push_param_info(param_info >("N",1)); this->push_param_info(param_info >("x0",0)); this->push_param_info(param_info >("sigma",1)); } public: T do_eval(const T& x,const std::vector& param) { T N=get_element(param,0); T x0=get_element(param,1); T sigma=get_element(param,2); T y=(x-x0)/sigma; return N*exp(-y*y); } private: std::string do_to_string()const { return "Gaussian model\n" "y=N*exp(-(x-x0)^2/sigma^2\n"; } }; } #endif //EOF