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/bl.hpp | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 vmodels/bl.hpp (limited to 'vmodels/bl.hpp') diff --git a/vmodels/bl.hpp b/vmodels/bl.hpp new file mode 100644 index 0000000..84d6ca5 --- /dev/null +++ b/vmodels/bl.hpp @@ -0,0 +1,67 @@ +#ifndef BROKEN_LINE_MODEL_H_ +#define BROKEN_LINE_MODEL_H_ +#define OPT_HEADER +#include +#include +#include +namespace opt_utilities +{ + template + class bl + :public model,optvec,optvec,std::string> + { + private: + model,optvec,optvec,std::string >* do_clone()const + { + return new bl(*this); + } + + const char* do_get_type_name()const + { + return "broken linear model"; + } + public: + bl() + { + this->push_param_info(param_info >("break point y value",1)); + this->push_param_info(param_info >("break point x value",1)); + this->push_param_info(param_info >("slop 1",1)); + this->push_param_info(param_info >("slop 2",1)); + } + + public: + optvec do_eval(const optvec& x,const optvec& param) + { + T x_b=get_element(param,0); + T f_b=get_element(param,1); + T k1=get_element(param,2); + T k2=get_element(param,3); + optvec result(x.size()); + for(int i=0;i