/** \file bpl1d.hpp \brief broken powerlaw \author Junhua Gu */ #ifndef BROKEN_POWER_LAW_MODEL_H_ #define BROKEN_POWER_LAW_MODEL_H_ #define OPT_HEADER #include #include namespace opt_utilities { template class bpl1d :public model,std::string> { private: model >* 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)); } T do_eval(const T& x,const std::vector& 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); if(xf(x;xb,yb,γ1,γ2) = yb xγ1xbγ1 x < xb yb xγ2xbγ2 otherwise "; } }; } #endif //EOF