From 83f8b6ea00b90959dacc2b61f263a54475a014bd Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Mon, 28 Mar 2011 17:52:27 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@185 ed2142bd-67ad-457f-ba7c-d818d4011675 --- vmodels/quad_pl.hpp | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 vmodels/quad_pl.hpp (limited to 'vmodels') diff --git a/vmodels/quad_pl.hpp b/vmodels/quad_pl.hpp new file mode 100644 index 0000000..a6a1e57 --- /dev/null +++ b/vmodels/quad_pl.hpp @@ -0,0 +1,59 @@ +/** + \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,optvec,optvec,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 >("a",1)); + this->push_param_info(param_info >("b",1)); + this->push_param_info(param_info >("c",1)); + } + + optvec do_eval(const optvec& x,const optvec& param) + { + T a=get_element(param,0); + T b=get_element(param,1); + T c=get_element(param,1); + return c*exp(a*log(x)*log(x)+b*log(x)); + } + + private: + std::string do_get_information()const + { + return "Simple power law model\n" + "y=A*x^gamma\n"; + } + }; +} + + + +#endif +//EOF -- cgit v1.2.2