Commit 93e7de14 authored by Katter, Janike Yvonne's avatar Katter, Janike Yvonne
Browse files

Small changes in lmfit.hpp

parent 04e2a686
Pipeline #34795 passed with stage
in 10 seconds
...@@ -25,9 +25,9 @@ typedef struct lm_result_struct{ ...@@ -25,9 +25,9 @@ typedef struct lm_result_struct{
std::vector<double> parerr; std::vector<double> parerr;
std::vector<double> covar; std::vector<double> covar;
lm_status_struct status; lm_status_struct status;
lm_result_struct(std::vector<double>& start_par) lm_result_struct(std::vector<double>& p0)
: par(start_par), parerr(std::vector<double>(start_par.size())), : par(p0), parerr(std::vector<double>(p0.size())),
covar(std::vector<double>(start_par.size()*start_par.size())) {} covar(std::vector<double>(p0.size()*p0.size())) {}
} lm_result_struct; } lm_result_struct;
lm_result_struct fit_curve(std::vector<double>& par, lm_result_struct fit_curve(std::vector<double>& par,
...@@ -36,7 +36,7 @@ lm_result_struct fit_curve(std::vector<double>& par, ...@@ -36,7 +36,7 @@ lm_result_struct fit_curve(std::vector<double>& par,
const lm_control_struct* control) const lm_control_struct* control)
{ {
assert (t.size() == y.size()); assert (t.size() == y.size());
lm_result_struct res = lm_result_struct(par); lm_result_struct res(par);
lmcurve(par.size(), res.par.data(), t.size(), t.data(), y.data(), lmcurve(par.size(), res.par.data(), t.size(), t.data(), y.data(),
g, control, &res.status); g, control, &res.status);
return res; return res;
...@@ -50,7 +50,7 @@ lm_result_struct minimize(std::vector<double>& start_par, ...@@ -50,7 +50,7 @@ lm_result_struct minimize(std::vector<double>& start_par,
int *const userbreak), int *const userbreak),
const lm_control_struct *const control) const lm_control_struct *const control)
{ {
lm_result_struct res = lm_result_struct(start_par); lm_result_struct res(start_par);
lmmin2(start_par.size(), res.par.data(), res.parerr.data(), lmmin2(start_par.size(), res.par.data(), res.parerr.data(),
res.covar.data(), m_dat, NULL, data, evaluate, control, &res.status); res.covar.data(), m_dat, NULL, data, evaluate, control, &res.status);
...@@ -66,7 +66,7 @@ lm_result_struct fit(std::vector<double>& start_par, ...@@ -66,7 +66,7 @@ lm_result_struct fit(std::vector<double>& start_par,
double *const fvec, int *const userbreak), double *const fvec, int *const userbreak),
const lm_control_struct *const control) const lm_control_struct *const control)
{ {
lm_result_struct res = lm_result_struct(start_par); lm_result_struct res(start_par);
lmmin2(start_par.size(), res.par.data(), res.parerr.data(), lmmin2(start_par.size(), res.par.data(), res.parerr.data(),
res.covar.data(), y.size(), y.data(), data, evaluate, control, res.covar.data(), y.size(), y.data(), data, evaluate, control,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment