/** \file guss1d.hpp \brief gauss model \author Junhua Gu */ #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); } const char* do_get_type_name()const { return "1d gaussian"; } 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/2); } private: std::string do_get_information()const { return "f(x;N,x0,σ) = Ne(xx0)22σ2 "; } }; } #endif //EOF