aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/fitter.hpp18
-rw-r--r--example/Makefile4
-rw-r--r--example/test_fitter.cpp2
3 files changed, 19 insertions, 5 deletions
diff --git a/core/fitter.hpp b/core/fitter.hpp
index cb2c799..bea0d5c 100644
--- a/core/fitter.hpp
+++ b/core/fitter.hpp
@@ -1033,7 +1033,7 @@ namespace opt_utilities
}
if(rhs.p_data_set!=0)
{
- load_data(*(rhs.p_data_set));
+ set_data_set(*(rhs.p_data_set));
}
optengine=rhs.optengine;
}
@@ -1058,7 +1058,7 @@ namespace opt_utilities
}
if(rhs.p_data_set!=0)
{
- load_data(*(rhs.p_data_set));
+ set_data_set(*(rhs.p_data_set));
}
optengine=rhs.optengine;
@@ -1230,6 +1230,20 @@ namespace opt_utilities
}
}
+ void set_data_set(const data_set<Ty,Tx>& da)
+ {
+ if(p_data_set!=0)
+ {
+ //delete p_data_set;
+ p_data_set->destroy();
+ }
+ p_data_set=da.clone();
+ if(p_statistic!=0)
+ {
+ p_statistic->set_fitter(*this);
+ }
+ }
+
/**
get the data set that have been loaded
\return the const reference of inner data_set
diff --git a/example/Makefile b/example/Makefile
index dc05276..fe3e168 100644
--- a/example/Makefile
+++ b/example/Makefile
@@ -4,10 +4,10 @@ all:$(target)
test_optimizer:test_optimizer.cpp
- g++ -o $@ $< -I ../ -O2 -g
+ g++ -o $@ $< -I ../ -O3 -g
test_fitter:test_fitter.cpp
- g++ -o $@ $< -I ../ -O2 -g
+ g++ -o $@ $< -I ../ -O3 -g
clean:
rm -f $(target)
diff --git a/example/test_fitter.cpp b/example/test_fitter.cpp
index 48c4d8c..8da9d86 100644
--- a/example/test_fitter.cpp
+++ b/example/test_fitter.cpp
@@ -44,7 +44,7 @@ int main()
fitter<double,double,std::vector<double>,double,std::string> f;
f.set_model(lin1d());
//f.set_method(powell_method<double,std::vector<double> >());
- f.set_method(aga_method<double,std::vector<double> >());
+ f.set_opt_method(aga_method<double,std::vector<double> >());
default_data_set<double,double> ds;
for(int i=0;i<100;++i)