/** \file gauss1d.hpp \brief Gauss model \author Junhua Gu */ #ifndef GAUSS_MODEL_H_ #define GAUSS_MODEL_H_ #define OPT_HEADER #include #include #include #include #include namespace opt_utilities { template class gauss1d :public model,optvec,optvec,std::string>, public pre_estimatable,optvec,optvec,std::string> ,public pre_estimatable,optvec,optvec,std::string> { private: gauss1d* 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: optvec do_eval(const optvec& x,const optvec& param) { T N=get_element(param,0); T x0=get_element(param,1); T sigma=get_element(param,2); optvec y=(x-x0)/sigma; return N*exp(-y*y/2.); } private: std::string do_get_information()const { return ""; } }; } #endif //EOF