#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