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/powerlaw.hpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 vmodel/powerlaw.hpp (limited to 'vmodel/powerlaw.hpp') diff --git a/vmodel/powerlaw.hpp b/vmodel/powerlaw.hpp new file mode 100644 index 0000000..1f05301 --- /dev/null +++ b/vmodel/powerlaw.hpp @@ -0,0 +1,50 @@ +#ifndef POWER_LAW_MODEL_H_ +#define POWER_LAW_MODEL_H_ +#define OPT_HEADER +#include +#include +#include + +namespace opt_utilities +{ + template + class powerlaw + :public model,optvec,optvec,std::string> + { + private: + powerlaw* do_clone()const + { + return new powerlaw(*this); + } + + const char* do_get_type_name()const + { + return "1d power law"; + } + public: + powerlaw() + { + this->push_param_info(param_info >("Ampl",1)); + this->push_param_info(param_info >("gamma",1)); + } + + optvec do_eval(const optvec& x,const optvec& param) + { + T A=get_element(param,0); + T gamma=get_element(param,1); + return A*pow(x,gamma); + } + + private: + std::string do_get_information()const + { + return "Simple power law model\n" + "y=A*x^gamma\n"; + } + }; +} + + + +#endif +//EOF -- cgit v1.2.2