From 5855acc5ef57ec0fcc2b43447df939ece970c40c Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Thu, 19 Jan 2012 13:06:54 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@218 ed2142bd-67ad-457f-ba7c-d818d4011675 --- models/quad_pl.hpp | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 models/quad_pl.hpp (limited to 'models') diff --git a/models/quad_pl.hpp b/models/quad_pl.hpp new file mode 100644 index 0000000..0619d2b --- /dev/null +++ b/models/quad_pl.hpp @@ -0,0 +1,52 @@ +/** + \file quad_pl.hpp + \brief power law model + \author Junhua Gu + */ + + +#ifndef QUAD_PL_MODEL_H_ +#define QUAD_PL_MODEL_H_ +#define OPT_HEADER +#include +#include +#include + +namespace opt_utilities +{ + template + class quad_pl + :public model,std::string> + { + private: + quad_pl* do_clone()const + { + return new quad_pl(*this); + } + + const char* do_get_type_name()const + { + return "quad power law"; + } + public: + quad_pl() + { + this->push_param_info(param_info >("norm",1)); + this->push_param_info(param_info >("gamma",1)); + this->push_param_info(param_info >("corr",0)); + } + + T do_eval(const T& x,const std::vector& param) + { + T norm=get_element(param,0); + T gamma=get_element(param,1); + T corr=get_element(param,2); + return norm*pow(x,gamma)*exp(corr*log(x)*log(x)); + } + }; +} + + + +#endif +//EOF -- cgit v1.2.2