From 4170b13f464439ab97efadb210dab0d749fa4b42 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Thu, 17 Dec 2009 17:01:15 +0000 Subject: rename vmodel to vmodels git-svn-id: file:///home/svn/opt_utilities@103 ed2142bd-67ad-457f-ba7c-d818d4011675 --- vmodels/bpl.hpp | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 vmodels/bpl.hpp (limited to 'vmodels/bpl.hpp') diff --git a/vmodels/bpl.hpp b/vmodels/bpl.hpp new file mode 100644 index 0000000..e99efe3 --- /dev/null +++ b/vmodels/bpl.hpp @@ -0,0 +1,67 @@ +#ifndef BROKEN_POWER_LAW_MODEL_H_ +#define BROKEN_POWER_LAW_MODEL_H_ +#define OPT_HEADER +#include +#include +#include + +namespace opt_utilities +{ + template + class bpl1d + :public model,optvec,optvec,std::string> + { + private: + bpl1d* do_clone()const + { + return new bpl1d(*this); + } + + const char* do_get_type_name()const + { + return "broken power law"; + } + public: + bpl1d() + { + this->push_param_info(param_info >("bpx",1)); + this->push_param_info(param_info >("bpy",1)); + this->push_param_info(param_info >("gamma1",1)); + this->push_param_info(param_info >("gamma2",1)); + } + + optvec do_eval(const optvec& x,const optvec& param) + { + T x_b=get_element(param,0); + T f_b=get_element(param,1); + T gamma1=get_element(param,2); + T gamma2=get_element(param,3); + + optvec result(x.size()); + for(int i=0;i