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/bpl.hpp | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 vmodel/bpl.hpp (limited to 'vmodel/bpl.hpp') diff --git a/vmodel/bpl.hpp b/vmodel/bpl.hpp new file mode 100644 index 0000000..e99efe3 --- /dev/null +++ b/vmodel/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