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