From 2eec1bc95e708a280cc4f6e7a912b7fa90131c44 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Mon, 7 Feb 2011 05:41:12 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@171 ed2142bd-67ad-457f-ba7c-d818d4011675 --- vmodels/dualgauss1d.hpp | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 vmodels/dualgauss1d.hpp (limited to 'vmodels') diff --git a/vmodels/dualgauss1d.hpp b/vmodels/dualgauss1d.hpp new file mode 100644 index 0000000..bace73b --- /dev/null +++ b/vmodels/dualgauss1d.hpp @@ -0,0 +1,68 @@ +/** + \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 -- cgit v1.2.2