Attention une mise à jour du serveur va être effectuée le vendredi 16 avril entre 12h et 12h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit 21a54898 authored by Laurent Belcour's avatar Laurent Belcour

Correction of some bug in the data2data and rational_fitter_parallel.

parent f1d1425f
...@@ -28,7 +28,7 @@ ALTA_DLL_EXPORT fitter* provide_fitter() ...@@ -28,7 +28,7 @@ ALTA_DLL_EXPORT fitter* provide_fitter()
rational_fitter_parallel::rational_fitter_parallel() : nb_starting_points(100) rational_fitter_parallel::rational_fitter_parallel() : nb_starting_points(100)
{ {
} }
rational_fitter_parallel::~rational_fitter_parallel() rational_fitter_parallel::~rational_fitter_parallel()
{ {
} }
...@@ -48,14 +48,14 @@ bool rational_fitter_parallel::fit_data(const ptr<data> dat, function* fit, cons ...@@ -48,14 +48,14 @@ bool rational_fitter_parallel::fit_data(const ptr<data> dat, function* fit, cons
std::cerr << "<<WARNING>> we advise you to perform convertion with a separate command." << std::endl; std::cerr << "<<WARNING>> we advise you to perform convertion with a separate command." << std::endl;
ptr<vertical_segment> vs(new vertical_segment()); ptr<vertical_segment> vs(new vertical_segment());
for(int i=0; i<dat->size(); ++i) for(int i=0; i<dat->size(); ++i)
{ {
const vec x = dat->get(i); const vec x = dat->get(i);
vec y(dat->dimX() + 3*dat->dimY()); vec y(dat->dimX() + 3*dat->dimY());
for(int k=0; k<x.size() ; ++k) { y[k] = x[k]; } for(int k=0; k<x.size() ; ++k) { y[k] = x[k]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size()] = (1.0 - args.get_float("dt", 0.1)) * x[k + dat->dimX() + dat->dimY()]; } for(int k=0; k<dat->dimY(); ++k) { y[k + x.size() + dat->dimY()] = (1.0 - args.get_float("dt", 0.1)) * x[k + dat->dimX()]; }
for(int k=0; k<dat->dimY(); ++k) { y[k + x.size() + dat->dimY()] = (1.0 + args.get_float("dt", 0.1)) * x[k + dat->dimX() + 2*dat->dimY()]; } for(int k=0; k<dat->dimY(); ++k) { y[k + x.size() + 2*dat->dimY()] = (1.0 + args.get_float("dt", 0.1)) * x[k + dat->dimX()]; }
vs->set(y); vs->set(y);
} }
...@@ -151,7 +151,7 @@ bool rational_fitter_parallel::fit_data(const ptr<data> dat, function* fit, cons ...@@ -151,7 +151,7 @@ bool rational_fitter_parallel::fit_data(const ptr<data> dat, function* fit, cons
std::cout << "<<INFO>> delta = " << delta << std::endl; std::cout << "<<INFO>> delta = " << delta << std::endl;
std::cout << std::endl; std::cout << std::endl;
// Get the solution with the minimum delta or the minimum L2 distance, // Get the solution with the minimum delta or the minimum L2 distance,
// and update the main rational function r. // and update the main rational function r.
if((use_delta && delta < min_delta) || (!use_delta && l2_dist < min_l2_dist)) if((use_delta && delta < min_delta) || (!use_delta && l2_dist < min_l2_dist))
{ {
...@@ -201,7 +201,7 @@ void rational_fitter_parallel::set_parameters(const arguments&) ...@@ -201,7 +201,7 @@ void rational_fitter_parallel::set_parameters(const arguments&)
} }
bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np, int nq, bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np, int nq,
rational_function* r, const arguments &args, rational_function* r, const arguments &args,
double& delta, double& linf_dist, double& l2_dist) double& delta, double& linf_dist, double& l2_dist)
{ {
...@@ -294,8 +294,8 @@ bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np, ...@@ -294,8 +294,8 @@ bool rational_fitter_parallel::fit_data(const ptr<vertical_segment>& d, int np,
return false; return false;
} }
void rational_fitter_parallel::get_constraint(int i, int np, int nq, int ny, void rational_fitter_parallel::get_constraint(int i, int np, int nq, int ny,
const ptr<vertical_segment>& data, const ptr<vertical_segment>& data,
const rational_function_1d* func, const rational_function_1d* func,
vec& cu, vec& cl) vec& cu, vec& cl)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* or to perform interpolation of sample values (i.e. to fill gaps). * or to perform interpolation of sample values (i.e. to fill gaps).
* *
* <h3>Usage</h3> * <h3>Usage</h3>
* \verbatim * \verbatim
data2data --input data.file --output data.file --out-data exporter.so --in-data importer.so data2data --input data.file --output data.file --out-data exporter.so --in-data importer.so
\endverbatim \endverbatim
* *
...@@ -96,16 +96,14 @@ int main(int argc, char** argv) ...@@ -96,16 +96,14 @@ int main(int argc, char** argv)
return 1 ; return 1 ;
} }
*/ */
// Import data // Import data
ptr<data> d_in = NULL ; ptr<data> d_in = plugins_manager::get_data(args["in-data"]) ;
d_in = plugins_manager::get_data(args["in-data"]) ;
d_in->load(args["input"], args); d_in->load(args["input"], args);
ptr<data> d_out = NULL; ptr<data> d_out = plugins_manager::get_data(args["out-data"]) ;
d_out = plugins_manager::get_data(args["out-data"]) ;
if(!d_in && !d_out) if(!d_in && !d_out)
{ {
std::cerr << "<<ERROR>> cannot import or export data" << std::endl ; std::cerr << "<<ERROR>> cannot import or export data" << std::endl ;
...@@ -138,7 +136,7 @@ int main(int argc, char** argv) ...@@ -138,7 +136,7 @@ int main(int argc, char** argv)
// Copy the input vector // Copy the input vector
vec x = d_in->get(i); vec x = d_in->get(i);
params::convert(&x[0], d_in->parametrization(), d_out->parametrization(), &temp[0]); params::convert(&x[0], d_in->parametrization(), d_out->parametrization(), &temp[0]);
for(int j=0; j<d_in->dimY(); ++j) for(int j=0; j<d_in->dimY(); ++j)
{ {
temp[d_out->dimX() + j] = x[d_in->dimX() + j]; temp[d_out->dimX() + j] = x[d_in->dimX() + j];
...@@ -146,7 +144,7 @@ int main(int argc, char** argv) ...@@ -146,7 +144,7 @@ int main(int argc, char** argv)
d_out->set(temp); d_out->set(temp);
} }
} }
else else
{ {
...@@ -170,8 +168,8 @@ int main(int argc, char** argv) ...@@ -170,8 +168,8 @@ int main(int argc, char** argv)
} }
d_out->set(x); d_out->set(x);
} }
} }
d_out->save(args["output"]); d_out->save(args["output"]);
return 0 ; return 0 ;
} }
Markdown is supported
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