/** \file dualgauss1d.hpp \brief Dualgauss model \author Junhua Gu */ #ifndef DUALGAUSS_MODEL_H_ #define DUALGAUSS_MODEL_H_ #define OPT_HEADER #include #include #include namespace opt_utilities { template class dualgauss1d :public model,optvec,optvec,std::string> { private: dualgauss1d* do_clone()const { return new dualgauss1d(*this); } const char* do_get_type_name()const { return "1d dualgaussian"; } public: dualgauss1d() { this->push_param_info(param_info >("N1",1)); this->push_param_info(param_info >("x01",0)); this->push_param_info(param_info >("sigma1",1)); this->push_param_info(param_info >("N2",1)); this->push_param_info(param_info >("x02",1)); this->push_param_info(param_info >("sigma2",1)); } public: optvec do_eval(const optvec& x,const optvec& param) { T N1=get_element(param,0); T x01=get_element(param,1); T sigma1=get_element(param,2); T N2=get_element(param,3); T x02=get_element(param,4); T sigma2=get_element(param,5); optvec y1=(x-x01)/sigma1; optvec y2=(x-x02)/sigma2; return N1*exp(-y1*y1/2.)+N2*exp(-y2*y2/2.); } private: std::string do_get_information()const { return ""; } }; } #endif //EOF