From 5a4dfd8ac3d47ceec08be073b7eaa318ea42e41d Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Sun, 29 Nov 2009 16:31:48 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@100 ed2142bd-67ad-457f-ba7c-d818d4011675 --- vmodel/gauss1d.hpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 vmodel/gauss1d.hpp (limited to 'vmodel/gauss1d.hpp') diff --git a/vmodel/gauss1d.hpp b/vmodel/gauss1d.hpp new file mode 100644 index 0000000..5576c89 --- /dev/null +++ b/vmodel/gauss1d.hpp @@ -0,0 +1,53 @@ +#ifndef GAUSS_MODEL_H_ +#define GAUSS_MODEL_H_ +#define OPT_HEADER +#include +#include +#include + +namespace opt_utilities +{ + template + class gauss1d + :public model,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)/2./sigma; + return N*exp(-y*y); + } + + private: + std::string do_get_information()const + { + return ""; + } + }; +} + + + +#endif +//EOF -- cgit v1.2.2