From 3c9658cc88db6c77ee834a59c2816a9e4fdf8912 Mon Sep 17 00:00:00 2001 From: astrojhgu Date: Tue, 27 Jul 2010 06:30:34 +0000 Subject: git-svn-id: file:///home/svn/opt_utilities@128 ed2142bd-67ad-457f-ba7c-d818d4011675 --- methods/lsnewton_cg/lsnewton_cg.hpp | 238 ------------------------------------ 1 file changed, 238 deletions(-) delete mode 100644 methods/lsnewton_cg/lsnewton_cg.hpp diff --git a/methods/lsnewton_cg/lsnewton_cg.hpp b/methods/lsnewton_cg/lsnewton_cg.hpp deleted file mode 100644 index e1c912a..0000000 --- a/methods/lsnewton_cg/lsnewton_cg.hpp +++ /dev/null @@ -1,238 +0,0 @@ -#ifndef LSNEWTON_GG_HPP -#define LSNEWTON_GG_HPP -#include -#include -#include -#include -#include - -#include - -using std::cout; -using std::cerr; -using std::endl; - -namespace opt_utilities -{ - - template - void lsnewton_cg_f(func_obj& foo,pT& x0,const rT& threshold) - { - for(int k=0;;++k) - { - cerr<::epsilon()); - rT djBkdj=0; - pT Bkdj; - resize(Bkdj,get_size(x0)); - pT x1,x2; - typename element_type_trait::element_type h=1; - for(int i=0;i - class lsnewton_cg - :public opt_method - { - public: - typedef pT array1d_type; - typedef rT T; - private: - func_obj* p_fo; - optimizer* p_optimizer; - - //typedef blitz::Array array2d_type; - - - private: - array1d_type start_point; - array1d_type end_point; - - private: - rT threshold; - private: - rT func(const pT& x) - { - assert(p_fo!=0); - return p_fo->eval(x); - } - - - public: - lsnewton_cg() - :threshold(1e-4) - {} - - virtual ~lsnewton_cg() - { - }; - - lsnewton_cg(const lsnewton_cg& rhs) - :p_fo(rhs.p_fo),p_optimizer(rhs.p_optimizer), - start_point(rhs.start_point), - end_point(rhs.end_point), - threshold(rhs.threshold) - { - } - - lsnewton_cg& operator=(const lsnewton_cg& rhs) - { - threshold=rhs.threshold; - p_fo=rhs.p_fo; - p_optimizer=rhs.p_optimizer; - opt_eq(start_point,rhs.start_point); - opt_eq(end_point,rhs.end_point); - } - - opt_method* do_clone()const - { - return new lsnewton_cg(*this); - } - - void do_set_start_point(const array1d_type& p) - { - start_point.resize(get_size(p)); - opt_eq(start_point,p); - - } - - array1d_type do_get_start_point()const - { - return start_point; - } - - void do_set_precision(rT t) - { - threshold=t; - } - - rT do_get_precision()const - { - return threshold; - } - - void do_set_optimizer(optimizer& o) - { - p_optimizer=&o; - p_fo=p_optimizer->ptr_func_obj(); - } - - - - pT do_optimize() - { - lsnewton_cg_f(*p_fo,start_point,threshold); - opt_eq(end_point,start_point); - return end_point; - } - }; - - -} - -#endif -//EOF -- cgit v1.2.2